On Fri, Sep 27, 2024 at 03:45:41PM +0800, Han Han wrote: > Here is a draft patch series for amd-iommu device. It will implement > amd-iommu device and its attributes: intremap, device-iotlb, xtsup. > > However, its secret device AMDVI-PCI will occupy a PCIe slot and cause > VM failed to start: > Domain XML: > <domain type='kvm'> > ... > <video> > <model type='virtio' heads='1' primary='yes'/> > <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> > </video> > <iommu model='amd'/> > ... > </domain> > > ➜ ~ virsh create /tmp/fedora.xml > error: Failed to create domain from /tmp/fedora.xml > error: internal error: QEMU unexpectedly closed the monitor (vm='fedora'): 2024-09-27T07:55:46.132886Z qemu-system-x86_64: -device {"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pcie.0","addr":"0x1"}: PCI: slot 1 function 0 not available for virtio-vga, in use by AMDVI-PCI,id=(null) > > I'll update the series when QEMU fixes the blocker. Is anyone even working on this problem in QEMU ? I don't recall seeing any patchset that claimed to address this. The amd-iommu device as it exists today is completely unsupportable, due to it secretly creating this PCI device behind the scenes, making it impossible for libvirt to configure PCI placement. IOW, this series is pretty much useless until the amd-iommu device is re-designed, at which point you'll need to re-write it to cope with the new design which properly exposes the PCI device (or alternatively removes the need for a secret PCI device?). With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|