KVM: s390: Generalize access to IPTE controls
authorEugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Tue, 21 Apr 2015 12:44:54 +0000 (14:44 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 30 Nov 2015 11:47:06 +0000 (12:47 +0100)
This patch generalizes access to the IPTE controls, which is a part of SCA.
This is to prepare for upcoming introduction of Extended SCA support.

Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/gaccess.c
arch/s390/kvm/kvm-s390.h

index a7559f7207df3a0ac62d0fc16b199f3b4c6b6dac..06f7edb3770db22b6cc0b80302b980555309a9bd 100644 (file)
@@ -259,7 +259,7 @@ struct aste {
 
 int ipte_lock_held(struct kvm_vcpu *vcpu)
 {
-       union ipte_control *ic = &vcpu->kvm->arch.sca->ipte_control;
+       union ipte_control *ic = kvm_s390_get_ipte_control(vcpu->kvm);
 
        if (vcpu->arch.sie_block->eca & 1)
                return ic->kh != 0;
@@ -274,7 +274,7 @@ static void ipte_lock_simple(struct kvm_vcpu *vcpu)
        vcpu->kvm->arch.ipte_lock_count++;
        if (vcpu->kvm->arch.ipte_lock_count > 1)
                goto out;
-       ic = &vcpu->kvm->arch.sca->ipte_control;
+       ic = kvm_s390_get_ipte_control(vcpu->kvm);
        do {
                old = READ_ONCE(*ic);
                while (old.k) {
@@ -296,7 +296,7 @@ static void ipte_unlock_simple(struct kvm_vcpu *vcpu)
        vcpu->kvm->arch.ipte_lock_count--;
        if (vcpu->kvm->arch.ipte_lock_count)
                goto out;
-       ic = &vcpu->kvm->arch.sca->ipte_control;
+       ic = kvm_s390_get_ipte_control(vcpu->kvm);
        do {
                old = READ_ONCE(*ic);
                new = old;
@@ -311,7 +311,7 @@ static void ipte_lock_siif(struct kvm_vcpu *vcpu)
 {
        union ipte_control old, new, *ic;
 
-       ic = &vcpu->kvm->arch.sca->ipte_control;
+       ic = kvm_s390_get_ipte_control(vcpu->kvm);
        do {
                old = READ_ONCE(*ic);
                while (old.kg) {
@@ -328,7 +328,7 @@ static void ipte_unlock_siif(struct kvm_vcpu *vcpu)
 {
        union ipte_control old, new, *ic;
 
-       ic = &vcpu->kvm->arch.sca->ipte_control;
+       ic = kvm_s390_get_ipte_control(vcpu->kvm);
        do {
                old = READ_ONCE(*ic);
                new = old;
index 1e70e00d3c5ecd4b97df9faa2d7d8b98fabecb58..844f711972f9ac19ed446db32b78a8b42717a040 100644 (file)
@@ -340,4 +340,9 @@ void kvm_s390_clear_bp_data(struct kvm_vcpu *vcpu);
 void kvm_s390_prepare_debug_exit(struct kvm_vcpu *vcpu);
 void kvm_s390_handle_per_event(struct kvm_vcpu *vcpu);
 
+/* support for Basic/Extended SCA handling */
+static inline union ipte_control *kvm_s390_get_ipte_control(struct kvm *kvm)
+{
+       return &kvm->arch.sca->ipte_control;
+}
 #endif