]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
PCI: Introduce pci_walk_bus_reverse(), for_each_pci_dev_reverse()
authorDan Williams <dan.j.williams@intel.com>
Fri, 31 Oct 2025 21:28:55 +0000 (14:28 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 4 Nov 2025 03:27:40 +0000 (19:27 -0800)
commit215afa89d249bb095126cf00f8be719e421c75e9
tree80a0b8264f84f08aad2155e3b47e01c3af94d124
parentf16469ee733ac52b2373216803699cbb05e82786
PCI: Introduce pci_walk_bus_reverse(), for_each_pci_dev_reverse()

PCI/TSM, the PCI core functionality for the PCIe TEE Device Interface
Security Protocol (TDISP), has a need to walk all subordinate functions of
a Device Security Manager (DSM) to setup a device security context. A DSM
is physical function 0 of multi-function or SR-IOV device endpoint, or it
is an upstream switch port.

In error scenarios or when a TEE Security Manager (TSM) device is removed
it needs to unwind all established DSM contexts.

Introduce reverse versions of PCI device iteration helpers to mirror the
setup path and ensure that dependent children are handled before parents.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Link: https://patch.msgid.link/20251031212902.2256310-4-dan.j.williams@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/base/bus.c
drivers/pci/bus.c
drivers/pci/search.c
include/linux/device/bus.h
include/linux/pci.h