utmapp / UTM

Virtual machines for iOS and macOS
https://getutm.app
Apache License 2.0
26.86k stars 1.34k forks source link

QEMU crashes with assertion when running macOS guest with Intel Hypervisor #2610

Open conath opened 3 years ago

conath commented 3 years ago

When attempting to run a macOS Monterey Beta VM in UTM on an Intel Mac, QEMU crashes with the message: Assertion failed: (vector < nr_vectors), function msi_notify, file ../hw/pci/msi.c, line 317.

After searching online I can not find anyone with this error before. I have tried to change my configuration to use only one core, at no avail (maybe vectors has to do with the number of cores).

Configuration

Debug log debug.log

VM Config config.plist.zip

More info:
As you can see, the VM uses custom EFI BIOS and OpenCore to get macOS to boot. Here's a screenshot of the verbose macOS boot right before the crash (only QEMU crashes, not UTM):

Verbose mode boot
conath commented 3 years ago

Update: I have discovered a workaround for this issue. By changing the configuration to disable the HD Audio and USB Redirect features, the error goes away.

thenickdude commented 3 years ago

The issue seems to be the USB 3 controller (added by using USB passthrough of a USB 3 device) and its MSI setting.

I added this to my QEMU command line to disable MSI and the assert went away, and my USB 3 card reader functions correctly:

-global nec-usb-xhci.msi=off
conath commented 3 years ago

@thenickdude Thanks! Do you know if it is safe to add this MSI setting as a default in UTM?

thenickdude commented 3 years ago

I think for non-macOS guests this will cause a performance reduction for USB 3 devices (as non-MSI interrupts have higher overhead)

For macOS guests this should be perfect

osy commented 3 years ago

I think this is a bug in QEMU and should be fixed in QEMU rather than hacking in a config to disable MSI. Has this been reported to QEMU?

In the meantime, -global nec-usb-xhci.msi=off can be added to custom arguments as a workaround right?

conath commented 3 years ago

It could, just with a performance hit to USB passthrough, according to @thenickdude. What do you think about a "quirks" tab instead of adding this as a default? https://github.com/utmapp/UTM/pull/3031#discussion_r696593486

thenickdude commented 3 years ago

Often virtual machine software rolls quirks like this into a set that is implicitly activated by telling it what guest OS you're running (e.g. Workstation, VirtualBox and Proxmox all do this).

osy commented 2 years ago

@conath So for a while we’ve used qemu-xhci which has MSI=0 by default. However I think that caused issues with Windows (#3194) so I changed it back to nec-usb-xhci. However I’m wondering if maybe QEMU 6.2.0 has fixed this issue so can you re-test after 8fb5b5d2fa7c04f137eff7a4ad42d879772b7cc3?

lwabish commented 10 months ago

-global nec-usb-xhci.msi=off

I think this is a bug in QEMU and should be fixed in QEMU rather than hacking in a config to disable MSI. Has this been reported to QEMU?

In the meantime, -global nec-usb-xhci.msi=off can be added to custom arguments as a workaround right?

Thanks.This tweak works in pve 8.1.3 with hacintosh sonoma