Re: [PATCH v13 2/5] PCI/TPH: Add requester/completer type helpers

fengchengwen <[email protected]> Mon, 3 Aug 2026 09:21:24 +0800
Newsgroups org.kernel.vger.linux-rdma,org.freedesktop.lists.dri-devel,org.kernel.vger.kvm,org.kernel.vger.linux-pci
Message-ID <[email protected]>
Acked-by: Chengwen Feng <[email protected]>

On 8/1/2026 5:15 AM, Zhiping Zhang wrote:
> Add pcie_tph_enabled_req_type() so drivers can query the enabled TPH
> requester mode without reaching into pci_dev internals.
> 
> Add pcie_tph_completer_type() so drivers that publish TPH metadata for a
> device acting as a completer can gate on the "TPH Completer Supported"
> field of Device Capabilities 2 (bits 13:12, PCI_EXP_DEVCAP2_TPH_COMP_MASK)
> rather than reusing requester-side state. It applies the same reserved-
> encoding fold as get_rp_completer_type(), inlined, so the reserved 0b10
> value never reaches callers.
> 
> This keeps pci_dev::tph_req_type and the completer-capability decode
> inside the PCI/TPH code and provides !CONFIG_PCIE_TPH stubs for callers.
> 
> Signed-off-by: Zhiping Zhang <[email protected]>