[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220517154100.29983-6-weijiang.yang@intel.com>
Date: Tue, 17 May 2022 11:40:49 -0400
From: Yang Weijiang <weijiang.yang@...el.com>
To: pbonzini@...hat.com, jmattson@...gle.com, seanjc@...gle.com,
like.xu.linux@...il.com, vkuznets@...hat.com,
kan.liang@...ux.intel.com, wei.w.wang@...el.com,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Yang Weijiang <weijiang.yang@...el.com>
Subject: [PATCH v12 05/16] KVM: x86: Add Arch LBR MSRs to msrs_to_save_all list
Arch LBR MSR_ARCH_LBR_DEPTH and MSR_ARCH_LBR_CTL are queried by
userspace application before it wants to {save|restore} the Arch LBR
data. Other LBR related data MSRs are omitted here intentionally due
to lengthy list(32*3). Userspace can still use KVM_{GET|SET}_MSRS to
access them if necessary.
Suggested-by: Jim Mattson <jmattson@...gle.com>
Signed-off-by: Yang Weijiang <weijiang.yang@...el.com>
Reviewed-by: Jim Mattson <jmattson@...gle.com>
---
arch/x86/kvm/x86.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 247c58f5c8af..93b027aed2f3 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1458,6 +1458,7 @@ static const u32 msrs_to_save_all[] = {
MSR_F15H_PERF_CTR3, MSR_F15H_PERF_CTR4, MSR_F15H_PERF_CTR5,
MSR_IA32_XFD, MSR_IA32_XFD_ERR,
MSR_IA32_XSS,
+ MSR_ARCH_LBR_CTL, MSR_ARCH_LBR_DEPTH,
};
static u32 msrs_to_save[ARRAY_SIZE(msrs_to_save_all)];
@@ -6741,6 +6742,11 @@ static void kvm_init_msr_list(void)
if (!supported_xss)
continue;
break;
+ case MSR_ARCH_LBR_DEPTH:
+ case MSR_ARCH_LBR_CTL:
+ if (!kvm_cpu_cap_has(X86_FEATURE_ARCH_LBR))
+ continue;
+ break;
default:
break;
}
--
2.27.0
Powered by blists - more mailing lists