pseries: Improve handling of multiple PCI host bridges
authorDavid Gibson <david@gibson.dropbear.id.au>
Wed, 23 Jan 2013 17:20:39 +0000 (17:20 +0000)
committerAlexander Graf <agraf@suse.de>
Fri, 25 Jan 2013 21:02:55 +0000 (22:02 +0100)
commitcaae58cba07efec5f0616f568531c9dfaf1e9179
tree81f5e343ef6129a3864d75e13f547ad496a1fe79
parentfe828a4d4b7a5617cda7b24e95e327bfb71d790e
pseries: Improve handling of multiple PCI host bridges

Multiple - even many - PCI host bridges (i.e. PCI domains) are very
common on real PAPR compliant hardware.  For reasons related to the
PAPR specified IOMMU interfaces, PCI device assignment with VFIO will
generally require at least two (virtual) PHBs and possibly more
depending on which devices are assigned.

At the moment the qemu PAPR PCI code will not deal with this well,
leaving several crucial parameters of PHBs other than the default one
uninitialized.  This patch reworks the code to allow this.

Every PHB needs a unique BUID (Bus Unit Identifier, the id used for
the PAPR PCI related interfaces) and a unique LIOBN (Logical IO Bus
Number, the id used for the PAPR IOMMU related interfaces).  In
addition they need windows in CPU real address space to access PCI
memory space, PCI IO space and MSIs.  Properties are added to the PCI
host bridge qdevice to allow configuration of all these.

To simplify configuration of multiple PHBs for common cases, a
convenience "index" property is also added.  This can be set instead
of the low-level properties, and will generate suitable values for the
other parameters, different for each index value.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
hw/spapr.c
hw/spapr_pci.c
hw/spapr_pci.h