Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1703391pxm; Thu, 24 Feb 2022 07:56:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyajljvMhz8vMkXB2DuxSU40xSwSLP9uyyiBQyAKJ6OhhTvULI58DQJL+tx0nBAvy4mMUxE X-Received: by 2002:a17:906:dfd0:b0:6ce:4226:2672 with SMTP id jt16-20020a170906dfd000b006ce42262672mr2828811ejc.141.1645718193097; Thu, 24 Feb 2022 07:56:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645718193; cv=none; d=google.com; s=arc-20160816; b=BdwMluXSw+jtnlvw/gkv/gnWkqxCnMld9HXHsCib+bFBa8cF6IdxDcmemL0HxuP60W tmfKuQZ+FfkTTNsO3j9UI4A2t0/l1h8xDnrBHqu0j14m6FXJceu/L0OfxlZgBVp5/keR 4/XO1AZ1x9iIL2tfU+whmbo/1qxIZZZhxEdvvWC2kPkZf0Dn3FMh72PTLjqVU7zfBk2Z u1F6HHsrJpevRw+MvUAhUYppYKWc8Kz8Af4ScDJ0VWx8ratJqVV9G2u3bcZJbdr886uw B6Jb5XQkrFIxaGIrlDgcoPCMih0V6kTFl1TDveE2w8bTrcjbx4cHf7LcaphpLFz/mD6f CMrw== 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=SoLWoxQGeUKZjE9h8L2l2qk5+X9SG+gfIi8ibJmZsdo=; b=aSPd1SLMnwu/O0kX8QaUILId405VDGcwjRsseKDKtucncG9Dy4DyeSHX1YI5NaTjGg 6LMMAfIOTZP1f/8FfAKhCTg4/HnjD7aXA4UkF3DDJi3KR2fDTo4VBhX+EHpXFYTs6Zyz lf35sQ6Y2YMAdiV/lwx0aihrJ5SVf+eYwwoaED7dn4p05K7mXA6Ga3v3GvxfXlmM7opJ qUBz+CbiSS7xKCDCBqqHDvaU+p/tcZLMP9L09yBl5sOAoe14OBjUQCZ6YXI9vq00uBYL QWxIqzCWkJzOs/2AQlZ++hIsWjollaRWzOO2C32pejGG//U34Ot4lLiu/26nLA1qgsnX biQQ== 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 nc1si2220157ejc.151.2022.02.24.07.56.09; Thu, 24 Feb 2022 07:56:33 -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 S235340AbiBXOJ1 (ORCPT + 99 others); Thu, 24 Feb 2022 09:09:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232103AbiBXOJZ (ORCPT ); Thu, 24 Feb 2022 09:09:25 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2E2229456D; Thu, 24 Feb 2022 06:08:54 -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 74410ED1; Thu, 24 Feb 2022 06:08:54 -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 58CC83F66F; Thu, 24 Feb 2022 06:08:53 -0800 (PST) Date: Thu, 24 Feb 2022 14:08:47 +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: <20220224140847.GA4839@lpieralisi> References: <20211226074019.2556-1-jszhang@kernel.org> <20220223114622.GA27645@lpieralisi> 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 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 content is restored on power up to the correct value then ? I assume those registers when the IP loses power are reset to their reset value, so something does not add up. Lorenzo