qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i386/tdx: Don't mask off CPUID_EXT_PDCM
@ 2025-06-25  3:57 Xiaoyao Li
  2025-06-27  8:44 ` Zhao Liu
  2025-07-11  8:58 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Xiaoyao Li @ 2025-06-25  3:57 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: xiaoyao.li, qemu-devel

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.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 target/i386/cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 0d35e95430fe..b4cdebf85aac 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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");
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] i386/tdx: Don't mask off CPUID_EXT_PDCM
  2025-06-25  3:57 [PATCH] i386/tdx: Don't mask off CPUID_EXT_PDCM Xiaoyao Li
@ 2025-06-27  8:44 ` Zhao Liu
  2025-07-11  8:58 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Zhao Liu @ 2025-06-27  8:44 UTC (permalink / raw)
  To: Xiaoyao Li; +Cc: Paolo Bonzini, qemu-devel

On Wed, Jun 25, 2025 at 11:57:10AM +0800, Xiaoyao Li wrote:
> Date: Wed, 25 Jun 2025 11:57:10 +0800
> From: Xiaoyao Li <xiaoyao.li@intel.com>
> 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.
> 
> Don't mask off CPUID_EXT_PDCM for TDX.
> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>  target/i386/cpu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i386/tdx: Don't mask off CPUID_EXT_PDCM
  2025-06-25  3:57 [PATCH] i386/tdx: Don't mask off CPUID_EXT_PDCM Xiaoyao Li
  2025-06-27  8:44 ` Zhao Liu
@ 2025-07-11  8:58 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2025-07-11  8:58 UTC (permalink / raw)
  To: Xiaoyao Li; +Cc: qemu-devel

> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-11  9:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25  3:57 [PATCH] i386/tdx: Don't mask off CPUID_EXT_PDCM Xiaoyao Li
2025-06-27  8:44 ` Zhao Liu
2025-07-11  8:58 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).