s390x/pci: dynamically allocate iommu
authorYi Min Zhao <zyimin@linux.vnet.ibm.com>
Thu, 8 Dec 2016 05:03:18 +0000 (13:03 +0800)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Fri, 20 Jan 2017 09:01:18 +0000 (10:01 +0100)
commit03805be08195fca358b12dacc26370f8d1b2c27b
treee594e55fe2140114975efd16f6d1c1aa6d61076e
parentde91ea92e9082609dc413f0109abc77283b4ff0a
s390x/pci: dynamically allocate iommu

When initializing a PCI device, an address space is required during PCI
core initialization and before the call to the embedding object hotplug
callback. To provide this AS, we allocate a S390PCIIOMMU object
containing this AS. Initialization of S390PCIIOMMU object is done
before the PCI device is completely created. So that we cannot
associate the IOMMU with the device at the moment. To track the IOMMU
object, we use g_hash functions with the PCI device's bus address as a
key to provide an array of pointers indexed by the PCI device's devfn
to the allocated IOMMU.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
hw/s390x/s390-pci-bus.c
hw/s390x/s390-pci-bus.h