Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1522702pxb; Thu, 16 Sep 2021 09:10:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD4iZDG3qvQ4G6AK8fPmnptlx56I7uv5sPd763MUDKm5u1EtABX0BTscMY4AkgPzB8MI5e X-Received: by 2002:a02:908a:: with SMTP id x10mr5023100jaf.30.1631808657915; Thu, 16 Sep 2021 09:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631808657; cv=none; d=google.com; s=arc-20160816; b=W70MAYfe9lVkp0tF9DSq/MrcImb9A3avvP1PFmQO2sogbQTkXjBB8ruNZinlThnYbw o0SHrjL03W8m24PAXCRbaiRZmU2A91Bfcnx50AHOKdAcTNb2fguYUuil2yriooJigAG8 +vJ3nu8TSgvUAu19kVkMx6US9DzseX6RDB6kh+x5Bfx4wQBAIbV7C+hwdXKoJsxyhJpR 4ydMAp6mf16Bx+2FM9PTF9DwmuHYP092XuHufDDnWAsX40DB4nlRBN+pZRUe4s2bzBbH nOPFP/eEdgYWvmZjloT9Tinmx16FYOyNJ6YdYL/nKmKsyBuSYITmDbGXyVaCP+0lky02 2CbA== 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=0U0w3UsNvpHfeaD8slUlPcVXNq9O6v0zAtFga7G5NSw=; b=krWzbMqcgGb16cB7b4ARA7J9UysG/Hzo/Ik6l/y6fH2bEJ6Xjhv0YnaAQqtnSdOJ6a 5qMqTuXaBfPhVYb/tf4vEMckolvug2VyMBQv9NTiaTVzAQ1+AwNK+wttfm3BYJ/Ked8f Ew3J9+6k9M7U7lE2aSqYRoGPMaaw9q33JRtLV+BUxa6vmN0SSy9DMVWB4j0y9uj5PKLK 4l4Y/f8kjvHin3ghjbyeIms1CymxPHTO0dRY7INI6kQrtsCouB7dZsxRjdtOlptyYkcp JbnLarZ/lib5VHp2IHZoKVzGCE5NBPeu/x+55/L6L969tvPNYYPfSjh0tJvCQs+meeef jwbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HyPb0fWM; 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 w18si2966380ilc.63.2021.09.16.09.10.44; Thu, 16 Sep 2021 09:10:57 -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=HyPb0fWM; 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 S234532AbhIPQJe (ORCPT + 99 others); Thu, 16 Sep 2021 12:09:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:46606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232062AbhIPQHB (ORCPT ); Thu, 16 Sep 2021 12:07:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3DE9E61279; Thu, 16 Sep 2021 16:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808340; bh=ZQdBUDSqknIVerKIxW2TEhvFP3oaJitWRlTGFWppdI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HyPb0fWMG0jScz79BqnqEC7v45euqvPqgl1ifr1A3MHs4dZoHE0ur3HBSl1e2TlTn EyilM/B17BZQeN/F0hcr1Cnd2s0HPCJA2NZEhYRh/O0R/n2hmXWfeWw1hXw/XExZG6 b4+u1knwcBPpYEojRnZue5vVs/bsdUnNbVScRId8= 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.10 053/306] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts Date: Thu, 16 Sep 2021 17:56:38 +0200 Message-Id: <20210916155755.751675924@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@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 @@ -237,6 +237,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");