Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2568588lkm; Mon, 20 Sep 2021 18:57:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJiQAEcNkf7rFH+K7Qf/YqwQAIeS/MqY7e5nmEvcPMaWCEhMmdNFcY44F5/EXTwfw27lG/ X-Received: by 2002:a05:6e02:144c:: with SMTP id p12mr20413954ilo.292.1632188992017; Mon, 20 Sep 2021 18:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188992; cv=none; d=google.com; s=arc-20160816; b=EZR8Vmo13PEnnokJN/QcXaEmsfFWUJzk0Zh5iTIvgNarMfpZ8V1NKCGOpVi88UpoOw kG+258+dDS3XhiUB4G9BHd5G0ofW/jhukyyMBnAcryz/2eBTrsns76TSpQsZmm9Ji0UX /G6Lb6huUwm5jsGsbVTShbnK66QKp0q/eML1MXL6KiLLh49Vb10ioeETl2YKnHzpOJPy aIQHtW7kEzH1GzY83zhteJHLyIwdXNnXZRjqcUxBt0rLN2IRTbTrNMcEemaU0vUyRSnr ePbnFEvOm19fSPxrm3m4u8FbFzBeXUjnwcvdDDkc9mxh1eBlyxWSFvj9K0pDlZ5f0EVC QrDA== 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=3pjNVvjd//0d7slBIYlhOFpMR74hQ/cL3XajOM8w6gQ=; b=G8loNN0bI2JjxGc2gpjpbnRLrw7/Vz9Eb/0eI3Qy+HHljOSS0nvQb+ypcZ0L7o4Yfj vSc1LfShI+4qNdZ3W18pK1k5ZFMDlkCV82FSwTl2VpZ4JYTmIVp5FrUBMBlPloANipx5 dy+3XJ98tGVuOMfZItXswg7cQ4nJYtun8Vnc1gDBXUQmI9b5krVEkF4UYX77f9Wi4cJ/ hs8GMlavYi6zcPgYUafQe0aJsOp/LLZw6KY50sz1gwVQsfgrJRB/vqabEf4oXyTv9APF mj5W17y6IisHJdzbhqzeEbP2V4EhN4xlZLoLPClVve0DsYaKckOGw5YO0qU0QCSxt0di Cs4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nQw6bpTk; 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.49.40; Mon, 20 Sep 2021 18:49:52 -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=nQw6bpTk; 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 S1349150AbhITRrg (ORCPT + 99 others); Mon, 20 Sep 2021 13:47:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:48038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350999AbhITRox (ORCPT ); Mon, 20 Sep 2021 13:44:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CAEB861B61; Mon, 20 Sep 2021 17:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632157796; bh=iHyxHR61XfOSJB5qDfJ1WV9b76hc0bzzgVfM6MERV9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQw6bpTkFD7T5ZCQp+FzuMRobJQ+SZdOxzF0kitBQUcB/lBKoiQLV2o3E8EIVXX0f dYmZcugj3UFC7VagQAay1nrDBp6T+CDx/QiRjDozL0/qfF6noMJLOIR/78Nc58cfuj PXoGkPHYm+mpozSogc7sInK1rEjySjIiL+F9qm34= 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 4.19 156/293] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts Date: Mon, 20 Sep 2021 18:41:58 +0200 Message-Id: <20210920163938.622396291@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163933.258815435@linuxfoundation.org> References: <20210920163933.258815435@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 @@ -181,6 +181,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; @@ -603,22 +604,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, @@ -701,6 +708,8 @@ static int advk_pcie_init_irq_domain(str struct device_node *pcie_intc_node; struct irq_chip *irq_chip; + 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");