thebeanogamer / rpms / qemu-kvm

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