Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2564821lkm; Mon, 20 Sep 2021 18:50:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMFo2tcG7m7S8ZoaNG/KKEGMpZdOf6k5IG/5k6ZXw+iTXkM44wdDiBfXiYiqlXa7w5Mx13 X-Received: by 2002:a05:6e02:e01:: with SMTP id a1mr19975187ilk.72.1632189044397; Mon, 20 Sep 2021 18:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632189044; cv=none; d=google.com; s=arc-20160816; b=in3IJF5E7cAquPu5E5RMfKktHi6iFtgfVD0xJgFWta4FToC7qdCSgqEtgMcm0i/fiJ BjDjO0D3g0cwsp5TxaP9PDtgHci8ErOHBylfAfBnrGMWVnAMQstvl9rCyXb+MwpC9sN9 NKbzrol9bQGlKjmsYZFVqQvyq0IqHgaXtQaC5qh8wGKqDyGCOej4VIZ3/huzatOdDSYE b5H8myJHgmBdP8ws46rN3DOdWHOfEolUOURDG/AUg6NgwusltQ3VUOvUmTB3zO+958ew 9kWKUpqtanuKSMBY/BAKkuSwmolnwWb5zeZ/rQLAC74kWwEYK4cD60AFZYzrJiFygbTg verw== 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=KkmlWXvDg0kt8PvMMr8nXWwH75Y51Ep/31y+7oINBN8=; b=Qdo3bfbp1XSXs5VZ2wSyzTeUcJMsBLkftIeJQRw61U9frhTSv2vAfaur8keNWRvEQe NK6ZxGAPezeD5KemwpFhuUSwcPjzzl+WbYn5lwK3Cvtuzc670NQMnPNIj3qU6jsY/y6e LTXh9ZJzo08Ec2gUfP1FXAcTd1vCTtsa10MEU5bXRzu5qxG1TXBae3SkDTjJcfb3m0ZH V8ZYl4FMRld9mTZZgDmkCIWqc6ZlcUiU7V5SbQ5nf7u1zfhh3h3OKVryRnfbsRBF7wj2 0OXXLJUIfrl8lkvVASU5agc9iqkJPxS5dypjkAVCeXjpV7/zc6ivfD+4DwYLGwXSXKaw cliA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EYkfodtn; 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 a187si13676002jaa.34.2021.09.20.18.50.33; Mon, 20 Sep 2021 18:50:44 -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=EYkfodtn; 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 S1358724AbhITSHh (ORCPT + 99 others); Mon, 20 Sep 2021 14:07:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:57650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356861AbhITSB4 (ORCPT ); Mon, 20 Sep 2021 14:01:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 84C666322F; Mon, 20 Sep 2021 17:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158176; bh=uAgDrDaQvuwlGbDQmjOOVb1AG5MD5EJZLfmWEmvOr2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EYkfodtnLRI79ojhuxpXJ4QJRMMBoce1qEeo3G/J6PV48YfWfpELT0p3EPTclsHLy g0vBtWS1xeVlF7DdPuiAq4PyqwlVGh2Vnu2+hYcXt+zM5/NrKnMBG2iarn+pAozoG3 3A31qvE+yXkve/Lr1d17LMYN23Sy5csmNSOQGbr4= 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.4 035/260] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts Date: Mon, 20 Sep 2021 18:40:53 +0200 Message-Id: <20210920163932.316505502@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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 @@ -194,6 +194,7 @@ struct advk_pcie { struct list_head resources; 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; @@ -812,22 +813,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, @@ -911,6 +918,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");