From: Filippo Sironi <sironi@amazon.de>
To: pbonzini@redhat.com, rkrcmar@redhat.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Filippo Sironi <sironi@amazon.de>
Subject: [PATCH 1/2] KVM: x86: Store the microcode version in struct kvm_arch
Date: Sun, 26 Nov 2017 17:41:21 +0100 [thread overview]
Message-ID: <1511714482-3273-1-git-send-email-sironi@amazon.de> (raw)
... and read it from there when emulating accesses to
MSR_IA32_UCODE_REV. This is the first step to allow userspace to define
what's the microcode version that the guest should see.
Signed-off-by: Filippo Sironi <sironi@amazon.de>
---
arch/x86/include/asm/kvm_host.h | 2 ++
arch/x86/kvm/x86.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 1bfb99770c34..84b20139f4f1 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -776,6 +776,8 @@ struct kvm_arch {
struct mutex apic_map_lock;
struct kvm_apic_map *apic_map;
+ u32 microcode_version;
+
unsigned int tss_addr;
bool apic_access_page_done;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 34c85aa2e2d1..925c3e29cad3 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2447,7 +2447,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
msr_info->data = 0;
break;
case MSR_IA32_UCODE_REV:
- msr_info->data = 0x100000000ULL;
+ msr_info->data = (u64)vcpu->kvm->arch.microcode_version << 32;
break;
case MSR_MTRRcap:
case 0x200 ... 0x2ff:
@@ -8121,6 +8121,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
if (type)
return -EINVAL;
+ kvm->arch.microcode_version = 0x1;
+
INIT_HLIST_HEAD(&kvm->arch.mask_notifier_list);
INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages);
--
2.7.4
next reply other threads:[~2017-11-26 16:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-26 16:41 Filippo Sironi [this message]
2017-11-26 16:41 ` [PATCH 2/2] KVM: x86: Allow userspace to define what's the microcode version Filippo Sironi
2017-11-27 1:02 ` Wanpeng Li
2017-12-09 7:21 ` Sironi, Filippo
2017-11-27 10:40 ` Paolo Bonzini
2017-12-09 7:33 ` Sironi, Filippo
2017-11-27 11:58 ` Paolo Bonzini
2017-11-27 22:09 ` Steve Rutherford
2017-12-09 7:51 ` Sironi, Filippo
2017-12-09 7:42 ` Sironi, Filippo
2017-12-11 16:03 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1511714482-3273-1-git-send-email-sironi@amazon.de \
--to=sironi@amazon.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®