On Mon, Mar 04, 2024 at 02:52:15PM +0530, Manivannan Sadhasivam wrote: > For DWC glue drivers supporting PERST# (currently Qcom and Tegra194), some > of the DWC resources like eDMA should be cleaned up during the PERST# > assert time. > > So let's introduce a dw_pcie_ep_cleanup() API that could be called by these > drivers to cleanup the DWC specific resources. Currently, it just removes > eDMA. > > Reported-by: Niklas Cassel <cassel@xxxxxxxxxx> > Closes: https://lore.kernel.org/linux-pci/ZWYmX8Y%2F7Q9WMxES@x1-carbon > Reviewed-by: Frank Li <Frank.Li@xxxxxxx> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx> > --- > drivers/pci/controller/dwc/pcie-designware-ep.c | 11 +++++++++-- > drivers/pci/controller/dwc/pcie-designware.h | 5 +++++ > drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 + > drivers/pci/controller/dwc/pcie-tegra194.c | 2 ++ > 4 files changed, 17 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c > index 2b11290aab4c..1205bfba8310 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-ep.c > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c > @@ -564,12 +564,19 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, > return 0; > } > > -void dw_pcie_ep_deinit(struct dw_pcie_ep *ep) > +void dw_pcie_ep_cleanup(struct dw_pcie_ep *ep) > { > struct dw_pcie *pci = to_dw_pcie_from_ep(ep); > - struct pci_epc *epc = ep->epc; > > dw_pcie_edma_remove(pci); > +} > +EXPORT_SYMBOL_GPL(dw_pcie_ep_cleanup); Since you are not clearing the iATU bits in ep->ib_window_map and ep->bar_to_atu, this will "leak" resources, so depending on how many inbound iATUs the platform has, by simply the RC toggling PERST, will cause an error when calling set_bar() after dw_pcie_ep_init_notify(). However, because you have said that you will address this in a follow up series: Reviewed-by: Niklas Cassel <cassel@xxxxxxxxxx>