Re: [PATCH v7 13/13] PCI: tegra194: Free resources during controller deinitialization
From: Manikanta Maddireddy
Date: Sun Mar 15 2026 - 10:17:16 EST
On 05/03/26 4:13 pm, Manivannan Sadhasivam wrote:
On Tue, Mar 03, 2026 at 12:24:48PM +0530, Manikanta Maddireddy wrote:Ok, I see epf-test is doing clear_bar which access DBI space.
From: Vidya Sagar <vidyas@xxxxxxxxxx>
Call pci_epc_deinit_notify() during controller deinitialization to free the
resources allocated by Endpoint function driver. This is safe to call
during PCIe assert sequence because we don't expect Endpoint function
driver to touch hardware in deinit function.
Are you sure? The epf-test driver itself touches DBI space during deinit.
- Mani
But, I think we should give give a chance to EPF drivers to clean up resources and stop using them in PERST# assert. Let me know your inputs on this.
- Manikanta
Fixes: 40e2125381dc ("PCI: tegra194: Move controller cleanups to pex_ep_event_pex_rst_deassert()")
Reviewed-by: Jon Hunter <jonathanh@xxxxxxxxxx>
Tested-by: Jon Hunter <jonathanh@xxxxxxxxxx>
Signed-off-by: Vidya Sagar <vidyas@xxxxxxxxxx>
Signed-off-by: Manikanta Maddireddy <mmaddireddy@xxxxxxxxxx>
---
Changes V5 -> V7: None
Changes V4 -> V5: Remove pci_epc_deinit_notify() call from pex_ep_event_pex_rst_deassert()
Changes V1 -> V4: None
drivers/pci/controller/dwc/pcie-tegra194.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index a311c31109e3..b1ae46761915 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -1624,12 +1624,16 @@ static int tegra_pcie_config_rp(struct tegra_pcie_dw *pcie)
static void pex_ep_event_pex_rst_assert(struct tegra_pcie_dw *pcie)
{
+ struct dw_pcie *pci = &pcie->pci;
+ struct dw_pcie_ep *ep = &pci->ep;
u32 val;
int ret;
if (pcie->ep_state == EP_STATE_DISABLED)
return;
+ pci_epc_deinit_notify(ep->epc);
+
ret = readl_poll_timeout(pcie->appl_base + APPL_DEBUG, val,
((val & APPL_DEBUG_LTSSM_STATE_MASK) == LTSSM_STATE_DETECT_QUIET) ||
((val & APPL_DEBUG_LTSSM_STATE_MASK) == LTSSM_STATE_DETECT_ACT) ||
@@ -1796,7 +1800,6 @@ static void pex_ep_event_pex_rst_deassert(struct tegra_pcie_dw *pcie)
reset_control_deassert(pcie->core_rst);
/* Perform cleanup that requires refclk and core reset deasserted */
- pci_epc_deinit_notify(pcie->pci.ep.epc);
dw_pcie_ep_cleanup(&pcie->pci.ep);
val = dw_pcie_readl_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL);
--
2.34.1
--
nvpublic