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