whpx: arm: set of small fixes
v2 cover whpx: arm: set of small fixes
Highlight is probably getting -cpu host working on WHPX again, but otherwise pretty small set of fixes.
Mohamed Mediouni (5):
whpx: arm: fix -cpu host
whpx: arm: add EC_DATAABORT assert for
WHvRunVpExitReasonGpaIntercept/UnmappedGpa
whpx: arm: enable more enlightements
whpx: arm: remove comment bit that is no longer accurate target/arm: cpu: alter error message for host CPU type
hw/arm/virt.c | 2 +- target/arm/cpu.c | 4 ++-- target/arm/whpx/whpx-all.c | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)
PATCH v2 1/5 whpx: arm: fix -cpu host
"hw/arm/virt: Register valid CPU types dynamically" went under my radar, so fix this for WHPX.
--- hw/arm/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/virt.c +1 -1
@@ -3477,7 +3477,7 @@ static GPtrArray *virt_get_valid_cpu_types(const MachineState *ms)if (target_aarch64 ()) {g_ptr_array_add (vct,g_strdup (ARM_CPU_TYPE_NAME ("cortex-a53" )));g_ptr_array_add (vct,g_strdup (ARM_CPU_TYPE_NAME ("cortex-a57" ))); -if (kvm_enabled () ||hvf_enabled ()) { +if (kvm_enabled () ||hvf_enabled () ||whpx_enabled ()) {g_ptr_array_add (vct,g_strdup (ARM_CPU_TYPE_NAME ("host" ))); } }
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [PATCH v2 1/5] whpx: arm: fix -cpu host
Quoted 6 lines · Mohamed Mediouni
"hw/arm/virt: Register valid CPU types dynamically" went under my radar, so fix this for WHPX.
Signed-off-by Mohamed Mediouni <[email protected]>--- hw/arm/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v2 2/5 whpx: arm: add EC_DATAABORT assert for WHvRunVpExitReasonGpaIntercept/UnmappedGpa
In reply to Mohamed MediouniIf we get anything else from Hyper-V there's a problem, so enforce this.
--- target/arm/whpx/whpx-all.c | 1 + 1 file changed, 1 insertion(+)
target/arm/whpx/whpx-all.c +1 -0
@@ -439,6 +439,7 @@ int whpx_vcpu_run(CPUState *cpu)switch (vcpu->exit_ctx.ExitReason) {case WHvRunVpExitReasonGpaIntercept:case WHvRunVpExitReasonUnmappedGpa: +assert (syn_get_ec (vcpu->exit_ctx.MemoryAccess.Syndrome) ==EC_DATAABORT ); advance_pc = true;if (vcpu->exit_ctx.MemoryAccess.Syndrome &BIT (8 )) {
Signature · 1 line
2.50.1 (Apple Git-155)
PATCH v2 3/5 whpx: arm: enable more enlightements
In reply to Mohamed MediouniLinux uses AccessVpRegs without checking availability and panics if it's not there. Expose it unconditionally.
--- target/arm/whpx/whpx-all.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
target/arm/whpx/whpx-all.c +4 -2
@@ -832,6 +832,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms)UINT32 whpx_cap_size;WHV_PARTITION_PROPERTY prop;WHV_CAPABILITY_FEATURES features; +WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS synthetic_features;MachineClass *mc =MACHINE_GET_CLASS (ms);int pa_range =0 ;
@@ -942,7 +943,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) }/* 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 ;
@@ -953,13 +953,15 @@ int whpx_accel_init(AccelState *as, MachineState *ms) 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 ; + synthetic_features.Bank0.FastHypercallOutput =1 ; + synthetic_features.Bank0.AccessVpRegs =1 ; + synthetic_features.Bank0.SyncContext =1 ;/* * On ARM64, have enlightenments off by default
Signature · 1 line
2.50.1 (Apple Git-155)
PATCH v2 4/5 whpx: arm: remove comment bit that is no longer accurate
In reply to Mohamed MediouniAs of Windows 11 version 26H1, SME support shipped. However the MIT-licensed headers aren't updated yet.
--- target/arm/whpx/whpx-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/whpx/whpx-all.c +1 -1
@@ -717,7 +717,7 @@ static bool whpx_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)* Work needed for SVE support: * - SVE state save/restore * - any potentially needed VL management -* Also disable SME at the same time. (not currently supported by Hyper-V) +* Also disable SME at the same time. */ SET_IDREG (&ahcf->isar,ID_AA64PFR0 ,GET_IDREG (&ahcf->isar,ID_AA64PFR0 ) & ~R_ID_AA64PFR0_SVE_MASK );
Signature · 1 line
2.50.1 (Apple Git-155)
PATCH v2 5/5 target/arm: cpu: alter error message for host CPU type
In reply to Mohamed Mediouni--- target/arm/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/cpu.c +2 -2
@@ -1629,8 +1629,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* this is the first point where we can report it. */ if (cpu->host_cpu_probe_failed) { -if (!kvm_enabled () && !hvf_enabled ()) { -error_setg (errp,"The 'host' CPU type can only be used with KVM or HVF" ); +if (!kvm_enabled () && !hvf_enabled () && !whpx_enabled ()) { +error_setg (errp,"The 'host' CPU type can only be used with KVM, HVF or WHPX" ); }else {error_setg (errp,"Failed to retrieve host CPU features" ); }
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [PATCH v2 5/5] target/arm: cpu: alter error message for host CPU type
Quoted 10 lines · Mohamed Mediouni
Signed-off-by Mohamed Mediouni <[email protected]>--- target/arm/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/arm/cpu.c +0
-0
target/arm/cpu.c static void arm_cpu_realizefn(DeviceState *dev, Error **errp) · line 1633
Quoted 7 lines
target/arm/cpu.c +2
-2@@ -1629,8 +1629,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* this is the first point where we can report it. */ if (cpu->host_cpu_probe_failed) { -if (!kvm_enabled () && !hvf_enabled ()) { -error_setg (errp,"The 'host' CPU type can only be used with KVM or HVF" ); +if (!kvm_enabled () && !hvf_enabled () && !whpx_enabled ()) { +error_setg (errp,"The 'host' CPU type can only be used with KVM, HVF or WHPX" );
Squash with patch #1?
Quoted 3 lines
target/arm/cpu.c +0
-0}else {error_setg (errp,"Failed to retrieve host CPU features" ); }
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH v2 5/5] target/arm: cpu: alter error message for host CPU type
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Mohamed Mediouni
Signed-off-by Mohamed Mediouni <[email protected]>--- target/arm/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 19 lines
target/arm/cpu.c static void arm_cpu_realizefn(DeviceState *dev, Error **errp) · line 1633
Quoted 12 lines
target/arm/cpu.c +2
-2@@ -1629,8 +1629,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* this is the first point where we can report it. */ if (cpu->host_cpu_probe_failed) { -if (!kvm_enabled () && !hvf_enabled ()) { -error_setg (errp,"The 'host' CPU type can only be used with KVM or HVF" ); +if (!kvm_enabled () && !hvf_enabled () && !whpx_enabled ()) { +error_setg (errp,"The 'host' CPU type can only be used with KVM, HVF or WHPX" );Squash with patch #1?
Quoted 3 lines
target/arm/cpu.c +0
-0}else {error_setg (errp,"Failed to retrieve host CPU features" ); }
At any rate,