From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46B73C4332F for ; Wed, 2 Nov 2022 23:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=5/man3GqLiEMnG9YRtdW/VMep+MSDXPICWhvCSHfEfA=; b=ZQ14zcbUazM6Az 1qCe/bPROiD5hJLsIMtHOZo0+2o7DBJ9ATm8rx0bM9d5PylTtzrPhCG3Wqc3PNC1AUY2pO2VlB75b MNJubx4zEM0p3uMkkGYBmYS4+M2hOwXyePNleBxcYEjRqex/yZwlEQ6+McDZ2I9TDKhdtGfPcjQ0J 8cRznwHfCB80sgQdROxEOqTT8C4OcD5BX3RPYLbRmcGja/7NaS/ogbs3jGLYrWxHzWyy+vN2IyCam x3o69lv1o/Sd4arhMyyAsXKWbVAcngq85Jy889sO7HbccnpM+lA+P28g4NBlvWkFFV1XYC5rhKEAj diF/fePhve3NHhZpRUKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqMsj-00ErOB-OJ; Wed, 02 Nov 2022 23:10:49 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqMsd-00ErN3-QN for linux-arm-kernel@lists.infradead.org; Wed, 02 Nov 2022 23:10:47 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A07C6B824FA; Wed, 2 Nov 2022 23:10:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20676C433D6; Wed, 2 Nov 2022 23:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667430639; bh=7z2vQGpx8aQdXx6lSmQcW2FtPxBrqDU9ClMERbgqoT8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=LzlSIBqRlMoZwqnBUQaox+KQrA6wW1lP+R4NKx62il+eYjhu8jk7Ru8bt3WgvjiQE N+ygvU74YQlOMYNN0P384TX12D+C91SkKdaDBUOBFXdqUiu44yF8ODAqdNsWXkg7mj 7TUKHjdYGLTL3NPruUfXexd8LCDx4mGYrLykh/cUA4MQGdP9A87jrSLO0SIi1J95B0 oK+L0vmElBStgyC0NEtP94jZJnIZunSlezOMNBN5t/B17RUO14VXdye2Jthtz2Ei5D TmbzENaRt4xPrABC8WCMlwhi4WC93GS2Vy/EQ7ph1AYG8gJsC5DYqU+KV20YqJduX5 Utd0iMsjkKXpw== Date: Wed, 2 Nov 2022 18:10:37 -0500 From: Bjorn Helgaas To: Richard Zhu Cc: l.stach@pengutronix.de, bhelgaas@google.com, lorenzo.pieralisi@arm.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com Subject: Re: [PATCH v1] PCI: imx6: Set MSI enable bit of RC in resume Message-ID: <20221102231037.GA6902@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1667289595-12440-1-git-send-email-hongxing.zhu@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221102_161044_159118_B1563103 X-CRM114-Status: GOOD ( 25.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Nov 01, 2022 at 03:59:55PM +0800, Richard Zhu wrote: > The MSI Enable bit controls delivery of MSI interrupts from components > below the Root Port. This bit might lost during the suspend, should be > re-configured during resume. Just out of curiosity, why would this bit "get lost" during suspend? Don't the normal save and restore in the suspend/resume paths take care of this? Are there other bits that might get lost? > Encapsulate the MSI enable set into a standalone function, and invoke it > in both probe and resume. > > Signed-off-by: Richard Zhu > --- > drivers/pci/controller/dwc/pci-imx6.c | 24 +++++++++++++++++------- > 1 file changed, 17 insertions(+), 7 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 2616585ca5f8..dba15546075f 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -1041,6 +1041,21 @@ static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie) > usleep_range(1000, 10000); > } > > +static void pci_imx_set_msi_en(struct dw_pcie *pci) > +{ > + u8 offset; > + u16 val; > + > + if (pci_msi_enabled()) { > + offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); > + dw_pcie_dbi_ro_wr_en(pci); > + val = dw_pcie_readw_dbi(pci, offset + PCI_MSI_FLAGS); > + val |= PCI_MSI_FLAGS_ENABLE; > + dw_pcie_writew_dbi(pci, offset + PCI_MSI_FLAGS, val); > + dw_pcie_dbi_ro_wr_dis(pci); > + } > +} > + > static int imx6_pcie_suspend_noirq(struct device *dev) > { > struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); > @@ -1073,6 +1088,7 @@ static int imx6_pcie_resume_noirq(struct device *dev) > if (imx6_pcie->link_is_up) > imx6_pcie_start_link(imx6_pcie->pci); > > + pci_imx_set_msi_en(imx6_pcie->pci); > return 0; > } > > @@ -1090,7 +1106,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) > struct resource *dbi_base; > struct device_node *node = dev->of_node; > int ret; > - u16 val; > > imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); > if (!imx6_pcie) > @@ -1282,12 +1297,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) > if (ret < 0) > return ret; > > - if (pci_msi_enabled()) { > - u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); > - val = dw_pcie_readw_dbi(pci, offset + PCI_MSI_FLAGS); > - val |= PCI_MSI_FLAGS_ENABLE; > - dw_pcie_writew_dbi(pci, offset + PCI_MSI_FLAGS, val); > - } > + pci_imx_set_msi_en(pci); > > return 0; > } > -- > 2.25.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel