[v3,0/5] core/pci: Track changes of topology by an OS
mbox series

Message ID 20190816141714.26380-1-s.miroshnichenko@yadro.com
Headers show
Series
  • core/pci: Track changes of topology by an OS
Related show

Message

Sergey Miroshnichenko Aug. 16, 2019, 2:17 p.m. UTC
An OS may re-enumerate the PCIe tree during boot and after hot-plugging a
bridge, but this leads to de-sync of the cached and actual BDF addresses.

Track the changes in bus numbering and update the cached topology (a tree
consisting of struct pci_device nodes) correspondingly, including PEs.

Append the cached topology when reading a config space reveals a hot-added
device, with no need for an explicit OPAL call for that.

Tested on POWER8 PowerNV+PHB3 ppc64le (Vesnin platform) and Linux kernel
5.3.0-rc4: both vanilla and patched for using the standard pciehp hotplug
driver and sysfs rescan instead of the pnv_php driver.

Changes since v2:
 - Removed handling VFs, as skiboot doesn't track them anymore;
 - Use macros for accessing PCI BDF bits.

Changes since v1:
 - Fixed comparing 32-bit constant with uint16_t and uint8_t.

Sergey Miroshnichenko (5):
  core/pci: Add functions to find accessible devices by bdfn
  core/pci: Make the pci_scan_one() function public
  core/pci: Create the struct pci_device nodes automatically
  core/pci: Hook up the writes to PRIMARY/SECONDARY/SUBORDINATE_BUS
    registers
  core/pci: Indicate support for PCI re-enumeration

 core/pci-opal.c | 101 +++++++++++++++++++++++++++++++++++++++++++++---
 core/pci.c      |  88 ++++++++++++++++++++++++++++++++++++++++-
 include/pci.h   |   4 ++
 3 files changed, 186 insertions(+), 7 deletions(-)