On 7/17/2018 9:42 PM, Laszlo Ersek wrote:
On 07/16/18 11:45, Liu, Jing2 wrote:
On 7/12/2018 3:29 PM, Laszlo Ersek wrote:
On 07/12/18 07:43, Liu, Jing2 wrote:
Yep, thanks for the advice. But hotplugging on pci-bridge is the actual use case request so we would better solve and fix this.
You can cold-plug a PCI Express Root Port in the Q35 root complex (pcie.0), reserving the MMIO resources you want, cold-plug a PCIE-PCI Bridge in that root port, and then hot-plug the desired endpoint into that PCIE-PCI Bridge.
I'm trying this. But actual results show that, when pcie-pci-bridge has no coldplug device, it shows all NONE for each windows. 01:00.0 PCI bridge: Red Hat, Inc. Device 000e (prog-if 00 [Normal decode]) I/O behind bridge: None Memory behind bridge: None Prefetchable memory behind bridge: None
Can you check /proc/iomem, and dmesg?
What is your exact QEMU command line?
I tried again and realized it is my fault to forget the device driver in the guest kernel. After adding that driver, the hotplug is successful.
In conclusion, the legacy pci hotplug can be finished only if 1~3. 1. pcie-root-port reserves enough spaces 2. device drivers exist in guest 3. CONFIG_PCI_REALLOC_ENABLE_AUTO is not set. It is not about this issue. 4. When no device under pcie-pci-bridge, it will show us all NONE. But __pci_bridge_assign_resources (qemu codes) will dynamic assign the resouce sizes which are got by __pci_bus_size_bridges. SHPC is used.
Thanks very much for the help, Laszlo!
BTW, there's also https://bugzilla.redhat.com/show_bug.cgi?id=1536147. It might be relevant here.
(I haven't personally tested SeaBIOS in the hotplug scenario at hand, but it's been my understanding that, as long as you cold-plug the PCIe-PCI bridge itself, RHBZ#1536147 shouldn't apply, and the hotplug into the bridge should just work. Personally I've only tested the same with OVMF only.)
Adding Marcel and Alexander to the thread (likely belatedly; sorry about that).
Only if I cold plug some device (e.g. e1000) under it, and then hotplug another device might be successful.
BTW, I open the guest kernel config: CONFIG_PCI_REALLOC_ENABLE_AUTO=y, but it doesn't work. I'm not sure if there are some other issues I forgot?
This is one of the exact examples that
"docs/pcie_pci_bridge.txt" provides. (The other example is when the PCIE-PCI bridge itself is hot-plugged into the root port, for which bus number reservation is necessary too, at the root port level.)
If you want more than that, e.g. do something similar on i440fx, that will take QEMU work as well, not just SeaBIOS.