Browse Source

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>
master
Mohamed Mediouni 5 months ago
committed by Paolo Bonzini
parent
commit
eb3eaf882e
  1. 22
      target/i386/whpx/whpx-all.c

22
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));

Loading…
Cancel
Save