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

22c213
From 27d7b085f2f568050d638b694ed2f51495db718c Mon Sep 17 00:00:00 2001
22c213
From: Paolo Bonzini <pbonzini@redhat.com>
22c213
Date: Mon, 17 Feb 2020 16:23:15 +0000
22c213
Subject: [PATCH 5/9] target/i386: check for availability of MSR_IA32_UCODE_REV
22c213
 as an emulated MSR
22c213
MIME-Version: 1.0
22c213
Content-Type: text/plain; charset=UTF-8
22c213
Content-Transfer-Encoding: 8bit
22c213
22c213
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
22c213
Message-id: <20200217162316.2464-6-pbonzini@redhat.com>
22c213
Patchwork-id: 93898
22c213
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 5/6] target/i386: check for availability of MSR_IA32_UCODE_REV as an emulated MSR
22c213
Bugzilla: 1791648
22c213
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
22c213
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
22c213
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
22c213
Even though MSR_IA32_UCODE_REV has been available long before Linux 5.6,
22c213
which added it to the emulated MSR list, a bug caused the microcode
22c213
version to revert to 0x100000000 on INIT.  As a result, processors other
22c213
than the bootstrap processor would not see the host microcode revision;
22c213
some Windows version complain loudly about this and crash with a
22c213
fairly explicit MICROCODE REVISION MISMATCH error.
22c213
22c213
[If running 5.6 prereleases, the kernel fix "KVM: x86: do not reset
22c213
 microcode version on INIT or RESET" should also be applied.]
22c213
22c213
Reported-by: Alex Williamson <alex.williamson@redhat.com>
22c213
Message-id: <20200211175516.10716-1-pbonzini@redhat.com>
22c213
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
22c213
(cherry picked from commit 6702514814c7e7b4cbf179624539b5f38c72740b)
22c213
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
22c213
---
22c213
 target/i386/kvm.c | 7 +++++--
22c213
 1 file changed, 5 insertions(+), 2 deletions(-)
22c213
22c213
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
22c213
index 6c61aef..99840ca 100644
22c213
--- a/target/i386/kvm.c
22c213
+++ b/target/i386/kvm.c
22c213
@@ -105,6 +105,7 @@ static bool has_msr_smi_count;
22c213
 static bool has_msr_arch_capabs;
22c213
 static bool has_msr_core_capabs;
22c213
 static bool has_msr_vmx_vmfunc;
22c213
+static bool has_msr_ucode_rev;
22c213
 
22c213
 static uint32_t has_architectural_pmu_version;
22c213
 static uint32_t num_architectural_pmu_gp_counters;
22c213
@@ -2056,6 +2057,9 @@ static int kvm_get_supported_msrs(KVMState *s)
22c213
             case MSR_IA32_VMX_VMFUNC:
22c213
                 has_msr_vmx_vmfunc = true;
22c213
                 break;
22c213
+            case MSR_IA32_UCODE_REV:
22c213
+                has_msr_ucode_rev = true;
22c213
+                break;
22c213
             }
22c213
         }
22c213
     }
22c213
@@ -2696,8 +2700,7 @@ static void kvm_init_msrs(X86CPU *cpu)
22c213
                           env->features[FEAT_CORE_CAPABILITY]);
22c213
     }
22c213
 
22c213
-    if (kvm_arch_get_supported_msr_feature(kvm_state,
22c213
-                                           MSR_IA32_UCODE_REV)) {
22c213
+    if (has_msr_ucode_rev) {
22c213
         kvm_msr_entry_add(cpu, MSR_IA32_UCODE_REV, cpu->ucode_rev);
22c213
     }
22c213
 
22c213
-- 
22c213
1.8.3.1
22c213