@samitouri / QOSamiQemu / commits / bb7e0a3426

whpx: arm64: enable enlightenments if asked for

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr> Link: https://lore.kernel.org/r/20260307181856.2209-9-mohamed@unpredictable.fr Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Mohamed Mediouni committed Mar 7, 2026 at 19:18 UTC bb7e0a342636f68c53ed0d096acd9e4350fab205
1 file changed +37
target/arm/whpx/whpx-all.c
+37
@@ -940,6 +940,43 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
940 goto error;
941 }
942
943 + /* Enable synthetic processor features */
944 + WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS synthetic_features;
945 + memset(&synthetic_features, 0, sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS));
946 + synthetic_features.BanksCount = 1;
947 +
948 + synthetic_features.Bank0.HypervisorPresent = 1;
949 + synthetic_features.Bank0.Hv1 = 1;
950 + synthetic_features.Bank0.AccessVpRunTimeReg = 1;
951 + synthetic_features.Bank0.AccessPartitionReferenceCounter = 1;
952 + synthetic_features.Bank0.AccessPartitionReferenceTsc = 1;
953 + synthetic_features.Bank0.AccessHypercallRegs = 1;
954 + synthetic_features.Bank0.AccessVpIndex = 1;
955 + synthetic_features.Bank0.AccessHypercallRegs = 1;
956 + synthetic_features.Bank0.TbFlushHypercalls = 1;
957 + synthetic_features.Bank0.AccessSynicRegs = 1;
958 + synthetic_features.Bank0.AccessSyntheticTimerRegs = 1;
959 + synthetic_features.Bank0.AccessIntrCtrlRegs = 1;
960 + synthetic_features.Bank0.SyntheticClusterIpi = 1;
961 + synthetic_features.Bank0.DirectSyntheticTimers = 1;
962 +
963 + /*
964 + * On ARM64, have enlightenments off by default
965 + * as they're not needed for performance.
966 + */
967 + if (whpx->hyperv_enlightenments_required) {
968 + hr = whp_dispatch.WHvSetPartitionProperty(
969 + whpx->partition,
970 + WHvPartitionPropertyCodeSyntheticProcessorFeaturesBanks,
971 + &synthetic_features,
972 + sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS));
973 + if (FAILED(hr)) {
974 + error_report("WHPX: Failed to set synthetic features, hr=%08lx", hr);
975 + ret = -EINVAL;
976 + goto error;
977 + }
978 + }
979 +
980 hr = whp_dispatch.WHvSetupPartition(whpx->partition);
981 if (FAILED(hr)) {
982 error_report("WHPX: Failed to setup partition, hr=%08lx", hr);