On Fri, Sep 20, 2024 at 03:47:59PM +0530, Krishna chaitanya chundru wrote: Subject should be modified to reflect the fact that the link up is skipped in the dwc driver. PCI: dwc: Skip waiting for link up if vendor drivers can detect Link up event > In cases where a global IRQ handler is present to manage link up > interrupts, it may not be necessary to wait for the link to be up > during PCI initialization which optimizes the bootup time. > How about, "If the vendor drivers can detect the Link up event using mechanisms such as Link up IRQ, then waiting for Link up during probe is not needed. So let's skip waiting for link to be up if the driver supports 'linkup_irq'. Currently, only Qcom RC driver supports the 'linkup_irq' as it can detect the Link Up event using its own 'global IRQ' interrupt." Techincally, you could also split the dwc and qcom driver changes into two patches. One adding the option to skip the wait and another making use of it. > Move platform_get_irq_byname_optional() above to set linkup_irq > before dw_pcie_host_init() as this flag is used in this function only. > This is not a valid justification. You are moving it so that the 'pp->linkup_irq' flag is set before calling dw_pcie_host_init() API that waits for the link to be up. Mention it clearly. > Signed-off-by: Krishna chaitanya chundru <quic_krichai@xxxxxxxxxxx> > --- > drivers/pci/controller/dwc/pcie-designware-host.c | 11 +++++++++-- > drivers/pci/controller/dwc/pcie-designware.h | 1 + > drivers/pci/controller/dwc/pcie-qcom.c | 5 ++++- > 3 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > index 3e41865c7290..b7d20a1bab0a 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > @@ -530,8 +530,15 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) > goto err_remove_edma; > } > > - /* Ignore errors, the link may come up later */ > - dw_pcie_wait_for_link(pci); > + /* > + * Note: The link up delay is skipped only when a link up IRQ is present. > + * This flag should not be used to bypass the link up delay for arbitrary > + * reasons. > + * > + * Ignore errors, the link may come up later. Maybe you can move this comment just above dw_pcie_wait_for_link(). - Mani > + */ > + if (!pp->linkup_irq) > + dw_pcie_wait_for_link(pci); > > bridge->sysdata = pp; > > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > index e518f81ea80c..b850f0a74695 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.h > +++ b/drivers/pci/controller/dwc/pcie-designware.h > @@ -348,6 +348,7 @@ struct dw_pcie_rp { > bool use_atu_msg; > int msg_atu_index; > struct resource *msg_res; > + bool linkup_irq; > }; > > struct dw_pcie_ep_ops { > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index 88a98be930e3..905c9154fc65 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -1686,6 +1686,10 @@ static int qcom_pcie_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, pcie); > > + irq = platform_get_irq_byname_optional(pdev, "global"); > + if (irq > 0) > + pp->linkup_irq = true; > + > ret = dw_pcie_host_init(pp); > if (ret) { > dev_err(dev, "cannot initialize host\n"); > @@ -1699,7 +1703,6 @@ static int qcom_pcie_probe(struct platform_device *pdev) > goto err_host_deinit; > } > > - irq = platform_get_irq_byname_optional(pdev, "global"); > if (irq > 0) { > ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, > qcom_pcie_global_irq_thread, > > -- > 2.34.1 > -- மணிவண்ணன் சதாசிவம்