diff options
author | Christian Borntraeger <cborntra@de.ibm.com> | 2005-06-25 17:55:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:37 -0400 |
commit | 6b979de395c7e1b7e59f74a870e1d1911853eccb (patch) | |
tree | 82502e9e93c977b0f812d017f5d8d4e12436c6c8 /arch/s390 | |
parent | 77fa22450de00d535de2cc8be653983560828000 (diff) |
[PATCH] s390: add vmcp interface
Add interface to issue VM control program commands.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/defconfig | 1 | ||||
-rw-r--r-- | arch/s390/kernel/cpcmd.c | 109 | ||||
-rw-r--r-- | arch/s390/kernel/setup.c | 6 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 6 | ||||
-rw-r--r-- | arch/s390/kernel/traps.c | 2 | ||||
-rw-r--r-- | arch/s390/mm/extmem.c | 4 |
6 files changed, 75 insertions, 53 deletions
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 07fd0414a4bf..89850b2c27ea 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -245,6 +245,7 @@ CONFIG_S390_TAPE_BLOCK=y | |||
245 | # | 245 | # |
246 | CONFIG_S390_TAPE_34XX=m | 246 | CONFIG_S390_TAPE_34XX=m |
247 | # CONFIG_VMLOGRDR is not set | 247 | # CONFIG_VMLOGRDR is not set |
248 | # CONFIG_VMCP is not set | ||
248 | # CONFIG_MONREADER is not set | 249 | # CONFIG_MONREADER is not set |
249 | # CONFIG_DCSS_SHM is not set | 250 | # CONFIG_DCSS_SHM is not set |
250 | 251 | ||
diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c index 44df8dc07c59..20062145e84e 100644 --- a/arch/s390/kernel/cpcmd.c +++ b/arch/s390/kernel/cpcmd.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * arch/s390/kernel/cpcmd.c | 2 | * arch/s390/kernel/cpcmd.c |
3 | * | 3 | * |
4 | * S390 version | 4 | * S390 version |
5 | * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation | 5 | * Copyright (C) 1999,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation |
6 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), | 6 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), |
7 | * Christian Borntraeger (cborntra@de.ibm.com), | 7 | * Christian Borntraeger (cborntra@de.ibm.com), |
8 | */ | 8 | */ |
@@ -18,93 +18,114 @@ | |||
18 | #include <asm/system.h> | 18 | #include <asm/system.h> |
19 | 19 | ||
20 | static DEFINE_SPINLOCK(cpcmd_lock); | 20 | static DEFINE_SPINLOCK(cpcmd_lock); |
21 | static char cpcmd_buf[240]; | 21 | static char cpcmd_buf[241]; |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * the caller of __cpcmd has to ensure that the response buffer is below 2 GB | 24 | * the caller of __cpcmd has to ensure that the response buffer is below 2 GB |
25 | */ | 25 | */ |
26 | void __cpcmd(char *cmd, char *response, int rlen) | 26 | int __cpcmd(const char *cmd, char *response, int rlen, int *response_code) |
27 | { | 27 | { |
28 | const int mask = 0x40000000L; | 28 | const int mask = 0x40000000L; |
29 | unsigned long flags; | 29 | unsigned long flags; |
30 | int return_code; | ||
31 | int return_len; | ||
30 | int cmdlen; | 32 | int cmdlen; |
31 | 33 | ||
32 | spin_lock_irqsave(&cpcmd_lock, flags); | 34 | spin_lock_irqsave(&cpcmd_lock, flags); |
33 | cmdlen = strlen(cmd); | 35 | cmdlen = strlen(cmd); |
34 | BUG_ON(cmdlen > 240); | 36 | BUG_ON(cmdlen > 240); |
35 | strcpy(cpcmd_buf, cmd); | 37 | memcpy(cpcmd_buf, cmd, cmdlen); |
36 | ASCEBC(cpcmd_buf, cmdlen); | 38 | ASCEBC(cpcmd_buf, cmdlen); |
37 | 39 | ||
38 | if (response != NULL && rlen > 0) { | 40 | if (response != NULL && rlen > 0) { |
39 | memset(response, 0, rlen); | 41 | memset(response, 0, rlen); |
40 | #ifndef CONFIG_ARCH_S390X | 42 | #ifndef CONFIG_ARCH_S390X |
41 | asm volatile ("LRA 2,0(%0)\n\t" | 43 | asm volatile ( "lra 2,0(%2)\n" |
42 | "LR 4,%1\n\t" | 44 | "lr 4,%3\n" |
43 | "O 4,%4\n\t" | 45 | "o 4,%6\n" |
44 | "LRA 3,0(%2)\n\t" | 46 | "lra 3,0(%4)\n" |
45 | "LR 5,%3\n\t" | 47 | "lr 5,%5\n" |
46 | ".long 0x83240008 # Diagnose X'08'\n\t" | 48 | "diag 2,4,0x8\n" |
47 | : /* no output */ | 49 | "brc 8, .Litfits\n" |
48 | : "a" (cpcmd_buf), "d" (cmdlen), | 50 | "ar 5, %5\n" |
49 | "a" (response), "d" (rlen), "m" (mask) | 51 | ".Litfits: \n" |
50 | : "cc", "2", "3", "4", "5" ); | 52 | "lr %0,4\n" |
53 | "lr %1,5\n" | ||
54 | : "=d" (return_code), "=d" (return_len) | ||
55 | : "a" (cpcmd_buf), "d" (cmdlen), | ||
56 | "a" (response), "d" (rlen), "m" (mask) | ||
57 | : "cc", "2", "3", "4", "5" ); | ||
51 | #else /* CONFIG_ARCH_S390X */ | 58 | #else /* CONFIG_ARCH_S390X */ |
52 | asm volatile (" lrag 2,0(%0)\n" | 59 | asm volatile ( "lrag 2,0(%2)\n" |
53 | " lgr 4,%1\n" | 60 | "lgr 4,%3\n" |
54 | " o 4,%4\n" | 61 | "o 4,%6\n" |
55 | " lrag 3,0(%2)\n" | 62 | "lrag 3,0(%4)\n" |
56 | " lgr 5,%3\n" | 63 | "lgr 5,%5\n" |
57 | " sam31\n" | 64 | "sam31\n" |
58 | " .long 0x83240008 # Diagnose X'08'\n" | 65 | "diag 2,4,0x8\n" |
59 | " sam64" | 66 | "sam64\n" |
60 | : /* no output */ | 67 | "brc 8, .Litfits\n" |
61 | : "a" (cpcmd_buf), "d" (cmdlen), | 68 | "agr 5, %5\n" |
62 | "a" (response), "d" (rlen), "m" (mask) | 69 | ".Litfits: \n" |
63 | : "cc", "2", "3", "4", "5" ); | 70 | "lgr %0,4\n" |
71 | "lgr %1,5\n" | ||
72 | : "=d" (return_code), "=d" (return_len) | ||
73 | : "a" (cpcmd_buf), "d" (cmdlen), | ||
74 | "a" (response), "d" (rlen), "m" (mask) | ||
75 | : "cc", "2", "3", "4", "5" ); | ||
64 | #endif /* CONFIG_ARCH_S390X */ | 76 | #endif /* CONFIG_ARCH_S390X */ |
65 | EBCASC(response, rlen); | 77 | EBCASC(response, rlen); |
66 | } else { | 78 | } else { |
79 | return_len = 0; | ||
67 | #ifndef CONFIG_ARCH_S390X | 80 | #ifndef CONFIG_ARCH_S390X |
68 | asm volatile ("LRA 2,0(%0)\n\t" | 81 | asm volatile ( "lra 2,0(%1)\n" |
69 | "LR 3,%1\n\t" | 82 | "lr 3,%2\n" |
70 | ".long 0x83230008 # Diagnose X'08'\n\t" | 83 | "diag 2,3,0x8\n" |
71 | : /* no output */ | 84 | "lr %0,3\n" |
72 | : "a" (cpcmd_buf), "d" (cmdlen) | 85 | : "=d" (return_code) |
73 | : "2", "3" ); | 86 | : "a" (cpcmd_buf), "d" (cmdlen) |
87 | : "2", "3" ); | ||
74 | #else /* CONFIG_ARCH_S390X */ | 88 | #else /* CONFIG_ARCH_S390X */ |
75 | asm volatile (" lrag 2,0(%0)\n" | 89 | asm volatile ( "lrag 2,0(%1)\n" |
76 | " lgr 3,%1\n" | 90 | "lgr 3,%2\n" |
77 | " sam31\n" | 91 | "sam31\n" |
78 | " .long 0x83230008 # Diagnose X'08'\n" | 92 | "diag 2,3,0x8\n" |
79 | " sam64" | 93 | "sam64\n" |
80 | : /* no output */ | 94 | "lgr %0,3\n" |
81 | : "a" (cpcmd_buf), "d" (cmdlen) | 95 | : "=d" (return_code) |
82 | : "2", "3" ); | 96 | : "a" (cpcmd_buf), "d" (cmdlen) |
97 | : "2", "3" ); | ||
83 | #endif /* CONFIG_ARCH_S390X */ | 98 | #endif /* CONFIG_ARCH_S390X */ |
84 | } | 99 | } |
85 | spin_unlock_irqrestore(&cpcmd_lock, flags); | 100 | spin_unlock_irqrestore(&cpcmd_lock, flags); |
101 | if (response_code != NULL) | ||
102 | *response_code = return_code; | ||
103 | return return_len; | ||
86 | } | 104 | } |
87 | 105 | ||
88 | EXPORT_SYMBOL(__cpcmd); | 106 | EXPORT_SYMBOL(__cpcmd); |
89 | 107 | ||
90 | #ifdef CONFIG_ARCH_S390X | 108 | #ifdef CONFIG_ARCH_S390X |
91 | void cpcmd(char *cmd, char *response, int rlen) | 109 | int cpcmd(const char *cmd, char *response, int rlen, int *response_code) |
92 | { | 110 | { |
93 | char *lowbuf; | 111 | char *lowbuf; |
112 | int len; | ||
113 | |||
94 | if ((rlen == 0) || (response == NULL) | 114 | if ((rlen == 0) || (response == NULL) |
95 | || !((unsigned long)response >> 31)) | 115 | || !((unsigned long)response >> 31)) |
96 | __cpcmd(cmd, response, rlen); | 116 | len = __cpcmd(cmd, response, rlen, response_code); |
97 | else { | 117 | else { |
98 | lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA); | 118 | lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA); |
99 | if (!lowbuf) { | 119 | if (!lowbuf) { |
100 | printk(KERN_WARNING | 120 | printk(KERN_WARNING |
101 | "cpcmd: could not allocate response buffer\n"); | 121 | "cpcmd: could not allocate response buffer\n"); |
102 | return; | 122 | return -ENOMEM; |
103 | } | 123 | } |
104 | __cpcmd(cmd, lowbuf, rlen); | 124 | len = __cpcmd(cmd, lowbuf, rlen, response_code); |
105 | memcpy(response, lowbuf, rlen); | 125 | memcpy(response, lowbuf, rlen); |
106 | kfree(lowbuf); | 126 | kfree(lowbuf); |
107 | } | 127 | } |
128 | return len; | ||
108 | } | 129 | } |
109 | 130 | ||
110 | EXPORT_SYMBOL(cpcmd); | 131 | EXPORT_SYMBOL(cpcmd); |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index eb7be0ad7175..b6d740ac0e6e 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -198,11 +198,11 @@ static void __init conmode_default(void) | |||
198 | char *ptr; | 198 | char *ptr; |
199 | 199 | ||
200 | if (MACHINE_IS_VM) { | 200 | if (MACHINE_IS_VM) { |
201 | __cpcmd("QUERY CONSOLE", query_buffer, 1024); | 201 | __cpcmd("QUERY CONSOLE", query_buffer, 1024, NULL); |
202 | console_devno = simple_strtoul(query_buffer + 5, NULL, 16); | 202 | console_devno = simple_strtoul(query_buffer + 5, NULL, 16); |
203 | ptr = strstr(query_buffer, "SUBCHANNEL ="); | 203 | ptr = strstr(query_buffer, "SUBCHANNEL ="); |
204 | console_irq = simple_strtoul(ptr + 13, NULL, 16); | 204 | console_irq = simple_strtoul(ptr + 13, NULL, 16); |
205 | __cpcmd("QUERY TERM", query_buffer, 1024); | 205 | __cpcmd("QUERY TERM", query_buffer, 1024, NULL); |
206 | ptr = strstr(query_buffer, "CONMODE"); | 206 | ptr = strstr(query_buffer, "CONMODE"); |
207 | /* | 207 | /* |
208 | * Set the conmode to 3215 so that the device recognition | 208 | * Set the conmode to 3215 so that the device recognition |
@@ -211,7 +211,7 @@ static void __init conmode_default(void) | |||
211 | * 3215 and the 3270 driver will try to access the console | 211 | * 3215 and the 3270 driver will try to access the console |
212 | * device (3215 as console and 3270 as normal tty). | 212 | * device (3215 as console and 3270 as normal tty). |
213 | */ | 213 | */ |
214 | __cpcmd("TERM CONMODE 3215", NULL, 0); | 214 | __cpcmd("TERM CONMODE 3215", NULL, 0, NULL); |
215 | if (ptr == NULL) { | 215 | if (ptr == NULL) { |
216 | #if defined(CONFIG_SCLP_CONSOLE) | 216 | #if defined(CONFIG_SCLP_CONSOLE) |
217 | SET_CONSOLE_SCLP; | 217 | SET_CONSOLE_SCLP; |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 50c335067cfe..642572a8e334 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -284,7 +284,7 @@ static void do_machine_restart(void * __unused) | |||
284 | * locks are always held disabled). | 284 | * locks are always held disabled). |
285 | */ | 285 | */ |
286 | if (MACHINE_IS_VM) | 286 | if (MACHINE_IS_VM) |
287 | cpcmd ("IPL", NULL, 0); | 287 | cpcmd ("IPL", NULL, 0, NULL); |
288 | else | 288 | else |
289 | reipl (0x10000 | S390_lowcore.ipl_device); | 289 | reipl (0x10000 | S390_lowcore.ipl_device); |
290 | } | 290 | } |
@@ -313,7 +313,7 @@ static void do_machine_halt(void * __unused) | |||
313 | if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) { | 313 | if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) { |
314 | smp_send_stop(); | 314 | smp_send_stop(); |
315 | if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) | 315 | if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) |
316 | cpcmd(vmhalt_cmd, NULL, 0); | 316 | cpcmd(vmhalt_cmd, NULL, 0, NULL); |
317 | signal_processor(smp_processor_id(), | 317 | signal_processor(smp_processor_id(), |
318 | sigp_stop_and_store_status); | 318 | sigp_stop_and_store_status); |
319 | } | 319 | } |
@@ -332,7 +332,7 @@ static void do_machine_power_off(void * __unused) | |||
332 | if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) { | 332 | if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) { |
333 | smp_send_stop(); | 333 | smp_send_stop(); |
334 | if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) | 334 | if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) |
335 | cpcmd(vmpoff_cmd, NULL, 0); | 335 | cpcmd(vmpoff_cmd, NULL, 0, NULL); |
336 | signal_processor(smp_processor_id(), | 336 | signal_processor(smp_processor_id(), |
337 | sigp_stop_and_store_status); | 337 | sigp_stop_and_store_status); |
338 | } | 338 | } |
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index ca34b6f34b38..bc7b7be7acbe 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -735,7 +735,7 @@ void __init trap_init(void) | |||
735 | &ext_int_pfault); | 735 | &ext_int_pfault); |
736 | #endif | 736 | #endif |
737 | #ifndef CONFIG_ARCH_S390X | 737 | #ifndef CONFIG_ARCH_S390X |
738 | cpcmd("SET PAGEX ON", NULL, 0); | 738 | cpcmd("SET PAGEX ON", NULL, 0, NULL); |
739 | #endif | 739 | #endif |
740 | } | 740 | } |
741 | } | 741 | } |
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c index 648deed17e25..c5348108ca3c 100644 --- a/arch/s390/mm/extmem.c +++ b/arch/s390/mm/extmem.c | |||
@@ -576,8 +576,8 @@ segment_save(char *name) | |||
576 | segtype_string[seg->range[i].start & 0xff]); | 576 | segtype_string[seg->range[i].start & 0xff]); |
577 | } | 577 | } |
578 | sprintf(cmd2, "SAVESEG %s", name); | 578 | sprintf(cmd2, "SAVESEG %s", name); |
579 | cpcmd(cmd1, NULL, 0); | 579 | cpcmd(cmd1, NULL, 0, NULL); |
580 | cpcmd(cmd2, NULL, 0); | 580 | cpcmd(cmd2, NULL, 0, NULL); |
581 | spin_unlock(&dcss_lock); | 581 | spin_unlock(&dcss_lock); |
582 | } | 582 | } |
583 | 583 | ||