cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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