Need help stop qemu from crashing when Looking Glass' ivshmem-plain is enabled

Hi. I have managed to get almost all the way to my goal of using Looking Glass on a VM that I pass my EVGA RTX 3090ti to.

As long as I don’t add the:

<shmem name='looking-glass'>
  <model type='ivshmem-plain'/>
  <size unit='M'>32</size>
</shmem>

As long as this isn’t set, I can boot, install NVIDIA drivers, do everything. I add it, and it crashes on startup with a bunch of “VFIO_MAP_DMA failed: Invalid Argument” followed by a “qemu: hardware error: vfio: DMA mapping failed, unable to continue”.

Any help would be much appreciated!

Best regards,
Marco

Edit: here is the qemu log for the run, slightly abridged. I couldn’t upload a .txt file and didn’t find any formatting option similar to ‘spoiler’, apologies if this is gauche:

2022-12-10 08:42:55.405+0000: starting up libvirt version: 8.10.0, qemu version: 7.1.0, kernel: 6.0.11-arch1-1, hostname: marco-arch.lan
LC_ALL=C \
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin \
HOME=/var/lib/libvirt/qemu/domain-3-win11 \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-3-win11/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-3-win11/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-3-win11/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=win11,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-3-win11/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/usr/share/edk2/x64/OVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/win11_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
-machine pc-q35-7.1,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel kvm \
-cpu host,migratable=on,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x1fff \
-m 16384 \
-object '{"qom-type":"memory-backend-memfd","id":"pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":17179869184}' \
-overcommit mem-lock=off \
-smp 24,sockets=24,cores=1,threads=1 \
-uuid 8cd3fc3b-c2cf-4c6f-aa5d-dd2be7711cf3 \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=33,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=localtime,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay \
-no-hpet \
-no-shutdown \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot strict=on \
-device '{"driver":"pcie-root-port","port":16,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x2"}' \
-device '{"driver":"pcie-root-port","port":17,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x2.0x1"}' \
-device '{"driver":"pcie-root-port","port":18,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x2.0x2"}' \
-device '{"driver":"pcie-root-port","port":19,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x3"}' \
-device '{"driver":"pcie-root-port","port":20,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x4"}' \
-device '{"driver":"pcie-root-port","port":21,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x2.0x5"}' \
-device '{"driver":"pcie-root-port","port":22,"chassis":7,"id":"pci.7","bus":"pcie.0","addr":"0x2.0x6"}' \
-device '{"driver":"pcie-root-port","port":23,"chassis":8,"id":"pci.8","bus":"pcie.0","addr":"0x2.0x7"}' \
-device '{"driver":"pcie-root-port","port":24,"chassis":9,"id":"pci.9","bus":"pcie.0","multifunction":true,"addr":"0x3"}' \
-device '{"driver":"pcie-root-port","port":25,"chassis":10,"id":"pci.10","bus":"pcie.0","addr":"0x3.0x1"}' \
-device '{"driver":"pcie-root-port","port":26,"chassis":11,"id":"pci.11","bus":"pcie.0","addr":"0x3.0x2"}' \
-device '{"driver":"pcie-root-port","port":27,"chassis":12,"id":"pci.12","bus":"pcie.0","addr":"0x3.0x3"}' \
-device '{"driver":"pcie-root-port","port":28,"chassis":13,"id":"pci.13","bus":"pcie.0","addr":"0x3.0x4"}' \
-device '{"driver":"pcie-root-port","port":29,"chassis":14,"id":"pci.14","bus":"pcie.0","addr":"0x3.0x5"}' \
-device '{"driver":"pcie-root-port","port":30,"chassis":15,"id":"pci.15","bus":"pcie.0","addr":"0x3.0x6"}' \
-device '{"driver":"pcie-pci-bridge","id":"pci.16","bus":"pci.6","addr":"0x0"}' \
-device '{"driver":"qemu-xhci","p2":15,"p3":15,"id":"usb","bus":"pci.2","addr":"0x0"}' \
-device '{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.3","addr":"0x0"}' \
-netdev tap,fd=34,id=hostnet0 \
-device '{"driver":"e1000e","netdev":"hostnet0","id":"net0","mac":"52:54:00:87:7a:b7","bus":"pci.1","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev spicevmc,id=charchannel0,name=vdagent \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"com.redhat.spice.0"}' \
-audiodev '{"id":"audio1","driver":"spice"}' \
-spice port=5900,addr=127.0.0.1,disable-ticketing=on,image-compression=off,seamless-migration=on \
-device '{"driver":"qxl-vga","id":"video0","max_outputs":1,"ram_size":67108864,"vram_size":67108864,"vram64_size_mb":0,"vgamem_mb":16,"bus":"pcie.0","addr":"0x1"}' \
-device '{"driver":"ich9-intel-hda","id":"sound0","bus":"pcie.0","addr":"0x1b"}' \
-device '{"driver":"hda-duplex","id":"sound0-codec0","bus":"sound0.0","cad":0,"audiodev":"audio1"}' \
-chardev spicevmc,id=charredir0,name=usbredir \
-device '{"driver":"usb-redir","chardev":"charredir0","id":"redir0","bus":"usb.0","port":"2"}' \
-chardev spicevmc,id=charredir1,name=usbredir \
-device '{"driver":"usb-redir","chardev":"charredir1","id":"redir1","bus":"usb.0","port":"3"}' \
-device '{"driver":"vfio-pci","host":"0000:01:00.0","id":"hostdev0","bus":"pci.4","addr":"0x0"}' \
-device '{"driver":"vfio-pci","host":"0000:01:00.1","id":"hostdev1","bus":"pci.5","addr":"0x0"}' \
-device '{"driver":"vfio-pci","host":"0000:03:00.0","id":"hostdev2","bootindex":1,"bus":"pci.7","addr":"0x0"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-object '{"qom-type":"memory-backend-file","id":"shmmem-shmem0","mem-path":"/dev/shm/looking-glass","size":67108864,"share":true}' \
-device '{"driver":"ivshmem-plain","id":"shmem0","memdev":"shmmem-shmem0","bus":"pci.16","addr":"0x1"}' \
-msg timestamp=on
char device redirected to /dev/pts/0 (label charserial0)
2022-12-10T08:43:02.535169Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-10T08:43:02.535253Z qemu-system-x86_64: vfio_dma_map(0x55907c7c39d0, 0x380000000000, 0x800000000, 0x7f6257c00000) = -2 (No such file or directory)
2022-12-10T08:43:02.547739Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-10T08:43:02.547785Z qemu-system-x86_64: vfio_dma_map(0x55907c7c39d0, 0x380800000000, 0x2000000, 0x7f6255c00000) = -22 (Invalid argument)
2022-12-10T08:43:02.758788Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-10T08:43:02.758805Z qemu-system-x86_64: vfio_dma_map(0x55907c7c39d0, 0x380000000000, 0x800000000, 0x7f6257c00000) = -22 (Invalid argument)
2022-12-10T08:43:02.764125Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-10T08:43:02.764135Z qemu-system-x86_64: vfio_dma_map(0x55907c7c39d0, 0x380800000000, 0x2000000, 0x7f6255c00000) = -22 (Invalid argument)
2022-12-10T08:43:02.769889Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-10T08:43:02.769898Z qemu-system-x86_64: vfio_dma_map(0x55907c7c39d0, 0x384800000000, 0x4000000, 0x7f6adbffe000) = -22 (Invalid argument)
qemu: hardware error: vfio: DMA mapping failed, unable to continue
<<Hundreds of lines of registers>>
2022-12-10 08:43:04.479+0000: shutting down, reason=crashed

