[PATCH] PCI: dwc: rcar-gen4-ep: Program Resizable BARs and drop 1MiB BAR limit

Koichiro Den posted 1 patch 3 months, 2 weeks ago
drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] PCI: dwc: rcar-gen4-ep: Program Resizable BARs and drop 1MiB BAR limit
Posted by Koichiro Den 3 months, 2 weeks ago
R-Car Gen4 (S4) exposes BAR0 and BAR2 as Resizable BARs. Program them
accordingly by using dw_pcie_ep_set_bar_resizable() instead of the
programmable BAR path.

Before this change the driver left the Resizable BAR capability
untouched and only wrote the BAR register, so the RC enumerated BAR0/2
as 1 MiB regardless of the size requested by the endpoint function. For
example, configuring a 2 MiB window for pci-epf-vntb still produced:

  ntb_hw_epf 0000:01:00.0: \
  Size:0x0000000000200000 is greater than the MW size 0x0000000000100000

Program the Resizable BAR control so the RC sees the requested size and
ntb_transport can use larger memory windows.

Signed-off-by: Koichiro Den <den@valinux.co.jp>
---
 drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
index 80778917d2dd..dbad741b8286 100644
--- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c
+++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
@@ -421,7 +421,9 @@ static int rcar_gen4_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
 
 static const struct pci_epc_features rcar_gen4_pcie_epc_features = {
 	.msi_capable = true,
+	.bar[BAR_0] = { .type = BAR_RESIZABLE, },
 	.bar[BAR_1] = { .type = BAR_RESERVED, },
+	.bar[BAR_2] = { .type = BAR_RESIZABLE, },
 	.bar[BAR_3] = { .type = BAR_RESERVED, },
 	.bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = 256 },
 	.bar[BAR_5] = { .type = BAR_RESERVED, },
-- 
2.48.1