From 85fd66c2b926d5805f344d5ea1e0e9e11626c6f7 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Sun, 11 Apr 2010 12:37:54 +0300 Subject: [PATCH] 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 --- tools/kvm/cpuid.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/kvm/cpuid.c b/tools/kvm/cpuid.c index 0759ed75c267..92bac1d9d61a 100644 --- a/tools/kvm/cpuid.c +++ b/tools/kvm/cpuid.c @@ -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; -- 2.39.5