diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2008-04-17 01:46:09 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2008-04-17 01:47:00 -0400 |
commit | aa24f7f08baca5aa9201901131cbdd0b14deceb6 (patch) | |
tree | 31f9194686ca8f18262da6e75823926c7a448cb6 /include | |
parent | f60c768c387026499bbdefdd807d9124ae2b3a8c (diff) |
[S390] KVM preparation: split sysinfo definitions for kvm use
drivers/s390/sysinfo.c uses the store system information intruction to query
the system about information of the machine, the LPAR and additional
hypervisors. KVM has to implement the host part for this instruction.
To avoid code duplication, this patch splits the common definitions from
sysinfo.c into a separate header file include/asm-s390/sysinfo.h for KVM use.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-s390/sysinfo.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/include/asm-s390/sysinfo.h b/include/asm-s390/sysinfo.h new file mode 100644 index 000000000000..014f2a24664e --- /dev/null +++ b/include/asm-s390/sysinfo.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * definition for store system information stsi | ||
3 | * | ||
4 | * Copyright IBM Corp. 2001,2008 | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License (version 2 only) | ||
8 | * as published by the Free Software Foundation. | ||
9 | * | ||
10 | * Author(s): Ulrich Weigand <weigand@de.ibm.com> | ||
11 | * Christian Borntraeger <borntraeger@de.ibm.com> | ||
12 | */ | ||
13 | |||
14 | struct sysinfo_1_1_1 { | ||
15 | char reserved_0[32]; | ||
16 | char manufacturer[16]; | ||
17 | char type[4]; | ||
18 | char reserved_1[12]; | ||
19 | char model_capacity[16]; | ||
20 | char sequence[16]; | ||
21 | char plant[4]; | ||
22 | char model[16]; | ||
23 | }; | ||
24 | |||
25 | struct sysinfo_1_2_1 { | ||
26 | char reserved_0[80]; | ||
27 | char sequence[16]; | ||
28 | char plant[4]; | ||
29 | char reserved_1[2]; | ||
30 | unsigned short cpu_address; | ||
31 | }; | ||
32 | |||
33 | struct sysinfo_1_2_2 { | ||
34 | char format; | ||
35 | char reserved_0[1]; | ||
36 | unsigned short acc_offset; | ||
37 | char reserved_1[24]; | ||
38 | unsigned int secondary_capability; | ||
39 | unsigned int capability; | ||
40 | unsigned short cpus_total; | ||
41 | unsigned short cpus_configured; | ||
42 | unsigned short cpus_standby; | ||
43 | unsigned short cpus_reserved; | ||
44 | unsigned short adjustment[0]; | ||
45 | }; | ||
46 | |||
47 | struct sysinfo_1_2_2_extension { | ||
48 | unsigned int alt_capability; | ||
49 | unsigned short alt_adjustment[0]; | ||
50 | }; | ||
51 | |||
52 | struct sysinfo_2_2_1 { | ||
53 | char reserved_0[80]; | ||
54 | char sequence[16]; | ||
55 | char plant[4]; | ||
56 | unsigned short cpu_id; | ||
57 | unsigned short cpu_address; | ||
58 | }; | ||
59 | |||
60 | struct sysinfo_2_2_2 { | ||
61 | char reserved_0[32]; | ||
62 | unsigned short lpar_number; | ||
63 | char reserved_1; | ||
64 | unsigned char characteristics; | ||
65 | unsigned short cpus_total; | ||
66 | unsigned short cpus_configured; | ||
67 | unsigned short cpus_standby; | ||
68 | unsigned short cpus_reserved; | ||
69 | char name[8]; | ||
70 | unsigned int caf; | ||
71 | char reserved_2[16]; | ||
72 | unsigned short cpus_dedicated; | ||
73 | unsigned short cpus_shared; | ||
74 | }; | ||
75 | |||
76 | #define LPAR_CHAR_DEDICATED (1 << 7) | ||
77 | #define LPAR_CHAR_SHARED (1 << 6) | ||
78 | #define LPAR_CHAR_LIMITED (1 << 5) | ||
79 | |||
80 | struct sysinfo_3_2_2 { | ||
81 | char reserved_0[31]; | ||
82 | unsigned char count; | ||
83 | struct { | ||
84 | char reserved_0[4]; | ||
85 | unsigned short cpus_total; | ||
86 | unsigned short cpus_configured; | ||
87 | unsigned short cpus_standby; | ||
88 | unsigned short cpus_reserved; | ||
89 | char name[8]; | ||
90 | unsigned int caf; | ||
91 | char cpi[16]; | ||
92 | char reserved_1[24]; | ||
93 | |||
94 | } vm[8]; | ||
95 | }; | ||
96 | |||
97 | static inline int stsi(void *sysinfo, int fc, int sel1, int sel2) | ||
98 | { | ||
99 | register int r0 asm("0") = (fc << 28) | sel1; | ||
100 | register int r1 asm("1") = sel2; | ||
101 | |||
102 | asm volatile( | ||
103 | " stsi 0(%2)\n" | ||
104 | "0: jz 2f\n" | ||
105 | "1: lhi %0,%3\n" | ||
106 | "2:\n" | ||
107 | EX_TABLE(0b, 1b) | ||
108 | : "+d" (r0) : "d" (r1), "a" (sysinfo), "K" (-ENOSYS) | ||
109 | : "cc", "memory"); | ||
110 | return r0; | ||
111 | } | ||