linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: x86: Add AMD's EX_CFG to the list of ignored MSRs
@ 2018-12-18  0:34 Eduardo Habkost
  2018-12-18 21:10 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Eduardo Habkost @ 2018-12-18  0:34 UTC (permalink / raw)
  To: kvm
  Cc: Brijesh Singh, Paolo Bonzini, Tom Lendacky, Babu Moger,
	linux-kernel, Radim Krčmář

Some guests OSes (including Windows 10) write to MSR 0xc001102c
on some cases (possibly while trying to apply a CPU errata).
Make KVM ignore reads and writes to that MSR, so the guest won't
crash.

The MSR is documented as "Execution Unit Configuration (EX_CFG)",
at AMD's "BIOS and Kernel Developer's Guide (BKDG) for AMD Family
15h Models 00h-0Fh Processors".

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 arch/x86/include/asm/msr-index.h | 1 +
 arch/x86/kvm/x86.c               | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index c8f73efb4ece..9e39cc8bd989 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -390,6 +390,7 @@
 #define MSR_F15H_NB_PERF_CTR		0xc0010241
 #define MSR_F15H_PTSC			0xc0010280
 #define MSR_F15H_IC_CFG			0xc0011021
+#define MSR_F15H_EX_CFG			0xc001102c
 
 /* Fam 10h MSRs */
 #define MSR_FAM10H_MMIO_CONF_BASE	0xc0010058
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9cbce3ec84ec..69f822165fe2 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2429,6 +2429,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 	case MSR_AMD64_PATCH_LOADER:
 	case MSR_AMD64_BU_CFG2:
 	case MSR_AMD64_DC_CFG:
+	case MSR_F15H_EX_CFG:
 		break;
 
 	case MSR_IA32_UCODE_REV:
@@ -2724,6 +2725,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 	case MSR_AMD64_BU_CFG2:
 	case MSR_IA32_PERF_CTL:
 	case MSR_AMD64_DC_CFG:
+	case MSR_F15H_EX_CFG:
 		msr_info->data = 0;
 		break;
 	case MSR_F15H_PERF_CTL0 ... MSR_F15H_PERF_CTR5:
-- 
2.18.0.rc1.1.g3f1ff2140


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

* Re: [PATCH] kvm: x86: Add AMD's EX_CFG to the list of ignored MSRs
  2018-12-18  0:34 [PATCH] kvm: x86: Add AMD's EX_CFG to the list of ignored MSRs Eduardo Habkost
@ 2018-12-18 21:10 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2018-12-18 21:10 UTC (permalink / raw)
  To: Eduardo Habkost, kvm
  Cc: Brijesh Singh, Tom Lendacky, Babu Moger, linux-kernel,
	Radim Krčmář

On 18/12/18 01:34, Eduardo Habkost wrote:
> Some guests OSes (including Windows 10) write to MSR 0xc001102c
> on some cases (possibly while trying to apply a CPU errata).
> Make KVM ignore reads and writes to that MSR, so the guest won't
> crash.
> 
> The MSR is documented as "Execution Unit Configuration (EX_CFG)",
> at AMD's "BIOS and Kernel Developer's Guide (BKDG) for AMD Family
> 15h Models 00h-0Fh Processors".
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  arch/x86/include/asm/msr-index.h | 1 +
>  arch/x86/kvm/x86.c               | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
> index c8f73efb4ece..9e39cc8bd989 100644
> --- a/arch/x86/include/asm/msr-index.h
> +++ b/arch/x86/include/asm/msr-index.h
> @@ -390,6 +390,7 @@
>  #define MSR_F15H_NB_PERF_CTR		0xc0010241
>  #define MSR_F15H_PTSC			0xc0010280
>  #define MSR_F15H_IC_CFG			0xc0011021
> +#define MSR_F15H_EX_CFG			0xc001102c
>  
>  /* Fam 10h MSRs */
>  #define MSR_FAM10H_MMIO_CONF_BASE	0xc0010058
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 9cbce3ec84ec..69f822165fe2 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2429,6 +2429,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  	case MSR_AMD64_PATCH_LOADER:
>  	case MSR_AMD64_BU_CFG2:
>  	case MSR_AMD64_DC_CFG:
> +	case MSR_F15H_EX_CFG:
>  		break;
>  
>  	case MSR_IA32_UCODE_REV:
> @@ -2724,6 +2725,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  	case MSR_AMD64_BU_CFG2:
>  	case MSR_IA32_PERF_CTL:
>  	case MSR_AMD64_DC_CFG:
> +	case MSR_F15H_EX_CFG:
>  		msr_info->data = 0;
>  		break;
>  	case MSR_F15H_PERF_CTL0 ... MSR_F15H_PERF_CTR5:
> 

Queued, thanks.

Paolo

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

end of thread, other threads:[~2018-12-18 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18  0:34 [PATCH] kvm: x86: Add AMD's EX_CFG to the list of ignored MSRs Eduardo Habkost
2018-12-18 21:10 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).