Commit 4b9f9525 authored by Michael Mueller's avatar Michael Mueller Committed by Christian Borntraeger

KVM: s390: introduce the format-1 GISA

The patch modifies the previously defined GISA data structure to be
able to store two GISA formats, format-0 and format-1. Additionally,
it verifies the availability of the GISA format facility and enables
the use of a format-1 GISA in the SIE control block accordingly.

A format-1 can do everything that format-0 can and we will need it
for real HW passthrough. As there are systems with only format-0
we keep both variants.
Signed-off-by: default avatarMichael Mueller <mimu@linux.vnet.ibm.com>
Reviewed-by: default avatarPierre Morel <pmorel@linux.vnet.ibm.com>
Reviewed-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Acked-by: default avatarCornelia Huck <cohuck@redhat.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent 9e73ea70
...@@ -228,6 +228,7 @@ struct kvm_s390_sie_block { ...@@ -228,6 +228,7 @@ struct kvm_s390_sie_block {
__u8 epdx; /* 0x0069 */ __u8 epdx; /* 0x0069 */
__u8 reserved6a[2]; /* 0x006a */ __u8 reserved6a[2]; /* 0x006a */
__u32 todpr; /* 0x006c */ __u32 todpr; /* 0x006c */
#define GISA_FORMAT1 0x00000001
__u32 gd; /* 0x0070 */ __u32 gd; /* 0x0070 */
__u8 reserved74[12]; /* 0x0074 */ __u8 reserved74[12]; /* 0x0074 */
__u64 mso; /* 0x0080 */ __u64 mso; /* 0x0080 */
...@@ -719,6 +720,14 @@ struct kvm_s390_crypto_cb { ...@@ -719,6 +720,14 @@ struct kvm_s390_crypto_cb {
}; };
struct kvm_s390_gisa { struct kvm_s390_gisa {
union {
struct { /* common to all formats */
u32 next_alert;
u8 ipm;
u8 reserved01[2];
u8 iam;
};
struct { /* format 0 */
u32 next_alert; u32 next_alert;
u8 ipm; u8 ipm;
u8 reserved01; u8 reserved01;
...@@ -728,6 +737,21 @@ struct kvm_s390_gisa { ...@@ -728,6 +737,21 @@ struct kvm_s390_gisa {
u8 iam; u8 iam;
u8 reserved02[4]; u8 reserved02[4];
u32 airq_count; u32 airq_count;
} g0;
struct { /* format 1 */
u32 next_alert;
u8 ipm;
u8 simm;
u8 nimm;
u8 iam;
u8 aism[8];
u8 : 6;
u8 g : 1;
u8 c : 1;
u8 reserved03[11];
u32 airq_count;
} g1;
};
}; };
/* /*
...@@ -738,7 +762,7 @@ struct sie_page2 { ...@@ -738,7 +762,7 @@ struct sie_page2 {
__u64 fac_list[S390_ARCH_FAC_LIST_SIZE_U64]; /* 0x0000 */ __u64 fac_list[S390_ARCH_FAC_LIST_SIZE_U64]; /* 0x0000 */
struct kvm_s390_crypto_cb crycb; /* 0x0800 */ struct kvm_s390_crypto_cb crycb; /* 0x0800 */
struct kvm_s390_gisa gisa; /* 0x0900 */ struct kvm_s390_gisa gisa; /* 0x0900 */
u8 reserved910[0x1000 - 0x910]; /* 0x0910 */ u8 reserved920[0x1000 - 0x920]; /* 0x0920 */
}; };
struct kvm_s390_vsie { struct kvm_s390_vsie {
......
...@@ -2842,9 +2842,7 @@ void kvm_s390_gisa_clear(struct kvm *kvm) ...@@ -2842,9 +2842,7 @@ void kvm_s390_gisa_clear(struct kvm *kvm)
void kvm_s390_gisa_init(struct kvm *kvm) void kvm_s390_gisa_init(struct kvm *kvm)
{ {
if (!css_general_characteristics.aiv) if (css_general_characteristics.aiv) {
kvm->arch.gisa = NULL;
else {
kvm->arch.gisa = &kvm->arch.sie_page2->gisa; kvm->arch.gisa = &kvm->arch.sie_page2->gisa;
VM_EVENT(kvm, 3, "gisa 0x%pK initialized", kvm->arch.gisa); VM_EVENT(kvm, 3, "gisa 0x%pK initialized", kvm->arch.gisa);
kvm_s390_gisa_clear(kvm); kvm_s390_gisa_clear(kvm);
......
...@@ -2531,6 +2531,8 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, ...@@ -2531,6 +2531,8 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
vcpu->arch.sie_block->icpua = id; vcpu->arch.sie_block->icpua = id;
spin_lock_init(&vcpu->arch.local_int.lock); spin_lock_init(&vcpu->arch.local_int.lock);
vcpu->arch.sie_block->gd = (u32)(u64)kvm->arch.gisa; vcpu->arch.sie_block->gd = (u32)(u64)kvm->arch.gisa;
if (vcpu->arch.sie_block->gd && sclp.has_gisaf)
vcpu->arch.sie_block->gd |= GISA_FORMAT1;
seqcount_init(&vcpu->arch.cputm_seqcount); seqcount_init(&vcpu->arch.cputm_seqcount);
rc = kvm_vcpu_init(vcpu, kvm, id); rc = kvm_vcpu_init(vcpu, kvm, id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment