Re: [PATCH] PCI: rcar-gen4: Limit Max_Read_Request_Size and Max_Payload_Size to 256 Bytes
From: Marek Vasut
Date: Tue May 12 2026 - 19:08:41 EST
On 5/13/26 12:57 AM, Marek Vasut wrote:
On 5/11/26 4:34 PM, Manivannan Sadhasivam wrote:
Hello Manivannan,
The root port MPSS is already 3'b001 = 256 Bytes and is read-only for EXPCAP1F0 (PCI_EXP_DEVCAP) .drivers/pci/controller/dwc/pcie-rcar-gen4.c | 56 +++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/ pci/controller/dwc/pcie-rcar-gen4.c
index 8b03c42f8c84c..82f0a074a71da 100644
--- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c
+++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
@@ -576,6 +576,7 @@ static int r8a779f0_pcie_ltssm_control(struct rcar_gen4_pcie *rcar, bool enable)
static void rcar_gen4_pcie_additional_common_init(struct rcar_gen4_pcie *rcar)
{
struct dw_pcie *dw = &rcar->dw;
+ u16 offset = dw_pcie_find_capability(dw, PCI_CAP_ID_EXP);
u32 val;
val = dw_pcie_readl_dbi(dw, PCIE_PORT_LANE_SKEW);
@@ -584,11 +585,66 @@ static void rcar_gen4_pcie_additional_common_init(struct rcar_gen4_pcie *rcar)
val |= BIT(6);
dw_pcie_writel_dbi(dw, PCIE_PORT_LANE_SKEW, val);
+ val = dw_pcie_readl_dbi(dw, offset + PCI_EXP_DEVCTL);
+ val &= ~(PCI_EXP_DEVCTL_PAYLOAD | PCI_EXP_DEVCTL_READRQ);
+ val |= PCI_EXP_DEVCTL_PAYLOAD_256B | PCI_EXP_DEVCTL_READRQ_256B;
+ dw_pcie_writel_dbi(dw, offset + PCI_EXP_DEVCTL, val);
Instead of limiting the MRRS/MPS values for all devices through quirks, why
can't you just limit the Root Port's MPSS value in PCI_EXP_DEVCAP?
I have to correct myself here -- EXPCAP1F0 Type 0 MPSS is 256 Bytes and Read-Only, Type 1 MPSS is 128 Bytes and Read-Write . I will now try to increase the later, but the MRRS topic below remains.
The controller is limited to MPS 256 Bytes according to V4H rev.1.30 documentation. There is no explicitly spelled out MRRS limitation in the documentation to my knowledge, except for the DMA hint, but please read on.
The root port EXPCAP2F0 MPS is 128 Bytes and MRRS is 512 Bytes .
I now noticed that in V4H rev.1.30 documentation, the EXPCAP2F0 MRRS field is default set to 3'b010 = 512 Bytes, but that value is "Reserved" and only two non-reserved values are 3'b000 and 3'b001 which are MRRS 128 Bytes and 256 Bytes respectively. That means MRRS has to be trimmed to maximum 256 Bytes in software to avoid "Reserved" settings. I will also ask the hardware and documentation team about this.
As a result, I adjust EXPCAP2F0:
- I raise MPS from 128 Bytes to 256 Bytes
- I reduce MRRS from 512 Bytes to 256 Bytes (this is important to prevent data corruption)
However, the downstream devices (in my case, PCIe SSD) can still be configured with MRRS > 256 (in my case, Crucial P5 Plus 1 TiB has MRRS=512 and MPS=128), which is where the quirk kicks in and reconfigures MRRS for those downstream devices.
The pci_configure_mps() does propagate MPS from root port EXPCAP2F0 to downstream devices, but there is no equivalent for MRRS as far as I can find ?
Thank you for your help!