yeahuh / rpms / qemu-kvm

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