Hi,

does anyone on this list have experience with $SUBJECT, using physical
UEFI firmware derived from edk2?

The problem we're seeing with OVMF is the following: PCIe hotplug works
with PCIe root ports, but it doesn't work with PCIe downstream ports.
The error messages reported by both Linux and Windows guests indicate
"lack of resources" for the device being plugged.

In my understanding:

* Each PCIe downstream port qualifies as a separate bus / bridge.

* Bridges need IO and MMIO resources for themselves. When a device is
  behind a bridge at boot, the device's IO and MMIO BARs are carved out
  of the bridge's IO and MMIO apertures. For IO, the standard bridge
  aperture size is 4096 (byte-sized) ports.

* If no device behind a bridge needs a specific type of resource (for
  example, no devices behind a bridge have IO BARs), then that kind of
  aperture is not necessary for the bridge either.

  A special case of this is when there are no devices behind a bridge
  at all. Example: PCIe downstream port empty at boot. In this case,
  the bridge needs no resources at all, at boot.

* Different firmwares seem to follow different policies in the last
  case (-> bridge empty at boot). SeaBIOS for example allocates the
  0x1000 IO ports nonetheless. The PCI bus driver in edk2 does not: it
  allocates no apertures for bridges that have no devices behind them
  at boot.

  This appears to be a trade-off: if the bridge remains empty for the
  entire lifetime of the OS, then any IO ports that have been allocated
  in advance will be in vain (wasted). However, if the aperture is not
  allocated at boot, then hotplug under the bridge may not work --
  resources for the device being hot-plugged cannot be allocated from
  nonexistent bridge apertures.

And that's what we are experiencing with OVMF.

My questions are:

- Is the above behavior of the edk2 PCI bus driver intentional?

- Does PCIe hotplug into downstream ports work with any (phys) firmware
  forked from edk2? Brian, Samer, do you guys have experience with this?

- What could be the difference between root ports and downstream ports?
  (Hotplug into root ports seems to work fine.) Are OSes entitled to
  allocate any unused address space (MMIO and IO) right when a device is
  hot-plugged into a root port?

Thanks!
Laszlo
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to