s390/extmem: remove code for 31 bit addressing mode
authorGerald Schaefer <gerald.schaefer@de.ibm.com>
Thu, 21 Feb 2019 14:34:21 +0000 (15:34 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 21 Feb 2019 14:57:24 +0000 (15:57 +0100)
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>
arch/s390/mm/extmem.c

index eba2def..86c8a3c 100644 (file)
 #include <asm/cpcmd.h>
 #include <asm/setup.h>
 
-#define DCSS_LOADSHR    0x00
-#define DCSS_LOADNSR    0x04
 #define DCSS_PURGESEG   0x08
-#define DCSS_FINDSEG    0x0c
-#define DCSS_LOADNOLY   0x10
-#define DCSS_SEGEXT     0x18
 #define DCSS_LOADSHRX  0x20
 #define DCSS_LOADNSRX  0x24
 #define DCSS_FINDSEGX  0x2c
@@ -53,20 +48,6 @@ struct qout64 {
        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 {
        char qopcode;
        char rsrv1[3];
@@ -95,52 +76,10 @@ static DEFINE_MUTEX(dcss_lock);
 static LIST_HEAD(dcss_list);
 static char *segtype_string[] = { "SW", "EW", "SR", "ER", "SN", "EN", "SC",
                                        "EW/EN-MIXED" };
-static int loadshr_scode, loadnsr_scode;
-static int segext_scode, purgeseg_scode;
-static int scode_set;
-
-/* 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;
-}
+static int loadshr_scode = DCSS_LOADSHRX;
+static int loadnsr_scode = DCSS_LOADNSRX;
+static int purgeseg_scode = DCSS_PURGESEG;
+static int segext_scode = DCSS_SEGEXTX;
 
 /*
  * Create the 8 bytes, ebcdic VM segment name from
@@ -196,32 +135,15 @@ dcss_diag(int *func, void *parameter,
        unsigned long rx, ry;
        int rc;
 
-       if (scode_set == 0) {
-               rc = dcss_set_subcodes();
-               if (rc < 0)
-                       return rc;
-               scode_set = 1;
-       }
        rx = (unsigned long) parameter;
        ry = (unsigned long) *func;
 
-       /* 64-bit Diag x'64' new subcode, keep in 64-bit addressing mode */
        diag_stat_inc(DIAG_STAT_X064);
-       if (*func > DCSS_SEGEXT)
-               asm volatile(
-                       "       diag    %0,%1,0x64\n"
-                       "       ipm     %2\n"
-                       "       srl     %2,28\n"
-                       : "+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");
+       asm volatile(
+               "       diag    %0,%1,0x64\n"
+               "       ipm     %2\n"
+               "       srl     %2,28\n"
+               : "+d" (rx), "+d" (ry), "=d" (rc) : : "cc");
        *ret1 = rx;
        *ret2 = ry;
        return rc;
@@ -271,31 +193,6 @@ query_segment_type (struct dcss_segment *seg)
                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) {
                rc = -EOPNOTSUPP;
                goto out_free;
@@ -410,11 +307,9 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
        if (rc < 0)
                goto out_free;
 
-       if (loadshr_scode == DCSS_LOADSHRX) {
-               if (segment_overlaps_others(seg)) {
-                       rc = -EBUSY;
-                       goto out_free;
-               }
+       if (segment_overlaps_others(seg)) {
+               rc = -EBUSY;
+               goto out_free;
        }
 
        rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1);