yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Blob Blame History Raw
From 0ed92ca843fec14757ea7b59f4c83ed52b91b815 Mon Sep 17 00:00:00 2001
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Date: Wed, 22 Mar 2017 11:26:40 +0100
Subject: x86: Work around SMI breakages

RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: <20170322112640.5933-1-dgilbert@redhat.com>
Patchwork-id: 74427
O-Subject: [RHEL-7.4 qemu-kvm-rhev PATCH v2] x86: Work around SMI breakages
Bugzilla: 1420679
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

This enables the fix added upstream in fc3a1fd7 on 7.3 machine types
and earlier.

The reported symptom was that a 7.2->7.4 migration failed with the
guest rebooting on the destination; 7.2->7.3 worked as did 7.3->7.4

7.2,7.3,7.4 all have different levels of support for SMI's:
   7.2 basically doesn't support it, but knows enough to set the
       CPU_INTERRUPT_SMI flag.

   7.3 thought it supported SMIs but fails to deliver SMI interrupts
       (see upstream 68c6efe07a) - but it does clear the
       CPU_INTERRUPT_SMI flag when it tries.

   7.4 apparently supports SMIs

On 7.2 something tries an SMI, but the interrupt never happens,
but it does leave the CPU_INTERRUPT_SMI flag set - this ends up
in the migration stream, but it's ignored by 7.2.

7.2->7.3 sees the CPU_INTERRUPT_SMI, clears the flag but fails
to actually enter the SMI code.  Everything seems to survive,
but perhaps this explains some of the bugs we hit until we
disabled the SMI in Seabios in 7.3

7.2->7.4 sees the CPU_INTERRUPT_SMI and actually takes the SMI,
landing in what I think is empty SMRAM space, eventually falling
off the end, triple faulting and rebooting - which is what we hit
here.

The (nasty) fix is to reinstate the 7.3 bug for machine types older
than 7.4; that should keep us compatible with 7.3 and get
lucky in the same way as we did with 7.2.

Note: We still have to be careful in the ROMs we provide with 7.4
because the ROM contents will get migrated whenever we do
7.4->7.3/7.2 migrates.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
(cherry picked from commit c094723a6ed544df512c4c3fd22d0eec71262886)
---
 include/hw/i386/pc.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index c88c46a..b69e53c 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -1042,6 +1042,11 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
             .driver   = TYPE_X86_CPU,\
             .property = "cpuid-0xb",\
             .value    = "off",\
+        },\
+        { /* PC_RHEL7_3_COMPAT */ \
+            .driver = TYPE_X86_CPU,\
+            .property = "kvm-no-smi-migration",\
+            .value    = "on",\
         },
 
 #define PC_RHEL7_2_COMPAT \
-- 
1.8.3.1