 ba7d12eb8c
			
		
	
	
		ba7d12eb8c
		
	
	
	
	
		
			
			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>
		
	
			
		
			
				
	
	
		
			76 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			76 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #ifndef QEMU_PCI_BUS_H
 | |
| #define QEMU_PCI_BUS_H
 | |
| 
 | |
| #include "hw/pci/pci.h"
 | |
| 
 | |
| /*
 | |
|  * PCI Bus datastructures.
 | |
|  *
 | |
|  * Do not access the following members directly;
 | |
|  * use accessor functions in pci.h
 | |
|  */
 | |
| 
 | |
| struct PCIBusClass {
 | |
|     /*< private >*/
 | |
|     BusClass parent_class;
 | |
|     /*< public >*/
 | |
| 
 | |
|     int (*bus_num)(PCIBus *bus);
 | |
|     uint16_t (*numa_node)(PCIBus *bus);
 | |
| };
 | |
| 
 | |
| enum PCIBusFlags {
 | |
|     /* This bus is the root of a PCI domain */
 | |
|     PCI_BUS_IS_ROOT                                         = 0x0001,
 | |
|     /* PCIe extended configuration space is accessible on this bus */
 | |
|     PCI_BUS_EXTENDED_CONFIG_SPACE                           = 0x0002,
 | |
|     /* This is a CXL Type BUS */
 | |
|     PCI_BUS_CXL                                             = 0x0004,
 | |
| };
 | |
| 
 | |
| #define PCI_NO_PASID UINT32_MAX
 | |
| 
 | |
| struct PCIBus {
 | |
|     BusState qbus;
 | |
|     enum PCIBusFlags flags;
 | |
|     const PCIIOMMUOps *iommu_ops;
 | |
|     void *iommu_opaque;
 | |
|     uint8_t devfn_min;
 | |
|     uint32_t slot_reserved_mask;
 | |
|     pci_set_irq_fn set_irq;
 | |
|     pci_map_irq_fn map_irq;
 | |
|     pci_route_irq_fn route_intx_to_irq;
 | |
|     void *irq_opaque;
 | |
|     PCIDevice *devices[PCI_SLOT_MAX * PCI_FUNC_MAX];
 | |
|     PCIDevice *parent_dev;
 | |
|     MemoryRegion *address_space_mem;
 | |
|     MemoryRegion *address_space_io;
 | |
| 
 | |
|     QLIST_HEAD(, PCIBus) child; /* this will be replaced by qdev later */
 | |
|     QLIST_ENTRY(PCIBus) sibling;/* this will be replaced by qdev later */
 | |
| 
 | |
|     /* The bus IRQ state is the logical OR of the connected devices.
 | |
|        Keep a count of the number of devices with raised IRQs.  */
 | |
|     int nirq;
 | |
|     int *irq_count;
 | |
| 
 | |
|     Notifier machine_done;
 | |
| };
 | |
| 
 | |
| static inline bool pci_bus_is_cxl(PCIBus *bus)
 | |
| {
 | |
|     return !!(bus->flags & PCI_BUS_CXL);
 | |
| }
 | |
| 
 | |
| static inline bool pci_bus_is_root(PCIBus *bus)
 | |
| {
 | |
|     return !!(bus->flags & PCI_BUS_IS_ROOT);
 | |
| }
 | |
| 
 | |
| static inline bool pci_bus_allows_extended_config_space(PCIBus *bus)
 | |
| {
 | |
|     return !!(bus->flags & PCI_BUS_EXTENDED_CONFIG_SPACE);
 | |
| }
 | |
| 
 | |
| #endif /* QEMU_PCI_BUS_H */
 |