[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <85e5aae70d2d09e0dec236ee531a08e837e9d97b.1509476456.git.Janakarajan.Natarajan@amd.com>
Date: Wed, 1 Nov 2017 11:19:30 -0500
From: Janakarajan Natarajan <Janakarajan.Natarajan@....com>
To: kvm@...r.kernel.org, x86@...nel.org, linux-kernel@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krcmar <rkrcmar@...hat.com>,
Len Brown <len.brown@...el.com>, Kyle Huey <me@...ehuey.com>,
Borislav Petkov <bp@...e.de>, Kan Liang <Kan.liang@...el.com>,
Grzegorz Andrejczuk <grzegorz.andrejczuk@...el.com>,
Tom Lendacky <thomas.lendacky@....com>,
Tony Luck <tony.luck@...el.com>,
Janakarajan Natarajan <Janakarajan.Natarajan@....com>
Subject: [PATCH 4/4] Expose AMD Core Perf Extension flag to guests
Expose the AMD Core Perf Extension flag to the guests.
Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@....com>
---
arch/x86/kvm/cpuid.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 0099e10..8c95a7c 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -55,6 +55,11 @@ bool kvm_mpx_supported(void)
}
EXPORT_SYMBOL_GPL(kvm_mpx_supported);
+bool perf_ext_supported(void)
+{
+ return boot_cpu_has(X86_FEATURE_PERFCTR_CORE);
+}
+
u64 kvm_supported_xcr0(void)
{
u64 xcr0 = KVM_SUPPORTED_XCR0 & host_xcr0;
@@ -327,6 +332,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
unsigned f_invpcid = kvm_x86_ops->invpcid_supported() ? F(INVPCID) : 0;
unsigned f_mpx = kvm_mpx_supported() ? F(MPX) : 0;
unsigned f_xsaves = kvm_x86_ops->xsaves_supported() ? F(XSAVES) : 0;
+ unsigned f_perfext = perf_ext_supported() ? F(PERFCTR_CORE) : 0;
/* cpuid 1.edx */
const u32 kvm_cpuid_1_edx_x86_features =
@@ -365,7 +371,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
F(LAHF_LM) | F(CMP_LEGACY) | 0 /*SVM*/ | 0 /* ExtApicSpace */ |
F(CR8_LEGACY) | F(ABM) | F(SSE4A) | F(MISALIGNSSE) |
F(3DNOWPREFETCH) | F(OSVW) | 0 /* IBS */ | F(XOP) |
- 0 /* SKINIT, WDT, LWP */ | F(FMA4) | F(TBM);
+ 0 /* SKINIT, WDT, LWP */ | F(FMA4) | F(TBM) | f_perfext;
/* cpuid 0xC0000001.edx */
const u32 kvm_cpuid_C000_0001_edx_x86_features =
--
2.7.4
Powered by blists - more mailing lists