Windows 11 VM: random hang on shutdown/reboot if msi is enabled on amd gpu?

Hi all,
I have an issue with my windows 11 virtual machine.
After some months I think I found the culprit; it seems that if I enable msi (message signaled interrupts) for my audio video amd gpu, sometimes, windows 11 hangs on shutdown or reboot: windows seems to shutdown/reboot, the monitor goes black, but the vm is reported as still running and only a forced shutdown fixes it.
My gpu is an amd 6900xt sapphire nitro+ SE.
Passthrough works as expected, the gpu is set as multifunction, the vm is setup as q35+ovmf with the latest stable edk2 ovmf release.
I’m running qemu 7.0, but the same happens with 6.2.

The hang doesn’t happen with line-based interrupts.

Disabling msi on the gpu unfortunately is not an option.
Now, this is becoming quite difficult to fix, because the issue could be everywhere, in windows, in the amd drivers, in qemu, in vfio…

I have some questions:

  1. if anybody has the same issue and with which gpu
  2. if anybody has a way to fix it :smiley:

In an attempt to have a not shared irq for my gpu, I tried to move the gpu on another pcie-root-port (not multifunction and with the only gpu attached to it), but it shares the same irq with another passed through usb controller…
usb controller attached to pcie-root-port on 00:06.0, gpu attached to pcie-root-port on 00:07.0.
I never understood how windows assigns irq values, I know it depends on the chipset layout, so maybe that I can reach my goal by changing the pc-q35 machine pcie-root-ports layout…?

Thank you for your time.

Nevermind, it was a placebo effect, it seemed it didn’t crash for several reboots, then it crashed again.
Thanks to an app to analyze the memory dumps I was able to identify the culprit: it’s a driver power failure of my mellanox infiniband card.
It’s a very old card, worked well in windows 7, survived windows 10, but it seems it has issue in windows 11. Luckily I don’t use it very much and I can disable the card and unloading the driver (ibbus.sys) before rebooting/shutting down.