Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: dwc: Replace certain BAR_RESERVED with BAR_DISABLED in glue drivers

Most DWC based EPC glue drivers that have BARs marked as BAR_RESERVED in
epc_features also call dw_pcie_ep_reset_bar() for these reserved BARs in
ep->ops->init(). (The only exception is pci-keystone.c.)

An EPF driver will be able to get/enable BARs that have been disabled/reset
using dw_pcie_ep_reset_bar(), except if the BAR is marked as BAR_RESERVED
(see pci_epc_get_next_free_bar()).

Thus, all EPC drivers that have BARs marked as BAR_RESERVED in epc_features
and call dw_pcie_ep_reset_bar(), should really have these BARs marked as
BAR_DISABLED. If dw_pcie_ep_reset_bar() is not called by the glue driver,
the BARs are kept as BAR_RESERVED.

No EPC drivers outside drivers/pci/controllers/dwc mark their BARs as
BAR_RESERVED, so there is nothing to do in non-DWC based EPC drivers.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Tested-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Tested-by: Koichiro Den <den@valinux.co.jp>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260312130229.2282001-18-cassel@kernel.org

authored by

Niklas Cassel and committed by
Manivannan Sadhasivam
5a95fecb 33642e9e

+27 -15
+6 -6
drivers/pci/controller/dwc/pci-imx6.c
··· 1433 1433 static const struct pci_epc_features imx8m_pcie_epc_features = { 1434 1434 DWC_EPC_COMMON_FEATURES, 1435 1435 .msi_capable = true, 1436 - .bar[BAR_1] = { .type = BAR_RESERVED, }, 1437 - .bar[BAR_3] = { .type = BAR_RESERVED, }, 1436 + .bar[BAR_1] = { .type = BAR_DISABLED, }, 1437 + .bar[BAR_3] = { .type = BAR_DISABLED, }, 1438 1438 .bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = SZ_256, }, 1439 - .bar[BAR_5] = { .type = BAR_RESERVED, }, 1439 + .bar[BAR_5] = { .type = BAR_DISABLED, }, 1440 1440 .align = SZ_64K, 1441 1441 }; 1442 1442 1443 1443 static const struct pci_epc_features imx8q_pcie_epc_features = { 1444 1444 DWC_EPC_COMMON_FEATURES, 1445 1445 .msi_capable = true, 1446 - .bar[BAR_1] = { .type = BAR_RESERVED, }, 1447 - .bar[BAR_3] = { .type = BAR_RESERVED, }, 1448 - .bar[BAR_5] = { .type = BAR_RESERVED, }, 1446 + .bar[BAR_1] = { .type = BAR_DISABLED, }, 1447 + .bar[BAR_3] = { .type = BAR_DISABLED, }, 1448 + .bar[BAR_5] = { .type = BAR_DISABLED, }, 1449 1449 .align = SZ_64K, 1450 1450 }; 1451 1451
+12
drivers/pci/controller/dwc/pci-keystone.c
··· 933 933 DWC_EPC_COMMON_FEATURES, 934 934 .msi_capable = true, 935 935 .msix_capable = true, 936 + /* 937 + * TODO: This driver is the only DWC glue driver that had BAR_RESERVED 938 + * BARs, but did not call dw_pcie_ep_reset_bar() for the reserved BARs. 939 + * 940 + * To not change the existing behavior, these BARs were not migrated to 941 + * BAR_DISABLED. If this driver wants the BAR_RESERVED BARs to be 942 + * disabled, it should migrate them to BAR_DISABLED. 943 + * 944 + * If they actually should be enabled, then the driver must also define 945 + * what is behind these reserved BARs, see the definition of struct 946 + * pci_epc_bar_rsvd_region. 947 + */ 936 948 .bar[BAR_0] = { .type = BAR_RESERVED, }, 937 949 .bar[BAR_1] = { .type = BAR_RESERVED, }, 938 950 .bar[BAR_2] = { .type = BAR_RESIZABLE, },
+3 -3
drivers/pci/controller/dwc/pcie-rcar-gen4.c
··· 422 422 static const struct pci_epc_features rcar_gen4_pcie_epc_features = { 423 423 DWC_EPC_COMMON_FEATURES, 424 424 .msi_capable = true, 425 - .bar[BAR_1] = { .type = BAR_RESERVED, }, 426 - .bar[BAR_3] = { .type = BAR_RESERVED, }, 425 + .bar[BAR_1] = { .type = BAR_DISABLED, }, 426 + .bar[BAR_3] = { .type = BAR_DISABLED, }, 427 427 .bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = 256 }, 428 - .bar[BAR_5] = { .type = BAR_RESERVED, }, 428 + .bar[BAR_5] = { .type = BAR_DISABLED, }, 429 429 .align = SZ_1M, 430 430 }; 431 431
+4 -4
drivers/pci/controller/dwc/pcie-tegra194.c
··· 1993 1993 .msi_capable = true, 1994 1994 .bar[BAR_0] = { .type = BAR_FIXED, .fixed_size = SZ_1M, 1995 1995 .only_64bit = true, }, 1996 - .bar[BAR_2] = { .type = BAR_RESERVED, }, 1997 - .bar[BAR_3] = { .type = BAR_RESERVED, }, 1998 - .bar[BAR_4] = { .type = BAR_RESERVED, }, 1999 - .bar[BAR_5] = { .type = BAR_RESERVED, }, 1996 + .bar[BAR_2] = { .type = BAR_DISABLED, }, 1997 + .bar[BAR_3] = { .type = BAR_DISABLED, }, 1998 + .bar[BAR_4] = { .type = BAR_DISABLED, }, 1999 + .bar[BAR_5] = { .type = BAR_DISABLED, }, 2000 2000 .align = SZ_64K, 2001 2001 }; 2002 2002
+2 -2
drivers/pci/controller/dwc/pcie-uniphier-ep.c
··· 427 427 .align = 1 << 16, 428 428 .bar[BAR_0] = { .only_64bit = true, }, 429 429 .bar[BAR_2] = { .only_64bit = true, }, 430 - .bar[BAR_4] = { .type = BAR_RESERVED, }, 431 - .bar[BAR_5] = { .type = BAR_RESERVED, }, 430 + .bar[BAR_4] = { .type = BAR_DISABLED, }, 431 + .bar[BAR_5] = { .type = BAR_DISABLED, }, 432 432 }, 433 433 }; 434 434