PCI/PTM: Add pci_upstream_ptm() helper
authorBjorn Helgaas <bhelgaas@google.com>
Fri, 9 Sep 2022 20:24:58 +0000 (15:24 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 12 Sep 2022 20:29:25 +0000 (15:29 -0500)
commite243c173c015d62b2bca9b030777ceba13311033
tree2c61b36ddd001ac6b27a03719ad48af80cbea3ba
parenta47126ec29f538e1197862919f94d3b6668144a4
PCI/PTM: Add pci_upstream_ptm() helper

PTM requires an unbroken path of PTM-supporting devices between the PTM
Root and the ultimate PTM Requester, but if a Switch supports PTM, only the
Upstream Port can have a PTM Capability; the Downstream Ports do not.

Previously we copied the PTM configuration from the Switch Upstream Port to
the Downstream Ports so dev->ptm_enabled for any device implied that all
the upstream devices support PTM.

Instead of making it look like Downstream Ports have their own PTM config,
add pci_upstream_ptm(), which returns the upstream device that has a PTM
Capability (either a Root Port or a Switch Upstream Port).

Link: https://lore.kernel.org/r/20220909202505.314195-3-helgaas@kernel.org
Tested-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/pci/pcie/ptm.c