@@ -847,4 +847,12 @@ static inline bool pmu_gp_counter_is_available(int i)
return !(cpuid(10).b & BIT(i));
}
+static inline u64 this_cpu_perf_capabilities(void)
+{
+ if (!this_cpu_has(X86_FEATURE_PDCM))
+ return 0;
+
+ return rdmsr(MSR_IA32_PERF_CAPABILITIES);
+}
+
#endif
@@ -660,7 +660,7 @@ int main(int ac, char **av)
check_counters();
- if (rdmsr(MSR_IA32_PERF_CAPABILITIES) & PMU_CAP_FW_WRITES) {
+ if (this_cpu_perf_capabilities() & PMU_CAP_FW_WRITES) {
gp_counter_base = MSR_IA32_PMC0;
report_prefix_push("full-width writes");
check_counters();
@@ -72,7 +72,7 @@ int main(int ac, char **av)
return report_summary();
}
- perf_cap = rdmsr(MSR_IA32_PERF_CAPABILITIES);
+ perf_cap = this_cpu_perf_capabilities();
if (!(perf_cap & PMU_CAP_LBR_FMT)) {
report_skip("(Architectural) LBR is not supported.");