whpx: i386, arm: do partition reset on boot CPU reset
PATCH 1/1 whpx: i386, arm: do partition reset on boot CPU reset
WHvResetPartition resets partition state, and is not supported on Windows 10.
On Arm, it's supposed to be used for reboots.
Signed-off-by Mohamed Mediouni <[email protected]>
--- accel/whpx/whpx-accel-ops.c | 1 + accel/whpx/whpx-common.c | 12 ++++++++++++ include/accel/accel-cpu-ops.h | 7 +++++++ include/system/cpus.h | 3 +++ include/system/whpx-accel-ops.h | 2 ++ system/cpus.c | 7 +++++++ system/runstate.c | 3 +++ target/arm/whpx/whpx-all.c | 2 -- 8 files changed, 35 insertions(+), 2 deletions(-)
accel/whpx/whpx-accel-ops.c +1 -0
@@ -98,6 +98,7 @@ static void whpx_accel_ops_class_init(ObjectClass *oc, const void *data) ops->handle_interrupt = generic_handle_interrupt; ops->supports_guest_debug = whpx_supports_guest_debug; + ops->vm_reset = whpx_partition_reset; ops->synchronize_post_reset = whpx_cpu_synchronize_post_reset; ops->synchronize_post_init = whpx_cpu_synchronize_post_init; ops->synchronize_state = whpx_cpu_synchronize_state;
accel/whpx/whpx-common.c +12 -0
@@ -205,6 +205,18 @@ static void do_whpx_cpu_synchronize_pre_loadvm(CPUState *cpu, cpu->vcpu_dirty = true; } +/* +* Partition support +*/ + +void whpx_partition_reset (void ) +{ +struct whpx_state *whpx = &whpx_global; +if (whp_dispatch.WHvResetPartition) { + whp_dispatch.WHvResetPartition (whpx->partition); + } +} +/* * CPU support. */
include/accel/accel-cpu-ops.h +7 -0
@@ -42,6 +42,13 @@ struct AccelOpsClass {void (*kick_vcpu_thread)(CPUState *cpu);bool (*cpu_thread_is_idle)(CPUState *cpu); +/** +* vm_reset +* +* Request to reset the VM to the hardware accelerator. +*/ +void (*vm_reset)(void ); +/** * synchronize_post_reset: * synchronize_post_init:
include/system/cpus.h +3 -0
@@ -40,4 +40,7 @@ void cpu_synchronize_all_post_reset(void);void cpu_synchronize_all_post_init (void );void cpu_synchronize_all_pre_loadvm (void ); +/* VM wide reset */ +void accel_vm_reset (void ); +#endif
include/system/whpx-accel-ops.h +2 -0
@@ -12,6 +12,8 @@#include "system/cpus.h" +void whpx_partition_reset (void ); +int whpx_init_vcpu (CPUState *cpu);int whpx_vcpu_exec (CPUState *cpu);void whpx_destroy_vcpu (CPUState *cpu);
system/cpus.c +7 -0
@@ -203,6 +203,13 @@ bool cpus_are_resettable(void)return true; } +void accel_vm_reset (void ) +{ +if (cpus_accel->vm_reset) { + cpus_accel->vm_reset (); + } +} +void cpu_exec_reset_hold (CPUState *cpu) {if (cpus_accel->cpu_reset_hold) {
system/runstate.c +3 -0
@@ -564,6 +564,9 @@ void qemu_system_reset(ShutdownCause reason)qapi_event_send_reset (shutdown_caused_by_guest (reason), reason); } +/* Tell the accelerator that the VM is being reset. */ +accel_vm_reset (); +/* * Some boards use the machine reset callback to point CPUs to the firmware * entry point. Assume that this is not the case for boards that support
target/arm/whpx/whpx-all.c +0 -2
@@ -472,8 +472,6 @@ int whpx_vcpu_run(CPUState *cpu)if (arm_cpu->power_state !=PSCI_OFF ) {whpx_psci_cpu_off (arm_cpu); } -/* Partition-wide reset, to reset state for reboots to succeed. */ - whp_dispatch.WHvResetPartition (whpx->partition);bql_unlock ();break ;case WHvRunVpExitReasonNone:
Signature · 1 line
2.50.1 (Apple Git-155)
Quoted 25 lines · Mohamed Mediouni
WHvResetPartition resets partition state, and is not supported on Windows 10.
On Arm, it's supposed to be used for reboots.
Signed-off-by Mohamed Mediouni <[email protected]>--- accel/whpx/whpx-accel-ops.c | 1 + accel/whpx/whpx-common.c | 12 ++++++++++++ include/accel/accel-cpu-ops.h | 7 +++++++ include/system/cpus.h | 3 +++ include/system/whpx-accel-ops.h | 2 ++ system/cpus.c | 7 +++++++ system/runstate.c | 3 +++ target/arm/whpx/whpx-all.c | 2 -- 8 files changed, 35 insertions(+), 2 deletions(-)include/accel/accel-cpu-ops.h +0
-0@@ -42,6 +42,13 @@ struct AccelOpsClass {void (*kick_vcpu_thread)(CPUState *cpu);bool (*cpu_thread_is_idle)(CPUState *cpu);
include/accel/accel-cpu-ops.h struct AccelOpsClass { · line 54
Quoted 10 lines
include/accel/accel-cpu-ops.h +7
-0+/** +* vm_reset +* +* Request to reset the VM to the hardware accelerator. +*/ +void (*vm_reset)(void ); +/** * synchronize_post_reset: * synchronize_post_init:
AccelOpsClass is per vCPU, AccelClass is per accel/VM.