Hi Zhenzhong Uh, good catch O.o
Reviewed-by: Clément Mathieu--Drif <[email protected]> On Sun, 2025-09-28 at 23:42 -0400, Zhenzhong Duan wrote: > The 2nd parameter of pci_device_get_iommu_bus_devfn() about root PCIBus > backed by an IOMMU for the PCI device, the 3rd is about aliased PCIBus > of the PCI device. > > Meanwhile the 3rd and 4th parameters are optional, pass NULL if they > are not needed. > > Signed-off-by: Zhenzhong Duan > <[[email protected]](mailto:[email protected])> > --- > hw/pci/pci.c | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index c3df9d6656..d5ed89aab7 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -2967,7 +2967,7 @@ int pci_iommu_init_iotlb_notifier(PCIDevice *dev, > IOMMUNotifier *n, > PCIBus *iommu_bus; > int devfn; > > - pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); > + pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn); > if (iommu_bus && iommu_bus->iommu_ops->init_iotlb_notifier) { > iommu_bus->iommu_ops->init_iotlb_notifier(bus, > iommu_bus->iommu_opaque, > devfn, n, fn, opaque); > @@ -3025,7 +3025,7 @@ int pci_pri_request_page(PCIDevice *dev, uint32_t > pasid, bool priv_req, > return -EPERM; > } > > - pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); > + pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn); > if (iommu_bus && iommu_bus->iommu_ops->pri_request_page) { > return iommu_bus->iommu_ops->pri_request_page(bus, > > iommu_bus->iommu_opaque, > @@ -3049,7 +3049,7 @@ int pci_pri_register_notifier(PCIDevice *dev, uint32_t > pasid, > return -EPERM; > } > > - pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); > + pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn); > if (iommu_bus && iommu_bus->iommu_ops->pri_register_notifier) { > iommu_bus->iommu_ops->pri_register_notifier(bus, > iommu_bus->iommu_opaque, > > @@ -3066,7 +3066,7 @@ void pci_pri_unregister_notifier(PCIDevice *dev, > uint32_t pasid) > PCIBus *iommu_bus; > int devfn; > > - pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); > + pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn); > if (iommu_bus && iommu_bus->iommu_ops->pri_unregister_notifier) { > iommu_bus->iommu_ops->pri_unregister_notifier(bus, > > iommu_bus->iommu_opaque, > @@ -3098,7 +3098,7 @@ ssize_t pci_ats_request_translation(PCIDevice *dev, > uint32_t pasid, > return -EPERM; > } > > - pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); > + pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn); > if (iommu_bus && iommu_bus->iommu_ops->ats_request_translation) { > return iommu_bus->iommu_ops->ats_request_translation(bus, > > iommu_bus->iommu_opaque, > @@ -3122,7 +3122,7 @@ int pci_iommu_register_iotlb_notifier(PCIDevice *dev, > uint32_t pasid, > return -EPERM; > } > > - pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); > + pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn); > if (iommu_bus && iommu_bus->iommu_ops->register_iotlb_notifier) { > iommu_bus->iommu_ops->register_iotlb_notifier(bus, > iommu_bus->iommu_opaque, devfn, > @@ -3144,7 +3144,7 @@ int pci_iommu_unregister_iotlb_notifier(PCIDevice *dev, > uint32_t pasid, > return -EPERM; > } > > - pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); > + pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn); > if (iommu_bus && iommu_bus->iommu_ops->unregister_iotlb_notifier) { > iommu_bus->iommu_ops->unregister_iotlb_notifier(bus, > > iommu_bus->iommu_opaque, > @@ -3158,11 +3158,9 @@ int pci_iommu_unregister_iotlb_notifier(PCIDevice > *dev, uint32_t pasid, > int pci_iommu_get_iotlb_info(PCIDevice *dev, uint8_t *addr_width, > uint32_t *min_page_size) > { > - PCIBus *bus; > PCIBus *iommu_bus; > - int devfn; > > - pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); > + pci_device_get_iommu_bus_devfn(dev, &iommu_bus, NULL, NULL); > if (iommu_bus && iommu_bus->iommu_ops->get_iotlb_info) { > iommu_bus->iommu_ops->get_iotlb_info(iommu_bus->iommu_opaque, > addr_width, min_page_size);
