Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4310303ybh; Tue, 6 Aug 2019 09:29:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKVsEC+BgetISsrmRjyejlo9hNDKsF5XK3RFKK3MK5ILM5NPvAPzO24sK6SRgoVucP6Q1K X-Received: by 2002:a62:b60e:: with SMTP id j14mr4659221pff.54.1565108986292; Tue, 06 Aug 2019 09:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565108986; cv=none; d=google.com; s=arc-20160816; b=UANWVPt0lgWF95KEi9jF8KYXM2m0PeijaJG7wOnNPH/ACkHILgHqrdhuTmjFr6S90Z ZEqIj6XqbhZBW4InN4Gw6G7NctW2MT2fvPcNbHnyXcR/QOaj6zKkMGOuqS7VkNi7cIy3 uuYdjMP7sVGVhXV7/FH/uqWgU55GSze60/EfjNsjEhkuOmt3GqvP5oX7/oFURz0kY+MQ throx4TD54gnTYVux/VE9Qbyq3bzslm8IzWS25YYXd+Q4svQmaVvdA9IkDlmRVn3tx+p ckczgzDu9H9/FcLh5A5zud5ssfT0yHr2MPttcWuzFvj8CSLKHb8shS1QMSxWzn9I61Qu 83Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7pLgGDCW6B1ONJISiyB3wkQcnoHFs9eWZ+DUyg9GsoM=; b=tyUNXzPgEbraaZcReCuiWd0cJp0ssKHnd+23RYr7Zaxz9r1Nq38P3l5EjhMI86rg5B 3vJ0M/y3FpAU76fvlioYWejHXlIcm0CEMR7xYWdQuBdW/+MGmVRV10LbbHUIYcV9BRYs iipPDBmiYnkQdila4sYPCY4SsWJP78LRpHdlREuR3p+5O2OJnlsrcQhHCHXPZ7EuwSA1 yrDUc+J8njxVhm9PepLIpYFzhahar6HJG9yLZOsngNuqzvoeEgCOKclInSTR1vCGaEa6 Ms1L4lFCcJMaSJImnZ6UE2sdMCi+JLFDHYlWnJUdhCg0wSzQHduvjgR6xEv/LnVLIj0o b5ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j17si47626813pfa.198.2019.08.06.09.29.30; Tue, 06 Aug 2019 09:29:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387851AbfHFQ2P (ORCPT + 99 others); Tue, 6 Aug 2019 12:28:15 -0400 Received: from foss.arm.com ([217.140.110.172]:36370 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728927AbfHFQ2P (ORCPT ); Tue, 6 Aug 2019 12:28:15 -0400 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 5C489344; Tue, 6 Aug 2019 09:28:14 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (unknown [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5A1443F575; Tue, 6 Aug 2019 09:28:13 -0700 (PDT) Date: Tue, 6 Aug 2019 17:28:11 +0100 From: Lorenzo Pieralisi To: Remi Pommarel , Thomas Petazzoni Cc: Bjorn Helgaas , Ellie Reeves , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] PCI: aardvark: Fix PCI_EXP_RTCTL register configuration Message-ID: <20190806162811.GB15498@e121166-lin.cambridge.arm.com> References: <20190614101059.1664-1-repk@triplefau.lt> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190614101059.1664-1-repk@triplefau.lt> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 14, 2019 at 12:10:59PM +0200, Remi Pommarel wrote: > PCI_EXP_RTCTL is used to activate PME interrupt only, so writing into it > should not modify other interrupts' mask. The ISR mask polarity was also > inverted, when PCI_EXP_RTCTL_PMEIE is set PCIE_MSG_PM_PME_MASK mask bit > should actually be cleared. > > Fixes: 8a3ebd8de328 ("PCI: aardvark: Implement emulated root PCI bridge config space") > Signed-off-by: Remi Pommarel > --- > Changes since v1: > * Improve code readability > * Fix mask polarity > * PME_MASK shift was off by one > Changes since v2: > * Modify patch title > * Change Fixes tag to commit that actually introduces the bug > --- > drivers/pci/controller/pci-aardvark.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) Thomas, are you OK with this patch ? Thanks, Lorenzo > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c > index 134e0306ff00..f6e55c4597b1 100644 > --- a/drivers/pci/controller/pci-aardvark.c > +++ b/drivers/pci/controller/pci-aardvark.c > @@ -415,7 +415,7 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, > > case PCI_EXP_RTCTL: { > u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG); > - *value = (val & PCIE_MSG_PM_PME_MASK) ? PCI_EXP_RTCTL_PMEIE : 0; > + *value = (val & PCIE_MSG_PM_PME_MASK) ? 0 : PCI_EXP_RTCTL_PMEIE; > return PCI_BRIDGE_EMUL_HANDLED; > } > > @@ -451,10 +451,15 @@ advk_pci_bridge_emul_pcie_conf_write(struct pci_bridge_emul *bridge, > advk_writel(pcie, new, PCIE_CORE_PCIEXP_CAP + reg); > break; > > - case PCI_EXP_RTCTL: > - new = (new & PCI_EXP_RTCTL_PMEIE) << 3; > - advk_writel(pcie, new, PCIE_ISR0_MASK_REG); > + case PCI_EXP_RTCTL: { > + /* Only mask/unmask PME interrupt */ > + u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG) & > + ~PCIE_MSG_PM_PME_MASK; > + if ((new & PCI_EXP_RTCTL_PMEIE) == 0) > + val |= PCIE_MSG_PM_PME_MASK; > + advk_writel(pcie, val, PCIE_ISR0_MASK_REG); > break; > + } > > case PCI_EXP_RTSTA: > new = (new & PCI_EXP_RTSTA_PME) >> 9; > -- > 2.20.1 >