From eb7adaf27d7b54ce8df7a129225123b8c81765d9 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: May 10 2023 08:00:42 +0000 Subject: PCI: aardvark: Fix masking and unmasking legacy INTx interrupts (git-fixes). --- diff --git a/patches.suse/PCI-aardvark-Fix-masking-and-unmasking-legacy-INTx-i.patch b/patches.suse/PCI-aardvark-Fix-masking-and-unmasking-legacy-INTx-i.patch new file mode 100644 index 0000000..c2e8993 --- /dev/null +++ b/patches.suse/PCI-aardvark-Fix-masking-and-unmasking-legacy-INTx-i.patch @@ -0,0 +1,73 @@ +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Fri, 20 Aug 2021 17:50:20 +0200 +Subject: PCI: aardvark: Fix masking and unmasking legacy INTx interrupts +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: d212dcee27c1f89517181047e5485fcbba4a25c2 +Patch-mainline: 5.15-rc1 +References: git-fixes + +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: Jiri Slaby +--- + drivers/pci/host/pci-aardvark.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/pci/host/pci-aardvark.c ++++ b/drivers/pci/host/pci-aardvark.c +@@ -231,6 +231,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; +@@ -841,22 +842,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, +@@ -940,6 +947,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"); diff --git a/series.conf b/series.conf index 37f3d94..a75f02a 100644 --- a/series.conf +++ b/series.conf @@ -61604,6 +61604,7 @@ patches.suse/PCI-aardvark-Fix-checking-for-PIO-status.patch patches.suse/PCI-aardvark-Increase-polling-delay-to-1.5s-while-wa.patch patches.suse/PCI-aardvark-Configure-PCIe-resources-from-ranges-DT.patch + patches.suse/PCI-aardvark-Fix-masking-and-unmasking-legacy-INTx-i.patch patches.suse/msft-hv-2426-PCI-hv-Support-for-create-interrupt-v3.patch patches.suse/profiling-fix-shift-out-of-bounds-bugs.patch patches.suse/prctl-allow-to-setup-brk-for-et_dyn-executables.patch