<div dir="ltr"><div><div><div><div>Hello <br><br></div>I&#39;m writing a custom PCI driver for a hobby endpoint. Due to some &quot;special&quot;, possibly unique, circumstance, I need to determine if two devices form a pair. As I&#39;m using a PCI switch to connect these two devices, I&#39;m thinking on the possibility of checking if the two devices share a common pci-pci bridge (or finding the least common ancestor in a directed graph).<br>
<br></div>Basically, I&#39;m trying to implement pci/bus.c::pci_walk_bus(), only, in a downstream direction (from end point to bridge). I could use pci_bus_upstream_bridge() to do my reverse walk but I noticed it uses a semaphore pci_bus_sem that is only made available via internal &quot;pci.h&quot; e.g. not available to outside modules.<br>
<br></div>Along with my study, I would like to ask for advice and a push in the right direction on how can I achieve a reverse PCI walk - if that is possible.<br><br></div><div>Thank you in advance for your help.<br></div>
<div><br></div>~amerei<br><br></div>