Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3874596pxf; Mon, 22 Mar 2021 18:26:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZIsUZWNb/uYfjgzurr8nwe2icOu3qa8UwB3N10QFbNVPf0+2weM39huWxF5udbqqrReZq X-Received: by 2002:aa7:d347:: with SMTP id m7mr2200790edr.260.1616462773295; Mon, 22 Mar 2021 18:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616462773; cv=none; d=google.com; s=arc-20160816; b=VJR23OCRQsQ94N2gZhgZKwksVAA6FWvZlVYrjFaOf1Qao1r2+kbcbZPlRwnmnJKH3e 9fBufGxTXGwFeHd7tH96FVLdgxwc9eQ1rHvcTlfQxBKuFuwFmN2/zqMTeRspa/7Zc9NE NbHJMHUBHddf6XQ+v33SBV+pVW/vhNnGo1HrSRjHADgvpVyig7w6rtYsFkCT4GK4SxGE mULFRrjwxotH9iwwSEy2BqWFoo8vQuzBVVBAfKQ4C1qF5Jhq7p7Z/KMcq5NW0STopgzk RBE1r8HvzctR6PzVAsKm2BajZHyREQGiI1vVOB2gEDs5WQ2ELVlxMMN/lWQteIgJ0CuN eLmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=M6l+NJZvUU00wgnjtU+lnRfVqiDoe2x2LqN9R38lBLk=; b=L4lqgG7+ygPBYX5kAj7o1bNPJCdiE1Rsv5O+S2o10g49l/arPARom1Z8SWVsjJhvIb lmp7YVHRgcll0/GeZOVnTEK4yjHyXZkDpMZvxNAezKe55w/WcuY7sdIjCpDZu5MAhty3 9VJ8a7mMXM+TAEU30NRswU93dJ/LIEPs3Ta5p2fPEzfUZKFTCNeuW0KZzvYzB123Ixf9 Iph+24HpJvcvC/9eHYcBbVk2cw+0/CKyZG6wrKuABDY3ppH9Gv4/S7kI3lqSqqVDLsfF 6fZFLhSJir7jEGLmlg6YZV9zV1pZIbEKAN0e/Xe2BTGunYjk1C6wnkdOkYhHogHJhsa9 6oMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oITALvP9; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v4si13068348ejx.329.2021.03.22.18.25.51; Mon, 22 Mar 2021 18:26:13 -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=@kernel.org header.s=k20201202 header.b=oITALvP9; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231543AbhCWBY7 (ORCPT + 99 others); Mon, 22 Mar 2021 21:24:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:35134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231569AbhCWBYo (ORCPT ); Mon, 22 Mar 2021 21:24:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 917C461934; Tue, 23 Mar 2021 01:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616462682; bh=EoBN4W8jvfpgQpUiF4qeqHSUMWuVaP/vkiyeVe8OrcU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=oITALvP94gugPGD651TSoMU9ZT+C6s7/z3V7eEEvHJVif1U4nNfPwIl98YX6LC5Gb Sjc/lGg89KkYXllxsObRlxKaAbhozN6xI65U0ZO1evxGeydfnx+c3yuNqSxlKat122 pRMixEZ4fWN0S/gcxYpRr6o7s5RdDbuwZllx5n2/pIqFJwATcugypivBje51xzpaTJ zlkJHIXMmMFjKzM2Xgcc/QnJeAvwf0bTYV0CULiS7+N0c8g9bG5VAyLRZtwRQyJnd7 Hmi7rfrwfc0wz6vPu5uLpM2R7sbbPjIOqG8a2VCylRorJGVC3ehqcnmtQNPm65/qLx n5uwmG8Z5WSfQ== Date: Mon, 22 Mar 2021 20:24:41 -0500 From: Bjorn Helgaas To: Jisheng Zhang Cc: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kishon Vijay Abraham I , Richard Zhu , Lucas Stach , Dilip Kota Subject: Re: [PATCH RESEND] PCI: dwc: Fix MSI not work after resume Message-ID: <20210323012441.GA515937@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210301111031.220a38b8@xhacker.debian> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+cc Kishon, Richard, Lucas, Dilip] On Mon, Mar 01, 2021 at 11:10:31AM +0800, Jisheng Zhang wrote: > After we move dw_pcie_msi_init() into core -- dw_pcie_host_init(), the > MSI stops working after resume. Because dw_pcie_host_init() is only > called once during probe. To fix this issue, we move dw_pcie_msi_init() > to dw_pcie_setup_rc(). This patch looks fine, but I don't think the commit log tells the whole story. Prior to 59fbab1ae40e, it looks like the only dwc-based drivers with resume functions were dra7xx, imx6, intel-gw, and tegra [1]. Only tegra called dw_pcie_msi_init() in the resume path, and I do think 59fbab1ae40e broke MSI after resume because it removed the dw_pcie_msi_init() call from tegra_pcie_enable_msi_interrupts(). I'm not convinced this patch fixes it reliably, though. The call chain looks like this: tegra_pcie_dw_resume_noirq tegra_pcie_dw_start_link if (dw_pcie_wait_for_link(pci)) dw_pcie_setup_rc dw_pcie_wait_for_link() returns 0 if the link is up, so we only call dw_pcie_setup_rc() in the case where the link *didn't* come up. If the link comes up nicely without retry, we won't call dw_pcie_setup_rc() and hence won't call dw_pcie_msi_init(). Since then, exynos added a resume function. My guess is MSI never worked after resume for dra7xx, exynos, imx6, and intel-gw because they don't call dw_pcie_msi_init() in their resume functions. This patch looks like it should fix MSI after resume for exynos, imx6, and intel-gw because they *do* call dw_pcie_setup_rc() from their resume functions [2], and after this patch, dw_pcie_msi_init() will be called from there. I suspect MSI after resume still doesn't work on dra7xx. [1] git grep -A20 -e "static.*resume_noirq" 59fbab1ae40e^:drivers/pci/controller/dwc [2] git grep -A20 -e "static.*resume_noirq" drivers/pci/controller/dwc > Fixes: 59fbab1ae40e ("PCI: dwc: Move dw_pcie_msi_init() into core") > Reviewed-by: Rob Herring > Signed-off-by: Jisheng Zhang > --- > Since v1: > - collect Reviewed-by tag > > drivers/pci/controller/dwc/pcie-designware-host.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > index 7e55b2b66182..e6c274f4485c 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > @@ -400,7 +400,6 @@ int dw_pcie_host_init(struct pcie_port *pp) > } > > dw_pcie_setup_rc(pp); > - dw_pcie_msi_init(pp); > > if (!dw_pcie_link_up(pci) && pci->ops && pci->ops->start_link) { > ret = pci->ops->start_link(pci); > @@ -551,6 +550,8 @@ void dw_pcie_setup_rc(struct pcie_port *pp) > } > } > > + dw_pcie_msi_init(pp); > + > /* Setup RC BARs */ > dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, 0x00000004); > dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_1, 0x00000000); > -- > 2.30.1 >