public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vidya Sagar <vidyas@nvidia.com>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	kishon@kernel.org, lpieralisi@kernel.org, bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	kw@linux.com, robh@kernel.org, vigneshr@ti.com
Subject: Re: [PATCH v3 2/5] PCI: tegra194: Move dw_pcie_ep_linkup() to threaded IRQ handler
Date: Mon, 10 Oct 2022 19:53:52 +0530	[thread overview]
Message-ID: <5ec4b46f-2590-bd34-f6fa-e4e2eeb38b7b@nvidia.com> (raw)
In-Reply-To: <20221006134927.41437-3-manivannan.sadhasivam@linaro.org>

Hi Mani,
Thanks for your change. One comment though.

On 10/6/2022 7:19 PM, Manivannan Sadhasivam wrote:
> External email: Use caution opening links or attachments
> 
> 
> dw_pcie_ep_linkup() may take more time to execute depending on the EPF
> driver implementation. Calling this API in the hard IRQ handler is not
> encouraged since the hard IRQ handlers are supposed to complete quickly.
> 
> So move the dw_pcie_ep_linkup() call to threaded IRQ handler.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>   drivers/pci/controller/dwc/pcie-tegra194.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
> index 1b6b437823d2..6a487f52e1fb 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -287,6 +287,7 @@ struct tegra_pcie_dw {
>          struct gpio_desc *pex_refclk_sel_gpiod;
>          unsigned int pex_rst_irq;
>          int ep_state;
> +       long link_status;
>   };
> 
>   static inline struct tegra_pcie_dw *to_tegra_pcie(struct dw_pcie *pci)
> @@ -450,9 +451,13 @@ static void pex_ep_event_hot_rst_done(struct tegra_pcie_dw *pcie)
>   static irqreturn_t tegra_pcie_ep_irq_thread(int irq, void *arg)
>   {
>          struct tegra_pcie_dw *pcie = arg;
> +       struct dw_pcie_ep *ep = &pcie->pci.ep;
>          struct dw_pcie *pci = &pcie->pci;
>          u32 val, speed;
> 
> +       if (test_and_clear_bit(0, &pcie->link_status))
> +               dw_pcie_ep_linkup(ep);
> +
>          speed = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA) &
>                  PCI_EXP_LNKSTA_CLS;
>          clk_set_rate(pcie->core_clk, pcie_gen_freq[speed - 1]);
> @@ -499,7 +504,6 @@ static irqreturn_t tegra_pcie_ep_irq_thread(int irq, void *arg)
>   static irqreturn_t tegra_pcie_ep_hard_irq(int irq, void *arg)
>   {
>          struct tegra_pcie_dw *pcie = arg;
> -       struct dw_pcie_ep *ep = &pcie->pci.ep;
>          int spurious = 1;
>          u32 status_l0, status_l1, link_status;
> 
> @@ -515,7 +519,7 @@ static irqreturn_t tegra_pcie_ep_hard_irq(int irq, void *arg)
>                          link_status = appl_readl(pcie, APPL_LINK_STATUS);
>                          if (link_status & APPL_LINK_STATUS_RDLH_LINK_UP) {
>                                  dev_dbg(pcie->dev, "Link is up with Host\n");
> -                               dw_pcie_ep_linkup(ep);
> +                               set_bit(0, &pcie->link_status);

irq thread needs to be woken up at this point. So, please add
return IRQ_WAKE_THREAD;

Thanks,
Vidya Sagar

>                          }
>                  }
> 
> --
> 2.25.1
> 

  reply	other threads:[~2022-10-10 14:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 13:49 [PATCH v3 0/5] PCI: endpoint: Rework the EPC to EPF notification Manivannan Sadhasivam
2022-10-06 13:49 ` [PATCH v3 1/5] PCI: dra7xx: Use threaded IRQ handler for "dra7xx-pcie-main" IRQ Manivannan Sadhasivam
2022-10-11 12:37   ` Kishon Vijay Abraham I
2022-10-06 13:49 ` [PATCH v3 2/5] PCI: tegra194: Move dw_pcie_ep_linkup() to threaded IRQ handler Manivannan Sadhasivam
2022-10-10 14:23   ` Vidya Sagar [this message]
2022-10-25 14:32     ` Manivannan Sadhasivam
2022-10-06 13:49 ` [PATCH v3 3/5] PCI: endpoint: Use a separate lock for protecting epc->pci_epf list Manivannan Sadhasivam
2022-10-11 12:40   ` Kishon Vijay Abraham I
2022-10-06 13:49 ` [PATCH v3 4/5] PCI: endpoint: Use callback mechanism for passing events from EPC to EPF Manivannan Sadhasivam
2022-10-11 12:57   ` Kishon Vijay Abraham I
2022-10-25 11:39     ` Manivannan Sadhasivam
2022-11-03  9:54       ` Kishon Vijay Abraham I
2022-10-06 13:49 ` [PATCH v3 5/5] PCI: endpoint: Use link_up() callback in place of LINK_UP notifier Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ec4b46f-2590-bd34-f6fa-e4e2eeb38b7b@nvidia.com \
    --to=vidyas@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=kishon@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=robh@kernel.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox