yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
b38b0f
From 1e8e3c4fe380a2a0ed88f7a92f5bcb8600ab1258 Mon Sep 17 00:00:00 2001
b38b0f
From: Paolo Bonzini <pbonzini@redhat.com>
b38b0f
Date: Mon, 22 Jul 2019 18:22:03 +0100
b38b0f
Subject: [PATCH 22/39] i386: Save EFER for 32-bit targets
b38b0f
b38b0f
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
b38b0f
Message-id: <20190722182220.19374-2-pbonzini@redhat.com>
b38b0f
Patchwork-id: 89619
b38b0f
O-Subject: [RHEL-8.1.0 PATCH qemu-kvm v3 01/18] i386: Save EFER for 32-bit targets
b38b0f
Bugzilla: 1689269
b38b0f
RH-Acked-by: Peter Xu <zhexu@redhat.com>
b38b0f
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
b38b0f
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
b38b0f
b38b0f
From: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
b38b0f
b38b0f
i386 (32 bit) emulation uses EFER in wrmsr and in MMU fault
b38b0f
processing.
b38b0f
But it does not included in VMState, because "efer" field is disabled with
b38b0f
b38b0f
This patch adds a section for 32-bit targets which saves EFER when
b38b0f
it's value is non-zero.
b38b0f
b38b0f
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
b38b0f
Message-Id: <155913371654.8429.1659082639780315242.stgit@pasha-Precision-3630-Tower>
b38b0f
Reviewed-by: Peter Xu <peterx@redhat.com>
b38b0f
[ehabkost: indentation fix]
b38b0f
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
b38b0f
(cherry picked from commit 89a44a103315267122119b4311218d00d2561ebe)
b38b0f
b38b0f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
b38b0f
---
b38b0f
 target/i386/machine.c | 24 ++++++++++++++++++++++++
b38b0f
 1 file changed, 24 insertions(+)
b38b0f
b38b0f
diff --git a/target/i386/machine.c b/target/i386/machine.c
b38b0f
index 2a85c91..561d4a5 100644
b38b0f
--- a/target/i386/machine.c
b38b0f
+++ b/target/i386/machine.c
b38b0f
@@ -932,6 +932,27 @@ static const VMStateDescription vmstate_msr_virt_ssbd = {
b38b0f
     }
b38b0f
 };
b38b0f
 
b38b0f
+#ifndef TARGET_X86_64
b38b0f
+static bool intel_efer32_needed(void *opaque)
b38b0f
+{
b38b0f
+    X86CPU *cpu = opaque;
b38b0f
+    CPUX86State *env = &cpu->env;
b38b0f
+
b38b0f
+    return env->efer != 0;
b38b0f
+}
b38b0f
+
b38b0f
+static const VMStateDescription vmstate_efer32 = {
b38b0f
+    .name = "cpu/efer32",
b38b0f
+    .version_id = 1,
b38b0f
+    .minimum_version_id = 1,
b38b0f
+    .needed = intel_efer32_needed,
b38b0f
+    .fields = (VMStateField[]) {
b38b0f
+        VMSTATE_UINT64(env.efer, X86CPU),
b38b0f
+        VMSTATE_END_OF_LIST()
b38b0f
+    }
b38b0f
+};
b38b0f
+#endif
b38b0f
+
b38b0f
 VMStateDescription vmstate_x86_cpu = {
b38b0f
     .name = "cpu",
b38b0f
     .version_id = 12,
b38b0f
@@ -1056,6 +1077,9 @@ VMStateDescription vmstate_x86_cpu = {
b38b0f
         &vmstate_msr_intel_pt,
b38b0f
         &vmstate_xsave,
b38b0f
         &vmstate_msr_virt_ssbd,
b38b0f
+#ifndef TARGET_X86_64
b38b0f
+        &vmstate_efer32,
b38b0f
+#endif
b38b0f
         NULL
b38b0f
     }
b38b0f
 };
b38b0f
-- 
b38b0f
1.8.3.1
b38b0f