| From a36df9137d96e6e5a8729c00d07dbb13b7a04c85 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Sat, 24 Jan 2026 23:50:07 +0900 |
| Subject: PCI: dwc: Advertise dynamic inbound mapping support |
| |
| From: Koichiro Den <den@valinux.co.jp> |
| |
| [ Upstream commit c0f1506f63546308e894469ceb0f1fadbdf9d2f9 ] |
| |
| The DesignWare EP core has supported updating the inbound iATU mapping |
| for an already configured BAR (i.e. allowing pci_epc_set_bar() to be |
| called again without a prior pci_epc_clear_bar()) since |
| commit 4284c88fff0e ("PCI: designware-ep: Allow pci_epc_set_bar() update |
| inbound map address"). |
| |
| Now that this capability is exposed via the dynamic_inbound_mapping EPC |
| feature bit, set it for DWC-based EP glue drivers using a common |
| initializer macro to avoid duplicating the same flag in each driver. |
| |
| Note that pci-layerscape-ep.c is untouched. It currently constructs the |
| feature struct dynamically in ls_pcie_ep_init(). Once converted to a |
| static feature definition, it will use DWC_EPC_COMMON_FEATURES as well. |
| |
| Signed-off-by: Koichiro Den <den@valinux.co.jp> |
| Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> |
| Reviewed-by: Niklas Cassel <cassel@kernel.org> |
| Reviewed-by: Frank Li <Frank.Li@nxp.com> |
| Link: https://patch.msgid.link/20260124145012.2794108-4-den@valinux.co.jp |
| Stable-dep-of: 72cb5ed2a5c6 ("PCI: dwc: ep: Add per-PF BAR and inbound ATU mapping support") |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/pci/controller/dwc/pci-dra7xx.c | 1 + |
| drivers/pci/controller/dwc/pci-imx6.c | 3 +++ |
| drivers/pci/controller/dwc/pci-keystone.c | 1 + |
| drivers/pci/controller/dwc/pcie-artpec6.c | 1 + |
| drivers/pci/controller/dwc/pcie-designware-plat.c | 1 + |
| drivers/pci/controller/dwc/pcie-designware.h | 3 +++ |
| drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 ++ |
| drivers/pci/controller/dwc/pcie-keembay.c | 1 + |
| drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 + |
| drivers/pci/controller/dwc/pcie-rcar-gen4.c | 1 + |
| drivers/pci/controller/dwc/pcie-stm32-ep.c | 1 + |
| drivers/pci/controller/dwc/pcie-tegra194.c | 1 + |
| drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 ++ |
| 13 files changed, 19 insertions(+) |
| |
| diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c |
| index 01cfd9aeb0b81..d5d26229063f2 100644 |
| --- a/drivers/pci/controller/dwc/pci-dra7xx.c |
| +++ b/drivers/pci/controller/dwc/pci-dra7xx.c |
| @@ -424,6 +424,7 @@ static int dra7xx_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no, |
| } |
| |
| static const struct pci_epc_features dra7xx_pcie_epc_features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .linkup_notifier = true, |
| .msi_capable = true, |
| }; |
| diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c |
| index 4668fc9648bff..f28e335bbbfaf 100644 |
| --- a/drivers/pci/controller/dwc/pci-imx6.c |
| +++ b/drivers/pci/controller/dwc/pci-imx6.c |
| @@ -1387,6 +1387,7 @@ 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, }, |
| @@ -1396,6 +1397,7 @@ static const struct pci_epc_features imx8m_pcie_epc_features = { |
| }; |
| |
| 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, }, |
| @@ -1416,6 +1418,7 @@ static const struct pci_epc_features imx8q_pcie_epc_features = { |
| * BAR5 | Enable | 32-bit | 64 KB | Programmable Size |
| */ |
| static const struct pci_epc_features imx95_pcie_epc_features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .msi_capable = true, |
| .bar[BAR_1] = { .type = BAR_FIXED, .fixed_size = SZ_64K, }, |
| .align = SZ_4K, |
| diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c |
| index f86d9111f863f..20fa4dadb82af 100644 |
| --- a/drivers/pci/controller/dwc/pci-keystone.c |
| +++ b/drivers/pci/controller/dwc/pci-keystone.c |
| @@ -930,6 +930,7 @@ static int ks_pcie_am654_raise_irq(struct dw_pcie_ep *ep, u8 func_no, |
| } |
| |
| static const struct pci_epc_features ks_pcie_am654_epc_features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .msi_capable = true, |
| .msix_capable = true, |
| .bar[BAR_0] = { .type = BAR_RESERVED, }, |
| diff --git a/drivers/pci/controller/dwc/pcie-artpec6.c b/drivers/pci/controller/dwc/pcie-artpec6.c |
| index f4a136ee2daf3..e994b75986c34 100644 |
| --- a/drivers/pci/controller/dwc/pcie-artpec6.c |
| +++ b/drivers/pci/controller/dwc/pcie-artpec6.c |
| @@ -370,6 +370,7 @@ static int artpec6_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no, |
| } |
| |
| static const struct pci_epc_features artpec6_pcie_epc_features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .msi_capable = true, |
| }; |
| |
| diff --git a/drivers/pci/controller/dwc/pcie-designware-plat.c b/drivers/pci/controller/dwc/pcie-designware-plat.c |
| index 12f41886c65d1..8530746ec5cbb 100644 |
| --- a/drivers/pci/controller/dwc/pcie-designware-plat.c |
| +++ b/drivers/pci/controller/dwc/pcie-designware-plat.c |
| @@ -61,6 +61,7 @@ static int dw_plat_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, |
| } |
| |
| static const struct pci_epc_features dw_plat_pcie_epc_features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .msi_capable = true, |
| .msix_capable = true, |
| }; |
| diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h |
| index 8a99a9c393f53..205fb55fca8c0 100644 |
| --- a/drivers/pci/controller/dwc/pcie-designware.h |
| +++ b/drivers/pci/controller/dwc/pcie-designware.h |
| @@ -305,6 +305,9 @@ |
| /* Default eDMA LLP memory size */ |
| #define DMA_LLP_MEM_SIZE PAGE_SIZE |
| |
| +/* Common struct pci_epc_feature bits among DWC EP glue drivers */ |
| +#define DWC_EPC_COMMON_FEATURES .dynamic_inbound_mapping = true |
| + |
| struct dw_pcie; |
| struct dw_pcie_rp; |
| struct dw_pcie_ep; |
| diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c |
| index 2f865f67a10a7..bf8ec3ca6f689 100644 |
| --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c |
| +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c |
| @@ -362,6 +362,7 @@ static int rockchip_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no, |
| } |
| |
| static const struct pci_epc_features rockchip_pcie_epc_features_rk3568 = { |
| + DWC_EPC_COMMON_FEATURES, |
| .linkup_notifier = true, |
| .msi_capable = true, |
| .msix_capable = true, |
| @@ -382,6 +383,7 @@ static const struct pci_epc_features rockchip_pcie_epc_features_rk3568 = { |
| * BARs) would be overwritten, resulting in (all other BARs) no longer working. |
| */ |
| static const struct pci_epc_features rockchip_pcie_epc_features_rk3588 = { |
| + DWC_EPC_COMMON_FEATURES, |
| .linkup_notifier = true, |
| .msi_capable = true, |
| .msix_capable = true, |
| diff --git a/drivers/pci/controller/dwc/pcie-keembay.c b/drivers/pci/controller/dwc/pcie-keembay.c |
| index 60e74ac782af3..2666a9c3d67e7 100644 |
| --- a/drivers/pci/controller/dwc/pcie-keembay.c |
| +++ b/drivers/pci/controller/dwc/pcie-keembay.c |
| @@ -309,6 +309,7 @@ static int keembay_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, |
| } |
| |
| static const struct pci_epc_features keembay_pcie_epc_features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .msi_capable = true, |
| .msix_capable = true, |
| .bar[BAR_0] = { .only_64bit = true, }, |
| diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c |
| index f1bc0ac81a928..5e990c7a5879f 100644 |
| --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c |
| +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c |
| @@ -820,6 +820,7 @@ static void qcom_pcie_ep_init_debugfs(struct qcom_pcie_ep *pcie_ep) |
| } |
| |
| static const struct pci_epc_features qcom_pcie_epc_features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .linkup_notifier = true, |
| .msi_capable = true, |
| .align = SZ_4K, |
| diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c |
| index 80778917d2ddd..a6912e85e4ddc 100644 |
| --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c |
| +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c |
| @@ -420,6 +420,7 @@ 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, }, |
| diff --git a/drivers/pci/controller/dwc/pcie-stm32-ep.c b/drivers/pci/controller/dwc/pcie-stm32-ep.c |
| index 2cecf32d2b0f3..c1944b40ce02f 100644 |
| --- a/drivers/pci/controller/dwc/pcie-stm32-ep.c |
| +++ b/drivers/pci/controller/dwc/pcie-stm32-ep.c |
| @@ -70,6 +70,7 @@ static int stm32_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no, |
| } |
| |
| static const struct pci_epc_features stm32_pcie_epc_features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .msi_capable = true, |
| .align = SZ_64K, |
| }; |
| diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c |
| index 0ddeef70726dd..06571d806ab31 100644 |
| --- a/drivers/pci/controller/dwc/pcie-tegra194.c |
| +++ b/drivers/pci/controller/dwc/pcie-tegra194.c |
| @@ -1988,6 +1988,7 @@ static int tegra_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, |
| } |
| |
| static const struct pci_epc_features tegra_pcie_epc_features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .linkup_notifier = true, |
| .msi_capable = true, |
| .bar[BAR_0] = { .type = BAR_FIXED, .fixed_size = SZ_1M, |
| diff --git a/drivers/pci/controller/dwc/pcie-uniphier-ep.c b/drivers/pci/controller/dwc/pcie-uniphier-ep.c |
| index d6e73811216e2..d52753060970f 100644 |
| --- a/drivers/pci/controller/dwc/pcie-uniphier-ep.c |
| +++ b/drivers/pci/controller/dwc/pcie-uniphier-ep.c |
| @@ -420,6 +420,7 @@ static const struct uniphier_pcie_ep_soc_data uniphier_pro5_data = { |
| .init = uniphier_pcie_pro5_init_ep, |
| .wait = NULL, |
| .features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .linkup_notifier = false, |
| .msi_capable = true, |
| .msix_capable = false, |
| @@ -438,6 +439,7 @@ static const struct uniphier_pcie_ep_soc_data uniphier_nx1_data = { |
| .init = uniphier_pcie_nx1_init_ep, |
| .wait = uniphier_pcie_nx1_wait_ep, |
| .features = { |
| + DWC_EPC_COMMON_FEATURES, |
| .linkup_notifier = false, |
| .msi_capable = true, |
| .msix_capable = false, |
| -- |
| 2.51.0 |
| |