All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: svm: writes to MSR_K7_HWCR generates GPE in guest
@ 2014-06-26 11:50 Matthias Lange
  2014-06-26 11:50 ` Matthias Lange
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Lange @ 2014-06-26 11:50 UTC (permalink / raw)
  To: kvm

This patch prevents a Linux guest running on an AMD processor from getting a
GPE upon setting bit 18 in MSR_K7_HWCR.

Matthias Lange (1):
  KVM: svm: writes to MSR_K7_HWCR generates GPE in guest

 arch/x86/kvm/x86.c | 1 +
 1 file changed, 1 insertion(+)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] KVM: svm: writes to MSR_K7_HWCR generates GPE in guest
  2014-06-26 11:50 [PATCH] KVM: svm: writes to MSR_K7_HWCR generates GPE in guest Matthias Lange
@ 2014-06-26 11:50 ` Matthias Lange
  2014-07-09 16:20   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Lange @ 2014-06-26 11:50 UTC (permalink / raw)
  To: kvm

Since commit 575203 the MCE subsystem in the Linux kernel for AMD sets bit 18
in MSR_K7_HWCR. Running such a kernel as a guest in KVM on an AMD host results
in a GPE injected into the guest because kvm_set_msr_common returns 1. This
patch fixes this by masking bit 18 from the MSR value desired by the guest.

Signed-off-by: Matthias Lange <matthias.lange@kernkonzept.com>
---
 arch/x86/kvm/x86.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 57eac30..24d70d4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2029,6 +2029,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 		data &= ~(u64)0x40;	/* ignore flush filter disable */
 		data &= ~(u64)0x100;	/* ignore ignne emulation enable */
 		data &= ~(u64)0x8;	/* ignore TLB cache disable */
+		data &= ~(u64)0x40000;  /* ignore Mc status write enable */
 		if (data != 0) {
 			vcpu_unimpl(vcpu, "unimplemented HWCR wrmsr: 0x%llx\n",
 				    data);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: svm: writes to MSR_K7_HWCR generates GPE in guest
  2014-06-26 11:50 ` Matthias Lange
@ 2014-07-09 16:20   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2014-07-09 16:20 UTC (permalink / raw)
  To: Matthias Lange, kvm

Il 26/06/2014 13:50, Matthias Lange ha scritto:
> Since commit 575203 the MCE subsystem in the Linux kernel for AMD sets bit 18
> in MSR_K7_HWCR. Running such a kernel as a guest in KVM on an AMD host results
> in a GPE injected into the guest because kvm_set_msr_common returns 1. This
> patch fixes this by masking bit 18 from the MSR value desired by the guest.
>
> Signed-off-by: Matthias Lange <matthias.lange@kernkonzept.com>
> ---
>  arch/x86/kvm/x86.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 57eac30..24d70d4 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2029,6 +2029,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  		data &= ~(u64)0x40;	/* ignore flush filter disable */
>  		data &= ~(u64)0x100;	/* ignore ignne emulation enable */
>  		data &= ~(u64)0x8;	/* ignore TLB cache disable */
> +		data &= ~(u64)0x40000;  /* ignore Mc status write enable */
>  		if (data != 0) {
>  			vcpu_unimpl(vcpu, "unimplemented HWCR wrmsr: 0x%llx\n",
>  				    data);
>

Thanks, looks good -- I queued it locally for now until I can test it on 
AMD.

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-09 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-26 11:50 [PATCH] KVM: svm: writes to MSR_K7_HWCR generates GPE in guest Matthias Lange
2014-06-26 11:50 ` Matthias Lange
2014-07-09 16:20   ` Paolo Bonzini

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.