9ae3a8
From 4c20b901edfb53e4545aab8fcefb6f40fca25964 Mon Sep 17 00:00:00 2001
9ae3a8
From: Andrea Arcangeli <aarcange@redhat.com>
9ae3a8
Date: Wed, 12 Feb 2014 13:30:18 +0100
9ae3a8
Subject: [PATCH 2/3] fix guest physical bits to match host, to go beyond 1TB guests
9ae3a8
9ae3a8
RH-Author: Andrea Arcangeli <aarcange@redhat.com>
9ae3a8
Message-id: <1392211818-14964-2-git-send-email-aarcange@redhat.com>
9ae3a8
Patchwork-id: 57245
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH] fix guest physical bits to match host, to go beyond 1TB guests
9ae3a8
Bugzilla: 989677
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Andrew Jones <drjones@redhat.com>
9ae3a8
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
9ae3a8
9ae3a8
Without this patch the guest physical bits are advertised as 40, not
9ae3a8
44 or more depending on the hardware capability of the host.
9ae3a8
9ae3a8
That leads to guest kernel crashes with injection of page faults 9
9ae3a8
(see oops: 0009) as bits above 40 in the guest pagetables are
9ae3a8
considered reserved.
9ae3a8
9ae3a8
exregion-0206 [324572448] [17] ex_system_memory_space: System-Memory (width 32) R/W 0 Address=00000000FED00000
9ae3a8
BUG: unable to handle kernel paging request at ffffc9006030e000
9ae3a8
IP: [<ffffffff812fbb6f>] acpi_ex_system_memory_space_handler+0x23e/0x2cb
9ae3a8
PGD e01f875067 PUD 1001f075067 PMD e0178d8067 PTE 80000000fed00173
9ae3a8
Oops: 0009 [#1] SMP
9ae3a8
9ae3a8
(see PUD with bit >=40 set)
9ae3a8
9ae3a8
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
9ae3a8
Reported-by: Chegu Vinod <chegu_vinod@hp.com>
9ae3a8
---
9ae3a8
 target-i386/cpu.c | 7 ++++++-
9ae3a8
 1 file changed, 6 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 target-i386/cpu.c |    7 ++++++-
9ae3a8
 1 files changed, 6 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
9ae3a8
index 2959915..31ff568 100644
9ae3a8
--- a/target-i386/cpu.c
9ae3a8
+++ b/target-i386/cpu.c
9ae3a8
@@ -2174,8 +2174,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
9ae3a8
 /* XXX: This value must match the one used in the MMU code. */
9ae3a8
         if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) {
9ae3a8
             /* 64 bit processor */
9ae3a8
-/* XXX: The physical address space is limited to 42 bits in exec.c. */
9ae3a8
             *eax = 0x00003028; /* 48 bits virtual, 40 bits physical */
9ae3a8
+            if (kvm_enabled()) {
9ae3a8
+                uint32_t _eax;
9ae3a8
+                host_cpuid(0x80000000, 0, &_eax, NULL, NULL, NULL);
9ae3a8
+                if (_eax >= 0x80000008)
9ae3a8
+                    host_cpuid(0x80000008, 0, eax, NULL, NULL, NULL);
9ae3a8
+            }
9ae3a8
         } else {
9ae3a8
             if (env->features[FEAT_1_EDX] & CPUID_PSE36) {
9ae3a8
                 *eax = 0x00000024; /* 36 bits physical */
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8