Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH V2] PCI/TPH: Skip Root Port completer check for RC_END devices
@ 2025-10-16  8:20 George Abraham P
  2025-12-17 12:27 ` George Abraham P
  0 siblings, 1 reply; 2+ messages in thread
From: George Abraham P @ 2025-10-16  8:20 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, giovanni.cabiddu, George Abraham P

Root Complex Integrated Endpoint devices (PCI_EXP_TYPE_RC_END) are
directly integrated into the root complex and do not have an
associated Root Port in the traditional PCIe hierarchy. The current
TPH implementation incorrectly attempts to find and check a Root Port's
TPH completer capability for these devices.

Add a check to skip Root Port completer type verification for RC_END
devices, allowing them to use their full TPH requester capability
without being limited by a non-existent Root Port's completer support.

For RC_END devices, the root complex itself acts as the TPH completer,
and this relationship is handled differently than the standard
endpoint-to-Root-Port model.

Fixes: f69767a1ada3 ("PCI: Add TLP Processing Hints (TPH) support")
Signed-off-by: George Abraham P <george.abraham.p@intel.com>
---
v1->v2:
  - Added "Fixes:" tag to link the commit hash that introduced the code

 drivers/pci/tph.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
index cc64f93709a4..c61456d24f61 100644
--- a/drivers/pci/tph.c
+++ b/drivers/pci/tph.c
@@ -397,10 +397,13 @@ int pcie_enable_tph(struct pci_dev *pdev, int mode)
 	else
 		pdev->tph_req_type = PCI_TPH_REQ_TPH_ONLY;
 
-	rp_req_type = get_rp_completer_type(pdev);
+	/* Check if the device is behind a Root Port */
+	if (pci_pcie_type(pdev) != PCI_EXP_TYPE_RC_END) {
+		rp_req_type = get_rp_completer_type(pdev);
 
-	/* Final req_type is the smallest value of two */
-	pdev->tph_req_type = min(pdev->tph_req_type, rp_req_type);
+		/* Final req_type is the smallest value of two */
+		pdev->tph_req_type = min(pdev->tph_req_type, rp_req_type);
+	}
 
 	if (pdev->tph_req_type == PCI_TPH_REQ_DISABLE)
 		return -EINVAL;

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2] PCI/TPH: Skip Root Port completer check for RC_END devices
  2025-10-16  8:20 [PATCH V2] PCI/TPH: Skip Root Port completer check for RC_END devices George Abraham P
@ 2025-12-17 12:27 ` George Abraham P
  0 siblings, 0 replies; 2+ messages in thread
From: George Abraham P @ 2025-12-17 12:27 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, giovanni.cabiddu

Hi Bjorn,

On 16-Oct-25 1:50 PM, George Abraham P wrote:
> Root Complex Integrated Endpoint devices (PCI_EXP_TYPE_RC_END) are
> directly integrated into the root complex and do not have an
> associated Root Port in the traditional PCIe hierarchy. The current
> TPH implementation incorrectly attempts to find and check a Root Port's
> TPH completer capability for these devices.
> 
> Add a check to skip Root Port completer type verification for RC_END
> devices, allowing them to use their full TPH requester capability
> without being limited by a non-existent Root Port's completer support.
> 
> For RC_END devices, the root complex itself acts as the TPH completer,
> and this relationship is handled differently than the standard
> endpoint-to-Root-Port model.
> 
> Fixes: f69767a1ada3 ("PCI: Add TLP Processing Hints (TPH) support")
> Signed-off-by: George Abraham P <george.abraham.p@intel.com>
> ---
> v1->v2:
>   - Added "Fixes:" tag to link the commit hash that introduced the code
> 
>  drivers/pci/tph.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
> index cc64f93709a4..c61456d24f61 100644
> --- a/drivers/pci/tph.c
> +++ b/drivers/pci/tph.c
> @@ -397,10 +397,13 @@ int pcie_enable_tph(struct pci_dev *pdev, int mode)
>  	else
>  		pdev->tph_req_type = PCI_TPH_REQ_TPH_ONLY;
>  
> -	rp_req_type = get_rp_completer_type(pdev);
> +	/* Check if the device is behind a Root Port */
> +	if (pci_pcie_type(pdev) != PCI_EXP_TYPE_RC_END) {
> +		rp_req_type = get_rp_completer_type(pdev);
>  
> -	/* Final req_type is the smallest value of two */
> -	pdev->tph_req_type = min(pdev->tph_req_type, rp_req_type);
> +		/* Final req_type is the smallest value of two */
> +		pdev->tph_req_type = min(pdev->tph_req_type, rp_req_type);
> +	}
>  
>  	if (pdev->tph_req_type == PCI_TPH_REQ_DISABLE)
>  		return -EINVAL;
> 
> base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787

Kindly let me know if there is anything i can do to take this patch forward.

Thanks,
George



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-17 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16  8:20 [PATCH V2] PCI/TPH: Skip Root Port completer check for RC_END devices George Abraham P
2025-12-17 12:27 ` George Abraham P

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox