Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp964770rwb; Thu, 6 Oct 2022 06:55:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DNjwk0p9kehQpYU2fffrUVuj9K4AQXC2q7hBL2/FIW24Dxr2Lx2OnuQZCyOkr0Zu0oNFp X-Received: by 2002:a63:2bd5:0:b0:434:ea9a:ace2 with SMTP id r204-20020a632bd5000000b00434ea9aace2mr27457pgr.323.1665064509013; Thu, 06 Oct 2022 06:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665064509; cv=none; d=google.com; s=arc-20160816; b=tPXg8WLFe4lpdVF/pRye9gBjGzAfFk58QAeLiejTx3HBF7uXiYXs+KUpqTBmVNAt3T px4GE7Nyx8h6loX2N/Zo/q0SuTgXZXxQu547GzWoRQH6O1ERxd2J0+iuVjRTSUH2esH7 gT8AKumvOqe0AcK5rwlTJkkEei+MpPp9NVtaS08RWK2JfQn+h9Th/xMMptM1pT5H7j3t YsCWtCPCmWXoLYEiNYWEovtiWiKRg8QUlRwFbkGDa60AcXJKAprEvuphYwnuEiQWhW/F U/qumZPI+k0rP6Nn6psIaLMyjjFD48cFdrJh3fYwAjJKHt4DTQQKf9R7wyT8HEw4tnGe i7SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PFAW0jcwtPS3OhOTEsyS1TaHRevCT8P/51hfS6qzO/0=; b=EOJ5fQsP5hhWiiL70zMRQIchATb9a56766wpknm9xVIH3VoJvShojbckl5areTNV8K PSl+Ku/K3V/ueywuilINgCizLtmI/perNg6t9ySdNhi8kBpMqzW2nRW5fVbUX6PVFZvV WN9oNzLWHEIolrfpdGWkuzYh3CpTTxtkgLtm6s2ZWzGyyQqed41eXjcPq3q0oOc4u40y oz4Uict/XL4RXqNghujaGD68nkIkoPAE39XlKcL0Iyq0a3VILUlqzt2i1ZYwOIeIn/Kw DSmQJxIbfBa+dduIpKC3KDnWjRkW3vmlLdaA+qc9atnnrZ8DHU2h0CBedI6hUTBz6ogq qWnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XbL5jZNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi3-20020a17090b1e4300b0020a8a23a3e4si5621785pjb.119.2022.10.06.06.54.48; Thu, 06 Oct 2022 06:55:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XbL5jZNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231617AbiJFNuK (ORCPT + 99 others); Thu, 6 Oct 2022 09:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbiJFNuF (ORCPT ); Thu, 6 Oct 2022 09:50:05 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92F6114D2F for ; Thu, 6 Oct 2022 06:49:52 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id x1-20020a17090ab00100b001fda21bbc90so4386600pjq.3 for ; Thu, 06 Oct 2022 06:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=PFAW0jcwtPS3OhOTEsyS1TaHRevCT8P/51hfS6qzO/0=; b=XbL5jZNUUKXEiK1u2yAh2XjMo9JrXVhEG6s45pdssMhcckLQfzKl5TyNqp9xhLguG9 ov6efDxeJ/OpTauHbeWKGubyk8nmkZ0frvB0931/42GCU57aK6jZmmRo3EFq0Wvrk/sQ VveP+1s1nqV3fnYAbx7ypCAZ6ZuRFEh6L0VeoWsPg6P8u34Q5ByaRzYQNEV3kp8I7n2u SHIQ/piSpxgfOgTtTfDazd5KPaVJ6aGCsIamTS1HLctAbMOyWeXIHxSQVEH7KzUbCvqA 7pF/b/C78Bfq9nQctz1ynXZDPLyzvd54oOeF/pJMBz2+1jgUkgwUUliCH6+OvmItDzjG f5Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=PFAW0jcwtPS3OhOTEsyS1TaHRevCT8P/51hfS6qzO/0=; b=4qTg6CwB9q9BHOGNjcsoUTi9SWG7aH3YrAa+FNiYPJvze9aY5dXJRpuVH+hhJB50Le IMlxHTQbp/W2+Hju8xFmRBiRjicHNa777oGjeisKMUm4ZqKqKQZTc2/N+Xf5+D2yqAj5 KQgQECpBfGieVp4Q/taPbJp/RTVbuOYfBdVIko3tW345paNdgIAYiw59eEcv363ndJdY 7tNtDWheJd+4KfkQv5eu8k5/fQDpMDjun8FQ03m7dlzQ01OtPcJzZS0uByUYMsou5g4h SA5BmmXxLL7pHy85zQrf9eJrgA2uND+ld+TB4RxK3HSuHP6GQSLQycLgvHIbyQBspJ9x VyWw== X-Gm-Message-State: ACrzQf06wXYH0bXzS/e+ubJ78aicJWzw01/14o1KWdM4uglwYp2KF81L IIJgq7XicBU3e6kzmwp8QavF X-Received: by 2002:a17:903:2d1:b0:17d:ba07:42d4 with SMTP id s17-20020a17090302d100b0017dba0742d4mr4859423plk.92.1665064191962; Thu, 06 Oct 2022 06:49:51 -0700 (PDT) Received: from localhost.localdomain ([220.158.158.220]) by smtp.gmail.com with ESMTPSA id k25-20020a635a59000000b00434760ee36asm1874053pgm.16.2022.10.06.06.49.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 06:49:49 -0700 (PDT) From: Manivannan Sadhasivam To: 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, vidyas@nvidia.com, vigneshr@ti.com, Manivannan Sadhasivam Subject: [PATCH v3 2/5] PCI: tegra194: Move dw_pcie_ep_linkup() to threaded IRQ handler Date: Thu, 6 Oct 2022 19:19:24 +0530 Message-Id: <20221006134927.41437-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221006134927.41437-1-manivannan.sadhasivam@linaro.org> References: <20221006134927.41437-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); } } -- 2.25.1