[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-07-30 Thread Roman Bolshakov
During the inspection of Apple reference, I have noticed that Guest CR0 and CR0 Guest/Host Mask has incorrect value. Apple defines that Guest CR0 is writable only if: CR0.CD and CR0.NW are unset But hvf accel code follows Intel SDM "Table 9-1. IA-32 and Intel 64 Processor States Following Power-

[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-07-30 Thread Roman Bolshakov
It's not possible to allocate MSR bitmap in userspace because it requires a physical address to be stored in the VMCS field. However, the bitmap page is already allocated inside kernel part of Hypervisor.framework. The 4k bitmap region is aligned to page boundary. It's worth to continue inspection

[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-07-27 Thread Roman Bolshakov
My guess is that RFLAGS.ZF == 1 and one or a few of the checks on VMX controls have failed. So far I have verified the following checks (26-2 and 26-3 in Intel SDM Vol. 3C): * Reserved bits in Pin-based VM execution controls are set according to associated capabilities MSR * Reserved bits in Pr

[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-07-23 Thread Gergely Kis
Hi Roman, thanks for the patch, we were able to reproduce this issue with our custom Android Cuttlefish based d VM (running 4.14 kernel): 2019-07-23T11:36:37.180753Z qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.8001H:ECX.svm [bit 2] 2019-07-23T11:36:37.182517Z q

[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-07-22 Thread Roman Bolshakov
The log line I've got is the following: ➜ vms ~/dev/qemu/x86_64-softmmu/qemu-system-x86_64 -accel hvf -m 2G -cdrom ~/Downloads/ubuntu-18.04.2-desktop-amd64.iso -hda ubuntu.qc ow2 qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.8001H:ECX.svm [bit 2] qemu-system-x86_

[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-07-22 Thread Roman Bolshakov
For the triage of the issue we need the following VMCS fields: * instruction error * exit reason * exit qualification On my machine (with macOS 10.14.5) each time QEMU exits with HV_ERROR, AppleHV spills the following error into system log: 2019-07-06 10:38:56.148547+0300 0x1e3ee4 Default 0

[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-07-21 Thread Gergely Kis
We can reproduce this problem with Linux guests as well (running 4.15 Ubuntu Xenial and 4.14 Android kernels). Mac models with integrated GPU seem to be more affected according to our testing, and the crash does not always occur, needs multiple tries to be triggered. We would be happy to assist in

[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-07-19 Thread Roman Bolshakov
I'm looking into the issue... HV_ERROR is a high-level return value and doesn't give enough details about the nature of the error. The error is returned from vmexit handler in AppleHV.kext (which implements kernel part of Hypervisor.framework). Perhaps we should extract more data from the VMCS and

[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-04-29 Thread Ben Wibking
^This is on version: % qemu-system-x86_64 --version QEMU emulator version 4.0.50 (v4.0.0-rc4-52-g3284aa1281-dirty) Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU

[Qemu-devel] [Bug 1818937] Re: Crash with HV_ERROR on macOS host

2019-04-29 Thread Ben Wibking
I can reproduce this by booting the Windows 10 x64 install ISO with the command line: + WINIMG=Win10.iso + VIRTIMG=virtio-win-0.1.164.iso + qemu-system-x86_64 -accel hvf -drive driver=raw,file=Win10.img,if=virtio -m 1536 -net nic,model=virtio -net user -cdrom Win10.iso -drive file=virtio-win-0.1