Signed-off-by: Mohamed Mediouni <[email protected]>
---
target/arm/whpx/whpx-all.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c
index bb94eac7bf..9983d59a38 100644
--- a/target/arm/whpx/whpx-all.c
+++ b/target/arm/whpx/whpx-all.c
@@ -947,6 +947,43 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
goto error;
}
+ /* Enable synthetic processor features */
+ WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS synthetic_features;
+ memset(&synthetic_features, 0,
sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS));
+ synthetic_features.BanksCount = 1;
+
+ synthetic_features.Bank0.HypervisorPresent = 1;
+ synthetic_features.Bank0.Hv1 = 1;
+ synthetic_features.Bank0.AccessVpRunTimeReg = 1;
+ synthetic_features.Bank0.AccessPartitionReferenceCounter = 1;
+ synthetic_features.Bank0.AccessPartitionReferenceTsc = 1;
+ synthetic_features.Bank0.AccessHypercallRegs = 1;
+ synthetic_features.Bank0.AccessVpIndex = 1;
+ synthetic_features.Bank0.AccessHypercallRegs = 1;
+ synthetic_features.Bank0.TbFlushHypercalls = 1;
+ synthetic_features.Bank0.AccessSynicRegs = 1;
+ synthetic_features.Bank0.AccessSyntheticTimerRegs = 1;
+ synthetic_features.Bank0.AccessIntrCtrlRegs = 1;
+ synthetic_features.Bank0.SyntheticClusterIpi = 1;
+ synthetic_features.Bank0.DirectSyntheticTimers = 1;
+
+ /*
+ * On ARM64, have enlightenments off by default
+ * as they're not needed for performance.
+ */
+ if (whpx->hyperv_enlightenments_required) {
+ hr = whp_dispatch.WHvSetPartitionProperty(
+ whpx->partition,
+ WHvPartitionPropertyCodeSyntheticProcessorFeaturesBanks,
+ &synthetic_features,
+ sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS));
+ if (FAILED(hr)) {
+ error_report("WHPX: Failed to set synthetic features, hr=%08lx",
hr);
+ ret = -EINVAL;
+ goto error;
+ }
+ }
+
hr = whp_dispatch.WHvSetupPartition(whpx->partition);
if (FAILED(hr)) {
error_report("WHPX: Failed to setup partition, hr=%08lx", hr);
--
2.50.1 (Apple Git-155)