[PATCH 5/9] PCI: dwc: Replace BAR_RESERVED with BAR_DISABLED in glue drivers
Frank Li
Frank.li at nxp.com
Tue Feb 17 14:15:35 PST 2026
On Tue, Feb 17, 2026 at 10:27:11PM +0100, Niklas Cassel wrote:
> 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().
>
> An EPF driver will be able to get/enable BARs that have been disabled/reset
> unless they are marked as BAR_RESERVED (see pci_epc_get_next_free_bar()).
>
> Thus all EPC drivers that have a BAR marked as BAR_RESERVED in epc_features
> AND call dw_pcie_ep_reset_bar() should really be marked as BAR_DISABLED.
>
> BARs that are marked as BAR_RESERVED in epc_features but for which
> dw_pcie_ep_reset_bar() is not called in ep->ops->init() are still kept as
> BAR_RESERVED.
combine the same condition together to make easy to read. like
"For BAR_RESERVED bars, change to BAR_DISABLED if call dw_pcie_ep_reset_bar().
and keep as BAR_RESERVED if not dw_pcie_ep_reset_bar() in ep-ops-init()"
Frank
>
> 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 at kernel.org>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 12 ++++++------
> drivers/pci/controller/dwc/pcie-rcar-gen4.c | 6 +++---
> drivers/pci/controller/dwc/pcie-tegra194.c | 8 ++++----
> drivers/pci/controller/dwc/pcie-uniphier-ep.c | 4 ++--
> 4 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index a5b8d0b71677..ec1e3557ca53 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1433,19 +1433,19 @@ static int imx_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
> static const struct pci_epc_features imx8m_pcie_epc_features = {
> DWC_EPC_COMMON_FEATURES,
> .msi_capable = true,
> - .bar[BAR_1] = { .type = BAR_RESERVED, },
> - .bar[BAR_3] = { .type = BAR_RESERVED, },
> + .bar[BAR_1] = { .type = BAR_DISABLED, },
> + .bar[BAR_3] = { .type = BAR_DISABLED, },
> .bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = SZ_256, },
> - .bar[BAR_5] = { .type = BAR_RESERVED, },
> + .bar[BAR_5] = { .type = BAR_DISABLED, },
> .align = SZ_64K,
> };
>
> static const struct pci_epc_features imx8q_pcie_epc_features = {
> DWC_EPC_COMMON_FEATURES,
> .msi_capable = true,
> - .bar[BAR_1] = { .type = BAR_RESERVED, },
> - .bar[BAR_3] = { .type = BAR_RESERVED, },
> - .bar[BAR_5] = { .type = BAR_RESERVED, },
> + .bar[BAR_1] = { .type = BAR_DISABLED, },
> + .bar[BAR_3] = { .type = BAR_DISABLED, },
> + .bar[BAR_5] = { .type = BAR_DISABLED, },
> .align = SZ_64K,
> };
>
> diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> index a6912e85e4dd..9dd05bac22b9 100644
> --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> @@ -422,10 +422,10 @@ 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 = {
> DWC_EPC_COMMON_FEATURES,
> .msi_capable = true,
> - .bar[BAR_1] = { .type = BAR_RESERVED, },
> - .bar[BAR_3] = { .type = BAR_RESERVED, },
> + .bar[BAR_1] = { .type = BAR_DISABLED, },
> + .bar[BAR_3] = { .type = BAR_DISABLED, },
> .bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = 256 },
> - .bar[BAR_5] = { .type = BAR_RESERVED, },
> + .bar[BAR_5] = { .type = BAR_DISABLED, },
> .align = SZ_1M,
> };
>
> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
> index 31aa9a494dbc..9f9453e8cd23 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -1994,10 +1994,10 @@ static const struct pci_epc_features tegra_pcie_epc_features = {
> .bar[BAR_0] = { .type = BAR_FIXED, .fixed_size = SZ_1M,
> .only_64bit = true, },
> .bar[BAR_1] = { .type = BAR_64BIT_UPPER, },
> - .bar[BAR_2] = { .type = BAR_RESERVED, },
> - .bar[BAR_3] = { .type = BAR_RESERVED, },
> - .bar[BAR_4] = { .type = BAR_RESERVED, },
> - .bar[BAR_5] = { .type = BAR_RESERVED, },
> + .bar[BAR_2] = { .type = BAR_DISABLED, },
> + .bar[BAR_3] = { .type = BAR_DISABLED, },
> + .bar[BAR_4] = { .type = BAR_DISABLED, },
> + .bar[BAR_5] = { .type = BAR_DISABLED, },
> .align = SZ_64K,
> };
>
> diff --git a/drivers/pci/controller/dwc/pcie-uniphier-ep.c b/drivers/pci/controller/dwc/pcie-uniphier-ep.c
> index f873a1659592..5bde3ee682b5 100644
> --- a/drivers/pci/controller/dwc/pcie-uniphier-ep.c
> +++ b/drivers/pci/controller/dwc/pcie-uniphier-ep.c
> @@ -429,8 +429,8 @@ static const struct uniphier_pcie_ep_soc_data uniphier_pro5_data = {
> .bar[BAR_1] = { .type = BAR_64BIT_UPPER, },
> .bar[BAR_2] = { .only_64bit = true, },
> .bar[BAR_3] = { .type = BAR_64BIT_UPPER, },
> - .bar[BAR_4] = { .type = BAR_RESERVED, },
> - .bar[BAR_5] = { .type = BAR_RESERVED, },
> + .bar[BAR_4] = { .type = BAR_DISABLED, },
> + .bar[BAR_5] = { .type = BAR_DISABLED, },
> },
> };
>
> --
> 2.53.0
>
More information about the linux-arm-kernel
mailing list