[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH 22/22] x86/AMD: add IRPerf support
From: Edwin Török <edvin.torok@xxxxxxxxxx> Instruction retired perf counter, enabled by writing to a bit in HWCR. Signed-off-by: Edwin Török <edvin.torok@xxxxxxxxxx> --- xen/arch/x86/include/asm/msr-index.h | 1 + xen/arch/x86/msr.c | 7 +++++++ xen/include/public/arch-x86/cpufeatureset.h | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86/include/asm/msr-index.h index 061b07c7ae..1d94fe3a5b 100644 --- a/xen/arch/x86/include/asm/msr-index.h +++ b/xen/arch/x86/include/asm/msr-index.h @@ -393,6 +393,7 @@ #define MSR_K8_HWCR 0xc0010015 #define K8_HWCR_TSC_FREQ_SEL (1ULL << 24) +#define K8_HWCR_IRPERF_EN (1ULL << 30) #define K8_HWCR_CPUID_USER_DIS (1ULL << 35) #define MSR_K7_FID_VID_CTL 0xc0010041 diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index 483b5e4f70..b3cd851d9d 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -584,6 +584,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) } break; + case MSR_K8_HWCR: + if ( !(cp->x86_vendor & X86_VENDOR_AMD) || + (val & ~K8_HWCR_IRPERF_EN) || + wrmsr_safe(msr, val) != 0 ) + goto gp_fault; + break; + case MSR_AMD64_DE_CFG: /* * OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP: diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h index 5faca0bf7a..40f74cd5e8 100644 --- a/xen/include/public/arch-x86/cpufeatureset.h +++ b/xen/include/public/arch-x86/cpufeatureset.h @@ -241,7 +241,7 @@ XEN_CPUFEATURE(EFRO, 7*32+10) /* APERF/MPERF Read Only interface */ /* AMD-defined CPU features, CPUID level 0x80000008.ebx, word 8 */ XEN_CPUFEATURE(CLZERO, 8*32+ 0) /*A CLZERO instruction */ -XEN_CPUFEATURE(IRPERF, 8*32+ 1) /* Instruction Retired Performance Counter */ +XEN_CPUFEATURE(IRPERF, 8*32+ 1) /*A! Instruction Retired Performance Counter */ XEN_CPUFEATURE(RSTR_FP_ERR_PTRS, 8*32+ 2) /*A (F)X{SAVE,RSTOR} always saves/restores FPU Error pointers */ XEN_CPUFEATURE(WBNOINVD, 8*32+ 9) /* WBNOINVD instruction */ XEN_CPUFEATURE(IBPB, 8*32+12) /*A IBPB support only (no IBRS, used by AMD) */ -- 2.41.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |