Skip to content

Commit f90d98b

Browse files
committed
xen/pv: fix vendor checks for pmu emulation
The CPU vendor checks for pmu emulation are rather limited today, as the assumption seems to be that only Intel and AMD are existing and/or supported vendors. Fix that by handling Centaur and Zhaoxin CPUs the same way as Intel, and Hygon the same way as AMD. While at it fix the return type of is_intel_pmu_msr(). Suggested-by: Jan Beulich <[email protected]> Signed-off-by: Juergen Gross <[email protected]> Reviewed-by: Jan Beulich <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 8714f7b commit f90d98b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

arch/x86/xen/pmu.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ static inline uint32_t get_fam15h_addr(u32 addr)
131131

132132
static inline bool is_amd_pmu_msr(unsigned int msr)
133133
{
134-
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
134+
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
135+
boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
135136
return false;
136137

137138
if ((msr >= MSR_F15H_PERF_CTL &&
@@ -143,11 +144,13 @@ static inline bool is_amd_pmu_msr(unsigned int msr)
143144
return false;
144145
}
145146

146-
static int is_intel_pmu_msr(u32 msr_index, int *type, int *index)
147+
static bool is_intel_pmu_msr(u32 msr_index, int *type, int *index)
147148
{
148149
u32 msr_index_pmc;
149150

150-
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
151+
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL &&
152+
boot_cpu_data.x86_vendor != X86_VENDOR_CENTAUR &&
153+
boot_cpu_data.x86_vendor != X86_VENDOR_ZHAOXIN)
151154
return false;
152155

153156
switch (msr_index) {

0 commit comments

Comments
 (0)