Marcel Apfelbaum firstname.lastname@example.org 于2018年8月25日周六 下午4:07写道：
On 08/09/2018 08:43 AM, Zihan Yang wrote:
Currently seabios assumes there is only one pci domain(0), and almost everything operates on pci domain 0 by default. This patch aims to add multiple pci domain support for pci_device, while reserve the original API for compatibility.
This is a necessary addition to support your QEMU patches, Please send a link to the QEMU series on your next re-spin.
OK, I will attach the link in later QEMU patches.
The reason to get seabios involved is that the pxb-pcie host bus created in QEMU is now in a different PCI domain, and its bus number would start from 0 instead of bus_nr. Actually bus_nr should not be used when in another non-zero domain.
That is not necessarily true. As we discussed in QEMU devel mailing list, it is possible PCI buses of a different domain to start from a positive bus number. Both bus_nr and domain_nr support makes sense.
OK, I think I will still use bus_nr as the start bus when in separate domain.
However, QEMU only binds port 0xcf8 and 0xcfc to bus pcie.0. To avoid bus confliction, we should use other port pairs for busses under new domains.
I would skip support for IO based configuration and use only MMCONFIG for extra root buses.
The question remains: how do we assign MMCONFIG space for each PCI domain.
Indeed, seabios does not have fixed MMCONFIG space(except for q35 host) yet.
- when trying to read config space of pcie_pci_bridge, it actually reads out the result of mch. I'm working on this weird behavior.
Changelog: v2 <- v1:
- Fix bugs in filtering domains when traversing pci devices
- Reformat some hardcoded codes, such as probing the pci device in pci_setup
Zihan Yang (3): fw/pciinit: Recognize pxb-pcie-dev device pci_device: Add pci domain support pci: filter undesired domain when traversing pci
src/fw/coreboot.c | 2 +- src/fw/csm.c | 2 +- src/fw/mptable.c | 1 + src/fw/paravirt.c | 3 +- src/fw/pciinit.c | 276 ++++++++++++++++++++++++++++++--------------------- src/hw/ahci.c | 1 + src/hw/ata.c | 1 + src/hw/esp-scsi.c | 1 + src/hw/lsi-scsi.c | 1 + src/hw/megasas.c | 1 + src/hw/mpt-scsi.c | 1 + src/hw/nvme.c | 1 + src/hw/pci.c | 69 +++++++------ src/hw/pci.h | 42 +++++--- src/hw/pci_ids.h | 6 +- src/hw/pcidevice.c | 11 +- src/hw/pcidevice.h | 8 +- src/hw/pvscsi.c | 1 + src/hw/sdcard.c | 1 + src/hw/usb-ehci.c | 1 + src/hw/usb-ohci.c | 1 + src/hw/usb-uhci.c | 1 + src/hw/usb-xhci.c | 1 + src/hw/virtio-blk.c | 1 + src/hw/virtio-scsi.c | 1 + src/optionroms.c | 3 + 26 files changed, 268 insertions(+), 170 deletions(-)