yeahuh / rpms / qemu-kvm

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