aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@de.ibm.com>2007-08-22 07:51:40 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-08-22 07:51:47 -0400
commit0a87c5cfc0bb0c1bdcc1cc9fd82e4a1711fac512 (patch)
treef204007f95e2807e63712593c3b42d3fb59be5fe
parent37cd0a007f88f1d6269035bdb02b50f536cca8de (diff)
[S390] vmur: fix diag14 exceptions with addresses > 2GB.
There are several s390 diagnose calls, which must be executed below the 2GB memory boundary. In order to enforce this, those diagnoses must be compiled into the kernel. Currently diag 14 can be called within the vmur kernel module from addresses above 2GB. This leads to specification exceptions. This patch moves diag10, diag14 and diag210 into the new diag.c file. Signed-off-by: Michael Holzheu <holzheu@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
-rw-r--r--arch/s390/kernel/Makefile2
-rw-r--r--arch/s390/kernel/diag.c102
-rw-r--r--arch/s390/kernel/s390_ksyms.c1
-rw-r--r--arch/s390/mm/cmm.c1
-rw-r--r--arch/s390/mm/init.c17
-rw-r--r--drivers/s390/block/dasd_diag.c1
-rw-r--r--drivers/s390/char/raw3270.c1
-rw-r--r--drivers/s390/char/vmur.c32
-rw-r--r--drivers/s390/cio/device_id.c48
-rw-r--r--include/asm-s390/cio.h15
-rw-r--r--include/asm-s390/diag.h39
-rw-r--r--include/asm-s390/pgalloc.h2
12 files changed, 150 insertions, 111 deletions
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 3195d375bd51..56cb71007cd9 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -6,7 +6,7 @@ EXTRA_AFLAGS := -traditional
6 6
7obj-y := bitmap.o traps.o time.o process.o base.o early.o \ 7obj-y := bitmap.o traps.o time.o process.o base.o early.o \
8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ 8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
9 semaphore.o s390_ext.o debug.o irq.o ipl.o dis.o 9 semaphore.o s390_ext.o debug.o irq.o ipl.o dis.o diag.o
10 10
11obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 11obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
12obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 12obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
diff --git a/arch/s390/kernel/diag.c b/arch/s390/kernel/diag.c
new file mode 100644
index 000000000000..c032d11da8a1
--- /dev/null
+++ b/arch/s390/kernel/diag.c
@@ -0,0 +1,102 @@
1/*
2 * Implementation of s390 diagnose codes
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */
7
8#include <linux/module.h>
9#include <asm/diag.h>
10
11/*
12 * Diagnose 10: Release pages
13 */
14void diag10(unsigned long addr)
15{
16 if (addr >= 0x7ff00000)
17 return;
18 asm volatile(
19#ifdef CONFIG_64BIT
20 " sam31\n"
21 " diag %0,%0,0x10\n"
22 "0: sam64\n"
23#else
24 " diag %0,%0,0x10\n"
25 "0:\n"
26#endif
27 EX_TABLE(0b, 0b)
28 : : "a" (addr));
29}
30EXPORT_SYMBOL(diag10);
31
32/*
33 * Diagnose 14: Input spool file manipulation
34 */
35int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode)
36{
37 register unsigned long _ry1 asm("2") = ry1;
38 register unsigned long _ry2 asm("3") = subcode;
39 int rc = 0;
40
41 asm volatile(
42#ifdef CONFIG_64BIT
43 " sam31\n"
44 " diag %2,2,0x14\n"
45 " sam64\n"
46#else
47 " diag %2,2,0x14\n"
48#endif
49 " ipm %0\n"
50 " srl %0,28\n"
51 : "=d" (rc), "+d" (_ry2)
52 : "d" (rx), "d" (_ry1)
53 : "cc");
54
55 return rc;
56}
57EXPORT_SYMBOL(diag14);
58
59/*
60 * Diagnose 210: Get information about a virtual device
61 */
62int diag210(struct diag210 *addr)
63{
64 /*
65 * diag 210 needs its data below the 2GB border, so we
66 * use a static data area to be sure
67 */
68 static struct diag210 diag210_tmp;
69 static DEFINE_SPINLOCK(diag210_lock);
70 unsigned long flags;
71 int ccode;
72
73 spin_lock_irqsave(&diag210_lock, flags);
74 diag210_tmp = *addr;
75
76#ifdef CONFIG_64BIT
77 asm volatile(
78 " lhi %0,-1\n"
79 " sam31\n"
80 " diag %1,0,0x210\n"
81 "0: ipm %0\n"
82 " srl %0,28\n"
83 "1: sam64\n"
84 EX_TABLE(0b, 1b)
85 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
86#else
87 asm volatile(
88 " lhi %0,-1\n"
89 " diag %1,0,0x210\n"
90 "0: ipm %0\n"
91 " srl %0,28\n"
92 "1:\n"
93 EX_TABLE(0b, 1b)
94 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
95#endif
96
97 *addr = diag210_tmp;
98 spin_unlock_irqrestore(&diag210_lock, flags);
99
100 return ccode;
101}
102EXPORT_SYMBOL(diag210);
diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c
index 90b5ef529eb7..7234c737f825 100644
--- a/arch/s390/kernel/s390_ksyms.c
+++ b/arch/s390/kernel/s390_ksyms.c
@@ -25,7 +25,6 @@ EXPORT_SYMBOL(_oi_bitmap);
25EXPORT_SYMBOL(_ni_bitmap); 25EXPORT_SYMBOL(_ni_bitmap);
26EXPORT_SYMBOL(_zb_findmap); 26EXPORT_SYMBOL(_zb_findmap);
27EXPORT_SYMBOL(_sb_findmap); 27EXPORT_SYMBOL(_sb_findmap);
28EXPORT_SYMBOL(diag10);
29 28
30/* 29/*
31 * semaphore ops 30 * semaphore ops
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index c5b2f4f078bc..fabc50adc46a 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/pgalloc.h> 21#include <asm/pgalloc.h>
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/diag.h>
23 24
24static char *sender = "VMRMSVM"; 25static char *sender = "VMRMSVM";
25module_param(sender, charp, 0400); 26module_param(sender, charp, 0400);
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 9098531a2671..3a25bbf2eb0a 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -42,23 +42,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
42pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE))); 42pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
43char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE))); 43char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
44 44
45void diag10(unsigned long addr)
46{
47 if (addr >= 0x7ff00000)
48 return;
49 asm volatile(
50#ifdef CONFIG_64BIT
51 " sam31\n"
52 " diag %0,%0,0x10\n"
53 "0: sam64\n"
54#else
55 " diag %0,%0,0x10\n"
56 "0:\n"
57#endif
58 EX_TABLE(0b,0b)
59 : : "a" (addr));
60}
61
62void show_mem(void) 45void show_mem(void)
63{ 46{
64 int i, total = 0, reserved = 0; 47 int i, total = 0, reserved = 0;
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index eccac1c3b71b..d32c60dbdd82 100644
--- a/drivers/s390/block/dasd_diag.c
+++ b/drivers/s390/block/dasd_diag.c
@@ -24,6 +24,7 @@
24#include <asm/s390_ext.h> 24#include <asm/s390_ext.h>
25#include <asm/todclk.h> 25#include <asm/todclk.h>
26#include <asm/vtoc.h> 26#include <asm/vtoc.h>
27#include <asm/diag.h>
27 28
28#include "dasd_int.h" 29#include "dasd_int.h"
29#include "dasd_diag.h" 30#include "dasd_diag.h"
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index 4f2f81b16cfa..2edd5fb6d3dc 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -21,6 +21,7 @@
21#include <asm/ccwdev.h> 21#include <asm/ccwdev.h>
22#include <asm/cio.h> 22#include <asm/cio.h>
23#include <asm/ebcdic.h> 23#include <asm/ebcdic.h>
24#include <asm/diag.h>
24 25
25#include "raw3270.h" 26#include "raw3270.h"
26 27
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 04b19bdc09da..2d96c958df64 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -14,6 +14,7 @@
14#include <asm/cio.h> 14#include <asm/cio.h>
15#include <asm/ccwdev.h> 15#include <asm/ccwdev.h>
16#include <asm/debug.h> 16#include <asm/debug.h>
17#include <asm/diag.h>
17 18
18#include "vmur.h" 19#include "vmur.h"
19 20
@@ -379,31 +380,6 @@ static ssize_t ur_write(struct file *file, const char __user *udata,
379 return do_write(urf->urd, udata, count, urf->dev_reclen, ppos); 380 return do_write(urf->urd, udata, count, urf->dev_reclen, ppos);
380} 381}
381 382
382static int do_diag_14(unsigned long rx, unsigned long ry1,
383 unsigned long subcode)
384{
385 register unsigned long _ry1 asm("2") = ry1;
386 register unsigned long _ry2 asm("3") = subcode;
387 int rc = 0;
388
389 asm volatile(
390#ifdef CONFIG_64BIT
391 " sam31\n"
392 " diag %2,2,0x14\n"
393 " sam64\n"
394#else
395 " diag %2,2,0x14\n"
396#endif
397 " ipm %0\n"
398 " srl %0,28\n"
399 : "=d" (rc), "+d" (_ry2)
400 : "d" (rx), "d" (_ry1)
401 : "cc");
402
403 TRACE("diag 14: subcode=0x%lx, cc=%i\n", subcode, rc);
404 return rc;
405}
406
407/* 383/*
408 * diagnose code 0x14 subcode 0x0028 - position spool file to designated 384 * diagnose code 0x14 subcode 0x0028 - position spool file to designated
409 * record 385 * record
@@ -415,7 +391,7 @@ static int diag_position_to_record(int devno, int record)
415{ 391{
416 int cc; 392 int cc;
417 393
418 cc = do_diag_14(record, devno, 0x28); 394 cc = diag14(record, devno, 0x28);
419 switch (cc) { 395 switch (cc) {
420 case 0: 396 case 0:
421 return 0; 397 return 0;
@@ -440,7 +416,7 @@ static int diag_read_file(int devno, char *buf)
440{ 416{
441 int cc; 417 int cc;
442 418
443 cc = do_diag_14((unsigned long) buf, devno, 0x00); 419 cc = diag14((unsigned long) buf, devno, 0x00);
444 switch (cc) { 420 switch (cc) {
445 case 0: 421 case 0:
446 return 0; 422 return 0;
@@ -533,7 +509,7 @@ static int diag_read_next_file_info(struct file_control_block *buf, int spid)
533{ 509{
534 int cc; 510 int cc;
535 511
536 cc = do_diag_14((unsigned long) buf, spid, 0xfff); 512 cc = diag14((unsigned long) buf, spid, 0xfff);
537 switch (cc) { 513 switch (cc) {
538 case 0: 514 case 0:
539 return 0; 515 return 0;
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c
index 60b9347f7c92..f232832f2b22 100644
--- a/drivers/s390/cio/device_id.c
+++ b/drivers/s390/cio/device_id.c
@@ -17,6 +17,7 @@
17#include <asm/delay.h> 17#include <asm/delay.h>
18#include <asm/cio.h> 18#include <asm/cio.h>
19#include <asm/lowcore.h> 19#include <asm/lowcore.h>
20#include <asm/diag.h>
20 21
21#include "cio.h" 22#include "cio.h"
22#include "cio_debug.h" 23#include "cio_debug.h"
@@ -25,51 +26,6 @@
25#include "ioasm.h" 26#include "ioasm.h"
26 27
27/* 28/*
28 * diag210 is used under VM to get information about a virtual device
29 */
30int
31diag210(struct diag210 * addr)
32{
33 /*
34 * diag 210 needs its data below the 2GB border, so we
35 * use a static data area to be sure
36 */
37 static struct diag210 diag210_tmp;
38 static DEFINE_SPINLOCK(diag210_lock);
39 unsigned long flags;
40 int ccode;
41
42 spin_lock_irqsave(&diag210_lock, flags);
43 diag210_tmp = *addr;
44
45#ifdef CONFIG_64BIT
46 asm volatile(
47 " lhi %0,-1\n"
48 " sam31\n"
49 " diag %1,0,0x210\n"
50 "0: ipm %0\n"
51 " srl %0,28\n"
52 "1: sam64\n"
53 EX_TABLE(0b,1b)
54 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
55#else
56 asm volatile(
57 " lhi %0,-1\n"
58 " diag %1,0,0x210\n"
59 "0: ipm %0\n"
60 " srl %0,28\n"
61 "1:\n"
62 EX_TABLE(0b,1b)
63 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
64#endif
65
66 *addr = diag210_tmp;
67 spin_unlock_irqrestore(&diag210_lock, flags);
68
69 return ccode;
70}
71
72/*
73 * Input : 29 * Input :
74 * devno - device number 30 * devno - device number
75 * ps - pointer to sense ID data area 31 * ps - pointer to sense ID data area
@@ -349,5 +305,3 @@ ccw_device_sense_id_irq(struct ccw_device *cdev, enum dev_event dev_event)
349 break; 305 break;
350 } 306 }
351} 307}
352
353EXPORT_SYMBOL(diag210);
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index f738d2827582..1982fb344164 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -258,19 +258,6 @@ struct ciw {
258/* Sick revalidation of device. */ 258/* Sick revalidation of device. */
259#define CIO_REVALIDATE 0x0008 259#define CIO_REVALIDATE 0x0008
260 260
261struct diag210 {
262 __u16 vrdcdvno : 16; /* device number (input) */
263 __u16 vrdclen : 16; /* data block length (input) */
264 __u32 vrdcvcla : 8; /* virtual device class (output) */
265 __u32 vrdcvtyp : 8; /* virtual device type (output) */
266 __u32 vrdcvsta : 8; /* virtual device status (output) */
267 __u32 vrdcvfla : 8; /* virtual device flags (output) */
268 __u32 vrdcrccl : 8; /* real device class (output) */
269 __u32 vrdccrty : 8; /* real device type (output) */
270 __u32 vrdccrmd : 8; /* real device model (output) */
271 __u32 vrdccrft : 8; /* real device feature (output) */
272} __attribute__ ((packed,aligned(4)));
273
274struct ccw_dev_id { 261struct ccw_dev_id {
275 u8 ssid; 262 u8 ssid;
276 u16 devno; 263 u16 devno;
@@ -285,8 +272,6 @@ static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
285 return 0; 272 return 0;
286} 273}
287 274
288extern int diag210(struct diag210 *addr);
289
290extern void wait_cons_dev(void); 275extern void wait_cons_dev(void);
291 276
292extern void css_schedule_reprobe(void); 277extern void css_schedule_reprobe(void);
diff --git a/include/asm-s390/diag.h b/include/asm-s390/diag.h
new file mode 100644
index 000000000000..72b2e2f2d32d
--- /dev/null
+++ b/include/asm-s390/diag.h
@@ -0,0 +1,39 @@
1/*
2 * s390 diagnose functions
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_DIAG_H
9#define _ASM_S390_DIAG_H
10
11/*
12 * Diagnose 10: Release pages
13 */
14extern void diag10(unsigned long addr);
15
16/*
17 * Diagnose 14: Input spool file manipulation
18 */
19extern int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode);
20
21/*
22 * Diagnose 210: Get information about a virtual device
23 */
24struct diag210 {
25 u16 vrdcdvno; /* device number (input) */
26 u16 vrdclen; /* data block length (input) */
27 u8 vrdcvcla; /* virtual device class (output) */
28 u8 vrdcvtyp; /* virtual device type (output) */
29 u8 vrdcvsta; /* virtual device status (output) */
30 u8 vrdcvfla; /* virtual device flags (output) */
31 u8 vrdcrccl; /* real device class (output) */
32 u8 vrdccrty; /* real device type (output) */
33 u8 vrdccrmd; /* real device model (output) */
34 u8 vrdccrft; /* real device feature (output) */
35} __attribute__((packed, aligned(4)));
36
37extern int diag210(struct diag210 *addr);
38
39#endif /* _ASM_S390_DIAG_H */
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
index 56c8a6c80e2e..e45d3c9a4b7e 100644
--- a/include/asm-s390/pgalloc.h
+++ b/include/asm-s390/pgalloc.h
@@ -19,8 +19,6 @@
19 19
20#define check_pgt_cache() do {} while (0) 20#define check_pgt_cache() do {} while (0)
21 21
22extern void diag10(unsigned long addr);
23
24/* 22/*
25 * Page allocation orders. 23 * Page allocation orders.
26 */ 24 */