@samitouri / QOSamiQemu / commits / 9bd8a24a17

whpx: i386: remove remaining winhvemulation support code

After moving away to target/i386/emulate, this is no longer necessary. Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr> Link: https://lore.kernel.org/r/20260223233950.96076-13-mohamed@unpredictable.fr Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Mohamed Mediouni committed Feb 24, 2026 at 00:39 UTC 9bd8a24a170660066da3c67f24870dbb6c1c29f6
4 files changed +1 -43
accel/whpx/whpx-common.c
-22
@@ -39,9 +39,6 @@ bool whpx_allowed;
39 bool whpx_irqchip_in_kernel;
40 static bool whp_dispatch_initialized;
41 static HMODULE hWinHvPlatform;
42 -#ifdef HOST_X86_64
43 -static HMODULE hWinHvEmulation;
44 -#endif
42
43 struct whpx_state whpx_global;
44 struct WHPDispatch whp_dispatch;
@@ -393,7 +390,6 @@ static bool load_whp_dispatch_fns(HMODULE *handle,
390 HMODULE hLib = *handle;
391
392 #define WINHV_PLATFORM_DLL "WinHvPlatform.dll"
396 - #define WINHV_EMULATION_DLL "WinHvEmulation.dll"
393 #define WHP_LOAD_FIELD_OPTIONAL(return_type, function_name, signature) \
394 whp_dispatch.function_name = \
395 (function_name ## _t)GetProcAddress(hLib, #function_name); \
@@ -420,14 +416,6 @@ static bool load_whp_dispatch_fns(HMODULE *handle,
416 WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib)
417 LIST_WINHVPLATFORM_FUNCTIONS(WHP_LOAD_FIELD)
418 break;
423 - case WINHV_EMULATION_FNS_DEFAULT:
424 -#ifdef HOST_X86_64
425 - WHP_LOAD_LIB(WINHV_EMULATION_DLL, hLib)
426 - LIST_WINHVEMULATION_FUNCTIONS(WHP_LOAD_FIELD)
427 -#else
428 - g_assert_not_reached();
429 -#endif
430 - break;
419 case WINHV_PLATFORM_FNS_SUPPLEMENTAL:
420 WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib)
421 LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_LOAD_FIELD_OPTIONAL)
@@ -543,11 +531,6 @@ bool init_whp_dispatch(void)
531 if (!load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_DEFAULT)) {
532 goto error;
533 }
546 -#ifdef HOST_X86_64
547 - if (!load_whp_dispatch_fns(&hWinHvEmulation, WINHV_EMULATION_FNS_DEFAULT)) {
548 - goto error;
549 - }
550 -#endif
534 assert(load_whp_dispatch_fns(&hWinHvPlatform,
535 WINHV_PLATFORM_FNS_SUPPLEMENTAL));
536 whp_dispatch_initialized = true;
@@ -557,11 +540,6 @@ error:
540 if (hWinHvPlatform) {
541 FreeLibrary(hWinHvPlatform);
542 }
560 -#ifdef HOST_X86_64
561 - if (hWinHvEmulation) {
562 - FreeLibrary(hWinHvEmulation);
563 - }
564 -#endif
543 return false;
544 }
545
include/system/whpx-common.h
-3
@@ -3,9 +3,6 @@
3 #define SYSTEM_WHPX_COMMON_H
4
5 struct AccelCPUState {
6 -#ifdef HOST_X86_64
7 - WHV_EMULATOR_HANDLE emulator;
8 -#endif
6 bool window_registered;
7 bool interruptable;
8 bool ready_for_pic_interrupt;
include/system/whpx-internal.h
-16
@@ -4,9 +4,6 @@
4
5 #include <windows.h>
6 #include <winhvplatform.h>
7 -#ifdef HOST_X86_64
8 -#include <winhvemulation.h>
9 -#endif
7 #include "hw/i386/apic.h"
8 #include "exec/vaddr.h"
9
@@ -89,12 +86,6 @@ void whpx_apic_get(APICCommonState *s);
86 X(HRESULT, WHvResetPartition, \
87 (WHV_PARTITION_HANDLE Partition)) \
88
92 -#define LIST_WINHVEMULATION_FUNCTIONS(X) \
93 - X(HRESULT, WHvEmulatorCreateEmulator, (const WHV_EMULATOR_CALLBACKS* Callbacks, WHV_EMULATOR_HANDLE* Emulator)) \
94 - X(HRESULT, WHvEmulatorDestroyEmulator, (WHV_EMULATOR_HANDLE Emulator)) \
95 - X(HRESULT, WHvEmulatorTryIoEmulation, (WHV_EMULATOR_HANDLE Emulator, VOID* Context, const WHV_VP_EXIT_CONTEXT* VpContext, const WHV_X64_IO_PORT_ACCESS_CONTEXT* IoInstructionContext, WHV_EMULATOR_STATUS* EmulatorReturnStatus)) \
96 - X(HRESULT, WHvEmulatorTryMmioEmulation, (WHV_EMULATOR_HANDLE Emulator, VOID* Context, const WHV_VP_EXIT_CONTEXT* VpContext, const WHV_MEMORY_ACCESS_CONTEXT* MmioInstructionContext, WHV_EMULATOR_STATUS* EmulatorReturnStatus)) \
97 -
89 #define WHP_DEFINE_TYPE(return_type, function_name, signature) \
90 typedef return_type (WINAPI *function_name ## _t) signature;
91
@@ -103,16 +94,10 @@ void whpx_apic_get(APICCommonState *s);
94
95 /* Define function typedef */
96 LIST_WINHVPLATFORM_FUNCTIONS(WHP_DEFINE_TYPE)
106 -#ifdef HOST_X86_64
107 -LIST_WINHVEMULATION_FUNCTIONS(WHP_DEFINE_TYPE)
108 -#endif
97 LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DEFINE_TYPE)
98
99 struct WHPDispatch {
100 LIST_WINHVPLATFORM_FUNCTIONS(WHP_DECLARE_MEMBER)
113 -#ifdef HOST_X86_64
114 - LIST_WINHVEMULATION_FUNCTIONS(WHP_DECLARE_MEMBER)
115 -#endif
101 LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DECLARE_MEMBER)
102 };
103
@@ -122,7 +107,6 @@ bool init_whp_dispatch(void);
107
108 typedef enum WHPFunctionList {
109 WINHV_PLATFORM_FNS_DEFAULT,
125 - WINHV_EMULATION_FNS_DEFAULT,
110 WINHV_PLATFORM_FNS_SUPPLEMENTAL
111 } WHPFunctionList;
112
meson.build
+1 -2
@@ -865,8 +865,7 @@ if get_option('whpx').allowed() and host_os == 'windows'
865 endif
866 # Leave CONFIG_WHPX disabled
867 else
868 - if cc.has_header('winhvplatform.h', required: get_option('whpx')) and \
869 - cc.has_header('winhvemulation.h', required: get_option('whpx'))
868 + if cc.has_header('winhvplatform.h', required: get_option('whpx'))
869 accelerators += 'CONFIG_WHPX'
870 endif
871 endif