KVM: selftests: Add a helper to query enable_mediated_pmu module param

Add a utility to check whether or not the mediated PMU is enabled, pivoting
on Intel vs. AMD since the module param is defined by vendor code.

Link: https://patch.msgid.link/20260610003030.2957261-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
Sean Christopherson 2026-06-09 17:30:29 -07:00
parent 4c396f19de
commit 0c277410f5

View File

@ -1394,6 +1394,14 @@ static inline bool kvm_is_pmu_enabled(void)
return get_kvm_param_bool("enable_pmu");
}
static inline bool kvm_is_mediated_pmu_enabled(void)
{
if (host_cpu_is_intel)
return get_kvm_intel_param_bool("enable_mediated_pmu");
return get_kvm_amd_param_bool("enable_mediated_pmu");
}
static inline bool kvm_is_forced_emulation_enabled(void)
{
return !!get_kvm_param_integer("force_emulation_prefix");