X-Received: by 2002:a17:90b:c8e:b0:1bc:3481:b2b7 with SMTP id o14-20020a17090b0c8e00b001bc3481b2b7mr10299070pjz.187.1645637063750; Wed, 23 Feb 2022 09:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645637063; cv=none; d=google.com; s=arc-20160816; b=s+1B0HTuJoy9lm7Mc13uqHioKPBn21dOvSjvv1uXt5cexjyGAuTBg/goR6V2V9aOcN jKGYPvOKl2G3l5fu54X+9JdZNJET3K/h5RhXc9djHuf3BPiKJWiFmXv8Y8Sbtxwsz6OJ 3a8oGmQyL/dLZ5+ywF306Pa9XfJbXqGvr0g89HJ35UqvHxTL+7PsWqQkNAgHA7Eueg03 JmNZKgFxGniZyxB+8koegk0kkVmDNW9i2qUeCSL7ihs3Z9cUzw36XuscjOnX2fdHEuL3 r9OatVroMzWxqbpZknOa63pUBeV98vMQm8LJkKp3JxS/LMDTp3qpl+HdOXoRbwGshVoq 15PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=cCQxCFIKQpUMztGYj/TaXBTAu6ZnxRZiK51TDLq1aew=; b=b3z71sXXENk2t0z8diSmCsr2ins/SkEtiDpM4dQW6K9T7u+28wbgquajCAYAEUnRYc PF5pbuTEdTeSG4GcmiINKDWR7CO2KTQ07ctt3TDQqwYSJDasuFfvfH6qKognsZOfGF4A 1aPG7DoGK6OiOhoA0UdAkyqcxv8494yS1JQ2M/TD3jDP7ooAfSeV7dD/BGfHSDVvK44T 7FfVNsa/PV8qdqiumUTalP13jbUqgSXbwbSoVID/WSsSvpilpaqxo/I4f5Mffq8BpTyh /RQArcOTe7xbg26GbW7b1zffTN4Xx6gRK8/AmF7XWlRZy6/ai7nEOvz6HETBCzamhizm tOQA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a64si209227pge.230.2022.02.23.09.24.07; Wed, 23 Feb 2022 09:24:23 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236756AbiBWLq6 (ORCPT + 99 others); Wed, 23 Feb 2022 06:46:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236216AbiBWLq4 (ORCPT ); Wed, 23 Feb 2022 06:46:56 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0621598F67; Wed, 23 Feb 2022 03:46:29 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C5235106F; Wed, 23 Feb 2022 03:46:28 -0800 (PST) Received: from lpieralisi (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A84113F70D; Wed, 23 Feb 2022 03:46:27 -0800 (PST) Date: Wed, 23 Feb 2022 11:46:22 +0000 From: Lorenzo Pieralisi To: Jisheng Zhang Cc: Jingoo Han , Gustavo Pimentel , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: dwc: Fix integrated MSI Receiver mask reg setting during resume Message-ID: <20220223114622.GA27645@lpieralisi> References: <20211226074019.2556-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Sun, Jan 23, 2022 at 08:02:42PM +0800, Jisheng Zhang wrote: > On Sun, Dec 26, 2021 at 03:40:19PM +0800, Jisheng Zhang wrote: > > If the host which makes use of the IP's integrated MSI Receiver losts > > power during suspend, we call dw_pcie_setup_rc() to reinit the RC. But > > dw_pcie_setup_rc() always set the pp->irq_mask[ctrl] as ~0, so the mask > > register is always set as 0xffffffff incorrectly, thus the MSI can't > > work after resume. > > > > Fix this issue by moving pp->irq_mask[ctrl] initialization to > > dw_pcie_host_init(), so we can correctly set the mask reg during both > > boot and resume. > > > > Signed-off-by: Jisheng Zhang > > Hi all, > > This patch can still be applied to the latest linus tree. Do you want > me to rebase and send out a new version? > > Without this patch, dwc host MSI interrupt(if use the IP's integrated > MSI receiver) can't work after resume. Could it be picked up as a fix > for v5.17? The tricky bit with this patch is that it is not clear what piece of logic is lost on power down and what not. IIUC MSI interrupt controller logic is kept so it does not need to be saved/restored (but in dw_pcie_setup_rc() we overwrite PCIE_MSI_INTR0_ENABLE even if it is not needed on resume - actually, it can even be destructive). Maybe we need to write suspend/resume hooks for the dwc core instead of moving code around to fix these bugs ? Lorenzo > > Thanks > > > --- > > drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > > index f4755f3a03be..2fa86f32d964 100644 > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > > @@ -362,6 +362,12 @@ int dw_pcie_host_init(struct pcie_port *pp) > > if (ret < 0) > > return ret; > > } else if (pp->has_msi_ctrl) { > > + u32 ctrl, num_ctrls; > > + > > + num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; > > + for (ctrl = 0; ctrl < num_ctrls; ctrl++) > > + pp->irq_mask[ctrl] = ~0; > > + > > if (!pp->msi_irq) { > > pp->msi_irq = platform_get_irq_byname_optional(pdev, "msi"); > > if (pp->msi_irq < 0) { > > @@ -541,7 +547,6 @@ void dw_pcie_setup_rc(struct pcie_port *pp) > > > > /* Initialize IRQ Status array */ > > for (ctrl = 0; ctrl < num_ctrls; ctrl++) { > > - pp->irq_mask[ctrl] = ~0; > > dw_pcie_writel_dbi(pci, PCIE_MSI_INTR0_MASK + > > (ctrl * MSI_REG_CTRL_BLOCK_SIZE), > > pp->irq_mask[ctrl]); > > -- > > 2.34.1 > >