whpx: i386: enable PMU
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>
Mohamed Mediouni committed
Feb 28, 2026 at 22:47 UTC
eb3eaf882edc64f6e1bf20a504b6dde1f5f027f0
1 file changed
+22
target/i386/whpx/whpx-all.c
+22
@@ -2026,6 +2026,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
2026
WHV_PARTITION_PROPERTY prop;
2027
WHV_CAPABILITY_FEATURES features = {0};
2028
WHV_PROCESSOR_FEATURES_BANKS processor_features;
2029
+ WHV_PROCESSOR_PERFMON_FEATURES perfmon_features;
2030
2031
whpx = &whpx_global;
2032
@@ -2170,6 +2171,27 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
2171
goto error;
2172
}
2173
2174
+ /* Enable supported performance monitoring capabilities */
2175
+ hr = whp_dispatch.WHvGetCapability(
2176
+ WHvCapabilityCodeProcessorPerfmonFeatures, &perfmon_features,
2177
+ sizeof(WHV_PROCESSOR_PERFMON_FEATURES), &whpx_cap_size);
2178
+ if (FAILED(hr)) {
2179
+ error_report("WHPX: Failed to get performance monitoring features, hr=%08lx", hr);
2180
+ ret = -ENOSPC;
2181
+ goto error;
2182
+ }
2183
+
2184
+ hr = whp_dispatch.WHvSetPartitionProperty(
2185
+ whpx->partition,
2186
+ WHvPartitionPropertyCodeProcessorPerfmonFeatures,
2187
+ &perfmon_features,
2188
+ sizeof(WHV_PROCESSOR_PERFMON_FEATURES));
2189
+ if (FAILED(hr)) {
2190
+ error_report("WHPX: Failed to set performance monitoring features, hr=%08lx", hr);
2191
+ ret = -EINVAL;
2192
+ goto error;
2193
+ }
2194
+
2195
/* Enable synthetic processor features */
2196
WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS synthetic_features;
2197
memset(&synthetic_features, 0, sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS));