X-Received: by 2002:a62:ab09:0:b0:4e0:d967:318f with SMTP id p9-20020a62ab09000000b004e0d967318fmr194783pff.86.1645634172037; Wed, 23 Feb 2022 08:36:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645634172; cv=none; d=google.com; s=arc-20160816; b=re6nuIh4hHWA1t8Gl6njT7/RLaAYVEh6VS+KQ4dhfBsCFG7EA3cSHXjWlpmOieSZW/ eHjnU861eE1pROjZS2e6KJCyUbjP4gYt3eS8UWeEwZINpq2wqaZ+gGrw/dOKWl/N9FQn ftqM5Ms9ZI1QcF33Ijx91sLpivptYPCV2w0Z78PIyOfckKd/gMolwuXFkZ22YY4aAY7l gUxfvOZguMnRL9gJjmvGJJDGup4mzHay4Hawky9QeQJ57rTcQzbxNtmmHjLn82eWiuYF NL3UOnLcmMrrzgXkeANqQMOjERnT+BaiBUmfK8B/+aPFuFXlMMP1Svxcfdhff0LiBYY1 ImHw== 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 :references:message-id:subject:cc:to:from:date:dkim-signature; bh=g8WxupTLs8MLJUu/T38IUQS7ZfG/Gt+sYScaZm50wEs=; b=YNCvrHGPXViU55pbxgQUpOpp2SLkC4XuTuD3IxGUqhNPyqfclLbwrFLVKZTBIQTOS/ ZyyWXjCCe4trjp5myMDRvFyYnCpTkCcLS6sRP51XFRv2dcIcf5w8uxqx29y1uI7xOQgX 6uh9lVfTps07D/6Opp6QlFxupYpcEwgn2NEJLQjSW7DPJClqn7d66bk0Q7Xw9xCd9LhW la2pH+/qa+/PUmBN8YvcBWeaSMyKgQIYIy/sNNvp6sr7SZiL687VUUQ92aLxbkgWrBPh 34a4FTb1A48gRt9NeWfOyWlmb/9kiFrDLmgQUUj2+7PGfoogVnGXG5h+MPxFmK3k67Lo qdJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YuRdXmLc; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f131si65721pgc.849.2022.02.23.08.35.53; Wed, 23 Feb 2022 08:36:12 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YuRdXmLc; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241789AbiBWQOg (ORCPT + 99 others); Wed, 23 Feb 2022 11:14:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234136AbiBWQOf (ORCPT ); Wed, 23 Feb 2022 11:14:35 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E1E1B717B; Wed, 23 Feb 2022 08:14:07 -0800 (PST) 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 sin.source.kernel.org (Postfix) with ESMTPS id F25E3CE1BC1; Wed, 23 Feb 2022 16:14:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3E93C340E7; Wed, 23 Feb 2022 16:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645632844; bh=RDlGUXhVMQjdPD7pgZi9YzuzAu6QlwjIsVRe2uzVobQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YuRdXmLcgPNMJOHk2OcUAFhYE945oDsoDg7DM3GMhKgfUK1j41IsKB+fndP08kJo4 gzaN4PQN0gv2/GE7I2q8KHSeuSpesGHqmJkTUgohUjN7BGWERSGBUX3R9tofkAWSTL DnwC9fmCiPywK+lZ2RguXtZLuSlD3aj3j+s3f1nwHfaEx1A23ePpyBZt53vYSHepKX uMaIpUZnGNGidvIl0L6eypjeWQDFuCw1SmRsVlHVxmhaIvA5M/tV41F0wObT/hDLtq TCQOQDZ5OvLIM17zzD3bXG/xYIHbYjclOpl7sLsEY9bg26pO4Flij+civl7k0yjHsy EJKrixSBvFVEg== Date: Thu, 24 Feb 2022 00:06:09 +0800 From: Jisheng Zhang To: Lorenzo Pieralisi 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: References: <20211226074019.2556-1-jszhang@kernel.org> <20220223114622.GA27645@lpieralisi> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220223114622.GA27645@lpieralisi> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Wed, Feb 23, 2022 at 11:46:22AM +0000, Lorenzo Pieralisi wrote: > 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 You may mean the external MSI interrupt controller case, but here the focus is the integrated MSI Receiver in the IP. Normally, after suspending to ram, the dwc IP would lost power, so the integrated MSI Receiver also lost power. > dw_pcie_setup_rc() we overwrite PCIE_MSI_INTR0_ENABLE even if it > is not needed on resume - actually, it can even be destructive). > For the integrated MSI Receiver case, since the entire IP power is lost, so the PCIE_MSI_INTR0_MASK|ENABLE setting is lost, we need to resume the mask to the one before suspending. For PCIE_MSI_INTR0_ENABLE register(s), since it's always 0xffffffff, so current code is fine. > Maybe we need to write suspend/resume hooks for the dwc core instead > of moving code around to fix these bugs ? > Even with suspend/resume hooks, we still need to fix the PCIE_MSI_INTR0_MASK wrong setting with always ~0. After the fix, msi works so we don't need suspend/resume hooks any more. Thanks