Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1734670pxb; Thu, 16 Sep 2021 14:19:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2W6lQkgLu/ffGFYlidlE17s43R236+BZGQLFtg/x+euGj9OTZf6lRHkRxtf4+1By3SY6m X-Received: by 2002:a92:c8c3:: with SMTP id c3mr5230330ilq.165.1631827147911; Thu, 16 Sep 2021 14:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631827147; cv=none; d=google.com; s=arc-20160816; b=Ruq0rLlR6GuhURj0FjjwG7hQXqIeiQQcLbR1q/LPU8rDFlsVYv1Bq2LN7jC6XXIOTz Oc7gY2R6baJQxG1r38ZqLgfYVOAtM3xYtt0NkJKgdf+tu11Fe4OQb2BjG0tvdXtpcivz 5Eiz7jdNrsIS6MEy8WbCN2+b7TTAKFo81BCqgAXIgsG3iVpfeaUQ3d7fQy/z7xw9eCka sacWbpLCr49HBjy7fcdE5BbEYkBAi3GargRSSsHOfmKT//f5jDWgdRGKRxi5ebpGEIrd OayvYuqhzkRrRaFkVHi/U3xfnuNXp9AC4iZAcCz7ZqZMBRLUXjXRt+N8Kt/YCVInFPMD nlDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sCveFEsGga3pxcb/w23LO5QRtjORbwpAUNA9QY6DU8M=; b=HNiPmIAC+Z+hOZ5KZp3b2EmB5Q/AqMWkWu+1oNWMa/an8GFkTDxWjoXdb94HYAfz41 7OGPv59Onwuq8kv76Acy+0qftqOieuQqZzbWlI2dkz5OeQtcQshDBh/YV2qrPwL772ra Fgq1+F57R+4KS/a2LX+KlRDnOjV/f8MUyM9skc7S8Elra+3lWTPRBm0wsGObqNBEDyaF PvHvXtYk8DcLUZreNQs88ItrfG1+ISikvzEfeT565VCDP7uVYZak1zE6lIzFoVAAt2h6 P5ZVvx1upw1mAgrMV3bRFuD35wtzgPDaYehJheCStqAknn6PlfW1VLF9RTLJSPbQ8wtf lx8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1aIsmiho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q6si3480180ilv.123.2021.09.16.14.18.52; Thu, 16 Sep 2021 14:19:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1aIsmiho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245400AbhIPQkY (ORCPT + 99 others); Thu, 16 Sep 2021 12:40:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:43910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241910AbhIPQc4 (ORCPT ); Thu, 16 Sep 2021 12:32:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 88A0F613D3; Thu, 16 Sep 2021 16:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809203; bh=PigDoh3hyPXh6lz7HeYb2Ci/XfGGvqQFWZpJhMgen44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1aIsmiho1UNTeCt/dKJjTODbF4N3UPSPPckNuk6JhYrxtaYxl+r1Mqh9QCOUExoU7 v69j38HJYbyq1h0aNCPNNQ2cCFqZae+pHX72dDqhWaHvJm5zI5s2QU5bqojXR+tP6U +DedOPGHX295AkXt/qZ7BcddhPE12oQ1xM2KCy2w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Lorenzo Pieralisi Subject: [PATCH 5.13 067/380] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts Date: Thu, 16 Sep 2021 17:57:04 +0200 Message-Id: <20210916155806.271913475@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Rohár commit d212dcee27c1f89517181047e5485fcbba4a25c2 upstream. irq_mask and irq_unmask callbacks need to be properly guarded by raw spin locks as masking/unmasking procedure needs atomic read-modify-write operation on hardware register. Link: https://lore.kernel.org/r/20210820155020.3000-1-pali@kernel.org Reported-by: Marc Zyngier Signed-off-by: Pali Rohár Signed-off-by: Lorenzo Pieralisi Acked-by: Marc Zyngier Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/pci-aardvark.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -230,6 +230,7 @@ struct advk_pcie { u8 wins_count; struct irq_domain *irq_domain; struct irq_chip irq_chip; + raw_spinlock_t irq_lock; struct irq_domain *msi_domain; struct irq_domain *msi_inner_domain; struct irq_chip msi_bottom_irq_chip; @@ -1045,22 +1046,28 @@ static void advk_pcie_irq_mask(struct ir { struct advk_pcie *pcie = d->domain->host_data; irq_hw_number_t hwirq = irqd_to_hwirq(d); + unsigned long flags; u32 mask; + raw_spin_lock_irqsave(&pcie->irq_lock, flags); mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); mask |= PCIE_ISR1_INTX_ASSERT(hwirq); advk_writel(pcie, mask, PCIE_ISR1_MASK_REG); + raw_spin_unlock_irqrestore(&pcie->irq_lock, flags); } static void advk_pcie_irq_unmask(struct irq_data *d) { struct advk_pcie *pcie = d->domain->host_data; irq_hw_number_t hwirq = irqd_to_hwirq(d); + unsigned long flags; u32 mask; + raw_spin_lock_irqsave(&pcie->irq_lock, flags); mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); mask &= ~PCIE_ISR1_INTX_ASSERT(hwirq); advk_writel(pcie, mask, PCIE_ISR1_MASK_REG); + raw_spin_unlock_irqrestore(&pcie->irq_lock, flags); } static int advk_pcie_irq_map(struct irq_domain *h, @@ -1144,6 +1151,8 @@ static int advk_pcie_init_irq_domain(str struct irq_chip *irq_chip; int ret = 0; + raw_spin_lock_init(&pcie->irq_lock); + pcie_intc_node = of_get_next_child(node, NULL); if (!pcie_intc_node) { dev_err(dev, "No PCIe Intc node found\n");