Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp230142ybi; Thu, 13 Jun 2019 14:57:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoOWG4csWMS2ZI4SXur1I5Qxt7t/Kg3FU9khty5+d+d2xVrDb2bGI8m0EiaQ19PerZ67dW X-Received: by 2002:a17:90a:db52:: with SMTP id u18mr7662541pjx.107.1560463073403; Thu, 13 Jun 2019 14:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560463073; cv=none; d=google.com; s=arc-20160816; b=NscrEYNj4ahwm3aTyyRFMNZAzn12tCsg9y8zZqX0GcTfgDGLjYfOlHrhmxjuERcAW5 ZT5+tHK9/dXvPeuqH1BYnolzt1xrWH2NLVRnFqoFonu66XcfuhIWEo+L+P24Sod1W9Rx 07i0qv+djFEVn6sL7LXinWcGPBn3yz3ZdiT1QDfYgI/t75MybZp8RZ+sYQDhxqXWDaUE oXwRCtBxE+WelTbOMAbtQ6yDJuB5J9/eQY8iNp0GZZ5R6oKoCj7SdBf0ndWUzZsc9vbQ ySvDYZ9V9hGkYvzLwXBGgN8KKr/r9AWo8aNa4jXAlF20AdvjvTm/GItczayGkhlj7K5s umxQ== 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=eSfGJqOciOrlZTffR40iw8/Y+MZHoDP7Kn2h+s5mm4E=; b=O2d3DeBKmBu2vy3tpYbhSE7Lui3r9qofqTs3u3fvY4KZO5GtcZ+TmoFQlCOlEw9TWW 3r6FbRCv2p+lTmMBH0Es/Ss9VeAMLGfoqrctzLHlfQqL95KMQAU5h/1Se9QWjMRF4roq l+xqJ3VvO0L+mczJYOo+FvPnpFwIbLfeGiM6O+SLsubLMsh/LKnpNW2ztxzr4tjGwGLK uTM3+yxJCrcPpTZv/RMkIpM7oFmjktQve9mRvcdcKTdYQKCo9Yjv+X40VYFpyqIBGBfb vWormZ2zRgoPh9umQ7CLZ9N3h25ywInlRf5OdAlBAXVLj5WSTKmOtCqAvv9Mxu/R40uR as+g== 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 x3si712742pgk.413.2019.06.13.14.57.38; Thu, 13 Jun 2019 14:57:53 -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 S1728477AbfFMV5M (ORCPT + 99 others); Thu, 13 Jun 2019 17:57:12 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:33497 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbfFMV5L (ORCPT ); Thu, 13 Jun 2019 17:57:11 -0400 X-Originating-IP: 88.190.179.123 Received: from localhost (unknown [88.190.179.123]) (Authenticated sender: repk@triplefau.lt) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id E8A4A240005; Thu, 13 Jun 2019 21:57:06 +0000 (UTC) Date: Fri, 14 Jun 2019 00:06:54 +0200 From: Remi Pommarel To: Lorenzo Pieralisi Cc: Thomas Petazzoni , Bjorn Helgaas , Ellie Reeves , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: aardvark: Fix PCI_EXP_RTCTL conf register writing Message-ID: <20190613220653.GB12859@voidbox.localdomain> References: <20190522213351.21366-1-repk@triplefau.lt> <20190613161441.GA2247@e121166-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190613161441.GA2247@e121166-lin.cambridge.arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 13, 2019 at 05:14:41PM +0100, Lorenzo Pieralisi wrote: > On Wed, May 22, 2019 at 11:33:49PM +0200, Remi Pommarel wrote: > > PCI_EXP_RTCTL is used to activate PME interrupt only, so writing into it > > should not modify other interrupts' mask (such as ISR0). > > > > Fixes: 6302bf3ef78d ("PCI: Init PCIe feature bits for managed host bridge alloc") > > Signed-off-by: Remi Pommarel > > --- > > Please note that I will unlikely be able to answer any comments from May > > 24th to June 10th. > > --- > > drivers/pci/controller/pci-aardvark.c | 10 +++++++--- > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c > > index 134e0306ff00..27102d3b4f9c 100644 > > --- a/drivers/pci/controller/pci-aardvark.c > > +++ b/drivers/pci/controller/pci-aardvark.c > > @@ -451,10 +451,14 @@ 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; > > + val |= (new & PCI_EXP_RTCTL_PMEIE) << 3; > > I know you have not introduced this code but maybe we can > take an opportunity to clarify it (that << 3 shift obfuscates > a bit): > > u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG) & > ~PCIE_MSG_PM_PME_MASK; > > if (new & PCI_EXP_RTCTL_PMEIE) > val |= PCIE_MSG_PM_PME_MASK; > > advk_writel(pcie, val, PCIE_ISR0_MASK_REG); > break; > > Or I am not reading the code correctly ? Sure, that clarifies the code at the point where I realize that the "<< 3" from the original code was off by one and the mask polarity was inverted. So I'll fix all that in the v2. Thanks. -- Remi