[PATCH 2/2] KVM: TDX: Disable pmu virtualization for TDX VMs
From: FirstName LastName
Date: Mon May 04 2026 - 21:43:18 EST
From: Vishal Annapurve <vannapurve@xxxxxxxxxx>
TDX module virtualizes PMU for TDX VMs[1]. Host has following
toggles to control the PMU functionality exposed to TDX VMs:
1) Configure TD_PARAMS to allow guests to use performance monitoring.
2) Restrict the TD to a subset of the PEBS counters if supported.
3) Limit the TD to setup a certain perfmon events using basic/enhanced
event filtering.
KVM will need to be enlightened to support these toggles. Explicitly
disable PMU virtualization for TDX VMs by default until such a support lands.
[1] Section 15.2: https://cdrdv2.intel.com/v1/dl/getContent/733575
Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Signed-off-by: Vishal Annapurve <vannapurve@xxxxxxxxxx>
---
arch/x86/kvm/vmx/tdx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index 1e47c194af53..01498c25942d 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -638,6 +638,12 @@ int tdx_vm_init(struct kvm *kvm)
kvm->arch.has_private_mem = true;
kvm->arch.disabled_quirks |= KVM_X86_QUIRK_IGNORE_GUEST_PAT;
+ /*
+ * PMU support is provide by the TDX-Module (if enabled for the VM).
+ * From KVM's perspective, the VM doesn't have a virtual PMU.
+ */
+ kvm->arch.enable_pmu = false;
+
/*
* Because guest TD is protected, VMM can't parse the instruction in TD.
* Instead, guest uses MMIO hypercall. For unmodified device driver,
--
2.54.0.545.g6539524ca2-goog