Skip to content

Commit 8f79026

Browse files
committed
s390/kvm: Split kvm_host header file
JIRA: https://issues.redhat.com/browse/RHEL-113452 commit d104937 Author: Heiko Carstens <hca@linux.ibm.com> Date: Fri Mar 21 13:22:12 2025 +0100 s390/kvm: Split kvm_host header file In order to generate asm offsets into kvm_s390_sie_block linux/kvm_host.h is included in asm-offsets.c. This causes quite often header dependency problems, since linux/kvm_host.h pulls in a lot of other header files. Solve this problem and split out the hardware structure declarations into a separate header file. Include only the new header file into asm-offsets.c instead of linux/kvm_host.h. This is sufficient to generate the two asm offsets required for kvm (__SIE_PROG0C and __SIE_PROG20). Acked-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Conflicts: arch/s390/kernel/asm-offsets.c (contextual conflict, "#include gmap.h" is still required in downstream) Signed-off-by: Thomas Huth <thuth@redhat.com>
1 parent 0f76979 commit 8f79026

File tree

3 files changed

+350
-339
lines changed

3 files changed

+350
-339
lines changed

arch/s390/include/asm/kvm_host.h

Lines changed: 1 addition & 338 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@
2020
#include <linux/module.h>
2121
#include <linux/pci.h>
2222
#include <linux/mmu_notifier.h>
23+
#include <asm/kvm_host_types.h>
2324
#include <asm/debug.h>
2425
#include <asm/cpu.h>
2526
#include <asm/fpu.h>
2627
#include <asm/isc.h>
2728
#include <asm/guarded_storage.h>
2829

29-
#define KVM_S390_BSCA_CPU_SLOTS 64
30-
#define KVM_S390_ESCA_CPU_SLOTS 248
3130
#define KVM_MAX_VCPUS 255
3231

