Skip to contentSkip to conversation

i386/tdx: Don't mask off CPUID_EXT_PDCM

PATCH Applied Xiaoyao Li 3 participants 3 messages Jun 25, 2025 – Jul 11, 2025

lore
Share & tools
lore

Xiaoyao Li

author
#0 lore raw

PATCH 1/1 i386/tdx: Don't mask off CPUID_EXT_PDCM

It gets below warning when booting TDX VMs:

warning: TDX forcibly sets the feature: CPUID[eax=01h].ECX.pdcm [bit 15]

Because CPUID_EXT_PDCM is fixed1 for TDX, and MSR_IA32_PERF_CAPABILITIES is supported for TDX guest unconditioanlly.

Don't mask off CPUID_EXT_PDCM for TDX.

---
 target/i386/cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target/i386/cpu.c +3 -1
index 0d35e95430fe..b4cdebf85aac 100644
@@ -28,6 +28,7 @@
 #include "system/hvf.h"
 #include "hvf/hvf-i386.h"
 #include "kvm/kvm_i386.h"
+#include "kvm/tdx.h"
 #include "sev.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
@@ -8338,7 +8339,8 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
         }
     }
 
-    if (!cpu->enable_pmu) {
+    /* PDCM is fixed1 bit for TDX */
+    if (!cpu->enable_pmu && !is_tdx_vm()) {
         mark_unavailable_features(cpu, FEAT_1_ECX,
                                   env->user_features[FEAT_1_ECX] & CPUID_EXT_PDCM,
                                   "This feature is not available due to PMU being disabled");
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Xiaoyao Li

Date: Wed, 25 Jun 2025 11:57:10 +0800
From: Xiaoyao Li <[email protected]>
Subject: [PATCH] i386/tdx: Don't mask off CPUID_EXT_PDCM
X-Mailer: git-send-email 2.43.0

It gets below warning when booting TDX VMs:

warning: TDX forcibly sets the feature: CPUID[eax=01h].ECX.pdcm [bit 15]

Because CPUID_EXT_PDCM is fixed1 for TDX, and MSR_IA32_PERF_CAPABILITIES is supported for TDX guest unconditioanlly.

Quoted 6 lines

Don't mask off CPUID_EXT_PDCM for TDX.

---
 target/i386/cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
#2 lore raw
In reply to Xiaoyao Li
Quoted 8 lines

It gets below warning when booting TDX VMs:

warning: TDX forcibly sets the feature: CPUID[eax=01h].ECX.pdcm [bit 15]

Because CPUID_EXT_PDCM is fixed1 for TDX, and MSR_IA32_PERF_CAPABILITIES is supported for TDX guest unconditioanlly.

Don't mask off CPUID_EXT_PDCM for TDX.

It makes little sense for the TDX module to do this, but I don't see any nicer way to comply. :(

Queued, thanks.

Paolo