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 X-Spam-Level: X-Spam-Status: No, score=-11.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7963C4338F for ; Thu, 19 Aug 2021 11:31:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6697F60EFE for ; Thu, 19 Aug 2021 11:31:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6697F60EFE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=DiAeirOPiPCbM6tJff9l76Wq4EamlWXLYan1DjBzRHs=; b=S+EfSECkQxqlty yuf532JKF0z/vidjv52Vjvvxha12Hw45PsOpolE2PBE3M01sgJYa4Xfyd0mTIp09aFFDYt82UlUSI FOjbEW6x28jGNhG2mVEwtKGt9LHEa5EJ370FhZGOthjJutJrD2WrkY93y00UuvK98QnJTWAvbtdgO 5aWb8AJ5WLU4Q0f+KvXyV/jmdl+UIu/IVxH/ccru5iwS0QIKvoIbtXbLVTwfcH4mv6z33NlAuTs8w MB2XLSWQuhGrnPL0rwIohq6KCLiRlgbInJwyJoYyT86xNkNlHY1j5VYJuBWaDPa48KRZBKYcMy36s d0PbymwbDFupC461vaIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGgEV-008BvB-9w; Thu, 19 Aug 2021 11:29:15 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGgER-008Bu4-BX for linux-arm-kernel@lists.infradead.org; Thu, 19 Aug 2021 11:29:12 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45DBE610D2; Thu, 19 Aug 2021 11:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629372550; bh=A7r+csymhYMGfcbq2KwxlTUQKlQXRKL2+USLxiLcJfU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=WAh1lKewT/u6UyP5EyuSQZNrpLQMxqMwfAdWNqC/PbBcn9pQRixOeRr26w3vJTqEN tJgZTHWTOmonxVMnj19cjybfkOwowYJdS+JNSgQ/chfIz9EM5RpViuD6q89CYd31jc dp7pFNdZTk8DQ4cQrYGv8mOvmSumiouY2uDXV5VLjUbdKjZAHU3pz2X8+A5hFRIMJQ HtJQs4B5BGpAyyPISdv2mggP8HwY3fsifiKsusa+cphLf0FA7rdEN2nliTYA9bMItw 7v3EJg6aNugSIqA3pceKra1x5VjmLLEu3mewzC+DJHeauxJ3tF2K29+Ya8ZdTxnxHo f6JYpMDwrJsug== Date: Thu, 19 Aug 2021 06:29:08 -0500 From: Bjorn Helgaas To: Kunihiko Hayashi Cc: Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?B?V2lsY3p577+977+977+9c2tp?= , Bjorn Helgaas , Pali =?utf-8?B?Um9o77+977+977+9cg==?= , Masami Hiramatsu , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: uniphier: Take lock in INTX irq_{mask,unmask,ack} callbacks Message-ID: <20210819112908.GA3188927@bjorn-Precision-5520> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1629370566-29984-1-git-send-email-hayashi.kunihiko@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210819_042911_465007_DCBF0924 X-CRM114-Status: GOOD ( 17.32 ) 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Possibly update subject to be more descriptive, along lines of: Serialize INTx masking/unmasking On Thu, Aug 19, 2021 at 07:56:06PM +0900, Kunihiko Hayashi wrote: > The same condition register PCI_RCV_INTX is used in irq_mask(), > irq_unmask() and irq_ack() callbacks. Accesses to register can occur at t= he > same time without lock. > This introduces a lock into the callbacks to prevent the issue. Rewrap into a single paragraph or add blank line between paragraphs. s/This introduces/Add/ to make this an imperative description of what you want this patch to do. No need for "This" since the context is obvious. > Fixes: 7e6d5cd88a6f ("PCI: uniphier: Add UniPhier PCIe host controller su= pport") > Suggested-by: Pali Roh=E1r > Signed-off-by: Kunihiko Hayashi > --- > drivers/pci/controller/dwc/pcie-uniphier.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > = > diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/con= troller/dwc/pcie-uniphier.c > index ebe43e9..5075714 100644 > --- a/drivers/pci/controller/dwc/pcie-uniphier.c > +++ b/drivers/pci/controller/dwc/pcie-uniphier.c > @@ -186,12 +186,17 @@ static void uniphier_pcie_irq_ack(struct irq_data *= d) > struct pcie_port *pp =3D irq_data_get_irq_chip_data(d); > struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); > struct uniphier_pcie_priv *priv =3D to_uniphier_pcie(pci); > + unsigned long flags; > u32 val; > = > + raw_spin_lock_irqsave(&pp->lock, flags); > + > val =3D readl(priv->base + PCL_RCV_INTX); > val &=3D ~PCL_RCV_INTX_ALL_STATUS; > val |=3D BIT(irqd_to_hwirq(d) + PCL_RCV_INTX_STATUS_SHIFT); > writel(val, priv->base + PCL_RCV_INTX); > + > + raw_spin_unlock_irqrestore(&pp->lock, flags); > } > = > static void uniphier_pcie_irq_mask(struct irq_data *d) > @@ -199,12 +204,17 @@ static void uniphier_pcie_irq_mask(struct irq_data = *d) > struct pcie_port *pp =3D irq_data_get_irq_chip_data(d); > struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); > struct uniphier_pcie_priv *priv =3D to_uniphier_pcie(pci); > + unsigned long flags; > u32 val; > = > + raw_spin_lock_irqsave(&pp->lock, flags); > + > val =3D readl(priv->base + PCL_RCV_INTX); > val &=3D ~PCL_RCV_INTX_ALL_MASK; > val |=3D BIT(irqd_to_hwirq(d) + PCL_RCV_INTX_MASK_SHIFT); > writel(val, priv->base + PCL_RCV_INTX); > + > + raw_spin_unlock_irqrestore(&pp->lock, flags); > } > = > static void uniphier_pcie_irq_unmask(struct irq_data *d) > @@ -212,12 +222,17 @@ static void uniphier_pcie_irq_unmask(struct irq_dat= a *d) > struct pcie_port *pp =3D irq_data_get_irq_chip_data(d); > struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); > struct uniphier_pcie_priv *priv =3D to_uniphier_pcie(pci); > + unsigned long flags; > u32 val; > = > + raw_spin_lock_irqsave(&pp->lock, flags); > + > val =3D readl(priv->base + PCL_RCV_INTX); > val &=3D ~PCL_RCV_INTX_ALL_MASK; > val &=3D ~BIT(irqd_to_hwirq(d) + PCL_RCV_INTX_MASK_SHIFT); > writel(val, priv->base + PCL_RCV_INTX); > + > + raw_spin_unlock_irqrestore(&pp->lock, flags); > } > = > static struct irq_chip uniphier_pcie_irq_chip =3D { > -- = > 2.7.4 > = _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel