Skip to contentSkip to conversation

PCI/TPH: Skip Root Port completer check for RC_END devices

PATCH RESEND Applied George Abraham P 4 participants 6 messages Jan 9 – Feb 27 PCI

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 PCI/TPH: Skip Root Port completer check for RC_END devices

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")

---
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(-)
drivers/pci/tph.c +6 -3
index ca4f97be7538..e896b3958281 100644
@@ -407,10 +407,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;
Signature · 1 line
2.40.1
#1 lore raw

[+cc TPH authors that were missed in the previous mail]

Quoted 44 lines · 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")

---
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(-)
drivers/pci/tph.c +6 -3
index ca4f97be7538..e896b3958281 100644
@@ -407,10 +407,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;
#2 lore raw
Quoted 22 lines · George Abraham P

[+cc TPH authors that were missed in the previous mail]

Quoted 19 lines · 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")

---
v1->v2:
- Added "Fixes:" tag to link the commit hash that introduced the code

I do not have a strong preference; I am fine with adding a Fixes tag or leaving it out. Up to commit 2961f841b025, pcie_enable_tph() is called in two drivers: bnxt and mlx5. Which of these devices is the RC_END device?

Thanks

#3 lore raw

Hi Leon,

Quoted 24 lines · Leon Romanovsky
Quoted 22 lines · George Abraham P

[+cc TPH authors that were missed in the previous mail]

Quoted 19 lines · 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")

---
v1->v2:
- Added "Fixes:" tag to link the commit hash that introduced the code

Quoted 6 lines

I do not have a strong preference; I am fine with adding a Fixes tag or leaving it out. Up to commit 2961f841b025, pcie_enable_tph() is called in two drivers: bnxt and mlx5. Which of these devices is the RC_END device?

Thanks

qat_6xxx supports TPH and is a RC_END device. The patches to enable TPH on qat_6xxx is yet to be reviewed. However, it requires this fix for the same to work.

Thanks,
George

#4 lore raw
Quoted 27 lines · George Abraham P

Hi Leon,

Quoted 24 lines · Leon Romanovsky
Quoted 22 lines · George Abraham P

[+cc TPH authors that were missed in the previous mail]

Quoted 19 lines · 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")

---
v1->v2:
- Added "Fixes:" tag to link the commit hash that introduced the code

Quoted 9 lines
Quoted 6 lines

I do not have a strong preference; I am fine with adding a Fixes tag or leaving it out. Up to commit 2961f841b025, pcie_enable_tph() is called in two drivers: bnxt and mlx5. Which of these devices is the RC_END device?

Thanks

qat_6xxx supports TPH and is a RC_END device. The patches to enable TPH on qat_6xxx is yet to be reviewed. However, it requires this fix for the same to work.

The patche looks fine to me - it shouldn't affect regular PCI Express Endpoint (type 0000b) devices.

Quoted 2 lines

Thanks,
George

#5 lore raw
In reply to George Abraham P
Quoted 10 lines · 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.

Quoted 6 lines

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")

Applied to pci/enumeration with the following commit log for v7.1, thanks! This will be rebased after v7.0-rc1.

PCI/TPH: Allow TPH enable for RCiEPs

Previously, pcie_enable_tph() only enabled TLP Processing Hints (TPH) if both the Endpoint and its Root Port advertised TPH support.

Root Complex Integrated Endpoints (RCiEPs) are directly integrated into a Root Complex and do not have an associated Root Port, so pcie_enable_tph() never enabled TPH for RCiEPs.

PCIe r7.0 doesn't seem to include a way to learn whether a Root Complex supports TPH, but sec 2.2.7.1.1 says Functions that lack TPH support should ignore TPH, and maybe the same is true for Root Complexes:

A Function that does not support the TPH Completer or Routing capability and receives a transaction with the TH bit [which indicates the presence of TPH in the TLP header] Set is required to ignore the TH bit and handle the Request in the same way as Requests of the same transaction type without the TH bit Set.

Allow drivers to enable TPH for any RCiEP with a TPH Requester Capability.

Quoted 31 lines

---
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(-)
drivers/pci/tph.c +6 -3
index ca4f97be7538..e896b3958281 100644
@@ -407,10 +407,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;
Signature · 1 line
2.40.1