Skip to contentSkip to conversation

pci_expander_brdige: Support pxb-pcie host bridge into separate pci domain

RFC In review Zihan Yang 1 participant 2 messages Aug 9, 2018

lore
Share & tools
lore

Zihan Yang

author
#0 lore raw

v4 cover pci_expander_brdige: Support pxb-pcie host bridge into separate pci domain

Currently only q35 host bridge is allocated an item in MCFG table, all pxb host bridges stay within pci domain 0. This series of patches put each pxb host bridge in separate pci domain, allocating a new MCFG table item for it.

Users can configure whether to put pxb host bridge into separate domain by passing parameter domain_nr to pxb pcie device. start_bus property indicates the Base Bus Number(BBN) of the pxb host bridge. Another property max_bus specifies the maximum desired bus numbers to reduce MCFG space cost. Example command is

    -device pxb-pcie,id=br3,bus="pcie.0",start_bus=0,domain_nr=1,max_bus=15

Then this pxb-pcie host bridge is placed at pci domain 1, and only reserve (15+1)=16 buses, which is much smaller than the default 256 buses.

The pxb host does not have an mch in it, as q35 host already has one. All pxb host bridges just serve as expander bridges in QEMU, which makes them a little simpler than q35 host bridge.

The corresponding seabios patch link is

https://mail.coreboot.org/pipermail/seabios/2018-August/012401.html

Current issues:
* seabios will still throw a PCI IO space out of range error, it seems the pcie_pci_bridge is not correctly recognized. I'm working on it.

v4 <- v3:
- Fix bug in setting mcfg table
- bus_nr is not used when pxb-pcie is in a new pci domain

v3 <- v2:
- Replace duplicate properties in pxb pcie host with link property to PXBDev
- Allow seabios to access config space and data space of expander bridge through a different ioport, because 0xcf8 is attached only to sysbus.
- Add a new property start_bus to indicate the BBN of pxb host bridge. The bus_nr property is used as the bus number of pxb-pcie device on pcie.0 bus

v2 <- v1:
- Allow user to configure whether to put pxb-pcie into seperate domain
- Add AML description part of each host bridge
- Modify the location of MCFG space to between RAM hotplug and pci hole64

Zihan Yang (6):
pci_expander_bridge: add type TYPE_PXB_PCIE_HOST
acpi-build: allocate mcfg for pxb-pcie host bridges i386/acpi-build: describe new pci domain in AML
pci_expander_bridge: Add config_read callback
pci_expander_bridge: Add ioport for pxb host bus i386/acpi-build: pxb-pcie start bus should always be 0 in separate pci
domain

 hw/i386/acpi-build.c                        | 169 ++++++++++++++------
 hw/i386/pc.c                                |  14 +-
 hw/pci-bridge/pci_expander_bridge.c         | 230 +++++++++++++++++++++++++++-
 hw/pci-host/q35.c                           |   2 +
 hw/pci/pci.c                                |  14 +-
 include/hw/i386/pc.h                        |   1 +
 include/hw/pci-bridge/pci_expander_bridge.h |  15 ++
 include/hw/pci-host/q35.h                   |   1 +
 include/hw/pci/pci.h                        |   1 +
 include/hw/pci/pci_bus.h                    |   1 +
 include/hw/pci/pci_host.h                   |   2 +-
 11 files changed, 389 insertions(+), 61 deletions(-)
 create mode 100644 include/hw/pci-bridge/pci_expander_bridge.h
Signature · 1 line
2.7.4
author
#1 lore raw

HI all,

Sorry about unthreaded messages, I forgot to add the in-reply-to field in the email. Future
patches will be threaded, but as for this patch, you can refer to the following links
[RFC 1/6]
http://lists.nongnu.org/archive/html/qemu-devel/2018-08/msg01364.html
[RFC 2/6]
http://lists.nongnu.org/archive/html/qemu-devel/2018-08/msg01365.html
[RFC 3/6]
http://lists.nongnu.org/archive/html/qemu-devel/2018-08/msg01366.html
[RFC 4/6]
http://lists.nongnu.org/archive/html/qemu-devel/2018-08/msg01367.html
[RFC 5/6]
http://lists.nongnu.org/archive/html/qemu-devel/2018-08/msg01368.html
[RFC 6/6]
http://lists.nongnu.org/archive/html/qemu-devel/2018-08/msg01369.html

P.S. The "current issue" section of last email is resolved now, but there are other issues.
I will see if I can work them out in the weekend and prepare for a v3 patch of seabios (and
maybe v5 of qemu).

Thanks
Zihan