3332
/*
@@ -49,342 +48,6 @@
4948
#define KVM_REQ_REFRESH_GUEST_PREFIX \
5049
KVM_ARCH_REQ_FLAGS(6, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
5150

52-
#define SIGP_CTRL_C 0x80
53-
#define SIGP_CTRL_SCN_MASK 0x3f
54-
55-
union bsca_sigp_ctrl {
56-
__u8 value;
57-
struct {
58-
__u8 c : 1;
59-
__u8 r : 1;
60-
__u8 scn : 6;
61-
};
62-
};
63-
64-
union esca_sigp_ctrl {
65-
__u16 value;
66-
struct {
67-
__u8 c : 1;
68-
__u8 reserved: 7;
69-
__u8 scn;
70-
};
71-
};
72-
73-
struct esca_entry {
74-
union esca_sigp_ctrl sigp_ctrl;
75-
__u16 reserved1[3];
76-
__u64 sda;
77-
__u64 reserved2[6];
78-
};
79-
80-
struct bsca_entry {
81-
__u8 reserved0;
82-
union bsca_sigp_ctrl sigp_ctrl;
83-
__u16 reserved[3];
84-
__u64 sda;
85-
__u64 reserved2[2];
86-
};
87-
88-
union ipte_control {
89-
unsigned long val;
90-
struct {
91-
unsigned long k : 1;
92-
unsigned long kh : 31;
93-
unsigned long kg : 32;
94-
};
95-
};
96-
97-
/*
98-
* Utility is defined as two bytes but having it four bytes wide
99-
* generates more efficient code. Since the following bytes are
100-
* reserved this makes no functional difference.
101-
*/
102-
union sca_utility {
103-
__u32 val;
104-
struct {
105-
__u32 mtcr : 1;
106-
__u32 : 31;
107-
};
108-
};
109-
110-
struct bsca_block {
111-
union ipte_control ipte_control;
112-
__u64 reserved[5];
113-
__u64 mcn;
114-
union sca_utility utility;
115-
__u8 reserved2[4];
116-
struct bsca_entry cpu[KVM_S390_BSCA_CPU_SLOTS];
117-
};
118-
119-
struct esca_block {
120-
union ipte_control ipte_control;
121-
__u64 reserved1[6];
122-
union sca_utility utility;
123-
__u8 reserved2[4];
124-
__u64 mcn[4];
125-
__u64 reserved3[20];
126-
struct esca_entry cpu[KVM_S390_ESCA_CPU_SLOTS];
127-
};
128-
129-
/*
130-
* This struct is used to store some machine check info from lowcore
131-
* for machine checks that happen while the guest is running.
132-
* This info in host's lowcore might be overwritten by a second machine
133-
* check from host when host is in the machine check's high-level handling.
134-
* The size is 24 bytes.
135-
*/
136-
struct mcck_volatile_info {
137-
__u64 mcic;
138-
__u64 failing_storage_address;
139-
__u32 ext_damage_code;
140-
__u32 reserved;
141-
};
142-
143-
#define CR0_INITIAL_MASK (CR0_UNUSED_56 | CR0_INTERRUPT_KEY_SUBMASK | \
144-
CR0_MEASUREMENT_ALERT_SUBMASK)
145-
#define CR14_INITIAL_MASK (CR14_UNUSED_32 | CR14_UNUSED_33 | \
146-
CR14_EXTERNAL_DAMAGE_SUBMASK)
147-
148-
#define SIDAD_SIZE_MASK 0xff
149-
#define sida_addr(sie_block) phys_to_virt((sie_block)->sidad & PAGE_MASK)
150-
#define sida_size(sie_block) \
151-
((((sie_block)->sidad & SIDAD_SIZE_MASK) + 1) * PAGE_SIZE)
152-
153-
#define CPUSTAT_STOPPED 0x80000000
154-
#define CPUSTAT_WAIT 0x10000000
155-
#define CPUSTAT_ECALL_PEND 0x08000000
156-
#define CPUSTAT_STOP_INT 0x04000000
157-
#define CPUSTAT_IO_INT 0x02000000
158-
#define CPUSTAT_EXT_INT 0x01000000
159-
#define CPUSTAT_RUNNING 0x00800000
160-
#define CPUSTAT_RETAINED 0x00400000
161-
#define CPUSTAT_TIMING_SUB 0x00020000
162-
#define CPUSTAT_SIE_SUB 0x00010000
163-
#define CPUSTAT_RRF 0x00008000
164-
#define CPUSTAT_SLSV 0x00004000
165-
#define CPUSTAT_SLSR 0x00002000
166-
#define CPUSTAT_ZARCH 0x00000800
167-
#define CPUSTAT_MCDS 0x00000100
168-
#define CPUSTAT_KSS 0x00000200
169-
#define CPUSTAT_SM 0x00000080
170-
#define CPUSTAT_IBS 0x00000040
171-
#define CPUSTAT_GED2 0x00000010
172-
#define CPUSTAT_G 0x00000008
173-
#define CPUSTAT_GED 0x00000004
174-
#define CPUSTAT_J 0x00000002
175-
#define CPUSTAT_P 0x00000001
176-
177-
struct kvm_s390_sie_block {
178-
atomic_t cpuflags; /* 0x0000 */
179-
__u32 : 1; /* 0x0004 */
180-
__u32 prefix : 18;
181-
__u32 : 1;
182-
__u32 ibc : 12;
183-
__u8 reserved08[4]; /* 0x0008 */
184-
#define PROG_IN_SIE (1<<0)
185-
__u32 prog0c; /* 0x000c */
186-
union {
187-
__u8 reserved10[16]; /* 0x0010 */
188-
struct {
189-
__u64 pv_handle_cpu;
190-
__u64 pv_handle_config;
191-
};
192-
};
193-
#define PROG_BLOCK_SIE (1<<0)
194-
#define PROG_REQUEST (1<<1)
195-
atomic_t prog20; /* 0x0020 */
196-
__u8 reserved24[4]; /* 0x0024 */
197-
__u64 cputm; /* 0x0028 */
198-
__u64 ckc; /* 0x0030 */
199-
__u64 epoch; /* 0x0038 */
200-
__u32 svcc; /* 0x0040 */
201-
#define LCTL_CR0 0x8000
202-
#define LCTL_CR6 0x0200
203-
#define LCTL_CR9 0x0040
204-
#define LCTL_CR10 0x0020
205-
#define LCTL_CR11 0x0010
206-
#define LCTL_CR14 0x0002
207-
__u16 lctl; /* 0x0044 */
208-
__s16 icpua; /* 0x0046 */
209-
#define ICTL_OPEREXC 0x80000000
210-
#define ICTL_PINT 0x20000000
211-
#define ICTL_LPSW 0x00400000
212-
#define ICTL_STCTL 0x00040000
213-
#define ICTL_ISKE 0x00004000
214-
#define ICTL_SSKE 0x00002000
215-
#define ICTL_RRBE 0x00001000
216-
#define ICTL_TPROT 0x00000200
217-
__u32 ictl; /* 0x0048 */
218-
#define ECA_CEI 0x80000000
219-
#define ECA_IB 0x40000000
220-
#define ECA_SIGPI 0x10000000
221-
#define ECA_MVPGI 0x01000000
222-
#define ECA_AIV 0x00200000
223-
#define ECA_VX 0x00020000
224-
#define ECA_PROTEXCI 0x00002000
225-
#define ECA_APIE 0x00000008
226-
#define ECA_SII 0x00000001
227-
__u32 eca; /* 0x004c */
228-
#define ICPT_INST 0x04
229-
#define ICPT_PROGI 0x08
230-
#define ICPT_INSTPROGI 0x0C
231-
#define ICPT_EXTREQ 0x10
232-
#define ICPT_EXTINT 0x14
233-
#define ICPT_IOREQ 0x18
234-
#define ICPT_WAIT 0x1c
235-
#define ICPT_VALIDITY 0x20
236-
#define ICPT_STOP 0x28
237-
#define ICPT_OPEREXC 0x2C
238-
#define ICPT_PARTEXEC 0x38
239-
#define ICPT_IOINST 0x40
240-
#define ICPT_KSS 0x5c
241-
#define ICPT_MCHKREQ 0x60
242-
#define ICPT_INT_ENABLE 0x64
243-
#define ICPT_PV_INSTR 0x68
244-
#define ICPT_PV_NOTIFY 0x6c
245-
#define ICPT_PV_PREF 0x70
246-
__u8 icptcode; /* 0x0050 */
247-
__u8 icptstatus; /* 0x0051 */
248-
__u16 ihcpu; /* 0x0052 */
249-
__u8 reserved54; /* 0x0054 */
250-
#define IICTL_CODE_NONE 0x00
251-
#define IICTL_CODE_MCHK 0x01
252-
#define IICTL_CODE_EXT 0x02
253-
#define IICTL_CODE_IO 0x03
254-
#define IICTL_CODE_RESTART 0x04
255-
#define IICTL_CODE_SPECIFICATION 0x10
256-
#define IICTL_CODE_OPERAND 0x11
257-
__u8 iictl; /* 0x0055 */
258-
__u16 ipa; /* 0x0056 */
259-
__u32 ipb; /* 0x0058 */
260-
__u32 scaoh; /* 0x005c */
261-
#define FPF_BPBC 0x20
262-
__u8 fpf; /* 0x0060 */
263-
#define ECB_GS 0x40
264-
#define ECB_TE 0x10
265-
#define ECB_SPECI 0x08
266-
#define ECB_SRSI 0x04
267-
#define ECB_HOSTPROTINT 0x02
268-
#define ECB_PTF 0x01
269-
__u8 ecb; /* 0x0061 */
270-
#define ECB2_CMMA 0x80
271-
#define ECB2_IEP 0x20
272-
#define ECB2_PFMFI 0x08
273-
#define ECB2_ESCA 0x04
274-
#define ECB2_ZPCI_LSI 0x02
275-
__u8 ecb2; /* 0x0062 */
276-
#define ECB3_AISI 0x20
277-
#define ECB3_AISII 0x10
278-
#define ECB3_DEA 0x08
279-
#define ECB3_AES 0x04
280-
#define ECB3_RI 0x01
281-
__u8 ecb3; /* 0x0063 */
282-
#define ESCA_SCAOL_MASK ~0x3fU
283-
__u32 scaol; /* 0x0064 */
284-
__u8 sdf; /* 0x0068 */
285-
__u8 epdx; /* 0x0069 */
286-
__u8 cpnc; /* 0x006a */
287-
__u8 reserved6b; /* 0x006b */
288-
__u32 todpr; /* 0x006c */
289-
#define GISA_FORMAT1 0x00000001
290-
__u32 gd; /* 0x0070 */
291-
__u8 reserved74[12]; /* 0x0074 */
292-
__u64 mso; /* 0x0080 */
293-
__u64 msl; /* 0x0088 */
294-
psw_t gpsw; /* 0x0090 */
295-
__u64 gg14; /* 0x00a0 */
296-
__u64 gg15; /* 0x00a8 */
297-
__u8 reservedb0[8]; /* 0x00b0 */
298-
#define HPID_KVM 0x4
299-
#define HPID_VSIE 0x5
300-
__u8 hpid; /* 0x00b8 */
301-
__u8 reservedb9[7]; /* 0x00b9 */
302-
union {
303-
struct {
304-
__u32 eiparams; /* 0x00c0 */
305-
__u16 extcpuaddr; /* 0x00c4 */
306-
__u16 eic; /* 0x00c6 */
307-
};
308-
__u64 mcic; /* 0x00c0 */
309-
} __packed;
310-
__u32 reservedc8; /* 0x00c8 */
311-
union {
312-
struct {
313-
__u16 pgmilc; /* 0x00cc */
314-
__u16 iprcc; /* 0x00ce */
315-
};
316-
__u32 edc; /* 0x00cc */
317-
} __packed;
318-
union {
319-
struct {
320-
__u32 dxc; /* 0x00d0 */
321-
__u16 mcn; /* 0x00d4 */
322-
__u8 perc; /* 0x00d6 */
323-
__u8 peratmid; /* 0x00d7 */
324-
};
325-
__u64 faddr; /* 0x00d0 */
326-
} __packed;
327-
__u64 peraddr; /* 0x00d8 */
328-
__u8 eai; /* 0x00e0 */
329-
__u8 peraid; /* 0x00e1 */
330-
__u8 oai; /* 0x00e2 */
331-
__u8 armid; /* 0x00e3 */
332-
__u8 reservede4[4]; /* 0x00e4 */
333-
union {
334-
__u64 tecmc; /* 0x00e8 */
335-
struct {
336-
__u16 subchannel_id; /* 0x00e8 */
337-
__u16 subchannel_nr; /* 0x00ea */
338-
__u32 io_int_parm; /* 0x00ec */
339-
__u32 io_int_word; /* 0x00f0 */
340-
};
341-
} __packed;
342-
__u8 reservedf4[8]; /* 0x00f4 */
343-
#define CRYCB_FORMAT_MASK 0x00000003
344-
#define CRYCB_FORMAT0 0x00000000
345-
#define CRYCB_FORMAT1 0x00000001
346-
#define CRYCB_FORMAT2 0x00000003
347-
__u32 crycbd; /* 0x00fc */
348-
__u64 gcr[16]; /* 0x0100 */
349-
union {
350-
__u64 gbea; /* 0x0180 */
351-
__u64 sidad;
352-
};
353-
__u8 reserved188[8]; /* 0x0188 */
354-
__u64 sdnxo; /* 0x0190 */
355-
__u8 reserved198[8]; /* 0x0198 */
356-
__u32 fac; /* 0x01a0 */
357-
__u8 reserved1a4[20]; /* 0x01a4 */
358-
__u64 cbrlo; /* 0x01b8 */
359-
__u8 reserved1c0[8]; /* 0x01c0 */
360-
#define ECD_HOSTREGMGMT 0x20000000
361-
#define ECD_MEF 0x08000000
362-
#define ECD_ETOKENF 0x02000000
363-
#define ECD_ECC 0x00200000
364-
#define ECD_HMAC 0x00004000
365-
__u32 ecd; /* 0x01c8 */
366-
__u8 reserved1cc[18]; /* 0x01cc */
367-
__u64 pp; /* 0x01de */
368-
__u8 reserved1e6[2]; /* 0x01e6 */
369-
__u64 itdba; /* 0x01e8 */
370-
__u64 riccbd; /* 0x01f0 */
371-
__u64 gvrd; /* 0x01f8 */
372-
} __packed __aligned(512);
373-
374-
struct kvm_s390_itdb {
375-
__u8 data[256];
376-
};
377-
378-
struct sie_page {
379-
struct kvm_s390_sie_block sie_block;
380-
struct mcck_volatile_info mcck_info; /* 0x0200 */
381-
__u8 reserved218[360]; /* 0x0218 */
382-
__u64 pv_grregs[16]; /* 0x0380 */
383-
__u8 reserved400[512]; /* 0x0400 */
384-
struct kvm_s390_itdb itdb; /* 0x0600 */
385-
__u8 reserved700[2304]; /* 0x0700 */
386-
};
387-
38851
struct kvm_vcpu_stat {
38952
struct kvm_vcpu_stat_generic generic;
39053
u64 exit_userspace;

0 commit comments

Comments
 (0)