From: Eduardo Habkost <ehabkost@redhat.com> To: qemu-devel@nongnu.org Cc: Eduardo Habkost <ehabkost@redhat.com>, kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>, Maxime Coquelin <maxime.coquelin@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <rth@twiddle.net> Subject: [PATCH] i386: Disable MSR_PLATFORM_INFO emulation Date: Fri, 25 Jan 2019 17:01:34 -0200 [thread overview] Message-ID: <20190125190134.25492-1-ehabkost@redhat.com> (raw) Linux v4.12 introduced[1] emulation of MSR_PLATFORM_INFO and MSR_MISC_FEATURES_ENABLES, and enabled the MSR_PLATFORM_INFO_CPUID_FAULT bit unconditionally. This made guests incorrectly believe the VM emulates MSR_MISC_FEATURES_ENABLES properly (which is not true because QEMU has no migration code to handle the MSR). The KVM_CAP_MSR_PLATFORM_INFO capability was added[2] to Linux v4.19 to address the issue. Use it to disable emulation of MSR_PLATFORM_INFO and stop incorrectly exposing cpuid_fault to guests. References: [1] commit db2336a80489 ("KVM: x86: virtualize cpuid faulting") [2] commit 6fbbde9a1969 ("KVM: x86: Control guest reads of MSR_PLATFORM_INFO") Reported-by: Maxime Coquelin <maxime.coquelin@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- target/i386/kvm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 9af4542fb8..9629f25c90 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -1647,6 +1647,14 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } } + /* + * QEMU doesn't initialize MSR_PLATFORM_INFO yet, so disable the MSR + * unconditionally until support for the MSR is properly implemented + */ + if (kvm_check_extension(s, KVM_CAP_MSR_PLATFORM_INFO)) { + kvm_vm_enable_cap(s, KVM_CAP_MSR_PLATFORM_INFO, 0); + } + return 0; } -- 2.18.0.rc1.1.g3f1ff2140
WARNING: multiple messages have this Message-ID (diff)
From: Eduardo Habkost <ehabkost@redhat.com> To: qemu-devel@nongnu.org Cc: Paolo Bonzini <pbonzini@redhat.com>, Maxime Coquelin <maxime.coquelin@redhat.com>, kvm@vger.kernel.org, Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <rth@twiddle.net>, Marcelo Tosatti <mtosatti@redhat.com> Subject: [Qemu-devel] [PATCH] i386: Disable MSR_PLATFORM_INFO emulation Date: Fri, 25 Jan 2019 17:01:34 -0200 [thread overview] Message-ID: <20190125190134.25492-1-ehabkost@redhat.com> (raw) Linux v4.12 introduced[1] emulation of MSR_PLATFORM_INFO and MSR_MISC_FEATURES_ENABLES, and enabled the MSR_PLATFORM_INFO_CPUID_FAULT bit unconditionally. This made guests incorrectly believe the VM emulates MSR_MISC_FEATURES_ENABLES properly (which is not true because QEMU has no migration code to handle the MSR). The KVM_CAP_MSR_PLATFORM_INFO capability was added[2] to Linux v4.19 to address the issue. Use it to disable emulation of MSR_PLATFORM_INFO and stop incorrectly exposing cpuid_fault to guests. References: [1] commit db2336a80489 ("KVM: x86: virtualize cpuid faulting") [2] commit 6fbbde9a1969 ("KVM: x86: Control guest reads of MSR_PLATFORM_INFO") Reported-by: Maxime Coquelin <maxime.coquelin@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- target/i386/kvm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 9af4542fb8..9629f25c90 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -1647,6 +1647,14 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } } + /* + * QEMU doesn't initialize MSR_PLATFORM_INFO yet, so disable the MSR + * unconditionally until support for the MSR is properly implemented + */ + if (kvm_check_extension(s, KVM_CAP_MSR_PLATFORM_INFO)) { + kvm_vm_enable_cap(s, KVM_CAP_MSR_PLATFORM_INFO, 0); + } + return 0; } -- 2.18.0.rc1.1.g3f1ff2140
next reply other threads:[~2019-01-25 19:01 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-25 19:01 Eduardo Habkost [this message] 2019-01-25 19:01 ` [Qemu-devel] [PATCH] i386: Disable MSR_PLATFORM_INFO emulation Eduardo Habkost
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=20190125190134.25492-1-ehabkost@redhat.com \ --to=ehabkost@redhat.com \ --cc=kvm@vger.kernel.org \ --cc=maxime.coquelin@redhat.com \ --cc=mtosatti@redhat.com \ --cc=pbonzini@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=rth@twiddle.net \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.