intel / haxm

Intel® Hardware Accelerated Execution Manager (Intel® HAXM)
BSD 3-Clause "New" or "Revised" License
3.18k stars 853 forks source link

HAXM does not enable XSAVE yet AVX is supported and cannot be enabled #465

Open NXTdevosc1 opened 1 year ago

NXTdevosc1 commented 1 year ago

After a long trip fixing my LEGACY BIOS bootloader to run on QEMU with HAXM enabled, the bootloader successfully do its job and jumps to the kernel, the first thing the kernel does is to enable CPU features. However, when HAXM is enabled, the kernel detects AVX support but xsetbv triggers a vCPU Shutdown. I figured out that XSAVE and OSXSAVE are disabled in CPUID,EAX=1. I tried to check for them by creating a windows program and they seem to be both enabled on the host CPU.

The goal of enabling HAXM was mainly to test and use AVX, PCID, AES, TSC_DEADLINE support and lot of other features present on my CPU, rather than just rebooting my PC each time which takes minutes !

How to enable OSXSAVE, XSAVE on an HAXM host ? How to use AVX and other CPU features ?

Please, I need to fix this soon.

However enabling these extensions on real hardware (the host CPU) seems to work normally.

I'll appreciate it too much if you provide these features, I don't want to reboot my PC each time to try them. AVX is only 86 Instructions though

NXTdevosc1 commented 1 year ago

Another thing : Enabling virtualization only activates XSAVE on other VMs (Without HAXM). Which provides activation possibility and usage for the AVX instruction set. Therefore, HAXM Must add support for the XSAVE Feature in order to enable AVX.

nevilad commented 1 year ago

Haxm does not support XSAVE and OSXSAVE emulation, thus returns these as disabled from cpuid emulation handlers. The feature set supported by haxm corresponds to very old CPU models - very similar to Nehalem. To use these you have to add they support to haxm.

Please, I need to fix this soon.

Nearly impossible, haxm didnt add features for a long time, see closed pull request list. There is no active development of the project.

NXTdevosc1 commented 1 year ago

Is there a way to do it ? or I just emulate with VBox or VMWare to test these extensions ?

nevilad commented 1 year ago

To do it with haxm, one has to implement these features in haxm code. If you just need some hypervisor to do your tests, then you can use VBox and VmWare. They implement features corresponfing to more recent CPUs.

NXTdevosc1 commented 1 year ago

where are HAXM developers ?