mbox series

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

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


Sergei Miroshnichenko Oct. 24, 2019, 6:02 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

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
  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(-)