[PATCH v2 04/20] KVM: s390: vsie: Add ssca_block and ssca_entry structs
Christoph Schlameuss <[email protected]>
| Newsgroups | org.kernel.vger.linux-s390,org.kernel.vger.kvm |
|---|---|
| Message-ID | <[email protected]> |
Add the required guest-1 structures for the ssca to the SIE control block for use in later patches. The shadow SCA features the address of the original SCA as well as an entry for each original SIGP entry. The entries contain the addresses of the shadow state description and original SIGP entry. Reviewed-by: Janosch Frank <[email protected]> Signed-off-by: Christoph Schlameuss <[email protected]> --- arch/s390/include/asm/kvm_host_types.h | 25 ++++++++++++++++++++++++- tools/testing/selftests/kvm/include/s390/sie.h | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/arch/s390/include/asm/kvm_host_types.h b/arch/s390/include/asm/kvm_host_types.h index ac82dd09fce5..8326ba1d2ead 100644 --- a/arch/s390/include/asm/kvm_host_types.h +++ b/arch/s390/include/asm/kvm_host_types.h @@ -6,6 +6,8 @@ #include <linux/atomic.h> #include <linux/types.h> +#define KVM_S390_MAX_VSIE_VCPUS 256 + #define KVM_S390_BSCA_CPU_SLOTS 64 #define KVM_S390_ESCA_CPU_SLOTS 248 @@ -47,6 +49,13 @@ struct bsca_entry { __u64 reserved2[2]; }; +struct ssca_entry { + __u64 reserved1; + __u64 ssda; + __u64 ossea; + __u64 reserved2; +}; + union ipte_control { unsigned long val; struct { @@ -88,6 +97,20 @@ struct esca_block { struct esca_entry cpu[KVM_S390_ESCA_CPU_SLOTS]; }; +/* + * The shadow sca / ssca needs to cover both bsca and esca depending on what the + * guest uses so we allocate space for 256 entries that are defined in the + * architecture. + * The header part of the struct must not cross page boundaries. + */ +struct ssca_block { + __u64 osca; + __u64 reserved08[7]; + struct ssca_entry cpu[KVM_S390_MAX_VSIE_VCPUS]; +}; + +static_assert(offsetof(struct ssca_block, cpu) == 64); + /* * This struct is used to store some machine check info from lowcore * for machine checks that happen while the guest is running. @@ -317,7 +340,7 @@ struct kvm_s390_sie_block { __u32 fac; /* 0x01a0 */ __u8 reserved1a4[20]; /* 0x01a4 */ __u64 cbrlo; /* 0x01b8 */ - __u8 reserved1c0[8]; /* 0x01c0 */ + __u64 osda; /* 0x01c0 */ #define ECD_HOSTREGMGMT 0x20000000 #define ECD_MEF 0x08000000 #define ECD_ETOKENF 0x02000000 diff --git a/tools/testing/selftests/kvm/include/s390/sie.h b/tools/testing/selftests/kvm/include/s390/sie.h index 160acd4a1db9..4ff1c1a354af 100644 --- a/tools/testing/selftests/kvm/include/s390/sie.h +++ b/tools/testing/selftests/kvm/include/s390/sie.h @@ -223,7 +223,7 @@ struct kvm_s390_sie_block { __u32 fac; /* 0x01a0 */ __u8 reserved1a4[20]; /* 0x01a4 */ __u64 cbrlo; /* 0x01b8 */ - __u8 reserved1c0[8]; /* 0x01c0 */ + __u64 osda; /* 0x01c0 */ #define ECD_HOSTREGMGMT 0x20000000 #define ECD_MEF 0x08000000 #define ECD_ETOKENF 0x02000000 -- 2.55.0