* [PATCH v2 0/2] PCI: qcom: Skip wait for link up if global IRQ handler is present
@ 2024-09-20 10:17 Krishna chaitanya chundru
2024-09-20 10:17 ` [PATCH v2 1/2] " Krishna chaitanya chundru
2024-09-20 10:18 ` [PATCH v2 2/2] PCI: qcom: Update ICC and OPP values during link up event Krishna chaitanya chundru
0 siblings, 2 replies; 5+ messages in thread
From: Krishna chaitanya chundru @ 2024-09-20 10:17 UTC (permalink / raw)
To: Jingoo Han, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas
Cc: quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth,
quic_vpernami, quic_mrana, linux-pci, linux-kernel, linux-arm-msm,
Krishna chaitanya chundru
In scenarios where a global IRQ handler is available to manage link up
interrupts, it may not be necessary to wait for the link to be up
during PCI initialization. This change helps in reducing the overall
bootup time.
As part of the PCIe link up event, the ICC and OPP values are updated.
Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
Changes in v2:
- Updated the bypass_link_up_wait name to linkup_irq & added comment as
suggested (mani).
- seperated the icc and opp update patch (mani).
- Link to v1: https://lore.kernel.org/r/20240917-remove_wait-v1-1-456d2551bc50@quicinc.com
---
Krishna chaitanya chundru (2):
PCI: qcom: Skip wait for link up if global IRQ handler is present
PCI: qcom: Update ICC and OPP values during link up event
drivers/pci/controller/dwc/pcie-designware-host.c | 11 +++++++++--
drivers/pci/controller/dwc/pcie-designware.h | 1 +
drivers/pci/controller/dwc/pcie-qcom.c | 7 ++++++-
3 files changed, 16 insertions(+), 3 deletions(-)
---
base-commit: 9aaeb87ce1e966169a57f53a02ba05b30880ffb8
change-id: 20240911-remove_wait-ad46248dc9f0
Best regards,
--
Krishna chaitanya chundru <quic_krichai@quicinc.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] PCI: qcom: Skip wait for link up if global IRQ handler is present
2024-09-20 10:17 [PATCH v2 0/2] PCI: qcom: Skip wait for link up if global IRQ handler is present Krishna chaitanya chundru
@ 2024-09-20 10:17 ` Krishna chaitanya chundru
2024-09-30 7:49 ` Manivannan Sadhasivam
2024-09-20 10:18 ` [PATCH v2 2/2] PCI: qcom: Update ICC and OPP values during link up event Krishna chaitanya chundru
1 sibling, 1 reply; 5+ messages in thread
From: Krishna chaitanya chundru @ 2024-09-20 10:17 UTC (permalink / raw)
To: Jingoo Han, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas
Cc: quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth,
quic_vpernami, quic_mrana, linux-pci, linux-kernel, linux-arm-msm,
Krishna chaitanya chundru
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.
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.
Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
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.
+ */
+ 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] PCI: qcom: Update ICC and OPP values during link up event
2024-09-20 10:17 [PATCH v2 0/2] PCI: qcom: Skip wait for link up if global IRQ handler is present Krishna chaitanya chundru
2024-09-20 10:17 ` [PATCH v2 1/2] " Krishna chaitanya chundru
@ 2024-09-20 10:18 ` Krishna chaitanya chundru
1 sibling, 0 replies; 5+ messages in thread
From: Krishna chaitanya chundru @ 2024-09-20 10:18 UTC (permalink / raw)
To: Jingoo Han, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas
Cc: quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth,
quic_vpernami, quic_mrana, linux-pci, linux-kernel, linux-arm-msm,
Krishna chaitanya chundru
As part of the PCIe link up event, update ICC and OPP values
as at this point only driver can know the link speed and
width of the PCIe link.
Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
drivers/pci/controller/dwc/pcie-qcom.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 905c9154fc65..e3c17276027a 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1552,6 +1552,8 @@ static irqreturn_t qcom_pcie_global_irq_thread(int irq, void *data)
pci_lock_rescan_remove();
pci_rescan_bus(pp->bridge->bus);
pci_unlock_rescan_remove();
+
+ qcom_pcie_icc_opp_update(pcie);
} else {
dev_WARN_ONCE(dev, 1, "Received unknown event. INT_STATUS: 0x%08x\n",
status);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] PCI: qcom: Skip wait for link up if global IRQ handler is present
2024-09-20 10:17 ` [PATCH v2 1/2] " Krishna chaitanya chundru
@ 2024-09-30 7:49 ` Manivannan Sadhasivam
2024-09-30 17:01 ` Bjorn Helgaas
0 siblings, 1 reply; 5+ messages in thread
From: Manivannan Sadhasivam @ 2024-09-30 7:49 UTC (permalink / raw)
To: Krishna chaitanya chundru
Cc: Jingoo Han, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring, Bjorn Helgaas, quic_vbadigan, quic_ramkri,
quic_nitegupt, quic_skananth, quic_vpernami, quic_mrana,
linux-pci, linux-kernel, linux-arm-msm
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@quicinc.com>
> ---
> 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
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] PCI: qcom: Skip wait for link up if global IRQ handler is present
2024-09-30 7:49 ` Manivannan Sadhasivam
@ 2024-09-30 17:01 ` Bjorn Helgaas
0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2024-09-30 17:01 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Krishna chaitanya chundru, Jingoo Han, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas,
quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth,
quic_vpernami, quic_mrana, linux-pci, linux-kernel, linux-arm-msm
On Mon, Sep 30, 2024 at 09:49:10AM +0200, Manivannan Sadhasivam wrote:
> 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'.
I avoid the "let's do X" structure because "let's do" is a proposal.
The patch actually *does* it, so it's more than a proposal.
Also, it would be helpful to extend this with a note about *why* we
can avoid waiting, i.e., if we can be notified when the link comes up,
we can enumerate downstream devices then instead of waiting here.
I suppose the "global" name is already set by DTs, but the name seems
far too general to me.
Bjorn
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-30 17:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-20 10:17 [PATCH v2 0/2] PCI: qcom: Skip wait for link up if global IRQ handler is present Krishna chaitanya chundru
2024-09-20 10:17 ` [PATCH v2 1/2] " Krishna chaitanya chundru
2024-09-30 7:49 ` Manivannan Sadhasivam
2024-09-30 17:01 ` Bjorn Helgaas
2024-09-20 10:18 ` [PATCH v2 2/2] PCI: qcom: Update ICC and OPP values during link up event Krishna chaitanya chundru
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).