xref: /qemu/docs/pci_expander_bridge.txt (revision f9735fd5)
1814550d7SMarcel ApfelbaumPCI EXPANDER BRIDGE (PXB)
2814550d7SMarcel Apfelbaum=========================
3814550d7SMarcel Apfelbaum
4814550d7SMarcel ApfelbaumDescription
5814550d7SMarcel Apfelbaum===========
6814550d7SMarcel ApfelbaumPXB is a "light-weight" host bridge in the same PCI domain
7814550d7SMarcel Apfelbaumas the main host bridge whose purpose is to enable
8814550d7SMarcel Apfelbaumthe main host bridge to support multiple PCI root buses.
9814550d7SMarcel ApfelbaumIt is implemented only for i440fx and can be placed only
10814550d7SMarcel Apfelbaumon bus 0 (pci.0).
11814550d7SMarcel Apfelbaum
12814550d7SMarcel ApfelbaumAs opposed to PCI-2-PCI bridge's secondary bus, PXB's bus
13814550d7SMarcel Apfelbaumis a primary bus and can be associated with a NUMA node
14814550d7SMarcel Apfelbaum(different from the main host bridge) allowing the guest OS
15814550d7SMarcel Apfelbaumto recognize the proximity of a pass-through device to
16814550d7SMarcel Apfelbaumother resources as RAM and CPUs.
17814550d7SMarcel Apfelbaum
18814550d7SMarcel ApfelbaumUsage
19814550d7SMarcel Apfelbaum=====
20814550d7SMarcel ApfelbaumA detailed command line would be:
21814550d7SMarcel Apfelbaum
22814550d7SMarcel Apfelbaum[qemu-bin + storage options]
23814550d7SMarcel Apfelbaum-m 2G
24814550d7SMarcel Apfelbaum-object memory-backend-ram,size=1024M,policy=bind,host-nodes=0,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0
25814550d7SMarcel Apfelbaum-object memory-backend-ram,size=1024M,policy=bind,host-nodes=1,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1
26814550d7SMarcel Apfelbaum-device pxb,id=bridge1,bus=pci.0,numa_node=1,bus_nr=4 -netdev user,id=nd -device e1000,bus=bridge1,addr=0x4,netdev=nd
27*f9735fd5SCao jin-device pxb,id=bridge2,bus=pci.0,numa_node=0,bus_nr=8 -device e1000,bus=bridge2,addr=0x3
28*f9735fd5SCao jin-device pxb,id=bridge3,bus=pci.0,bus_nr=40 -drive if=none,id=drive0,file=[img] -device virtio-blk-pci,drive=drive0,scsi=off,bus=bridge3,addr=1
29814550d7SMarcel Apfelbaum
30814550d7SMarcel ApfelbaumHere you have:
31814550d7SMarcel Apfelbaum - 2 NUMA nodes for the guest, 0 and 1. (both mapped to the same NUMA node in host, but you can and should put it in different host NUMA nodes)
32814550d7SMarcel Apfelbaum - a pxb host bridge attached to NUMA 1 with an e1000 behind it
33814550d7SMarcel Apfelbaum - a pxb host bridge attached to NUMA 0 with an e1000 behind it
34814550d7SMarcel Apfelbaum - a pxb host bridge not attached to any NUMA with a hard drive behind it.
35814550d7SMarcel Apfelbaum
36814550d7SMarcel ApfelbaumLimitations
37814550d7SMarcel Apfelbaum===========
38814550d7SMarcel ApfelbaumPlease observe that we specified the bus "pci.0" for the second and third pxb.
39814550d7SMarcel ApfelbaumThis is because when no bus is given, another pxb can be selected by QEMU as default bus,
40814550d7SMarcel Apfelbaumhowever, PXBs can be placed only under the root bus.
41814550d7SMarcel Apfelbaum
42814550d7SMarcel ApfelbaumImplementation
43814550d7SMarcel Apfelbaum==============
44814550d7SMarcel ApfelbaumThe PXB is composed by:
45814550d7SMarcel Apfelbaum- HostBridge (TYPE_PXB_HOST)
46*f9735fd5SCao jin  The host bridge allows to register and query the PXB's PCI root bus in QEMU.
47814550d7SMarcel Apfelbaum- PXBDev(TYPE_PXB_DEVICE)
48814550d7SMarcel Apfelbaum  It is a regular PCI Device that resides on the piix host-bridge bus and its bus uses the same PCI domain.
49814550d7SMarcel Apfelbaum  However, the bus behind is exposed through ACPI as a primary PCI bus and starts a new PCI hierarchy.
50814550d7SMarcel Apfelbaum  The interrupts from devices behind the PXB are routed through this device the same as if it were a
51814550d7SMarcel Apfelbaum  PCI-2-PCI bridge. The _PRT follows the i440fx model.
52814550d7SMarcel Apfelbaum- PCIBridgeDev(TYPE_PCI_BRIDGE_DEV)
53814550d7SMarcel Apfelbaum  Created automatically as part of init sequence.
54814550d7SMarcel Apfelbaum  When adding a device to PXB it is attached to the bridge for two reasons:
55814550d7SMarcel Apfelbaum  - Using the bridge will enable hotplug support
56814550d7SMarcel Apfelbaum  - All the devices behind the bridge will use bridge's IO/MEM windows compacting
57814550d7SMarcel Apfelbaum    the PCI address space.
58814550d7SMarcel Apfelbaum
59