Blame SOURCES/kvm-target-i386-check-for-availability-of-MSR_IA32_UCODE.patch

4636b8
From 2b1ca7468155b2bda5d81be114335e264767cc7a Mon Sep 17 00:00:00 2001
4636b8
From: Paolo Bonzini <pbonzini@redhat.com>
4636b8
Date: Mon, 17 Feb 2020 16:23:22 -0500
4636b8
Subject: [PATCH 07/12] target/i386: check for availability of
4636b8
 MSR_IA32_UCODE_REV as an emulated MSR
4636b8
MIME-Version: 1.0
4636b8
Content-Type: text/plain; charset=UTF-8
4636b8
Content-Transfer-Encoding: 8bit
4636b8
4636b8
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
4636b8
Message-id: <20200217162323.2572-6-pbonzini@redhat.com>
4636b8
Patchwork-id: 93908
4636b8
O-Subject: [RHEL7.9 qemu-kvm-rhev PATCH 5/6] target/i386: check for availability of MSR_IA32_UCODE_REV as an emulated MSR
4636b8
Bugzilla: 1791653
4636b8
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
4636b8
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4636b8
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4636b8
4636b8
Even though MSR_IA32_UCODE_REV has been available long before Linux 5.6,
4636b8
which added it to the emulated MSR list, a bug caused the microcode
4636b8
version to revert to 0x100000000 on INIT.  As a result, processors other
4636b8
than the bootstrap processor would not see the host microcode revision;
4636b8
some Windows version complain loudly about this and crash with a
4636b8
fairly explicit MICROCODE REVISION MISMATCH error.
4636b8
4636b8
[If running 5.6 prereleases, the kernel fix "KVM: x86: do not reset
4636b8
 microcode version on INIT or RESET" should also be applied.]
4636b8
4636b8
Reported-by: Alex Williamson <alex.williamson@redhat.com>
4636b8
Message-id: <20200211175516.10716-1-pbonzini@redhat.com>
4636b8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4636b8
(cherry picked from commit 6702514814c7e7b4cbf179624539b5f38c72740b)
4636b8
Signed-off-by: Jon Maloy <jmaloy.redhat.com>
4636b8
---
4636b8
 target/i386/kvm.c | 7 +++++--
4636b8
 1 file changed, 5 insertions(+), 2 deletions(-)
4636b8
4636b8
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
4636b8
index 4d43fba716..22da78aee9 100644
4636b8
--- a/target/i386/kvm.c
4636b8
+++ b/target/i386/kvm.c
4636b8
@@ -98,6 +98,7 @@ static bool has_msr_tsx_ctrl;
4636b8
 static bool has_msr_virt_ssbd;
4636b8
 static bool has_msr_smi_count;
4636b8
 static bool has_msr_arch_capabs;
4636b8
+static bool has_msr_ucode_rev;
4636b8
 
4636b8
 static uint32_t has_architectural_pmu_version;
4636b8
 static uint32_t num_architectural_pmu_gp_counters;
4636b8
@@ -1354,6 +1355,9 @@ static int kvm_get_supported_msrs(KVMState *s)
4636b8
                 case MSR_IA32_ARCH_CAPABILITIES:
4636b8
                     has_msr_arch_capabs = true;
4636b8
                     break;
4636b8
+                case MSR_IA32_UCODE_REV:
4636b8
+                    has_msr_ucode_rev = true;
4636b8
+                    break;
4636b8
                 }
4636b8
             }
4636b8
         }
4636b8
@@ -1828,8 +1832,7 @@ static void kvm_init_msrs(X86CPU *cpu)
4636b8
                           env->features[FEAT_ARCH_CAPABILITIES]);
4636b8
     }
4636b8
 
4636b8
-    if (kvm_arch_get_supported_msr_feature(kvm_state,
4636b8
-                                           MSR_IA32_UCODE_REV)) {
4636b8
+    if (has_msr_ucode_rev) {
4636b8
         kvm_msr_entry_add(cpu, MSR_IA32_UCODE_REV, cpu->ucode_rev);
4636b8
     }
4636b8
 
4636b8
-- 
4636b8
2.18.2
4636b8