xref: /linux/arch/s390/include/asm/sysinfo.h (revision 906fd46a65383cd639e5eec72a047efc33045d86)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * definition for store system information stsi
4  *
5  * Copyright IBM Corp. 2001, 2008
6  *
7  *    Author(s): Ulrich Weigand <weigand@de.ibm.com>
8  *		 Christian Borntraeger <borntraeger@de.ibm.com>
9  */
10 
11 #ifndef __ASM_S390_SYSINFO_H
12 #define __ASM_S390_SYSINFO_H
13 
14 #include <asm/bitsperlong.h>
15 #include <linux/uuid.h>
16 
17 struct sysinfo_1_1_1 {
18 	unsigned char p:1;
19 	unsigned char :6;
20 	unsigned char t:1;
21 	unsigned char :8;
22 	unsigned char ccr;
23 	unsigned char cai;
24 	char reserved_0[20];
25 	unsigned long lic;
26 	char manufacturer[16];
27 	char type[4];
28 	char reserved_1[12];
29 	char model_capacity[16];
30 	char sequence[16];
31 	char plant[4];
32 	char model[16];
33 	char model_perm_cap[16];
34 	char model_temp_cap[16];
35 	unsigned int model_cap_rating;
36 	unsigned int model_perm_cap_rating;
37 	unsigned int model_temp_cap_rating;
38 	unsigned char typepct[5];
39 	unsigned char reserved_2[3];
40 	unsigned int ncr;
41 	unsigned int npr;
42 	unsigned int ntr;
43 	char reserved_3[4];
44 	char model_var_cap[16];
45 	unsigned int model_var_cap_rating;
46 	unsigned int nvr;
47 };
48 
49 struct sysinfo_1_2_1 {
50 	char reserved_0[80];
51 	char sequence[16];
52 	char plant[4];
53 	char reserved_1[2];
54 	unsigned short cpu_address;
55 };
56 
57 struct sysinfo_1_2_2 {
58 	char format;
59 	char reserved_0[1];
60 	unsigned short acc_offset;
61 	unsigned char mt_installed :1;
62 	unsigned char :2;
63 	unsigned char mt_stid :5;
64 	unsigned char :3;
65 	unsigned char mt_gtid :5;
66 	char reserved_1[18];
67 	unsigned int nominal_cap;
68 	unsigned int secondary_cap;
69 	unsigned int capability;
70 	unsigned short cpus_total;
71 	unsigned short cpus_configured;
72 	unsigned short cpus_standby;
73 	unsigned short cpus_reserved;
74 	unsigned short adjustment[];
75 };
76 
77 struct sysinfo_1_2_2_extension {
78 	unsigned int alt_capability;
79 	unsigned short alt_adjustment[];
80 };
81 
82 struct sysinfo_2_2_1 {
83 	char reserved_0[80];
84 	char sequence[16];
85 	char plant[4];
86 	unsigned short cpu_id;
87 	unsigned short cpu_address;
88 };
89 
90 struct sysinfo_2_2_2 {
91 	char reserved_0[32];
92 	unsigned short lpar_number;
93 	char reserved_1;
94 	unsigned char characteristics;
95 	unsigned short cpus_total;
96 	unsigned short cpus_configured;
97 	unsigned short cpus_standby;
98 	unsigned short cpus_reserved;
99 	char name[8];
100 	unsigned int caf;
101 	char reserved_2[8];
102 	unsigned char mt_installed :1;
103 	unsigned char :2;
104 	unsigned char mt_stid :5;
105 	unsigned char :3;
106 	unsigned char mt_gtid :5;
107 	unsigned char :3;
108 	unsigned char mt_psmtid :5;
109 	char reserved_3[5];
110 	unsigned short cpus_dedicated;
111 	unsigned short cpus_shared;
112 	char reserved_4[3];
113 	unsigned char vsne;
114 	uuid_t uuid;
115 	char reserved_5[160];
116 	char ext_name[256];
117 };
118 
119 #define LPAR_CHAR_DEDICATED	(1 << 7)
120 #define LPAR_CHAR_SHARED	(1 << 6)
121 #define LPAR_CHAR_LIMITED	(1 << 5)
122 
123 struct sysinfo_3_2_2 {
124 	char reserved_0[31];
125 	unsigned char :4;
126 	unsigned char count:4;
127 	struct {
128 		char reserved_0[4];
129 		unsigned short cpus_total;
130 		unsigned short cpus_configured;
131 		unsigned short cpus_standby;
132 		unsigned short cpus_reserved;
133 		char name[8];
134 		unsigned int caf;
135 		char cpi[16];
136 		char reserved_1[3];
137 		unsigned char evmne;
138 		unsigned int reserved_2;
139 		uuid_t uuid;
140 	} vm[8];
141 	char reserved_3[1504];
142 	char ext_names[8][256];
143 };
144 
145 extern int topology_max_mnest;
146 
147 /*
148  * Returns the maximum nesting level supported by the cpu topology code.
149  * The current maximum level is 4 which is the drawer level.
150  */
151 static inline unsigned char topology_mnest_limit(void)
152 {
153 	return min(topology_max_mnest, 4);
154 }
155 
156 #define TOPOLOGY_NR_MAG		6
157 
158 struct topology_core {
159 	unsigned char nl;
160 	unsigned char reserved0[3];
161 	unsigned char :5;
162 	unsigned char d:1;
163 	unsigned char pp:2;
164 	unsigned char reserved1;
165 	unsigned short origin;
166 	unsigned long mask;
167 };
168 
169 struct topology_container {
170 	unsigned char nl;
171 	unsigned char reserved[6];
172 	unsigned char id;
173 };
174 
175 union topology_entry {
176 	unsigned char nl;
177 	struct topology_core cpu;
178 	struct topology_container container;
179 };
180 
181 struct sysinfo_15_1_x {
182 	unsigned char reserved0[2];
183 	unsigned short length;
184 	unsigned char mag[TOPOLOGY_NR_MAG];
185 	unsigned char reserved1;
186 	unsigned char mnest;
187 	unsigned char reserved2[4];
188 	union topology_entry tle[];
189 };
190 
191 int stsi(void *sysinfo, int fc, int sel1, int sel2);
192 
193 /*
194  * Service level reporting interface.
195  */
196 struct service_level {
197 	struct list_head list;
198 	void (*seq_print)(struct seq_file *, struct service_level *);
199 };
200 
201 int register_service_level(struct service_level *);
202 int unregister_service_level(struct service_level *);
203 
204 int sthyi_fill(void *dst, u64 *rc);
205 #endif /* __ASM_S390_SYSINFO_H */
206