Hi Eric, On Wed, Aug 27, 2025 at 06:36:09PM +0200, Eric Auger wrote: > On 8/26/25 7:21 PM, Nicolin Chen wrote: > > QEMU log: > > smmuv3_accel_set_iommu_device: bus=0, devfn=0, sid=0 > > > > The set_iommu_device op is invoked by vfio_pci_realize() where the > > the BDF number won't get ready for this kind of PCI setup until a > > later stage that I can't identify yet.. > > > > Given that VTD wants the BDF number too, I start to wonder whether > > the set_iommu_device op is invoked in the right place or not.. > > > > Maybe VTD works because it saves the bus pointer v.s. bus_num(=0), > > so its bus_num would be updated when later code calculates the BDF > > number using the saved bus pointer (in the key). Nonetheless, the > > saved devfn (in the key) is 0, which wouldn't be updated later as > > the bus_num. So, if the device is supposed to have a devfn (!=0), > > this wouldn't work? > > in hw/arm/smmu-common.c, along with smmu_find_smmu_pcibus() there is a > comment about late computation of bus number. This looks like a safe > place where the bus_num is known.
Yea, sid is a parameter of that smmu_find_smmu_pcibus() function, so bus_num must be known. What I want here is to allocate a vDEVICE (needs vSID), as early as possible. This will be potentially a requirement for CCA. Thanks Nicolin