I took a stab at trying to rebase/upstream the support for Intel HAXM. (Hardware Accelerated Execution Manager). Intel HAX is kernel-based hardware acceleration module for Windows and MacOSX.
I have based my work on the last version of the source code I found: the emu-2.2-release branch in the external/qemu-android repository as used by the Android emulator. In patch 2/3, I have forward-ported the core HAX code mostly unmodified from there, I just did some minor touch up to make it build and run properly. So it might contain some outdated constructs and probably requires more attention (thus the 'RFC' for this patchset). In patch 3/3, I have put the plumbing into the QEMU code base, I did some clean up there and it is reasonably intrusive: i.e. Makefile.target | 1 + configure | 18 +++++++ cpu-exec.c | 23 ++++++++- cpus.c | 125 ++++++++++++++++++++++++++++++++++++++++------ exec.c | 16 ++++++ hw/intc/apic_common.c | 3 +- include/qom/cpu.h | 5 ++ include/sysemu/hw_accel.h | 9 ++++ qemu-options.hx | 11 ++++ target-i386/Makefile.objs | 7 +++ target-i386/seg_helper.c | 5 ++ target-i386/translate.c | 8 +++ vl.c | 17 +++++-- 13 files changed, 229 insertions(+), 19 deletions(-) I'm not so happy with the qemu_cpu_kick_thread mess in cpus.c, if somebody can help/advise. The patch 1/3 just extracts from KVM specific header the cpu_synchronize_ functions that HAX is also using. I have tested the end result on a Windows 10 Pro machine (with UG support) with the Intel HAXM module 6.0.4 and a large ChromiumOS x86_64 image to exercise various code paths. It looks stable. I also did a quick regression testing of the integration by running a Linux build with KVM enabled. Vincent Palatin (3): kvm: move cpu synchronization code target-i386: Add Intel HAX files Plumb the HAXM-based hardware acceleration support Makefile.target | 1 + configure | 18 + cpu-exec.c | 23 +- cpus.c | 126 +++- exec.c | 16 + gdbstub.c | 1 + hax-stub.c | 66 ++ hw/i386/kvm/apic.c | 1 + hw/i386/kvmvapic.c | 1 + hw/intc/apic_common.c | 3 +- hw/misc/vmport.c | 2 +- include/qom/cpu.h | 5 + include/sysemu/hax.h | 66 ++ include/sysemu/hw_accel.h | 48 ++ include/sysemu/kvm.h | 23 - monitor.c | 2 +- qemu-options.hx | 11 + qom/cpu.c | 2 +- target-arm/cpu.c | 2 +- target-i386/Makefile.objs | 7 + target-i386/hax-all.c | 1449 +++++++++++++++++++++++++++++++++++++++++++ target-i386/hax-darwin.c | 315 ++++++++++ target-i386/hax-darwin.h | 63 ++ target-i386/hax-i386.h | 94 +++ target-i386/hax-interface.h | 357 +++++++++++ target-i386/hax-slot.c | 332 ++++++++++ target-i386/hax-slot.h | 58 ++ target-i386/hax-windows.c | 478 ++++++++++++++ target-i386/hax-windows.h | 89 +++ target-i386/helper.c | 1 + target-i386/kvm.c | 1 + target-i386/seg_helper.c | 5 + target-i386/translate.c | 8 + vl.c | 17 +- 34 files changed, 3645 insertions(+), 46 deletions(-) create mode 100644 hax-stub.c create mode 100644 include/sysemu/hax.h create mode 100644 include/sysemu/hw_accel.h create mode 100644 target-i386/hax-all.c create mode 100644 target-i386/hax-darwin.c create mode 100644 target-i386/hax-darwin.h create mode 100644 target-i386/hax-i386.h create mode 100644 target-i386/hax-interface.h create mode 100644 target-i386/hax-slot.c create mode 100644 target-i386/hax-slot.h create mode 100644 target-i386/hax-windows.c create mode 100644 target-i386/hax-windows.h -- 2.8.0.rc3.226.g39d4020