KVM: x86/pmu: Restrict advanced features based on module enable_pmu
authorLike Xu <likexu@tencent.com>
Wed, 1 Jun 2022 03:19:24 +0000 (11:19 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jun 2022 17:06:17 +0000 (13:06 -0400)
commit6ef25aa0a961298278301ae1d88106c701eb73fa
treebd57de8db47e08927d016a4153d9f707a09dfe76
parentb9181c8ef35636152facc72f801f27b4264df8c0
KVM: x86/pmu: Restrict advanced features based on module enable_pmu

Once vPMU is disabled, the KVM would not expose features like:
PEBS (via clear kvm_pmu_cap.pebs_ept), legacy LBR and ARCH_LBR,
CPUID 0xA leaf, PDCM bit and MSR_IA32_PERF_CAPABILITIES, plus
PT_MODE_HOST_GUEST mode.

What this group of features has in common is that their use
relies on the underlying PMU counter and the host perf_event as a
back-end resource requester or sharing part of the irq delivery path.

Signed-off-by: Like Xu <likexu@tencent.com>
Message-Id: <20220601031925.59693-2-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/pmu.h
arch/x86/kvm/vmx/capabilities.h
arch/x86/kvm/vmx/vmx.c