On Fri, Jan 31, 2025 at 05:08:28PM +0100, Eric Auger wrote: > Hi, > > > On 1/31/25 4:23 PM, Shameerali Kolothum Thodi wrote: > > > >> -----Original Message----- > >> From: Jason Gunthorpe <j...@nvidia.com> > >> Sent: Friday, January 31, 2025 2:54 PM > >> To: Shameerali Kolothum Thodi <shameerali.kolothum.th...@huawei.com> > >> Cc: Daniel P. Berrangé <berra...@redhat.com>; qemu-...@nongnu.org; > >> qemu-devel@nongnu.org; eric.au...@redhat.com; > >> peter.mayd...@linaro.org; nicol...@nvidia.com; ddut...@redhat.com; > >> Linuxarm <linux...@huawei.com>; Wangzhou (B) > >> <wangzh...@hisilicon.com>; jiangkunkun <jiangkun...@huawei.com>; > >> Jonathan Cameron <jonathan.came...@huawei.com>; > >> zhangfei....@linaro.org; Nathan Chen <nath...@nvidia.com> > >> Subject: Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable > >> nested SMMUv3 > >> > >> On Fri, Jan 31, 2025 at 02:39:53PM +0000, Shameerali Kolothum Thodi > >> wrote: > >> > >>>>> And Qemu does some checking to make sure that the device is indeed > >>>> associated > >>>>> with the specified phys-smmuv3. This can be done going through the > >>>> sysfs path checking > >>>>> which is what I guess libvirt is currently doing to populate the > >> topology. > >>>> So basically > >>>>> Qemu is just replicating that to validate again. > >>>> I would prefer that iommufd users not have to go out to sysfs.. > >>>> > >>>>> Or another option is extending the IOMMU_GET_HW_INFO IOCTL to > >>>> return the phys > >>>>> smmuv3 base address which can avoid going through the sysfs. > >>>> It also doesn't seem great to expose a physical address. But we could > >>>> have an 'iommu instance id' that was a unique small integer? > >>> Ok. But how the user space can map that to the device? > >> Why does it need to? > >> > >> libvirt picks some label for the vsmmu instance, it doesn't matter > >> what the string is. > >> > >> qemu validates that all of the vsmmu instances are only linked to PCI > >> device that have the same iommu ID. This is already happening in the > >> kernel, it will fail attaches to mismatched instances. > >> > >> Nothing further is needed? > > -device pxb-pcie,id=pcie.1,bus_nr=8,bus=pcie.0 \ > > -device pcie-root-port,id=pcie.port1,bus=pcie.1,chassis=1 \ > > -device arm-smmuv3-accel,bus=pcie.1,id=smmuv1 \ > I don't get what is the point of adding such an id if it is not > referenced anywhere?
Every QDev device instance has an 'id' property - if you don't set one explicitly, QEMU will generate one internally. Libvirt will always set the 'id' property to avoid the internal auto- generated IDs, as it wants full knowledge of naming. 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 :|