Marcel Apfelbaum | 814550d | 2015-06-02 14:23:12 +0300 | [diff] [blame] | 1 | PCI EXPANDER BRIDGE (PXB) |
| 2 | ========================= |
| 3 | |
| 4 | Description |
| 5 | =========== |
| 6 | PXB is a "light-weight" host bridge in the same PCI domain |
| 7 | as the main host bridge whose purpose is to enable |
| 8 | the main host bridge to support multiple PCI root buses. |
| 9 | It is implemented only for i440fx and can be placed only |
| 10 | on bus 0 (pci.0). |
| 11 | |
| 12 | As opposed to PCI-2-PCI bridge's secondary bus, PXB's bus |
| 13 | is a primary bus and can be associated with a NUMA node |
| 14 | (different from the main host bridge) allowing the guest OS |
| 15 | to recognize the proximity of a pass-through device to |
| 16 | other resources as RAM and CPUs. |
| 17 | |
| 18 | Usage |
| 19 | ===== |
| 20 | A detailed command line would be: |
| 21 | |
| 22 | [qemu-bin + storage options] |
| 23 | -m 2G |
| 24 | -object memory-backend-ram,size=1024M,policy=bind,host-nodes=0,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0 |
| 25 | -object memory-backend-ram,size=1024M,policy=bind,host-nodes=1,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1 |
Cao jin | 40c5204 | 2015-12-22 20:00:43 +0800 | [diff] [blame] | 26 | -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 |
Cao jin | f9735fd | 2016-03-01 17:45:24 +0800 | [diff] [blame] | 27 | -device pxb,id=bridge2,bus=pci.0,numa_node=0,bus_nr=8 -device e1000,bus=bridge2,addr=0x3 |
| 28 | -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 |
Marcel Apfelbaum | 814550d | 2015-06-02 14:23:12 +0300 | [diff] [blame] | 29 | |
| 30 | Here you have: |
| 31 | - 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) |
| 32 | - a pxb host bridge attached to NUMA 1 with an e1000 behind it |
| 33 | - a pxb host bridge attached to NUMA 0 with an e1000 behind it |
| 34 | - a pxb host bridge not attached to any NUMA with a hard drive behind it. |
| 35 | |
| 36 | Limitations |
| 37 | =========== |
| 38 | Please observe that we specified the bus "pci.0" for the second and third pxb. |
| 39 | This is because when no bus is given, another pxb can be selected by QEMU as default bus, |
| 40 | however, PXBs can be placed only under the root bus. |
| 41 | |
| 42 | Implementation |
| 43 | ============== |
| 44 | The PXB is composed by: |
| 45 | - HostBridge (TYPE_PXB_HOST) |
Cao jin | f9735fd | 2016-03-01 17:45:24 +0800 | [diff] [blame] | 46 | The host bridge allows to register and query the PXB's PCI root bus in QEMU. |
Marcel Apfelbaum | 814550d | 2015-06-02 14:23:12 +0300 | [diff] [blame] | 47 | - PXBDev(TYPE_PXB_DEVICE) |
| 48 | It is a regular PCI Device that resides on the piix host-bridge bus and its bus uses the same PCI domain. |
| 49 | However, the bus behind is exposed through ACPI as a primary PCI bus and starts a new PCI hierarchy. |
| 50 | The interrupts from devices behind the PXB are routed through this device the same as if it were a |
| 51 | PCI-2-PCI bridge. The _PRT follows the i440fx model. |
| 52 | - PCIBridgeDev(TYPE_PCI_BRIDGE_DEV) |
| 53 | Created automatically as part of init sequence. |
| 54 | When adding a device to PXB it is attached to the bridge for two reasons: |
| 55 | - Using the bridge will enable hotplug support |
| 56 | - All the devices behind the bridge will use bridge's IO/MEM windows compacting |
| 57 | the PCI address space. |
| 58 | |