ppc-for-4.0 queue 20190409
The following changes since commit 5263724b78f89cdea2354c8e92c53bac1b4641a3:
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-04-08 17:53:18 +0100)
are available in the Git repository at:
git://github.com/dgibson/qemu.git tags/ppc-for-4.0-20190409
for you to fetch changes up to 5cf0d326a0fec9ebac2d47c42b5f08e6bc2f686c:
spapr_pci: Fix extended config space accesses (2019-04-09 15:03:10 +1000)
----------------------------------------------------------------
ppc patch queue 2019-04-09
This is a small, hard freeze, pull request which fixes a regression on the pseries machine handling of PCI-E extended config space accesses.
----------------------------------------------------------------
Greg Kurz (2):
pci: Allow PCI bus subtypes to support extended config space accesses
spapr_pci: Fix extended config space accesses
hw/pci/pci.c | 24 ++++++++++++++++++++++++ hw/pci/pci_host.c | 2 +- hw/ppc/spapr_pci.c | 28 ++++++++++++++++++++++++++-- include/hw/pci/pci.h | 2 ++ include/hw/pci/pci_bus.h | 1 + 5 files changed, 54 insertions(+), 3 deletions(-)
[Qemu-devel] [PULL 2/2] spapr_pci: Fix extended config space accesses
From: Greg Kurz <[email protected]>
The PAPR PHB acts as a legacy PCI bus but it allows PCIe extended config space accesses anyway (for pseries-2.9 and newer machine types).
Introduce a specific PCI bus subtype to inform the common PCI code about that.
Message-Id: <[email protected]>
--- hw/ppc/spapr_pci.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
hw/ppc/spapr_pci.c +26 -2
@@ -1638,6 +1638,28 @@ static void spapr_phb_unrealize(DeviceState *dev, Error **errp)memory_region_del_subregion (get_system_memory (), &sphb->mem32window); } +static bool spapr_phb_allows_extended_config_space (PCIBus *bus) +{ +SpaprPhbState *sphb =SPAPR_PCI_HOST_BRIDGE (BUS (bus)->parent); + +return sphb->pcie_ecs; +} + +static void spapr_phb_root_bus_class_init (ObjectClass *klass,void *data) +{ +PCIBusClass *pbc =PCI_BUS_CLASS (klass); + + pbc->allows_extended_config_space = spapr_phb_allows_extended_config_space; +} + +#define TYPE_SPAPR_PHB_ROOT_BUS "spapr-pci-host-bridge-root-bus" + +static const TypeInfo spapr_phb_root_bus_info = { + .name =TYPE_SPAPR_PHB_ROOT_BUS , + .parent =TYPE_PCI_BUS , + .class_init = spapr_phb_root_bus_class_init, +}; +static void spapr_phb_realize (DeviceState *dev,Error **errp) {/* We don't use SPAPR_MACHINE() in order to exit gracefully if the user
@@ -1739,10 +1761,11 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (get_system_memory (), sphb->io_win_addr, &sphb->iowindow); - bus =pci_register_root_bus (dev,NULL , + bus =pci_register_root_bus (dev,"pci.0" , pci_spapr_set_irq, pci_spapr_map_irq, sphb, &sphb->memspace, &sphb->iospace, -PCI_DEVFN (0 ,0 ),PCI_NUM_PINS ,TYPE_PCI_BUS ); +PCI_DEVFN (0 ,0 ),PCI_NUM_PINS , +TYPE_SPAPR_PHB_ROOT_BUS ); phb->bus = bus;qbus_set_hotplug_handler (BUS (phb->bus),OBJECT (sphb),NULL );
@@ -2325,6 +2348,7 @@ void spapr_pci_rtas_init(void)static void spapr_pci_register_types (void ) {type_register_static (&spapr_phb_info); +type_register_static (&spapr_phb_root_bus_info); }type_init (spapr_pci_register_types)
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 1/2] pci: Allow PCI bus subtypes to support extended config space accesses
In reply to David GibsonFrom: Greg Kurz <[email protected]>
Some PHB implementations, eg. PAPR used on pseries machine, act like a regular PCI bus rather than a PCIe bus, but allow access to the PCIe extended config space anyway.
Introduce a new PCI bus class method to modelize this behaviour and use it when adjusting the config space size limit during accesses.
No behaviour change for existing PCI bus types.
Message-Id: <[email protected]>
--- hw/pci/pci.c | 24 ++++++++++++++++++++++++ hw/pci/pci_host.c | 2 +- include/hw/pci/pci.h | 2 ++ include/hw/pci/pci_bus.h | 1 + 4 files changed, 28 insertions(+), 1 deletion(-)
hw/pci/pci.c +24 -0
@@ -147,6 +147,11 @@ static uint16_t pcibus_numa_node(PCIBus *bus)return NUMA_NODE_UNASSIGNED ; } +static bool pcibus_allows_extended_config_space (PCIBus *bus) +{ +return false; +} +static void pci_bus_class_init (ObjectClass *klass,void *data) {BusClass *k =BUS_CLASS (klass);
@@ -162,6 +167,7 @@ static void pci_bus_class_init(ObjectClass *klass, void *data) pbc->is_root = pcibus_is_root; pbc->bus_num = pcibus_num; pbc->numa_node = pcibus_numa_node; + pbc->allows_extended_config_space = pcibus_allows_extended_config_space; }static const TypeInfo pci_bus_info = {
@@ -182,9 +188,22 @@ static const TypeInfo conventional_pci_interface_info = { .parent = TYPE_INTERFACE, }; +static bool pciebus_allows_extended_config_space (PCIBus *bus) +{ +return true; +} + +static void pcie_bus_class_init (ObjectClass *klass,void *data) +{ +PCIBusClass *pbc =PCI_BUS_CLASS (klass); + + pbc->allows_extended_config_space = pciebus_allows_extended_config_space; +} +static const TypeInfo pcie_bus_info = { .name =TYPE_PCIE_BUS , .parent =TYPE_PCI_BUS , + .class_init = pcie_bus_class_init, };static PCIBus *pci_find_bus_nr (PCIBus *bus,int bus_num);
@@ -401,6 +420,11 @@ bool pci_bus_is_root(PCIBus *bus)return PCI_BUS_GET_CLASS (bus)->is_root (bus); } +bool pci_bus_allows_extended_config_space (PCIBus *bus) +{ +return PCI_BUS_GET_CLASS (bus)->allows_extended_config_space (bus); +} + void pci_root_bus_new_inplace(PCIBus *bus, size_t bus_size, DeviceState *parent, const char *name, MemoryRegion *address_space_mem,
hw/pci/pci_host.c +1 -1
@@ -54,7 +54,7 @@ static inline PCIDevice *pci_dev_find_by_addr(PCIBus *bus, uint32_t addr)static void pci_adjust_config_limit (PCIBus *bus,uint32_t *limit) {if (*limit >PCI_CONFIG_SPACE_SIZE ) { -if (!pci_bus_is_express (bus)) { +if (!pci_bus_allows_extended_config_space (bus)) { *limit =PCI_CONFIG_SPACE_SIZE ;return ; }
include/hw/pci/pci.h +2 -0
@@ -396,6 +396,8 @@ typedef PCIINTxRoute (*pci_route_irq_fn)(void *opaque, int pin);bool pci_bus_is_express (PCIBus *bus);bool pci_bus_is_root (PCIBus *bus); +bool pci_bus_allows_extended_config_space (PCIBus *bus); + void pci_root_bus_new_inplace(PCIBus *bus, size_t bus_size, DeviceState *parent, const char *name, MemoryRegion *address_space_mem,
include/hw/pci/pci_bus.h +1 -0
@@ -18,6 +18,7 @@ typedef struct PCIBusClass {bool (*is_root)(PCIBus *bus);int (*bus_num)(PCIBus *bus);uint16_t (*numa_node)(PCIBus *bus); +bool (*allows_extended_config_space)(PCIBus *bus); } PCIBusClass;struct PCIBus {
Signature · 1 line
2.20.1
Peter Maydell
AppliedQuoted 13 lines · David Gibson
The following changes since commit
5263724b78f89cdea2354c8e92c53bac1b4641a3:Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-04-08 17:53:18 +0100)
are available in the Git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-4.0-20190409for you to fetch changes up to
5cf0d326a0fec9ebac2d47c42b5f08e6bc2f686c:
spapr_pci: Fix extended config space accesses (2019-04-09 15:03:10 +1000)
Quoted 7 lines
----------------------------------------------------------------
ppc patch queue 2019-04-09This is a small, hard freeze, pull request which fixes a regression on the pseries machine handling of PCI-E extended config space accesses.
----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.
-- PMM