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