apb: QOMify IOMMU

This is in preparation to split the IOMMU device out of the APB. As part of
this commit we also enforce separation of the IOMMU and APB devices by using
a QOM object link to pass the IOMMU reference and accessing the IOMMU registers
via a separate memory region mapped into the APB config space rather than
directly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Artyom Tarasenko <atar4qemu@gmail.com>
This commit is contained in:
Mark Cave-Ayland 2018-01-08 18:16:34 +00:00
parent f5980f757c
commit aea5b07101
3 changed files with 70 additions and 22 deletions

View file

@ -44,12 +44,18 @@
#define IOMMU_TSB_64K_OFFSET_MASK_2G 0x000000007fff0000ULL
typedef struct IOMMUState {
SysBusDevice parent_obj;
AddressSpace iommu_as;
IOMMUMemoryRegion iommu;
MemoryRegion iomem;
uint64_t regs[IOMMU_NREGS];
} IOMMUState;
#define TYPE_SUN4U_IOMMU "sun4u-iommu"
#define SUN4U_IOMMU(obj) OBJECT_CHECK(IOMMUState, (obj), TYPE_SUN4U_IOMMU)
#define MAX_IVEC 0x40
/* OBIO IVEC IRQs */
@ -78,7 +84,7 @@ typedef struct APBState {
MemoryRegion pci_mmio;
MemoryRegion pci_ioport;
uint64_t pci_irq_in;
IOMMUState iommu;
IOMMUState *iommu;
PCIBridge *bridgeA;
PCIBridge *bridgeB;
uint32_t pci_control[16];