PCIe cards passthrough to TCG guest works on 2GB of guest memory but fails on 4GB (vfio_dma_map invalid arg)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Expired
|
Undecided
|
Unassigned |
Bug Description
During one meeting coworker asked "did someone tried to passthrough PCIe card to other arch guest?" and I decided to check it.
Plugged SATA and USB3 controllers into spare slots on mainboard and started playing. On 1GB VM instance it worked (both cold- and hot-plugged). On 4GB one it did not:
Błąd podczas uruchamiania domeny: internal error: process exited while connecting to monitor: 2020-03-
2020-03-
Traceback (most recent call last):
File "/usr/share/
callback(
File "/usr/share/
callback(*args, **kwargs)
File "/usr/share/
ret = fn(self, *args, **kwargs)
File "/usr/share/
self.
File "/usr/lib64/
if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirt.
2020-03-
I played with memory and 3054 MB is maximum value possible to boot VM with coldplugged host PCIe cards.
summary: |
- PCIe cards passthrough to TCG guest works only up to 3054MB of guest - memory + PCIe cards passthrough to TCG guest works on 2GB of guest memory but + fails on 4GB (vfio_dma_map invalid arg) |
tags: | added: arm passthrough tcg |
Qemu command line for booting VM was generated by libvirt:
/usr/bin/ qemu-system- aarch64 aarch64- pcie,debug- threads= on id=masterKey0, format= raw,file= /var/lib/ libvirt/ qemu/domain- 1-fedora- aarch64- pcie/master- key.aes :"file" ,"filename" :"/usr/ share/edk2/ aarch64/ QEMU_EFI- pflash. raw","node- name":" libvirt- pflash0- storage" ,"auto- read-only" :true," discard" :"unmap" } name":" libvirt- pflash0- format" ,"read- only":true, "driver" :"raw", "file": "libvirt- pflash0- storage" } :"file" ,"filename" :"/var/ lib/libvirt/ qemu/nvram/ fedora- aarch64- pcie_VARS. fd","node- name":" libvirt- pflash1- storage" ,"auto- read-only" :true," discard" :"unmap" } name":" libvirt- pflash1- format" ,"read- only":false, "driver" :"raw", "file": "libvirt- pflash1- storage" } 2,accel= tcg,usb= off,dump- guest-core= off,gic- version= 2,pflash0= libvirt- pflash0- format, pflash1= libvirt- pflash1- format 3,cores= 1,threads= 1 1511-480d- b215-c58a5c80e6 46 id=charmonitor, fd=32,server, nowait charmonitor, id=monitor, mode=control port,port= 0x8,chassis= 1,id=pci. 1,bus=pcie. 0,multifunction =on,addr= 0x1 port,port= 0x9,chassis= 2,id=pci. 2,bus=pcie. 0,addr= 0x1.0x1 port,port= 0xa,chassis= 3,id=pci. 3,bus=pcie. 0,addr= 0x1.0x2 port,port= 0xb,chassis= 4,id=pci. 4,bus=pcie. 0,addr= 0x1.0x3 port,port= 0xc,chassis= 5,id=pci. 5,bus=pcie. 0,addr= 0x1.0x4 port,port= 0xd,chassis= 6,id=pci. 6,bus=pcie. 0,addr= 0x1.0x5 port,port= 0xe,chassis= 7,id=pci. 7,bus=pcie. 0,addr= 0x1.0x6 port,port= 0xf,chassis= 8,id=pci. 8,bus=pcie. 0,addr= 0x1.0x7 serial- pci,id= virtio- serial0, bus=pci. 2,addr= 0x0 29,id=hostnet0 net-pci, netdev= hostnet0, id=net0, mac=52: 54:00:87: 3e:d3,bus= pci.1,addr= 0x0 id=charchannel0 ,fd=33, server, nowait bus=virtio- serial0. 0,nr=1, chardev= charchannel0, id=channel0, name=org. qemu.guest_ agent.0 addr=127. 0.0.1,disable- ticketing, image-compressi on=off, seamless- migration= on gpu-pci, id=video0, max_outputs= 1,bus=pci. 7,addr= 0x0 host=0000: 29:00.0, id=hostdev0, bus=pci. 3,addr= 0x0 host=0000: 28:00.0, id=hostdev1, bus=pci. 4,addr= 0x0 balloon- pci,id= balloon0, bus=pci. 5,addr= 0x0 id=objrng0, filename= /dev/urandom rng-pci, rng=objrng0, id=rng0, bus=pci. 6,addr= 0x0 deny,elevatepri vileges= deny,spawn= deny,resourceco ntrol=deny
-name guest=fedora-
-S
-object secret,
-blockdev {"driver"
-blockdev {"node-
-blockdev {"driver"
-blockdev {"node-
-machine virt-4.
-cpu cortex-a57
-m 2048
-overcommit mem-lock=off
-smp 3,sockets=
-uuid 139dc97a-
-no-user-config
-nodefaults
-chardev socket,
-mon chardev=
-rtc base=utc
-no-shutdown
-boot strict=on
-device pcie-root-
-device pcie-root-
-device pcie-root-
-device pcie-root-
-device pcie-root-
-device pcie-root-
-device pcie-root-
-device pcie-root-
-device virtio-
-netdev tap,fd=
-device virtio-
-chardev pty,id=charserial0
-serial chardev:charserial0
-chardev socket,
-device virtserialport,
-spice port=5900,
-device virtio-
-device vfio-pci,
-device vfio-pci,
-device virtio-
-object rng-random,
-device virtio-
-sandbox on,obsolete=
-msg timestamp=on