EDIT2: trying to use B6-rc1 and using the kernel module provided instead with DKMS yields the same problem. as soon as I try to run a VM with the /dev/kvmfr0 file configured, it crashes. log below:

2022-12-10 12:19:02.394+0000: starting up libvirt version: 8.10.0, qemu version: 7.1.0, kernel: 6.0.11-arch1-1, hostname: marco-arch.lan
LC_ALL=C \
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin \
HOME=/var/lib/libvirt/qemu/domain-10-win10 \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-10-win10/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-10-win10/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-10-win10/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=win10,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-10-win10/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/usr/share/edk2/x64/OVMF_CODE.secboot.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/win10_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
-machine pc-q35-7.1,usb=off,vmport=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel kvm \
-cpu host,migratable=on,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x1fff \
-global driver=cfi.pflash01,property=secure,value=on \
-m 16384 \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":17179869184}' \
-overcommit mem-lock=off \
-smp 12,sockets=12,cores=1,threads=1 \
-uuid 8435f7c9-0913-4b1e-89dc-e11c76b85ee6 \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=33,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=localtime,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay \
-no-hpet \
-no-shutdown \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot strict=on \
-device '{"driver":"pcie-root-port","port":16,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x2"}' \
-device '{"driver":"pcie-root-port","port":17,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x2.0x1"}' \
-device '{"driver":"pcie-root-port","port":18,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x2.0x2"}' \
-device '{"driver":"pcie-root-port","port":19,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x3"}' \
-device '{"driver":"pcie-root-port","port":20,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x4"}' \
-device '{"driver":"pcie-root-port","port":21,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x2.0x5"}' \
-device '{"driver":"pcie-root-port","port":22,"chassis":7,"id":"pci.7","bus":"pcie.0","addr":"0x2.0x6"}' \
-device '{"driver":"pcie-root-port","port":23,"chassis":8,"id":"pci.8","bus":"pcie.0","addr":"0x2.0x7"}' \
-device '{"driver":"pcie-root-port","port":24,"chassis":9,"id":"pci.9","bus":"pcie.0","multifunction":true,"addr":"0x3"}' \
-device '{"driver":"pcie-root-port","port":25,"chassis":10,"id":"pci.10","bus":"pcie.0","addr":"0x3.0x1"}' \
-device '{"driver":"pcie-root-port","port":26,"chassis":11,"id":"pci.11","bus":"pcie.0","addr":"0x3.0x2"}' \
-device '{"driver":"pcie-root-port","port":27,"chassis":12,"id":"pci.12","bus":"pcie.0","addr":"0x3.0x3"}' \
-device '{"driver":"pcie-root-port","port":28,"chassis":13,"id":"pci.13","bus":"pcie.0","addr":"0x3.0x4"}' \
-device '{"driver":"pcie-root-port","port":29,"chassis":14,"id":"pci.14","bus":"pcie.0","addr":"0x3.0x5"}' \
-device '{"driver":"qemu-xhci","p2":15,"p3":15,"id":"usb","bus":"pci.2","addr":"0x0"}' \
-device '{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.3","addr":"0x0"}' \
-netdev tap,fd=34,id=hostnet0 \
-device '{"driver":"e1000e","netdev":"hostnet0","id":"net0","mac":"52:54:00:fe:82:19","bus":"pci.1","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev spicevmc,id=charchannel0,name=vdagent \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"com.redhat.spice.0"}' \
-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \
-audiodev '{"id":"audio1","driver":"spice"}' \
-spice port=5900,addr=127.0.0.1,disable-ticketing=on,image-compression=off,seamless-migration=on \
-device '{"driver":"qxl-vga","id":"video0","max_outputs":1,"ram_size":67108864,"vram_size":67108864,"vram64_size_mb":0,"vgamem_mb":16,"bus":"pcie.0","addr":"0x1"}' \
-device '{"driver":"ich9-intel-hda","id":"sound0","bus":"pcie.0","addr":"0x1b"}' \
-device '{"driver":"hda-duplex","id":"sound0-codec0","bus":"sound0.0","cad":0,"audiodev":"audio1"}' \
-chardev spicevmc,id=charredir0,name=usbredir \
-device '{"driver":"usb-redir","chardev":"charredir0","id":"redir0","bus":"usb.0","port":"2"}' \
-chardev spicevmc,id=charredir1,name=usbredir \
-device '{"driver":"usb-redir","chardev":"charredir1","id":"redir1","bus":"usb.0","port":"3"}' \
-device '{"driver":"vfio-pci","host":"0000:03:00.0","id":"hostdev0","bootindex":1,"bus":"pci.4","addr":"0x0"}' \
-device '{"driver":"ivshmem-plain","id":"shmem0","memdev":"looking-glass"}' \
-object '{"qom-type":"memory-backend-file","id":"looking-glass","mem-path":"/dev/kvmfr0","size":33554432,"share":true}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
char device redirected to /dev/pts/2 (label charserial0)
2022-12-10T12:19:08.227546Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-10T12:19:08.227571Z qemu-system-x86_64: vfio_dma_map(0x558fe17cba30, 0x384000000000, 0x2000000, 0x7fc359dff000) = -2 (No such file or directory)
qemu: hardware error: vfio: DMA mapping failed, unable to continue
<hundreds of registers>

With such an error there should be something related to vfio failing to map pages in dmesg. You should take a look there too.

Oh good call. sudo dmesg -w gets me some interesting output related to the CPU when I try to start the VM, but I have no idea what it means:

[11654.635281] kauditd_printk_skb: 3 callbacks suppressed
[11654.635288] audit: type=2502 audit(1670683521.576:1002): pid=22079 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm vm="win10" uuid=8435f7c9-0913-4b1e-89dc-e11c76b85ee6 vm-ctx=+1000:+1000 img-ctx=+1000:+1000 model=dac exe="/usr/bin/libvirtd" hostname=? addr=? terminal=? res=success'
[11654.675742] virbr0: port 1(vnet2) entered blocking state
[11654.675775] virbr0: port 1(vnet2) entered disabled state
[11654.675896] device vnet2 entered promiscuous mode
[11654.676081] audit: type=1700 audit(1670683521.616:1003): dev=vnet2 prom=256 old_prom=0 auid=4294967295 uid=0 gid=0 ses=4294967295
[11654.676103] audit: type=1300 audit(1670683521.616:1003): arch=c000003e syscall=16 success=yes exit=0 a0=24 a1=89a2 a2=7fa15e3f9f80 a3=7fa15e3f9cd6 items=0 ppid=1 pid=22079 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="rpc-libvirtd" exe="/usr/bin/libvirtd" key=(null)
[11654.676110] audit: type=1327 audit(1670683521.616:1003): proctitle=2F7573722F62696E2F6C69627669727464002D2D74696D656F757400313230
[11654.676190] virbr0: port 1(vnet2) entered blocking state
[11654.676196] virbr0: port 1(vnet2) entered listening state
[11654.676350] audit: type=2501 audit(1670683521.619:1004): pid=22079 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=net reason=open vm="win10" uuid=8435f7c9-0913-4b1e-89dc-e11c76b85ee6 net=52:54:00:fe:82:19 path="/dev/net/tun" rdev=0A:C8 exe="/usr/bin/libvirtd" hostname=? addr=? terminal=? res=success'
[11654.803784] audit: type=1130 audit(1670683521.746:1005): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[11654.808565] audit: type=1334 audit(1670683521.749:1006): prog-id=90 op=LOAD
[11654.808583] audit: type=1300 audit(1670683521.749:1006): arch=c000003e syscall=321 success=yes exit=34 a0=5 a1=7fa15e3fa120 a2=90 a3=40000 items=0 ppid=1 pid=22079 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="rpc-libvirtd" exe="/usr/bin/libvirtd" key=(null)
[11654.808589] audit: type=1327 audit(1670683521.749:1006): proctitle=2F7573722F62696E2F6C69627669727464002D2D74696D656F757400313230
[11654.808693] audit: type=2501 audit(1670683521.749:1007): pid=22079 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=cgroup reason=deny vm="win10" uuid=8435f7c9-0913-4b1e-89dc-e11c76b85ee6 cgroup="/sys/fs/cgroup/machine.slice/machine-qemu\x2d3\x2dwin10.scope/" class=all exe="/usr/bin/libvirtd" hostname=? addr=? terminal=? res=success'
[11654.842285] mmap kvmfr0: 7f162552e000-7f162752e000 with size 33554432 offset 0
[11656.712649] virbr0: port 1(vnet2) entered learning state
[11656.769732] vfio-pci 0000:03:00.0: vfio_ecap_init: hiding ecap 0x19@0x168
[11656.769756] vfio-pci 0000:03:00.0: vfio_ecap_init: hiding ecap 0x1e@0x190
[11657.293718] split_lock_warn: 1 callbacks suppressed
[11657.293720] x86/split lock detection: #AC: CPU 6/KVM/22412 took a split_lock trap at address: 0x7ef7e050
[11657.293741] x86/split lock detection: #AC: CPU 3/KVM/22409 took a split_lock trap at address: 0x7ef7e050
[11657.293741] x86/split lock detection: #AC: CPU 4/KVM/22410 took a split_lock trap at address: 0x7ef7e050
[11657.293763] x86/split lock detection: #AC: CPU 1/KVM/22407 took a split_lock trap at address: 0x7ef7e050
[11657.293774] x86/split lock detection: #AC: CPU 7/KVM/22413 took a split_lock trap at address: 0x7ef7e050
[11657.293776] x86/split lock detection: #AC: CPU 8/KVM/22414 took a split_lock trap at address: 0x7ef7e050
[11657.293791] x86/split lock detection: #AC: CPU 9/KVM/22415 took a split_lock trap at address: 0x7ef7e050
[11657.293793] x86/split lock detection: #AC: CPU 11/KVM/22417 took a split_lock trap at address: 0x7ef7e050
[11657.293794] x86/split lock detection: #AC: CPU 5/KVM/22411 took a split_lock trap at address: 0x7ef7e050
[11657.293795] x86/split lock detection: #AC: CPU 10/KVM/22416 took a split_lock trap at address: 0x7ef7e050
[11658.845892] virbr0: port 1(vnet2) entered forwarding state
[11658.845895] virbr0: topology change detected, propagating
[11660.487834] kauditd_printk_skb: 19 callbacks suppressed
[11660.487836] audit: type=1701 audit(1670683527.429:1027): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=22393 comm=43505520302F4B564D exe="/usr/bin/qemu-system-x86_64" sig=6 res=1
[11660.492515] audit: type=1334 audit(1670683527.432:1028): prog-id=91 op=LOAD
[11660.492619] audit: type=1334 audit(1670683527.436:1029): prog-id=92 op=LOAD
[11660.492624] audit: type=1334 audit(1670683527.436:1030): prog-id=93 op=LOAD
[11660.547037] audit: type=1130 audit(1670683527.489:1031): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@9-22451-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[11660.599730] audit: type=1131 audit(1670683527.542:1032): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@9-22451-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[11660.680035] virbr0: port 1(vnet2) entered disabled state
[11660.680316] device vnet2 left promiscuous mode
[11660.680320] virbr0: port 1(vnet2) entered disabled state
[11660.680323] audit: type=1700 audit(1670683527.622:1033): dev=vnet2 prom=0 old_prom=256 auid=4294967295 uid=1000 gid=1000 ses=4294967295
[11660.732795] audit: type=1334 audit(1670683527.676:1034): prog-id=0 op=UNLOAD
[11660.732808] audit: type=1334 audit(1670683527.676:1035): prog-id=0 op=UNLOAD
[11660.732813] audit: type=1334 audit(1670683527.676:1036): prog-id=0 op=UNLOAD

I’m also experiencing this exact issue, system boots in just fine without the ivshmem device, crashes instantly when added.

Dumb question / suggestion (because it worked for me) try changing your cpu model to anything thats not host passthrough/model, doing that fixed it immediately for me, don’t know why because ive never had to change it before its always ‘just worked’

if someone with a bigger brain than mine has any idea as to why it worked let me / us know

edit: host-model worked for me, passthrough refuses to work

Interesting. I tried that now but still no dice.

If I have the <qemu:commandline…/> block pointing to /dev/kvmfr0, it will only boot if I don’t pass-through any PCI host devices (NVMe or RTX 3090) and vice-versa. :face_holding_back_tears:

Unsure if this is relevant, but even when I boot successfully with just the GPU passthru, I still get the following in the logs. If I pass both NVMe and 3090 ti, looks like the same output, but twice. But Windows boots, NVIDIA drivers load, etc.

2022-12-11T08:00:39.994406Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-11T08:00:39.994430Z qemu-system-x86_64: vfio_dma_map(0x562e07d73b60, 0x380000000000, 0x800000000, 0x7ef626c00000) = -2 (No such file or directory)
2022-12-11T08:00:40.000135Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-11T08:00:40.000143Z qemu-system-x86_64: vfio_dma_map(0x562e07d73b60, 0x380800000000, 0x2000000, 0x7ef624c00000) = -22 (Invalid argument)
2022-12-11T08:00:40.143427Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-11T08:00:40.143439Z qemu-system-x86_64: vfio_dma_map(0x562e07d73b60, 0x380000000000, 0x800000000, 0x7ef626c00000) = -22 (Invalid argument)
2022-12-11T08:00:40.149610Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-11T08:00:40.149625Z qemu-system-x86_64: vfio_dma_map(0x562e07d73b60, 0x380800000000, 0x2000000, 0x7ef624c00000) = -22 (Invalid argument)
2022-12-11T08:00:40.330054Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-11T08:00:40.330102Z qemu-system-x86_64: vfio_dma_map(0x562e07d73b60, 0x380000000000, 0x800000000, 0x7ef626c00000) = -22 (Invalid argument)
2022-12-11T08:00:40.343303Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument
2022-12-11T08:00:40.343352Z qemu-system-x86_64: vfio_dma_map(0x562e07d73b60, 0x380800000000, 0x2000000, 0x7ef624c00000) = -22 (Invalid argument)

exactly same issue, fix by change ovmf bios file to default one with cpu passthrough.

loader readonly="yes" type="pflash">/usr/share/OVMF/OVMF_CODE.ms.fd</loader>
    <nvram>/default/path/to/OVMF_VARS.fd</nvram>

not root cause just a work around