[2/2] kvm: x86: IA32_ARCH_CAPABILITIES may be emulated on Intel
diff mbox series

Message ID 20190128181252.245510-2-jmattson@google.com
State New
Headers show
Series
  • [1/2] kvm: x86: IA32_ARCH_CAPABILITIES is only emulated for Intel
Related show

Commit Message

Jim Mattson Jan. 28, 2019, 6:12 p.m. UTC
This MSR should be listed in emulated_msrs[] rather than
msrs_to_save[], so that it will always be reported by
KVM_GET_MSR_INDEX_LIST. However, it is not emulated on AMD hosts.

Fixes: 1eaafe91a0df ("kvm: x86: IA32_ARCH_CAPABILITIES is always supported")
Reported-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Marc Orr <marcorr@google.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Tested-by: Eduardo Habkost <ehabkost@redhat.com>
---
 arch/x86/kvm/svm.c | 1 +
 arch/x86/kvm/x86.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Jim Mattson Feb. 8, 2019, 11:05 p.m. UTC | #1
On Mon, Jan 28, 2019 at 10:13 AM Jim Mattson <jmattson@google.com> wrote:
>
> This MSR should be listed in emulated_msrs[] rather than
> msrs_to_save[], so that it will always be reported by
> KVM_GET_MSR_INDEX_LIST. However, it is not emulated on AMD hosts.
>
> Fixes: 1eaafe91a0df ("kvm: x86: IA32_ARCH_CAPABILITIES is always supported")
> Reported-by: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Jim Mattson <jmattson@google.com>
> Reviewed-by: Marc Orr <marcorr@google.com>
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> Tested-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  arch/x86/kvm/svm.c | 1 +
>  arch/x86/kvm/x86.c | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index c34a6d77d8e4..96b680713301 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -5856,6 +5856,7 @@ static bool svm_has_emulated_msr(int index)
>  {
>         switch (index) {
>         case MSR_IA32_MCG_EXT_CTL:
> +       case MSR_IA32_ARCH_CAPABILITIES:
>                 return false;
>         default:
>                 break;
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 02c8e095a239..e47e24bc9500 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1125,7 +1125,7 @@ static u32 msrs_to_save[] = {
>  #endif
>         MSR_IA32_TSC, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA,
>         MSR_IA32_FEATURE_CONTROL, MSR_IA32_BNDCFGS, MSR_TSC_AUX,
> -       MSR_IA32_SPEC_CTRL, MSR_IA32_ARCH_CAPABILITIES,
> +       MSR_IA32_SPEC_CTRL,
>         MSR_IA32_RTIT_CTL, MSR_IA32_RTIT_STATUS, MSR_IA32_RTIT_CR3_MATCH,
>         MSR_IA32_RTIT_OUTPUT_BASE, MSR_IA32_RTIT_OUTPUT_MASK,
>         MSR_IA32_RTIT_ADDR0_A, MSR_IA32_RTIT_ADDR0_B,
> @@ -1167,6 +1167,7 @@ static u32 emulated_msrs[] = {
>         MSR_PLATFORM_INFO,
>         MSR_MISC_FEATURES_ENABLES,
>         MSR_AMD64_VIRT_SPEC_CTRL,
> +       MSR_IA32_ARCH_CAPABILITIES,
>  };
>
>  static unsigned num_emulated_msrs;
> --
> 2.20.1.495.gaa96b0ce6b-goog

Ping?

Patch
diff mbox series

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index c34a6d77d8e4..96b680713301 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -5856,6 +5856,7 @@  static bool svm_has_emulated_msr(int index)
 {
 	switch (index) {
 	case MSR_IA32_MCG_EXT_CTL:
+	case MSR_IA32_ARCH_CAPABILITIES:
 		return false;
 	default:
 		break;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 02c8e095a239..e47e24bc9500 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1125,7 +1125,7 @@  static u32 msrs_to_save[] = {
 #endif
 	MSR_IA32_TSC, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA,
 	MSR_IA32_FEATURE_CONTROL, MSR_IA32_BNDCFGS, MSR_TSC_AUX,
-	MSR_IA32_SPEC_CTRL, MSR_IA32_ARCH_CAPABILITIES,
+	MSR_IA32_SPEC_CTRL,
 	MSR_IA32_RTIT_CTL, MSR_IA32_RTIT_STATUS, MSR_IA32_RTIT_CR3_MATCH,
 	MSR_IA32_RTIT_OUTPUT_BASE, MSR_IA32_RTIT_OUTPUT_MASK,
 	MSR_IA32_RTIT_ADDR0_A, MSR_IA32_RTIT_ADDR0_B,
@@ -1167,6 +1167,7 @@  static u32 emulated_msrs[] = {
 	MSR_PLATFORM_INFO,
 	MSR_MISC_FEATURES_ENABLES,
 	MSR_AMD64_VIRT_SPEC_CTRL,
+	MSR_IA32_ARCH_CAPABILITIES,
 };
 
 static unsigned num_emulated_msrs;