[PATCH 2/2] i386/cpu: Warn about why CPUID_EXT_PDCM is not available

Xiaoyao Li posted 2 patches 21 hours ago
[PATCH 2/2] i386/cpu: Warn about why CPUID_EXT_PDCM is not available
Posted by Xiaoyao Li 21 hours ago
When user requests PDCM explicitly via "+pdcm" without PMU enabled, emit
a warning to inform the user.

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

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 2bf6495140a0..2aa2bab12100 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7682,6 +7682,9 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
     }
 
     if (!cpu->enable_pmu) {
+        mark_unavailable_features(cpu, FEAT_1_ECX,
+                                  env->user_features[FEAT_1_ECX] & CPUID_EXT_PDCM,
+                                  "This feature is not available due to PMU disabled");
         env->features[FEAT_1_ECX] &= ~CPUID_EXT_PDCM;
     }
 
-- 
2.34.1