whpx: i386: only do partition reset when exposed
PATCH 1/1 whpx: i386: only do partition reset when exposed
WHvResetPartition is not exposed before Windows 11 and Windows Server 2025.
It is also not exposed on Server 2022, which passes the legacy OS check otherwise.
As such, gate it behind availabilty of WHvResetPartition.
Signed-off-by Mohamed Mediouni <[email protected]>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4908
--- target/i386/whpx/whpx-all.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/i386/whpx/whpx-all.c +2 -1
@@ -530,7 +530,8 @@ void whpx_set_registers(CPUState *cpu, WHPXStateLevel level)assert (cpu_is_stopped (cpu) ||qemu_cpu_is_self (cpu));/* Assumes that cpu_synchronize_all_post_reset() runs cpu 0 first. */ -if (level ==WHPX_LEVEL_RESET_STATE && cpu->cpu_index ==0 ) { +if (whp_dispatch.WHvResetPartition && + level ==WHPX_LEVEL_RESET_STATE && cpu->cpu_index ==0 ) { hr = whp_dispatch.WHvResetPartition (whpx->partition);if (FAILED (hr)) {error_report ("WHPX: Failed to reset partition, hr=%08lx" , hr);
Signature · 1 line
2.54.0 (Apple Git-157)
Quoted 7 lines · Mohamed Mediouni
WHvResetPartition is not exposed before Windows 11 and Windows Server 2025.
Quoted 7 lines
It is also not exposed on Server 2022, which passes the legacy OS check otherwise.
As such, gate it behind availabilty of WHvResetPartition.
Signed-off-by Mohamed Mediouni <[email protected]>Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4908
Fixes 6275714a ("target/i386/whpx: handle processor reset”)
Quoted 22 lines
---
target/i386/whpx/whpx-all.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)target/i386/whpx/whpx-all.c +2
-1@@ -530,7 +530,8 @@ void whpx_set_registers(CPUState *cpu, WHPXStateLevel level)assert (cpu_is_stopped (cpu) ||qemu_cpu_is_self (cpu));/* Assumes that cpu_synchronize_all_post_reset() runs cpu 0 first. */ -if (level ==WHPX_LEVEL_RESET_STATE && cpu->cpu_index ==0 ) { +if (whp_dispatch.WHvResetPartition && + level ==WHPX_LEVEL_RESET_STATE && cpu->cpu_index ==0 ) { hr = whp_dispatch.WHvResetPartition (whpx->partition);if (FAILED (hr)) {error_report ("WHPX: Failed to reset partition, hr=%08lx" , hr);Signature · 1 line
2.54.0 (Apple Git-157)