cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-i386-do-not-migrate-MSR_SMI_COUNT-on-machine-types-2.patch

ae23c9
From d625effaaebcc744531947209db5a4ec5aca0b0a Mon Sep 17 00:00:00 2001
ae23c9
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
ae23c9
Date: Fri, 14 Dec 2018 18:20:55 +0000
ae23c9
Subject: [PATCH 3/5] i386: do not migrate MSR_SMI_COUNT on machine types <2.12
ae23c9
ae23c9
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
ae23c9
Message-id: <20181214182056.20233-2-dgilbert@redhat.com>
ae23c9
Patchwork-id: 83520
ae23c9
O-Subject: [RHEL8 qemu-kvm PATCH 1/2] i386: do not migrate MSR_SMI_COUNT on machine types <2.12
ae23c9
Bugzilla: 1659565
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
ae23c9
ae23c9
From: Paolo Bonzini <pbonzini@redhat.com>
ae23c9
ae23c9
MSR_SMI_COUNT started being migrated in QEMU 2.12.  Do not migrate it
ae23c9
on older machine types, or the subsection causes a load failure for
ae23c9
guests that use SMM.
ae23c9
ae23c9
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ae23c9
(cherry picked from commit 990e0be2603511560168e1ad61f68294d951c39e)
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 include/hw/i386/pc.h  | 4 ++++
ae23c9
 target/i386/cpu.c     | 2 ++
ae23c9
 target/i386/cpu.h     | 1 +
ae23c9
 target/i386/machine.c | 2 +-
ae23c9
 4 files changed, 8 insertions(+), 1 deletion(-)
ae23c9
ae23c9
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
ae23c9
index c29176d..dd473ca 100644
ae23c9
--- a/include/hw/i386/pc.h
ae23c9
+++ b/include/hw/i386/pc.h
ae23c9
@@ -311,6 +311,10 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
ae23c9
 #define PC_COMPAT_2_11 \
ae23c9
     HW_COMPAT_2_11 \
ae23c9
     {\
ae23c9
+        .driver   = TYPE_X86_CPU,\
ae23c9
+        .property = "x-migrate-smi-count",\
ae23c9
+        .value    = "off",\
ae23c9
+    },{\
ae23c9
         .driver   = "Skylake-Server" "-" TYPE_X86_CPU,\
ae23c9
         .property = "clflushopt",\
ae23c9
         .value    = "off",\
ae23c9
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
ae23c9
index c37cd1e..c979feb 100644
ae23c9
--- a/target/i386/cpu.c
ae23c9
+++ b/target/i386/cpu.c
ae23c9
@@ -5398,6 +5398,8 @@ static Property x86_cpu_properties[] = {
ae23c9
                      false),
ae23c9
     DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU, vmware_cpuid_freq, true),
ae23c9
     DEFINE_PROP_BOOL("tcg-cpuid", X86CPU, expose_tcg, true),
ae23c9
+    DEFINE_PROP_BOOL("x-migrate-smi-count", X86CPU, migrate_smi_count,
ae23c9
+                     true),
ae23c9
     /*
ae23c9
      * lecacy_cache defaults to true unless the CPU model provides its
ae23c9
      * own cache information (see x86_cpu_load_def()).
ae23c9
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
ae23c9
index 58d5430..fb6caf4 100644
ae23c9
--- a/target/i386/cpu.h
ae23c9
+++ b/target/i386/cpu.h
ae23c9
@@ -1369,6 +1369,7 @@ struct X86CPU {
ae23c9
     bool expose_kvm;
ae23c9
     bool expose_tcg;
ae23c9
     bool migratable;
ae23c9
+    bool migrate_smi_count;
ae23c9
     bool max_features; /* Enable all supported features automatically */
ae23c9
     uint32_t apic_id;
ae23c9
 
ae23c9
diff --git a/target/i386/machine.c b/target/i386/machine.c
ae23c9
index 5e9a19b..2a85c91 100644
ae23c9
--- a/target/i386/machine.c
ae23c9
+++ b/target/i386/machine.c
ae23c9
@@ -400,7 +400,7 @@ static bool msr_smi_count_needed(void *opaque)
ae23c9
     X86CPU *cpu = opaque;
ae23c9
     CPUX86State *env = &cpu->env;
ae23c9
 
ae23c9
-    return env->msr_smi_count != 0;
ae23c9
+    return cpu->migrate_smi_count && env->msr_smi_count != 0;
ae23c9
 }
ae23c9
 
ae23c9
 static const VMStateDescription vmstate_msr_smi_count = {
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9