From: Mohamed Mediouni Date: Sat, 28 Feb 2026 21:47:02 +0000 (+0100) Subject: whpx: i386: enable PMU X-Git-Tag: v11.0.0-rc0~43^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eb3eaf882edc64f6e1bf20a504b6dde1f5f027f0;p=thirdparty%2Fqemu.git whpx: i386: enable PMU Also a partition property instead of a CPU one... Signed-off-by: Mohamed Mediouni Link: https://lore.kernel.org/r/20260228214704.19048-7-mohamed@unpredictable.fr Signed-off-by: Paolo Bonzini --- diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 4186be62ada..7ccf92e4d11 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -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));