diff options
| author | CLEMENT MATHIEU--DRIF <clement.mathieu--drif@eviden.com> | 2025-05-20 07:19:01 +0000 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2025-06-01 06:38:53 -0400 |
| commit | a849ff5d6fa9d263beaecd6421fff8e21d2591c8 (patch) | |
| tree | 344b810f0772a7d26b69c7895709bec07cd8174e /hw/pci/pci.c | |
| parent | 7e94e45296d68982d448ae57e195efcf8f66649e (diff) | |
| download | focaccia-qemu-a849ff5d6fa9d263beaecd6421fff8e21d2591c8.tar.gz focaccia-qemu-a849ff5d6fa9d263beaecd6421fff8e21d2591c8.zip | |
pci: Add a pci-level initialization function for IOMMU notifiers
This is meant to be used by ATS-capable devices. Signed-off-by: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com> Message-Id: <20250520071823.764266-10-clement.mathieu--drif@eviden.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci/pci.c')
| -rw-r--r-- | hw/pci/pci.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c index fc4954ac81..dfa5a0259e 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2939,6 +2939,23 @@ AddressSpace *pci_device_iommu_address_space(PCIDevice *dev) return &address_space_memory; } +int pci_iommu_init_iotlb_notifier(PCIDevice *dev, IOMMUNotifier *n, + IOMMUNotify fn, void *opaque) +{ + PCIBus *bus; + PCIBus *iommu_bus; + int devfn; + + pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_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); + return 0; + } + + return -ENODEV; +} + bool pci_device_set_iommu_device(PCIDevice *dev, HostIOMMUDevice *hiod, Error **errp) { |