mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps
This patch modifies pci_setup_iommu() to set PCIIOMMUOps instead of setting PCIIOMMUFunc. PCIIOMMUFunc is used to get an address space for a PCI device in vendor specific way. The PCIIOMMUOps still offers this functionality. But using PCIIOMMUOps leaves space to add more iommu related vendor specific operations. Cc: Kevin Tian <kevin.tian@intel.com> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: Peter Xu <peterx@redhat.com> Cc: Eric Auger <eric.auger@redhat.com> Cc: Yi Sun <yi.y.sun@linux.intel.com> Cc: David Gibson <david@gibson.dropbear.id.au> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Eric Auger <eric.auger@redhat.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Peter Xu <peterx@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Helge Deller <deller@gmx.de> Cc: Hervé Poussineau <hpoussin@reactos.org> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Cc: BALATON Zoltan <balaton@eik.bme.hu> Cc: Elena Ufimtseva <elena.ufimtseva@oracle.com> Cc: Jagannathan Raman <jag.raman@oracle.com> Cc: Matthew Rosato <mjrosato@linux.ibm.com> Cc: Eric Farman <farman@linux.ibm.com> Cc: Halil Pasic <pasic@linux.ibm.com> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> Cc: Thomas Huth <thuth@redhat.com> Cc: Helge Deller <deller@gmx.de> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Eric Auger <eric.auger@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> [ clg: - refreshed on latest QEMU - included hw/remote/iommu.c - documentation update - asserts in pci_setup_iommu() - removed checks on iommu_bus->iommu_ops->get_address_space - included Elroy PCI host (PA-RISC) ] Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
71177490a8
commit
ba7d12eb8c
22 changed files with 143 additions and 26 deletions
|
@ -363,10 +363,42 @@ void pci_bus_get_w64_range(PCIBus *bus, Range *range);
|
|||
|
||||
void pci_device_deassert_intx(PCIDevice *dev);
|
||||
|
||||
typedef AddressSpace *(*PCIIOMMUFunc)(PCIBus *, void *, int);
|
||||
|
||||
/**
|
||||
* struct PCIIOMMUOps: callbacks structure for specific IOMMU handlers
|
||||
* of a PCIBus
|
||||
*
|
||||
* Allows to modify the behavior of some IOMMU operations of the PCI
|
||||
* framework for a set of devices on a PCI bus.
|
||||
*/
|
||||
typedef struct PCIIOMMUOps {
|
||||
/**
|
||||
* @get_address_space: get the address space for a set of devices
|
||||
* on a PCI bus.
|
||||
*
|
||||
* Mandatory callback which returns a pointer to an #AddressSpace
|
||||
*
|
||||
* @bus: the #PCIBus being accessed.
|
||||
*
|
||||
* @opaque: the data passed to pci_setup_iommu().
|
||||
*
|
||||
* @devfn: device and function number
|
||||
*/
|
||||
AddressSpace * (*get_address_space)(PCIBus *bus, void *opaque, int devfn);
|
||||
} PCIIOMMUOps;
|
||||
|
||||
AddressSpace *pci_device_iommu_address_space(PCIDevice *dev);
|
||||
void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque);
|
||||
|
||||
/**
|
||||
* pci_setup_iommu: Initialize specific IOMMU handlers for a PCIBus
|
||||
*
|
||||
* Let PCI host bridges define specific operations.
|
||||
*
|
||||
* @bus: the #PCIBus being updated.
|
||||
* @ops: the #PCIIOMMUOps
|
||||
* @opaque: passed to callbacks of the @ops structure.
|
||||
*/
|
||||
void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque);
|
||||
|
||||
pcibus_t pci_bar_address(PCIDevice *d,
|
||||
int reg, uint8_t type, pcibus_t size);
|
||||
|
|
|
@ -33,7 +33,7 @@ enum PCIBusFlags {
|
|||
struct PCIBus {
|
||||
BusState qbus;
|
||||
enum PCIBusFlags flags;
|
||||
PCIIOMMUFunc iommu_fn;
|
||||
const PCIIOMMUOps *iommu_ops;
|
||||
void *iommu_opaque;
|
||||
uint8_t devfn_min;
|
||||
uint32_t slot_reserved_mask;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue