]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm: Set up MAXPHYADDR guest CPUID
authorPekka Enberg <penberg@cs.helsinki.fi>
Sun, 11 Apr 2010 09:37:54 +0000 (12:37 +0300)
committerPekka Enberg <penberg@cs.helsinki.fi>
Sun, 11 Apr 2010 09:37:54 +0000 (12:37 +0300)
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>
tools/kvm/cpuid.c

index 0759ed75c26739750e945d87729928591d1711f5..92bac1d9d61a1adebd47f73e3b7c87496b09e033 100644 (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;