qemu-kvm/kvm-target-i386-kvm-initialize-microcode-revision-from-K.patch
Danilo C. L. de Paula 2084aa0246 * Sat Feb 29 2020 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.2.0-13.el8
- kvm-target-i386-kvm-initialize-feature-MSRs-very-early.patch [bz#1791648]
- kvm-target-i386-add-a-ucode-rev-property.patch [bz#1791648]
- kvm-target-i386-kvm-initialize-microcode-revision-from-K.patch [bz#1791648]
- kvm-target-i386-fix-TCG-UCODE_REV-access.patch [bz#1791648]
- kvm-target-i386-check-for-availability-of-MSR_IA32_UCODE.patch [bz#1791648]
- kvm-target-i386-enable-monitor-and-ucode-revision-with-c.patch [bz#1791648]
- kvm-qcow2-Fix-qcow2_alloc_cluster_abort-for-external-dat.patch [bz#1703907]
- kvm-mirror-Store-MirrorOp.co-for-debuggability.patch [bz#1794692]
- kvm-mirror-Don-t-let-an-operation-wait-for-itself.patch [bz#1794692]
- Resolves: bz#1703907
  ([upstream]QEMU coredump when converting to qcow2: external data file images on block devices with copy_offloading)
- Resolves: bz#1791648
  ([RFE] Passthrough host CPU microcode version to KVM guest if using CPU passthrough)
- Resolves: bz#1794692
  (Mirror block job stops making progress)
2020-02-29 03:50:42 +00:00

65 lines
2.4 KiB
Diff

From 8f39b0c9523630efeb451e2298cf64b88cd2ac81 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Mon, 17 Feb 2020 16:23:13 +0000
Subject: [PATCH 3/9] target/i386: kvm: initialize microcode revision from KVM
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <20200217162316.2464-4-pbonzini@redhat.com>
Patchwork-id: 93897
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 3/6] target/i386: kvm: initialize microcode revision from KVM
Bugzilla: 1791648
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
KVM can return the host microcode revision as a feature MSR.
Use it as the default value for -cpu host.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1579544504-3616-4-git-send-email-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 32c87d70ff55b96741f08c35108935cac6f40fe4)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
target/i386/cpu.c | 4 ++++
target/i386/kvm.c | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index e505d3e..5ac843d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6323,6 +6323,10 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
&cpu->mwait.ecx, &cpu->mwait.edx);
env->features[FEAT_1_ECX] |= CPUID_EXT_MONITOR;
}
+ if (kvm_enabled() && cpu->ucode_rev == 0) {
+ cpu->ucode_rev = kvm_arch_get_supported_msr_feature(kvm_state,
+ MSR_IA32_UCODE_REV);
+ }
}
if (cpu->ucode_rev == 0) {
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index f41605b..6c61aef 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -2696,6 +2696,11 @@ static void kvm_init_msrs(X86CPU *cpu)
env->features[FEAT_CORE_CAPABILITY]);
}
+ if (kvm_arch_get_supported_msr_feature(kvm_state,
+ MSR_IA32_UCODE_REV)) {
+ kvm_msr_entry_add(cpu, MSR_IA32_UCODE_REV, cpu->ucode_rev);
+ }
+
/*
* Older kernels do not include VMX MSRs in KVM_GET_MSR_INDEX_LIST, but
* all kernels with MSR features should have them.
--
1.8.3.1