KVM: s390: only reset CMMA state if it was enabled before
authorDominik Dingel <dingel@linux.vnet.ibm.com>
Thu, 18 Jun 2015 11:17:11 +0000 (13:17 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 29 Jul 2015 09:02:32 +0000 (11:02 +0200)
There is no point in resetting the CMMA state if it was never enabled.

Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/kvm-s390.c

index 641639b2fbd01a2e09ca6f7d00568d0c66accbff..3772947ac194bbf07149beabb5cc3241793d3b96 100644 (file)
@@ -344,6 +344,10 @@ static int kvm_s390_set_mem_control(struct kvm *kvm, struct kvm_device_attr *att
                mutex_unlock(&kvm->lock);
                break;
        case KVM_S390_VM_MEM_CLR_CMMA:
+               ret = -EINVAL;
+               if (!kvm->arch.use_cmma)
+                       break;
+
                mutex_lock(&kvm->lock);
                idx = srcu_read_lock(&kvm->srcu);
                s390_reset_cmma(kvm->arch.gmap->mm);