Re: [PATCH 01/11] PCI: qcom-ep: Disable resources unconditionally during PERST# assert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 26, 2024 at 01:14:29PM +0530, Manivannan Sadhasivam wrote:
> On Fri, Mar 22, 2024 at 05:08:22PM +0100, Niklas Cassel wrote:
> > On Thu, Mar 14, 2024 at 08:53:40PM +0530, Manivannan Sadhasivam wrote:
> > > All EP specific resources are enabled during PERST# deassert. As a counter
> > > operation, all resources should be disabled during PERST# assert. There is
> > > no point in skipping that if the link was not enabled.
> > > 
> > > This will also result in enablement of the resources twice if PERST# got
> > > deasserted again. So remove the check from qcom_pcie_perst_assert() and
> > > disable all the resources unconditionally.
> > > 
> > > Fixes: f55fee56a631 ("PCI: qcom-ep: Add Qualcomm PCIe Endpoint controller driver")
> > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
> > > ---
> > >  drivers/pci/controller/dwc/pcie-qcom-ep.c | 6 ------
> > >  1 file changed, 6 deletions(-)
> > > 
> > > diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> > > index 2fb8c15e7a91..50b1635e3cbb 100644
> > > --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
> > > +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> > > @@ -500,12 +500,6 @@ static int qcom_pcie_perst_deassert(struct dw_pcie *pci)
> > >  static void qcom_pcie_perst_assert(struct dw_pcie *pci)
> > >  {
> > >  	struct qcom_pcie_ep *pcie_ep = to_pcie_ep(pci);
> > > -	struct device *dev = pci->dev;
> > > -
> > > -	if (pcie_ep->link_status == QCOM_PCIE_EP_LINK_DISABLED) {
> > > -		dev_dbg(dev, "Link is already disabled\n");
> > > -		return;
> > > -	}
> > >  
> > >  	dw_pcie_ep_cleanup(&pci->ep);
> > >  	qcom_pcie_disable_resources(pcie_ep);
> > 
> > Are you really sure that this is safe?
> > 
> > I think I remember seeing some splat in dmesg if some clks, or maybe it
> > was regulators, got disabled while already being disabled.
> > 
> > Perhaps you could test it by simply calling:
> > qcom_pcie_disable_resources();
> > twice here, and see if you see and splat in dmesg.
> > 
> 
> Calling the disable_resources() function twice will definitely result in the
> splat. But here PERST# is level triggered, so I don't see how the EP can see
> assert twice.
> 
> Am I missing something?

I think I remember now, I was developing a driver using a .core_init_notifier,
but I followed the pcie-tegra model, which does not enable any resources in
probe() (it only gets them), so I got the splat because when PERST got
asserted, resources would get disabled even though they were already disabled.

pcie-qcom:
-gets resources in .probe()
-enables resources in .probe()
-sets no default state in .probe()

pcie-tegra:
-gets resources in .probe()
-enables resources in perst_deassert()
-sets default state to EP_STATE_DISABLED in probe()

So pcie-qcom does not seem to be following the same pattern like pcie-tegra,
because pcie-qcom actually does enable resources for the first time in
probe(), while tegra will enable resources for the first time in
perst_deassert().

Sorry for the noise.


Kind regards,
Niklas




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux