KVM: Fix cpuid2 killing 32-bit guests on non-NX machines
KVM_SET_CPUID fails to remove NX when the host doesn't support it, as previous
versions do. On the other hand, KVM_SET_CPUID2 removes the feature even
though, since we tell userspace about it, it shouldn't be necessary.
Swap the two cases.
Signed-off-by: Avi Kivity <avi@qumranet.com>
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 49651ad..c70ac33 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -748,6 +748,7 @@
vcpu->cpuid_entries[i].padding[2] = 0;
}
vcpu->cpuid_nent = cpuid->nent;
+ cpuid_fix_nx_cap(vcpu);
r = 0;
out_free:
@@ -770,7 +771,6 @@
cpuid->nent * sizeof(struct kvm_cpuid_entry2)))
goto out;
vcpu->cpuid_nent = cpuid->nent;
- cpuid_fix_nx_cap(vcpu);
return 0;
out: