|
|
22c213 |
From 8f39b0c9523630efeb451e2298cf64b88cd2ac81 Mon Sep 17 00:00:00 2001
|
|
|
22c213 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
22c213 |
Date: Mon, 17 Feb 2020 16:23:13 +0000
|
|
|
22c213 |
Subject: [PATCH 3/9] target/i386: kvm: initialize microcode revision from KVM
|
|
|
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-4-pbonzini@redhat.com>
|
|
|
22c213 |
Patchwork-id: 93897
|
|
|
22c213 |
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 3/6] target/i386: kvm: initialize microcode revision from KVM
|
|
|
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 |
KVM can return the host microcode revision as a feature MSR.
|
|
|
22c213 |
Use it as the default value for -cpu host.
|
|
|
22c213 |
|
|
|
22c213 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
22c213 |
Message-Id: <1579544504-3616-4-git-send-email-pbonzini@redhat.com>
|
|
|
22c213 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
22c213 |
(cherry picked from commit 32c87d70ff55b96741f08c35108935cac6f40fe4)
|
|
|
22c213 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
22c213 |
---
|
|
|
22c213 |
target/i386/cpu.c | 4 ++++
|
|
|
22c213 |
target/i386/kvm.c | 5 +++++
|
|
|
22c213 |
2 files changed, 9 insertions(+)
|
|
|
22c213 |
|
|
|
22c213 |
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
|
|
22c213 |
index e505d3e..5ac843d 100644
|
|
|
22c213 |
--- a/target/i386/cpu.c
|
|
|
22c213 |
+++ b/target/i386/cpu.c
|
|
|
22c213 |
@@ -6323,6 +6323,10 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
|
|
|
22c213 |
&cpu->mwait.ecx, &cpu->mwait.edx);
|
|
|
22c213 |
env->features[FEAT_1_ECX] |= CPUID_EXT_MONITOR;
|
|
|
22c213 |
}
|
|
|
22c213 |
+ if (kvm_enabled() && cpu->ucode_rev == 0) {
|
|
|
22c213 |
+ cpu->ucode_rev = kvm_arch_get_supported_msr_feature(kvm_state,
|
|
|
22c213 |
+ MSR_IA32_UCODE_REV);
|
|
|
22c213 |
+ }
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
if (cpu->ucode_rev == 0) {
|
|
|
22c213 |
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
|
|
|
22c213 |
index f41605b..6c61aef 100644
|
|
|
22c213 |
--- a/target/i386/kvm.c
|
|
|
22c213 |
+++ b/target/i386/kvm.c
|
|
|
22c213 |
@@ -2696,6 +2696,11 @@ 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 |
+ kvm_msr_entry_add(cpu, MSR_IA32_UCODE_REV, cpu->ucode_rev);
|
|
|
22c213 |
+ }
|
|
|
22c213 |
+
|
|
|
22c213 |
/*
|
|
|
22c213 |
* Older kernels do not include VMX MSRs in KVM_GET_MSR_INDEX_LIST, but
|
|
|
22c213 |
* all kernels with MSR features should have them.
|
|
|
22c213 |
--
|
|
|
22c213 |
1.8.3.1
|
|
|
22c213 |
|