Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: tegra194: Move dw_pcie_ep_linkup() to threaded IRQ handler

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.

Link: https://lore.kernel.org/linux-pci/20230124071158.5503-3-manivannan.sadhasivam@linaro.org
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Reviewed-by: Vidya Sagar <vidyas@nvidia.com>

authored by

Manivannan Sadhasivam and committed by
Krzysztof Wilczyński
c2cc5cdd da87d35a

+7 -2
+7 -2
drivers/pci/controller/dwc/pcie-tegra194.c
··· 286 286 struct gpio_desc *pex_refclk_sel_gpiod; 287 287 unsigned int pex_rst_irq; 288 288 int ep_state; 289 + long link_status; 289 290 }; 290 291 291 292 static inline struct tegra_pcie_dw *to_tegra_pcie(struct dw_pcie *pci) ··· 450 449 static irqreturn_t tegra_pcie_ep_irq_thread(int irq, void *arg) 451 450 { 452 451 struct tegra_pcie_dw *pcie = arg; 452 + struct dw_pcie_ep *ep = &pcie->pci.ep; 453 453 struct dw_pcie *pci = &pcie->pci; 454 454 u32 val, speed; 455 + 456 + if (test_and_clear_bit(0, &pcie->link_status)) 457 + dw_pcie_ep_linkup(ep); 455 458 456 459 speed = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA) & 457 460 PCI_EXP_LNKSTA_CLS; ··· 503 498 static irqreturn_t tegra_pcie_ep_hard_irq(int irq, void *arg) 504 499 { 505 500 struct tegra_pcie_dw *pcie = arg; 506 - struct dw_pcie_ep *ep = &pcie->pci.ep; 507 501 int spurious = 1; 508 502 u32 status_l0, status_l1, link_status; 509 503 ··· 518 514 link_status = appl_readl(pcie, APPL_LINK_STATUS); 519 515 if (link_status & APPL_LINK_STATUS_RDLH_LINK_UP) { 520 516 dev_dbg(pcie->dev, "Link is up with Host\n"); 521 - dw_pcie_ep_linkup(ep); 517 + set_bit(0, &pcie->link_status); 518 + return IRQ_WAKE_THREAD; 522 519 } 523 520 } 524 521