Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1049213pxm; Sat, 26 Feb 2022 05:00:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzz0d7G2tQ7QPT/FK5qZmqSFqU6gyRN2/uR8URKFxIS87bMD1nazs1CijqMWXx2hSd1dj+D X-Received: by 2002:a17:90a:fc87:b0:1bc:91e3:e5d8 with SMTP id ci7-20020a17090afc8700b001bc91e3e5d8mr7846323pjb.225.1645880435078; Sat, 26 Feb 2022 05:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645880435; cv=none; d=google.com; s=arc-20160816; b=Rr61B9Mzy2beVI5YNprzpvrRwyAuYmMEAUKhZ9y67j8KojWZZ9fl3Esvj2/z/A2ZUz sjnGbjMRYZ4f6FuSH4g1hTHxNyZbTKyEYwakCCNjWC89k8ya8nCAqeJYDHTlJsG1jk8G IpiyNiZ9MImRg7RiLFlkjua8Re9WZ3GeW+OnMVPXWDFcSFhwAgiWjjiKMKvlBOGAa8PC Bbnrkchdubx+++9hIdVOBoN+tVAyiex1wT5pOyw9LsFQbImZZZuUTfCj5bOPvZYjlPUS VPJ+rm1qOFfxKOVuXR6HBBUi0p7nlqwtk63M+oNrQ2HVcgbRwhWaCbExivqPnxeiWACc H9ZA== 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=gXOP3wjjElcwLYyj7YAAiQHBe4ba1dbznUKF4Ix3mVo=; b=uXuw4ZiawTfup+2/VnGGokO4X/0j3j6Ra0Jjb2emOko4HsGr4k1ilLfDDovDx+Gx2h bZBLNEMKymsVxxzxfb6UQ5F8IHobA+NOlYxJCcMfTIw046L8Af87i3oij4GLU2ONlXWc wpjUEZwuW18tNbS4hCsRwbQED6xxmuEO42Gn4BtkdgGukxRsEFhO0PTJVU9pRUfmVIgJ pfaud9PQs7uK7huUUXeNMAdcDpmgIhNJys5hRbCfHZzgWFZ29XWzuwK7bBjA5CVuYq/5 uIIRAqC/P9H/2Fq0z79YjeELaJ3RWyzSWoNSf1aLHLzX6QuDDBNCvtxKVN0DQx9OtwF0 j/fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R63McLfG; 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 w6-20020a170902e88600b0014febb64985si4563222plg.502.2022.02.26.05.00.19; Sat, 26 Feb 2022 05:00:35 -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=R63McLfG; 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 S230289AbiBZJYS (ORCPT + 99 others); Sat, 26 Feb 2022 04:24:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbiBZJYR (ORCPT ); Sat, 26 Feb 2022 04:24:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27E711B2AD5; Sat, 26 Feb 2022 01:23:44 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 9DA1760FD8; Sat, 26 Feb 2022 09:23:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0388C340E8; Sat, 26 Feb 2022 09:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645867423; bh=Drm593FxdaMjEXv54XpM7u4sTVgfw1fpSFTqP+vF/Sw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=R63McLfGxlNO1VVtTzVyhZlBLD/EdO2emxiJNDbz0alK4WVE7OKub43ux5C4Ugmg8 1nXjfBjm0q2kAjRCE10MS+A9w2pHM1ZiEcM2NVW+cs5fXFhq7lZ1lhQX4tPyVBVIAd SDEoE+lP3n6p7TDMn7+03zaddaLLSvgMdAR4t8K8Qdk5WTuF9yzmmnJCHrhjqxPhD+ l8Y2w4r3wj+T79am2nam0R7RhUyBFx6ZF4E5Jzy8P49wNOdE+x/Pb4tRk0EX75wSfp KoZ25z876TdL7bdDhYfCJMw74mLW3znqCGrzLp564ypky7UjG4tjNszKbBj8TCpgMt S+xpYFFMHKdmw== Date: Sat, 26 Feb 2022 17:15:42 +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> <20220224140847.GA4839@lpieralisi> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220224140847.GA4839@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 Thu, Feb 24, 2022 at 02:08:47PM +0000, Lorenzo Pieralisi wrote: > On Thu, Feb 24, 2022 at 12:06:09AM +0800, Jisheng Zhang wrote: > > 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. > > I don't understand. The fix removes code that is writing into > PCIE_MSI_INTR0_MASK (in dw_pcie_setup_rc()). Where that register No, the patch just moves the irq_mask[] array setting from dw_pcie_setup_rc() to dw_pcie_host_init(), the code which writes irq_mask[] array into PCIE_MSI_INTR0_MASK is still kept there. > content is restored on power up to the correct value then ? the irq_mask[] array.