Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2352033pxb; Mon, 20 Sep 2021 19:48:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhEvjejDVIzQgg63lZqC2gC6dELMvNOm0nfCqZIrowqtXsG/tNkRrepeFIReHSRj6IeP5R X-Received: by 2002:a05:6402:1352:: with SMTP id y18mr32239578edw.122.1632192527276; Mon, 20 Sep 2021 19:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192527; cv=none; d=google.com; s=arc-20160816; b=Oc8IImZsaRC1+mCpN9fac2D7oojAj1eOePhlZK+mAeMTCijsroWK3hej0UUYpaBGF4 90BTofL6ZlpD0UZOTEFEcO/E/QWZZXKm0qx2RVE4c2Ko9R3Ey3ZZg0A4NpbTBKLROdAN oipRSTY2rQFRIUoeqDCXcYsU+J7SAmT7ncMvOxx6tf22oR9A0+BthY96Vs3qLb6DZ1EO qPcq0gXMbpwV4rQcSoGD8OSx7w9Zt6qrhp5LCGQP9Zr5QIOQ6ykMTWZ9Eyo4h41k0eAr HBS9Pg10cSErjJZxZami7HrwrUCYwmYudp4mb6PNYH0Cd11x026EjeMvrt9V4trRqiSg ELkQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Gdg6zh+8e6WwhNLEc7/to7NeDKx4sfdkkXZ9FkvMk40=; b=Zsmx96bL/GemKK8aheXFPWekHVWNue+M5L7OlaEDKhxq0CMXZZnzM6Mri/pGbioQQ+ 17oIYwlnWziyQhcJ2Cobwnwh5dMLb/T0cILs8vbBOMYDOhU2B0XILJgK97mkfpYDspVm nMZNY3lBeIdDiMltWicYB2Xpp3JAP25gtqatAM500O8HskdRCqTnSmD4Y6GdpVCf37mn QP1jlX3/s37F4tzOkS4MQ4XHTzO9loc953gYuFwNwGPFEdK8yw7ESRz5o5qNTkX1wdq5 shaDwNOHYm6pdR4iuia6MdEOaVVgGBJAXWVtseWMYGU+qAKRsRcEo5QkKdbF+NgDSWsb 5FkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="YufAmoD/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si18138740eds.131.2021.09.20.19.48.23; Mon, 20 Sep 2021 19:48:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="YufAmoD/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380833AbhITSez (ORCPT + 99 others); Mon, 20 Sep 2021 14:34:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:48630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379519AbhITS32 (ORCPT ); Mon, 20 Sep 2021 14:29:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 879526137F; Mon, 20 Sep 2021 17:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158811; bh=O12ORUh350U1nDoSDlnv7lBP/4Stol3K7FbNOpeVNss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YufAmoD/Tk/LaFkdVzL/KSfCytcFbCj2bbwuF/P/qHZh3rZkVPvTbUztT6eJzdVW2 bbZjjKD+IBPaB3EmFH1f5Ie2JreV1VUMfJmezEVtb0acD15Z6u/6m4KF7jnU71VS8A vLfn0Dgcdd2ZwH7H5MvDxecIIjMZCmPgDz3qE60U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Om Prakash Singh , Lorenzo Pieralisi , Bjorn Helgaas , Vidya Sagar , Sasha Levin Subject: [PATCH 5.10 059/122] PCI: tegra194: Fix handling BME_CHGED event Date: Mon, 20 Sep 2021 18:43:51 +0200 Message-Id: <20210920163917.716160036@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Om Prakash Singh [ Upstream commit ceb1412c1c8ca5b28c4252bdb15f2f1f17b4a1b0 ] In tegra_pcie_ep_hard_irq(), APPL_INTR_STATUS_L0 is stored in val and again APPL_INTR_STATUS_L1_0_0 is also stored in val. So when execution reaches "if (val & APPL_INTR_STATUS_L0_PCI_CMD_EN_INT)", val is not correct. Link: https://lore.kernel.org/r/20210623100525.19944-2-omp@nvidia.com Signed-off-by: Om Prakash Singh Signed-off-by: Lorenzo Pieralisi Reviewed-by: Bjorn Helgaas Acked-by: Vidya Sagar Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pcie-tegra194.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c index 506f6a294eac..c2827a8d208f 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -515,19 +515,19 @@ 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 val, tmp; + u32 status_l0, status_l1, link_status; - val = appl_readl(pcie, APPL_INTR_STATUS_L0); - if (val & APPL_INTR_STATUS_L0_LINK_STATE_INT) { - val = appl_readl(pcie, APPL_INTR_STATUS_L1_0_0); - appl_writel(pcie, val, APPL_INTR_STATUS_L1_0_0); + status_l0 = appl_readl(pcie, APPL_INTR_STATUS_L0); + if (status_l0 & APPL_INTR_STATUS_L0_LINK_STATE_INT) { + status_l1 = appl_readl(pcie, APPL_INTR_STATUS_L1_0_0); + appl_writel(pcie, status_l1, APPL_INTR_STATUS_L1_0_0); - if (val & APPL_INTR_STATUS_L1_0_0_HOT_RESET_DONE) + if (status_l1 & APPL_INTR_STATUS_L1_0_0_HOT_RESET_DONE) pex_ep_event_hot_rst_done(pcie); - if (val & APPL_INTR_STATUS_L1_0_0_RDLH_LINK_UP_CHGED) { - tmp = appl_readl(pcie, APPL_LINK_STATUS); - if (tmp & APPL_LINK_STATUS_RDLH_LINK_UP) { + if (status_l1 & APPL_INTR_STATUS_L1_0_0_RDLH_LINK_UP_CHGED) { + 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); } @@ -536,11 +536,11 @@ static irqreturn_t tegra_pcie_ep_hard_irq(int irq, void *arg) spurious = 0; } - if (val & APPL_INTR_STATUS_L0_PCI_CMD_EN_INT) { - val = appl_readl(pcie, APPL_INTR_STATUS_L1_15); - appl_writel(pcie, val, APPL_INTR_STATUS_L1_15); + if (status_l0 & APPL_INTR_STATUS_L0_PCI_CMD_EN_INT) { + status_l1 = appl_readl(pcie, APPL_INTR_STATUS_L1_15); + appl_writel(pcie, status_l1, APPL_INTR_STATUS_L1_15); - if (val & APPL_INTR_STATUS_L1_15_CFG_BME_CHGED) + if (status_l1 & APPL_INTR_STATUS_L1_15_CFG_BME_CHGED) return IRQ_WAKE_THREAD; spurious = 0; @@ -548,8 +548,8 @@ static irqreturn_t tegra_pcie_ep_hard_irq(int irq, void *arg) if (spurious) { dev_warn(pcie->dev, "Random interrupt (STATUS = 0x%08X)\n", - val); - appl_writel(pcie, val, APPL_INTR_STATUS_L0); + status_l0); + appl_writel(pcie, status_l0, APPL_INTR_STATUS_L0); } return IRQ_HANDLED; -- 2.30.2