xref: /kvm-unit-tests/lib/s390x/stsi.h (revision d1e2a8e2d0d5856f1a6ce23ea3f044a1532eab40)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Structures used to Store System Information
4  *
5  * Copyright IBM Corp. 2022
6  */
7 
8 #ifndef _S390X_STSI_H_
9 #define _S390X_STSI_H_
10 
11 struct sysinfo_3_2_2 {
12 	uint8_t reserved[31];
13 	uint8_t count;
14 	struct {
15 		uint8_t reserved2[4];
16 		uint16_t total_cpus;
17 		uint16_t conf_cpus;
18 		uint16_t standby_cpus;
19 		uint16_t reserved_cpus;
20 		uint8_t name[8];
21 		uint32_t caf;
22 		uint8_t cpi[16];
23 		uint8_t reserved5[3];
24 		uint8_t ext_name_encoding;
25 		uint32_t reserved3;
26 		uint8_t uuid[16];
27 	} vm[8];
28 	uint8_t reserved4[1504];
29 	uint8_t ext_names[8][256];
30 };
31 
32 #define CPUS_TLE_RES_BITS 0x00fffffff8000000UL
33 union topology_cpu {
34 	uint64_t raw[2];
35 	struct {
36 		uint8_t nl;
37 		uint8_t reserved1[3];
38 		uint8_t reserved4:5;
39 		uint8_t d:1;
40 		uint8_t pp:2;
41 		uint8_t type;
42 		uint16_t origin;
43 		uint64_t mask;
44 	};
45 };
46 
47 enum topology_polarization {
48 	POLARIZATION_HORIZONTAL = 0,
49 	POLARIZATION_VERTICAL_LOW = 1,
50 	POLARIZATION_VERTICAL_MEDIUM = 2,
51 	POLARIZATION_VERTICAL_HIGH = 3,
52 };
53 
54 enum cpu_type {
55 	CPU_TYPE_IFL = 3,
56 };
57 
58 #define CONTAINER_TLE_RES_BITS 0x00ffffffffffff00UL
59 union topology_container {
60 	uint64_t raw;
61 	struct {
62 		uint8_t nl;
63 		uint8_t reserved[6];
64 		uint8_t id;
65 	};
66 };
67 
68 union topology_entry {
69 	uint8_t nl;
70 	union topology_cpu cpu;
71 	union topology_container container;
72 };
73 
74 #define CPU_TOPOLOGY_MAX_LEVEL 6
75 struct sysinfo_15_1_x {
76 	uint8_t reserved0[2];
77 	uint16_t length;
78 	uint8_t mag[CPU_TOPOLOGY_MAX_LEVEL];
79 	uint8_t reserved0a;
80 	uint8_t mnest;
81 	uint8_t reserved0c[4];
82 	union topology_entry tle[];
83 };
84 
85 #endif  /* _S390X_STSI_H_ */
86