[pve-devel] [PATCH qemu-server v2 12/13] fix #3574: enable multi pci device mapping from config

DERUMIER, Alexandre Alexandre.DERUMIER at groupe-cyllene.com
Thu Aug 25 16:21:29 CEST 2022


I can't get mdev device working, it don't create the mdev device

> +    # ignore mdev for multiple devices, except when from mapping
> +    if ($res->{mdev} && $ignore_mdev) {
> +	warn "ignoring mediated device with multifunction device\n";
> +	delete $res->{mdev};
>       }
>       return $res;
>   }
> @@ -433,11 +446,13 @@ my $print_pci_device = sub {
>   };
>   


root at pve2:~# qm start 101
ignoring mediated device with multifunction device


with
vmconfig
---------

agent: 1
boot: order=scsi0;ide2;net0
cores: 2
cpu: host
hostpci0: sharednvidia,mdev=nvidia-54
ide2: cephfs-1:iso/jammy-live-server-amd64.iso,media=cdrom,size=1439536K
machine: q35
memory: 8195
meta: creation-qemu=6.2.0,ctime=1659689043
name: ubuntu-server-gpu
net0: virtio=6E:67:68:AA:68:7F,bridge=vmbr0,firewall=1
numa: 1
ostype: l26
parent: toto
scsi0: ceph-vm-ct-1:vm-101-disk-0,size=32G
scsihw: virtio-scsi-pci
smbios1: uuid=3580645c-dd29-4ac9-8276-5a67474ce67a
sockets: 2
vga: virtio
vmgenid: 1c2eb299-a6f9-4d2d-ab33-9b43ffed8c6d


mapping
-------

  cat nodes/hardware-map.conf|jq
{
   "digest": "4a760264e56a84da88d4362d414684db860c3406",
   "pci": {
     "sharednvidia": {
       "pve1": {
         "mdev": "1",
         "device": "0x1c31",
         "iommugroup": "75",
         "subsystem-device": "0x131b",
         "path": "0000:02:00",
         "subsystem-vendor": "0x10de",
         "vendor": "0x10de"
       },
       "pve2": {
         "mdev": "1",
         "iommugroup": "47",
         "device": "0x1c31",
         "subsystem-device": "0x131b",
         "subsystem-vendor": "0x10de",
         "vendor": "0x10de",
         "path": "0000:02:00"
       }
     }
   }
}



generated kvm command line: (without mdev)

/usr/bin/kvm -id 101 -name ubuntu-server-gpu,debug-threads=on 
-no-shutdown -chardev 
socket,id=qmp,path=/var/run/qemu-server/101.qmp,server=on,wait=off -mon 
chardev=qmp,mode=control -chardev 
socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5 -mon 
chardev=qmp-event,mode=control -pidfile /var/run/qemu-server/101.pid 
-daemonize -smbios type=1,uuid=3580645c-dd29-4ac9-8276-5a67474ce67a -smp 
4,sockets=2,cores=2,maxcpus=4 -nodefaults -boot 
menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg 
-vnc unix:/var/run/qemu-server/101.vnc,password=on -cpu 
host,+kvm_pv_eoi,+kvm_pv_unhalt -m 8195 -object 
memory-backend-ram,id=ram-node0,size=4097.5M -numa 
node,nodeid=0,cpus=0-1,memdev=ram-node0 -object 
memory-backend-ram,id=ram-node1,size=4097.5M -numa 
node,nodeid=1,cpus=2-3,memdev=ram-node1 -readconfig 
/usr/share/qemu-server/pve-q35-4.0.cfg -device 
vmgenid,guid=1c2eb299-a6f9-4d2d-ab33-9b43ffed8c6d -device 
usb-tablet,id=tablet,bus=ehci.0,port=1 -device 
vfio-pci,host=0000:02:00.0,id=hostpci0.0,bus=pci.0,addr=0x10.0,multifunction=on 
-device vfio-pci,host=0000:02:00.1,id=hostpci0.1,bus=pci.0,addr=0x10.1 
-device virtio-vga,id=vga,bus=pcie.0,addr=0x1 -chardev 
socket,path=/var/run/qemu-server/101.qga,server=on,wait=off,id=qga0 
-device virtio-serial,id=qga0,bus=pci.0,addr=0x8 -device 
virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -device 
virtio-serial,id=spice,bus=pci.0,addr=0x9 -chardev 
spicevmc,id=vdagent,name=vdagent -device 
virtserialport,chardev=vdagent,name=com.redhat.spice.0 -spice 
tls-port=61000,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on 
-device 
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on 
-iscsi initiator-name=iqn.1993-08.org.debian:01:fbdf9d609751 -drive 
file=/mnt/pve/cephfs-1/template/iso/jammy-live-server-amd64.iso,if=none,id=drive-ide2,media=cdrom,aio=io_uring 
-device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=101 
-device virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5 -drive 
file=rbd:ceph-vm-ct-1/vm-101-disk-0:conf=/etc/pve/ceph.conf:id=admin:keyring=/etc/pve/priv/ceph/ceph-vm-ct-1.keyring,if=none,id=drive-scsi0,format=raw,cache=none,aio=io_uring,detect-zeroes=on 
-device 
scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100 
-netdev 
type=tap,id=net0,ifname=tap101i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on 
-device 
virtio-net-pci,mac=6E:67:68:AA:68:7F,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=102 
-machine type=q35+pve0






maybe not related, but after that, stop/start are not working anymore

root at pve2:~# qm stop 101
PCI device mapping invalid (hardware probably changed): 'mdev' 
configured but should not be

root at pve2:~# qm start 101
PCI device mapping invalid (hardware probably changed): 'mdev' 
configured but should not be





More information about the pve-devel mailing list