audk/MdeModulePkg
Laszlo Ersek e5b4d825af MdeModulePkg/PciBusDxe: catch unimplemented extended config space reads
When assigning a physical PCIe device to a QEMU/KVM guest, PciBusDxe may
find that the extended config space is not (fully) implemented. In
LocatePciExpressCapabilityRegBlock(), "CapabilityEntry" may be read as
0xFFFF_FFFF at a given config space offset, after which the loop gets
stuck spinning on offset 0xFFC (the read at offset 0xFFC returns
0xFFFF_FFFF most likely as well).

Another scenario (not related to virtualization) for triggering the above
is when a Conventional PCI bus -- exposed by a PCIe-to-PCI bridge in the
topology -- intervenes between a PCI Express Root Port and a PCI Express
Endpoint. The Conventional PCI bus limits the accessible config space of
the PCI Express Endpoint, even though the endpoint advertizes the PCI
Express capability. Here's a diagram, courtesy of Alex Williamson:

  [PCIe Root Port]--[PCIe-to-PCI]--[PCI-to-PCIe]--[PCIe EP]
                              ->|  |<- Conventional PCI bus

Catch reads of 0xFFFF_FFFF in LocatePciExpressCapabilityRegBlock(), and
break out of the scan with a warning message. The function will return
EFI_NOT_FOUND.

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2019-06-11 18:51:06 +02:00
..
Application Revert "EmulatorPkg: don't display the cpu current speed" 2019-06-05 10:10:41 +02:00
Bus MdeModulePkg/PciBusDxe: catch unimplemented extended config space reads 2019-06-11 18:51:06 +02:00
Core MdeModulePkg/Core: Remove PcdFrameworkCompatibilitySupport usage 2019-05-09 09:42:55 +08:00
Include NetworkPkg: Move Network library header file from MdeModulePkg to NetworkPkg 2019-05-27 09:25:18 +08:00
Library NetworkPkg: Move Network library and drivers from MdeModulePkg to NetworkPkg 2019-05-27 09:25:18 +08:00
Logo MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00
Universal NetworkPkg: Move Network library and drivers from MdeModulePkg to NetworkPkg 2019-05-27 09:25:18 +08:00
MdeModulePkg.dec MdeModulePkg: Remove network library header file from package DEC file 2019-05-27 09:25:18 +08:00
MdeModulePkg.dsc MdeModulePkg: Update MdeModulePkg.dsc to remove Network related modules 2019-05-23 22:41:01 +08:00
MdeModulePkg.uni MdeModulePkg: BaseSerialPortLib16550: Add missing Pcd to UNI 2019-05-10 16:43:22 +08:00
MdeModulePkgExtra.uni MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00