]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
whpx: i386: enable PMU
authorMohamed Mediouni <mohamed@unpredictable.fr>
Sat, 28 Feb 2026 21:47:02 +0000 (22:47 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 1 Mar 2026 15:02:54 +0000 (16:02 +0100)
Also a partition property instead of a CPU one...

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260228214704.19048-7-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/whpx/whpx-all.c

index 4186be62ada0b064fe039eda7f52c3c1d3c6ac7f..7ccf92e4d11ecf84096a50c51852a864140f5bfc 100644 (file)
@@ -2026,6 +2026,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
     WHV_PARTITION_PROPERTY prop;
     WHV_CAPABILITY_FEATURES features = {0};
     WHV_PROCESSOR_FEATURES_BANKS processor_features;
+    WHV_PROCESSOR_PERFMON_FEATURES perfmon_features;
 
     whpx = &whpx_global;
 
@@ -2170,6 +2171,27 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
         goto error;
     }
 
+    /* Enable supported performance monitoring capabilities */
+    hr = whp_dispatch.WHvGetCapability(
+        WHvCapabilityCodeProcessorPerfmonFeatures, &perfmon_features,
+        sizeof(WHV_PROCESSOR_PERFMON_FEATURES), &whpx_cap_size);
+    if (FAILED(hr)) {
+        error_report("WHPX: Failed to get performance monitoring features, hr=%08lx", hr);
+        ret = -ENOSPC;
+        goto error;
+    }
+
+    hr = whp_dispatch.WHvSetPartitionProperty(
+            whpx->partition,
+            WHvPartitionPropertyCodeProcessorPerfmonFeatures,
+            &perfmon_features,
+            sizeof(WHV_PROCESSOR_PERFMON_FEATURES));
+    if (FAILED(hr)) {
+        error_report("WHPX: Failed to set performance monitoring features, hr=%08lx", hr);
+        ret = -EINVAL;
+        goto error;
+    }
+
     /* Enable synthetic processor features */
     WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS synthetic_features;
     memset(&synthetic_features, 0, sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS));