diff options
author | Michael Mueller <mimu@linux.vnet.ibm.com> | 2017-06-23 07:51:25 -0400 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2018-01-26 08:13:58 -0500 |
commit | 4b9f952577fb40875a2a163d80515a8daa0d6bef (patch) | |
tree | b8716fde37d1f1bbe2ebe043ea9825bb5e74206d | |
parent | 9e73ea7056bd5f7e1b6e66e3d503478bb5160f07 (diff) |
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: Michael Mueller <mimu@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r-- | arch/s390/include/asm/kvm_host.h | 44 | ||||
-rw-r--r-- | arch/s390/kvm/interrupt.c | 4 | ||||
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 2 |
3 files changed, 37 insertions, 13 deletions
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h index 76d6f0ef3dbd..59dd46adf0e8 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h | |||
@@ -228,6 +228,7 @@ struct kvm_s390_sie_block { | |||
228 | __u8 epdx; /* 0x0069 */ | 228 | __u8 epdx; /* 0x0069 */ |
229 | __u8 reserved6a[2]; /* 0x006a */ | 229 | __u8 reserved6a[2]; /* 0x006a */ |
230 | __u32 todpr; /* 0x006c */ | 230 | __u32 todpr; /* 0x006c */ |
231 | #define GISA_FORMAT1 0x00000001 | ||
231 | __u32 gd; /* 0x0070 */ | 232 | __u32 gd; /* 0x0070 */ |
232 | __u8 reserved74[12]; /* 0x0074 */ | 233 | __u8 reserved74[12]; /* 0x0074 */ |
233 | __u64 mso; /* 0x0080 */ | 234 | __u64 mso; /* 0x0080 */ |
@@ -719,15 +720,38 @@ struct kvm_s390_crypto_cb { | |||
719 | }; | 720 | }; |
720 | 721 | ||
721 | struct kvm_s390_gisa { | 722 | struct kvm_s390_gisa { |
722 | u32 next_alert; | 723 | union { |
723 | u8 ipm; | 724 | struct { /* common to all formats */ |
724 | u8 reserved01; | 725 | u32 next_alert; |
725 | u8 : 6; | 726 | u8 ipm; |
726 | u8 g : 1; | 727 | u8 reserved01[2]; |
727 | u8 c : 1; | 728 | u8 iam; |
728 | u8 iam; | 729 | }; |
729 | u8 reserved02[4]; | 730 | struct { /* format 0 */ |
730 | u32 airq_count; | 731 | u32 next_alert; |
732 | u8 ipm; | ||
733 | u8 reserved01; | ||
734 | u8 : 6; | ||
735 | u8 g : 1; | ||
736 | u8 c : 1; | ||
737 | u8 iam; | ||
738 | u8 reserved02[4]; | ||
739 | u32 airq_count; | ||
740 | } g0; | ||
741 | struct { /* format 1 */ | ||
742 | u32 next_alert; | ||
743 | u8 ipm; | ||
744 | u8 simm; | ||
745 | u8 nimm; | ||
746 | u8 iam; | ||
747 | u8 aism[8]; | ||
748 | u8 : 6; | ||
749 | u8 g : 1; | ||
750 | u8 c : 1; | ||
751 | u8 reserved03[11]; | ||
752 | u32 airq_count; | ||
753 | } g1; | ||
754 | }; | ||
731 | }; | 755 | }; |
732 | 756 | ||
733 | /* | 757 | /* |
@@ -738,7 +762,7 @@ struct sie_page2 { | |||
738 | __u64 fac_list[S390_ARCH_FAC_LIST_SIZE_U64]; /* 0x0000 */ | 762 | __u64 fac_list[S390_ARCH_FAC_LIST_SIZE_U64]; /* 0x0000 */ |
739 | struct kvm_s390_crypto_cb crycb; /* 0x0800 */ | 763 | struct kvm_s390_crypto_cb crycb; /* 0x0800 */ |
740 | struct kvm_s390_gisa gisa; /* 0x0900 */ | 764 | struct kvm_s390_gisa gisa; /* 0x0900 */ |
741 | u8 reserved910[0x1000 - 0x910]; /* 0x0910 */ | 765 | u8 reserved920[0x1000 - 0x920]; /* 0x0920 */ |
742 | }; | 766 | }; |
743 | 767 | ||
744 | struct kvm_s390_vsie { | 768 | struct kvm_s390_vsie { |
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 488ecc7ea2a1..aabf46f5f883 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c | |||
@@ -2842,9 +2842,7 @@ void kvm_s390_gisa_clear(struct kvm *kvm) | |||
2842 | 2842 | ||
2843 | void kvm_s390_gisa_init(struct kvm *kvm) | 2843 | void kvm_s390_gisa_init(struct kvm *kvm) |
2844 | { | 2844 | { |
2845 | if (!css_general_characteristics.aiv) | 2845 | if (css_general_characteristics.aiv) { |
2846 | kvm->arch.gisa = NULL; | ||
2847 | else { | ||
2848 | kvm->arch.gisa = &kvm->arch.sie_page2->gisa; | 2846 | kvm->arch.gisa = &kvm->arch.sie_page2->gisa; |
2849 | VM_EVENT(kvm, 3, "gisa 0x%pK initialized", kvm->arch.gisa); | 2847 | VM_EVENT(kvm, 3, "gisa 0x%pK initialized", kvm->arch.gisa); |
2850 | kvm_s390_gisa_clear(kvm); | 2848 | kvm_s390_gisa_clear(kvm); |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 2c5e25b39435..f85a405e2595 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -2531,6 +2531,8 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, | |||
2531 | vcpu->arch.sie_block->icpua = id; | 2531 | vcpu->arch.sie_block->icpua = id; |
2532 | spin_lock_init(&vcpu->arch.local_int.lock); | 2532 | spin_lock_init(&vcpu->arch.local_int.lock); |
2533 | vcpu->arch.sie_block->gd = (u32)(u64)kvm->arch.gisa; | 2533 | vcpu->arch.sie_block->gd = (u32)(u64)kvm->arch.gisa; |
2534 | if (vcpu->arch.sie_block->gd && sclp.has_gisaf) | ||
2535 | vcpu->arch.sie_block->gd |= GISA_FORMAT1; | ||
2534 | seqcount_init(&vcpu->arch.cputm_seqcount); | 2536 | seqcount_init(&vcpu->arch.cputm_seqcount); |
2535 | 2537 | ||
2536 | rc = kvm_vcpu_init(vcpu, kvm, id); | 2538 | rc = kvm_vcpu_init(vcpu, kvm, id); |