Re: [PATCH v7 17/17] KVM: selftests: Add svm_pmu_host_guest_test for Host-Only/Guest-Only bits

From: Sean Christopherson

Date: Wed May 27 2026 - 22:25:39 EST


On Wed, May 27, 2026, Yosry Ahmed wrote:
> +int main(int argc, char *argv[])
> +{
> + struct kvm_pmu_event_filter *filter;
> + struct kvm_vcpu *vcpu;
> + struct kvm_vm *vm;
> + struct ucall uc;
> + gva_t svm_gva;
> +
> + TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
> + TEST_REQUIRE(kvm_is_pmu_enabled());
> + TEST_REQUIRE(get_kvm_amd_param_bool("enable_mediated_pmu"));

This can and should be handled in a helper, using either host_cpu_is_intel or
host_cpu_is_amd_compatible to choose while vendor to query.

> + TEST_REQUIRE(host_cpu_is_amd && kvm_cpu_family() >= 0x17);

Why the family check? Actually, why check host_cpu_is_amd at all?