9ae3a8
From ba222e201e070d95e282762e890cf8e86251e84c Mon Sep 17 00:00:00 2001
9ae3a8
From: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Date: Wed, 21 Aug 2019 22:28:26 +0200
9ae3a8
Subject: [PATCH 3/3] i386: Don't copy host virtual address limit
9ae3a8
9ae3a8
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Message-id: <20190821222826.11853-1-ehabkost@redhat.com>
9ae3a8
Patchwork-id: 90110
9ae3a8
O-Subject: [RHEL-7.8 qemu-kvm PATCH] i386: Don't copy host virtual address limit
9ae3a8
Bugzilla: 1706658
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9ae3a8
RH-Acked-by: Bandan Das <bsd@redhat.com>
9ae3a8
9ae3a8
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1706658
9ae3a8
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23157241
9ae3a8
Upstream: not applicable
9ae3a8
9ae3a8
The KVM code in RHEL-7 supports only 48-bit virtual addresses.
9ae3a8
Copying the host virtual address size to the guest is pointless
9ae3a8
and only makes the VM crash if the host virtual address size is
9ae3a8
not 48 bits.
9ae3a8
9ae3a8
Change the downstream-only code that copies host CPUID to just
9ae3a8
copy the physical address limit, and keep the hardcoded virtual
9ae3a8
address size.
9ae3a8
9ae3a8
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 target-i386/cpu.c | 8 +++++++-
9ae3a8
 1 file changed, 7 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
9ae3a8
index c74f597..ca43268 100644
9ae3a8
--- a/target-i386/cpu.c
9ae3a8
+++ b/target-i386/cpu.c
9ae3a8
@@ -2841,7 +2841,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
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
+                    host_cpuid(0x80000008, 0, &_eax, NULL, NULL, NULL);
9ae3a8
+                    /*
9ae3a8
+                     * Override physical size only, as RHEL-7 KVM only supports
9ae3a8
+                     * 48 bits virtual.
9ae3a8
+                     */
9ae3a8
+                    *eax &= ~0xff;
9ae3a8
+                    *eax |= _eax & 0xff;
9ae3a8
             }
9ae3a8
         } else {
9ae3a8
             if (env->features[FEAT_1_EDX] & CPUID_PSE36) {
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8