From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 204FCC19F4F for ; Wed, 8 May 2024 01:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=JGVBFgXCDmr/eX0LOEd81QcwDgGaJpQd55wuuWzrP3w=; b=HWTKKAH8fj3nY4 zShq9NRzHDoBv5mDOIOFLjpEgJMxCvhh5WQ5UdNpXb6iPUwrmL8OYmE/bOY834CzXGCc/XQQJGbnN RHzxec5cEzsxORhphBYD2HWTmwUxE3m36NymTNo2Fpph/wiZ3/aRQqo+XdHa0685xkjz9NK7MKGz/ mMPXl4GmqArKT12+Kwn92tVLf1dqY3/XNkVFsBt/NFsTIKc8pwWhrT7lH/wWSBHpmeR56PGCLWVDF LKgHbzSYeRSa0lsamNmZq+LQ96qAAgxks3n8gOMZazFoHf+gbSqrF1+eMfO/Qup4B/l4GEDILSQ5a 1tJyfTMlVj/7MUKdAxzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Wac-0000000Dhzk-45JX; Wed, 08 May 2024 01:59:26 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4WaZ-0000000Dhyh-0q3a for linux-arm-kernel@lists.infradead.org; Wed, 08 May 2024 01:59:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 6D0FCCE168B; Wed, 8 May 2024 01:59:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D316C2BBFC; Wed, 8 May 2024 01:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715133559; bh=OT5JakQt19xF8U1yLXWAVT404ZDx+aEIBvSlyMks/00=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=BZEWofxm4dginQL+bIA1eqQEoyel0G+G/WB9CeXJex8G5YJVB+pMLPACIAUo/SlNL aJdcwlaaX6GYYfbEnNUrTXYE2kVEKhSbfJMpMJJX9HRQdNhSuVw25mTE4ib2vFPmIy y7NPpBh9H9bsPEnpR/tW82mSJbc2Vfyw5aGIEspgSBKkOIG9N6NuCsONhUSRRDxnlk +mT+aHE+mWgSvcUlt05qqCb5Wrql5gVyujSmVdgodBbdwT/3D7CZE8egOviz+8Fbq6 vyRVb1REvqoXHwq1ukgaq2Jm7Gg6eeOFVUrgdCt9gkEspbDsx+GAZf2yLDaNuF8FZn Nsr5LZY56dJhw== Date: Tue, 7 May 2024 20:59:17 -0500 From: Bjorn Helgaas To: Sean Anderson Cc: Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , linux-pci@vger.kernel.org, Michal Simek , Bjorn Helgaas , Thippeswamy Havalige , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Bharat Kumar Gogada Subject: Re: [PATCH v2 2/7] PCI: xilinx-nwl: Fix off-by-one Message-ID: <20240508015917.GA1746057@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240506161510.2841755-3-sean.anderson@linux.dev> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_185923_958521_B2BBBBD1 X-CRM114-Status: GOOD ( 17.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Maybe the subject could include something about why this is important, e.g., it's IRQ-related, we mask/unmask the wrong thing, etc? On Mon, May 06, 2024 at 12:15:05PM -0400, Sean Anderson wrote: > IRQs start at 0, so we don't need to subtract 1. What does "IRQ" refer to here? Something to do with INTx, I guess, but apparently not PCI_INTERRUPT_PIN, since 0 in that register means the device doesn't use INTx, and 1=INTA, 2=INTB, etc. I assume this fixes a bug, e.g., we mask/unmask the wrong INTx? What does this look like for a user? Unexpected IRQs? 9a181e1093af is from seven years ago. Should we be surprised that we haven't tripped over this before? > Fixes: 9a181e1093af ("PCI: xilinx-nwl: Modify IRQ chip for legacy interrupts") > Cc: > Signed-off-by: Sean Anderson > --- > > (no changes since v1) > > drivers/pci/controller/pcie-xilinx-nwl.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c > index 0408f4d612b5..437927e3bcca 100644 > --- a/drivers/pci/controller/pcie-xilinx-nwl.c > +++ b/drivers/pci/controller/pcie-xilinx-nwl.c > @@ -371,7 +371,7 @@ static void nwl_mask_intx_irq(struct irq_data *data) > u32 mask; > u32 val; > > - mask = 1 << (data->hwirq - 1); > + mask = 1 << data->hwirq; > raw_spin_lock_irqsave(&pcie->leg_mask_lock, flags); > val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); > nwl_bridge_writel(pcie, (val & (~mask)), MSGF_LEG_MASK); > @@ -385,7 +385,7 @@ static void nwl_unmask_intx_irq(struct irq_data *data) > u32 mask; > u32 val; > > - mask = 1 << (data->hwirq - 1); > + mask = 1 << data->hwirq; > raw_spin_lock_irqsave(&pcie->leg_mask_lock, flags); > val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); > nwl_bridge_writel(pcie, (val | mask), MSGF_LEG_MASK); > -- > 2.35.1.1320.gc452695387.dirty > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel