I am recently writing a micro-hypervisor for Intel CPUs. My micro-hypervisor runs while VMX is enabled. However, I ran into problem when trying to reboot the machine.
I decide to follow https://wiki.osdev.org/Reboot and perform a PS/2 8042 reset (i.e. write command 0xfe to IO port 0x64). However, I discover that when VMX is enabled, the 8042 reset is not successful (I have to use the power button to restart the machine). However, if I disable VMX using VMXOFF and then perform the 8042 reset, the reset is successful (I then see BIOS splashscreen, etc.)
My question is: why cannot I perform a 8042 reset with VMX enabled? OSDev says that the 8042 controller will pulse the reset line. I am assuming that it means asserting the RESET# pin. Intel's SDM does not say that VMX will cause RESET# to be ignored.
Also, while googling around, I saw this comment in Linux's reboot code:
Disable virtualization, i.e. VMX or SVM, to ensure INIT is recognized during reboot. VMX blocks INIT if the CPU is post-VMXON, and SVM blocks INIT if GIF=0, i.e. if the crash occurred between CLGI and STGI.
Intel's SDM does say that when VMX is enabled, INIT interrupts are blocked. Is INIT interrupts related to 8042 reset? Or is Linux using a method other than 8042 reset to reboot? In general, how does the hardware reset the CPU?