forked from mirrors/linux
		
	s390/extmem: remove code for 31 bit addressing mode
All supported releases of z/VM allow 64 bit subcodes and addressing mode for diag 0x64. This patch removes a lot of code for handling 31 bit addressing mode and old subcodes. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
		
							parent
							
								
									ebb7c695d3
								
							
						
					
					
						commit
						ca57114609
					
				
					 1 changed files with 12 additions and 117 deletions
				
			
		| 
						 | 
					@ -28,12 +28,7 @@
 | 
				
			||||||
#include <asm/cpcmd.h>
 | 
					#include <asm/cpcmd.h>
 | 
				
			||||||
#include <asm/setup.h>
 | 
					#include <asm/setup.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DCSS_LOADSHR    0x00
 | 
					 | 
				
			||||||
#define DCSS_LOADNSR    0x04
 | 
					 | 
				
			||||||
#define DCSS_PURGESEG   0x08
 | 
					#define DCSS_PURGESEG   0x08
 | 
				
			||||||
#define DCSS_FINDSEG    0x0c
 | 
					 | 
				
			||||||
#define DCSS_LOADNOLY   0x10
 | 
					 | 
				
			||||||
#define DCSS_SEGEXT     0x18
 | 
					 | 
				
			||||||
#define DCSS_LOADSHRX	0x20
 | 
					#define DCSS_LOADSHRX	0x20
 | 
				
			||||||
#define DCSS_LOADNSRX	0x24
 | 
					#define DCSS_LOADNSRX	0x24
 | 
				
			||||||
#define DCSS_FINDSEGX	0x2c
 | 
					#define DCSS_FINDSEGX	0x2c
 | 
				
			||||||
