From: Sandipan Das When PMC virtualization (X86_FEATURE_SEV_PERFCTR_VIRT) is supported and the feature is enabled, additional save slots are available in the VMSA for the following MSRs. * Performance Counter Global Control (MSR 0xc0000301) (Swap Type C) * Performance Counter Global Status (MSR 0xc0000300) (Swap Type A) * Performance Event Select (MSR 0xc0010200..0xc001020a) (Swap Type C) * Performance Event Counter (MSR 0xc0010201..0xc001020b) (Swap Type C) Define the additional VMSA fields that will be used by hardware to save and restore the guest PMU state. Signed-off-by: Sandipan Das Signed-off-by: Manali Shukla --- arch/x86/include/asm/svm.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index 7208b910f2a56..6272ebc955d32 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -407,7 +407,11 @@ struct sev_es_save_area { u8 cpl; u8 reserved_0xcc[4]; u64 efer; - u8 reserved_0xd8[104]; + u8 reserved_0xd8[8]; + struct { + u64 perf_ctl; + u64 perf_ctr; + } __packed pmc[6]; u64 xss; u64 cr4; u64 cr3; @@ -424,7 +428,10 @@ struct sev_es_save_area { u64 dr1_addr_mask; u64 dr2_addr_mask; u64 dr3_addr_mask; - u8 reserved_0x1c0[24]; + u8 reserved_0x1c0[8]; + u64 perf_cntr_global_status; + u32 perf_cntr_global_control; + u8 reserved_0x1d4[4]; u64 rsp; u64 s_cet; u64 ssp; @@ -597,6 +604,7 @@ static inline void __unused_size_checks(void) BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0xcc); BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0xd8); BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0x1c0); + BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0x1d4); BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0x248); BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0x298); BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0x300); -- 2.43.0