KVM: s390: fix ais handling vs cpu model
authorChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 31 May 2017 08:18:55 +0000 (10:18 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 31 May 2017 17:54:49 +0000 (19:54 +0200)
If ais is disabled via cpumodel, we must act accordingly, even if
KVM_CAP_S390_AIS was enabled.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Reviewed-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/interrupt.c
arch/s390/kvm/kvm-s390.c

index 426614a882a9b12a71c96f06607f30e6b345cd0d..65d07ac34647001ad45052a18d97e49e151c4b20 100644 (file)
@@ -541,7 +541,6 @@ struct kvm_s390_float_interrupt {
        struct mutex ais_lock;
        u8 simm;
        u8 nimm;
-       int ais_enabled;
 };
 
 struct kvm_hw_wp_info_arch {
index caf15c8a8948e76c1bf7cfb5d5a109df6cee9b3e..2d120fef7d90d915e33d7f19cb0ba39e9a6a264e 100644 (file)
@@ -2160,7 +2160,7 @@ static int modify_ais_mode(struct kvm *kvm, struct kvm_device_attr *attr)
        struct kvm_s390_ais_req req;
        int ret = 0;
 
-       if (!fi->ais_enabled)
+       if (!test_kvm_facility(kvm, 72))
                return -ENOTSUPP;
 
        if (copy_from_user(&req, (void __user *)attr->addr, sizeof(req)))
@@ -2204,7 +2204,7 @@ static int kvm_s390_inject_airq(struct kvm *kvm,
        };
        int ret = 0;
 
-       if (!fi->ais_enabled || !adapter->suppressible)
+       if (!test_kvm_facility(kvm, 72) || !adapter->suppressible)
                return kvm_s390_inject_vm(kvm, &s390int);
 
        mutex_lock(&fi->ais_lock);
index 689ac48361c697318ba6192962c7790d027a3199..f28e2e776931e7fdcddb2ad285ddf35b1e85500e 100644 (file)
@@ -558,7 +558,6 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
                } else {
                        set_kvm_facility(kvm->arch.model.fac_mask, 72);
                        set_kvm_facility(kvm->arch.model.fac_list, 72);
-                       kvm->arch.float_int.ais_enabled = 1;
                        r = 0;
                }
                mutex_unlock(&kvm->lock);
@@ -1533,7 +1532,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
        mutex_init(&kvm->arch.float_int.ais_lock);
        kvm->arch.float_int.simm = 0;
        kvm->arch.float_int.nimm = 0;
-       kvm->arch.float_int.ais_enabled = 0;
        spin_lock_init(&kvm->arch.float_int.lock);
        for (i = 0; i < FIRQ_LIST_COUNT; i++)
                INIT_LIST_HEAD(&kvm->arch.float_int.lists[i]);