kvm: Set up MAXPHYADDR guest CPUID

As explained by Avi Kivity, we need to set up MAXPHYADDR for the guest to avoid
a triple fault when the guest tries to enter long mode. This fixes the
KVM_EXIT_SHUTDOWN problem I was seeing on my machine.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
Pekka Enberg
2015-06-01 16:39:39 +01:00
committed by Will Deacon
parent f01944c845
commit 342d95c20a
+11
View File
@@ -195,6 +195,17 @@ void kvm__setup_cpuid(struct kvm *self)
};
}
/*
* We need to set up MAXPHYADDR; otherwise switching to long mode in the
* guest will triple fault.
*/
if (highest_ext <= 0x80000008) {
kvm_cpuid->entries[ndx++] = (struct kvm_cpuid_entry2) {
.function = 0x80000008,
.eax = 0x00003028, /* 64-bit CPU */
};
}
assert(ndx < MAX_KVM_CPUID_ENTRIES);
kvm_cpuid->nent = ndx;