| 
						 | 
					@ -53,20 +48,6 @@ struct qout64 {
 | 
				
			||||||
	struct qrange range[6];
 | 
						struct qrange range[6];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct qrange_old {
 | 
					 | 
				
			||||||
	unsigned int start; /* last byte type */
 | 
					 | 
				
			||||||
	unsigned int end;   /* last byte reserved */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* output area format for the Diag x'64' old subcode x'18' */
 | 
					 | 
				
			||||||
struct qout64_old {
 | 
					 | 
				
			||||||
	int segstart;
 | 
					 | 
				
			||||||
	int segend;
 | 
					 | 
				
			||||||
	int segcnt;
 | 
					 | 
				
			||||||
	int segrcnt;
 | 
					 | 
				
			||||||
	struct qrange_old range[6];
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct qin64 {
 | 
					struct qin64 {
 | 
				
			||||||
	char qopcode;
 | 
						char qopcode;
 | 
				
			||||||
	char rsrv1[3];
 | 
						char rsrv1[3];
 | 
				
			||||||
| 
						 | 
					@ -95,52 +76,10 @@ static DEFINE_MUTEX(dcss_lock);
 | 
				
			||||||
static LIST_HEAD(dcss_list);
 | 
					static LIST_HEAD(dcss_list);
 | 
				
			||||||
static char *segtype_string[] = { "SW", "EW", "SR", "ER", "SN", "EN", "SC",
 | 
					static char *segtype_string[] = { "SW", "EW", "SR", "ER", "SN", "EN", "SC",
 | 
				
			||||||
					"EW/EN-MIXED" };
 | 
										"EW/EN-MIXED" };
 | 
				
			||||||
static int loadshr_scode, loadnsr_scode;
 | 
					static int loadshr_scode = DCSS_LOADSHRX;
 | 
				
			||||||
static int segext_scode, purgeseg_scode;
 | 
					static int loadnsr_scode = DCSS_LOADNSRX;
 | 
				
			||||||
static int scode_set;
 | 
					static int purgeseg_scode = DCSS_PURGESEG;
 | 
				
			||||||
 | 
					static int segext_scode = DCSS_SEGEXTX;
 | 
				
			||||||
/* set correct Diag x'64' subcodes. */
 | 
					 | 
				
			||||||
static int
 | 
					 | 
				
			||||||
dcss_set_subcodes(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	char *name = kmalloc(8, GFP_KERNEL | GFP_DMA);
 | 
					 | 
				
			||||||
	unsigned long rx, ry;
 | 
					 | 
				
			||||||
	int rc;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (name == NULL)
 | 
					 | 
				
			||||||
		return -ENOMEM;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	rx = (unsigned long) name;
 | 
					 | 
				
			||||||
	ry = DCSS_FINDSEGX;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	strcpy(name, "dummy");
 | 
					 | 
				
			||||||
	diag_stat_inc(DIAG_STAT_X064);
 | 
					 | 
				
			||||||
	asm volatile(
 | 
					 | 
				
			||||||
		"	diag	%0,%1,0x64\n"
 | 
					 | 
				
			||||||
		"0:	ipm	%2\n"
 | 
					 | 
				
			||||||
		"	srl	%2,28\n"
 | 
					 | 
				
			||||||
		"	j	2f\n"
 | 
					 | 
				
			||||||
		"1:	la	%2,3\n"
 | 
					 | 
				
			||||||
		"2:\n"
 | 
					 | 
				
			||||||
		EX_TABLE(0b, 1b)
 | 
					 | 
				
			||||||
		: "+d" (rx), "+d" (ry), "=d" (rc) : : "cc", "memory");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	kfree(name);
 | 
					 | 
				
			||||||
	/* Diag x'64' new subcodes are supported, set to new subcodes */
 | 
					 | 
				
			||||||
	if (rc != 3) {
 | 
					 | 
				
			||||||
		loadshr_scode = DCSS_LOADSHRX;
 | 
					 | 
				
			||||||
		loadnsr_scode = DCSS_LOADNSRX;
 | 
					 | 
				
			||||||
		purgeseg_scode = DCSS_PURGESEG;
 | 
					 | 
				
			||||||
		segext_scode = DCSS_SEGEXTX;
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	/* Diag x'64' new subcodes are not supported, set to old subcodes */
 | 
					 | 
				
			||||||
	loadshr_scode = DCSS_LOADNOLY;
 | 
					 | 
				
			||||||
	loadnsr_scode = DCSS_LOADNSR;
 | 
					 | 
				
			||||||
	purgeseg_scode = DCSS_PURGESEG;
 | 
					 | 
				
			||||||
	segext_scode = DCSS_SEGEXT;
 | 
					 | 
				
			||||||
	return 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Create the 8 bytes, ebcdic VM segment name from
 | 
					 * Create the 8 bytes, ebcdic VM segment name from
 | 
				
			||||||
| 
						 | 
					@ -196,32 +135,15 @@ dcss_diag(int *func, void *parameter,
 | 
				
			||||||
	unsigned long rx, ry;
 | 
						unsigned long rx, ry;
 | 
				
			||||||
	int rc;
 | 
						int rc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (scode_set == 0) {
 | 
					 | 
				
			||||||
		rc = dcss_set_subcodes();
 | 
					 | 
				
			||||||
		if (rc < 0)
 | 
					 | 
				
			||||||
			return rc;
 | 
					 | 
				
			||||||
		scode_set = 1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	rx = (unsigned long) parameter;
 | 
						rx = (unsigned long) parameter;
 | 
				
			||||||
	ry = (unsigned long) *func;
 | 
						ry = (unsigned long) *func;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* 64-bit Diag x'64' new subcode, keep in 64-bit addressing mode */
 | 
					 | 
				
			||||||
	diag_stat_inc(DIAG_STAT_X064);
 | 
						diag_stat_inc(DIAG_STAT_X064);
 | 
				
			||||||
	if (*func > DCSS_SEGEXT)
 | 
						asm volatile(
 | 
				
			||||||
		asm volatile(
 | 
							"	diag	%0,%1,0x64\n"
 | 
				
			||||||
			"	diag	%0,%1,0x64\n"
 | 
							"	ipm	%2\n"
 | 
				
			||||||
			"	ipm	%2\n"
 | 
							"	srl	%2,28\n"
 | 
				
			||||||
			"	srl	%2,28\n"
 | 
							: "+d" (rx), "+d" (ry), "=d" (rc) : : "cc");
 | 
				
			||||||
			: "+d" (rx), "+d" (ry), "=d" (rc) : : "cc");
 | 
					 | 
				
			||||||
	/* 31-bit Diag x'64' old subcode, switch to 31-bit addressing mode */
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		asm volatile(
 | 
					 | 
				
			||||||
			"	sam31\n"
 | 
					 | 
				
			||||||
			"	diag	%0,%1,0x64\n"
 | 
					 | 
				
			||||||
			"	sam64\n"
 | 
					 | 
				
			||||||
			"	ipm	%2\n"
 | 
					 | 
				
			||||||
			"	srl	%2,28\n"
 | 
					 | 
				
			||||||
			: "+d" (rx), "+d" (ry), "=d" (rc) : : "cc");
 | 
					 | 
				
			||||||
	*ret1 = rx;
 | 
						*ret1 = rx;
 | 
				
			||||||
	*ret2 = ry;
 | 
						*ret2 = ry;
 | 
				
			||||||
	return rc;
 | 
						return rc;
 | 
				
			||||||
| 
						 | 
					@ -271,31 +193,6 @@ query_segment_type (struct dcss_segment *seg)
 | 
				
			||||||
		goto out_free;
 | 
							goto out_free;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Only old format of output area of Diagnose x'64' is supported,
 | 
					 | 
				
			||||||
	   copy data for the new format. */
 | 
					 | 
				
			||||||
	if (segext_scode == DCSS_SEGEXT) {
 | 
					 | 
				
			||||||
		struct qout64_old *qout_old;
 | 
					 | 
				
			||||||
		qout_old = kzalloc(sizeof(*qout_old), GFP_KERNEL | GFP_DMA);
 | 
					 | 
				
			||||||
		if (qout_old == NULL) {
 | 
					 | 
				
			||||||
			rc = -ENOMEM;
 | 
					 | 
				
			||||||
			goto out_free;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		memcpy(qout_old, qout, sizeof(struct qout64_old));
 | 
					 | 
				
			||||||
		qout->segstart = (unsigned long) qout_old->segstart;
 | 
					 | 
				
			||||||
		qout->segend = (unsigned long) qout_old->segend;
 | 
					 | 
				
			||||||
		qout->segcnt = qout_old->segcnt;
 | 
					 | 
				
			||||||
		qout->segrcnt = qout_old->segrcnt;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (qout->segcnt > 6)
 | 
					 | 
				
			||||||
			qout->segrcnt = 6;
 | 
					 | 
				
			||||||
		for (i = 0; i < qout->segrcnt; i++) {
 | 
					 | 
				
			||||||
			qout->range[i].start =
 | 
					 | 
				
			||||||
				(unsigned long) qout_old->range[i].start;
 | 
					 | 
				
			||||||
			qout->range[i].end =
 | 
					 | 
				
			||||||
				(unsigned long) qout_old->range[i].end;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		kfree(qout_old);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (qout->segcnt > 6) {
 | 
						if (qout->segcnt > 6) {
 | 
				
			||||||
		rc = -EOPNOTSUPP;
 | 
							rc = -EOPNOTSUPP;
 | 
				
			||||||
		goto out_free;
 | 
							goto out_free;
 | 
				
			||||||
| 
						 | 
					@ -410,11 +307,9 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
 | 
				
			||||||
	if (rc < 0)
 | 
						if (rc < 0)
 | 
				
			||||||
		goto out_free;
 | 
							goto out_free;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (loadshr_scode == DCSS_LOADSHRX) {
 | 
						if (segment_overlaps_others(seg)) {
 | 
				
			||||||
		if (segment_overlaps_others(seg)) {
 | 
							rc = -EBUSY;
 | 
				
			||||||
			rc = -EBUSY;
 | 
							goto out_free;
 | 
				
			||||||
			goto out_free;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
 | 
						rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue