From: Greg Kroah-Hartman Date: Wed, 15 Sep 2021 14:29:26 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v5.14.5~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0c1e06f09220428100b6e2716ed5d3afea424ee;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: pci-aardvark-fix-masking-and-unmasking-legacy-intx-interrupts.patch pci-aardvark-increase-polling-delay-to-1.5s-while-waiting-for-pio-response.patch --- diff --git a/queue-4.14/pci-aardvark-fix-masking-and-unmasking-legacy-intx-interrupts.patch b/queue-4.14/pci-aardvark-fix-masking-and-unmasking-legacy-intx-interrupts.patch new file mode 100644 index 00000000000..5abf8fe376b --- /dev/null +++ b/queue-4.14/pci-aardvark-fix-masking-and-unmasking-legacy-intx-interrupts.patch @@ -0,0 +1,75 @@ +From d212dcee27c1f89517181047e5485fcbba4a25c2 Mon Sep 17 00:00:00 2001 +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 + +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/host/pci-aardvark.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/pci/host/pci-aardvark.c ++++ b/drivers/pci/host/pci-aardvark.c +@@ -200,6 +200,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; +@@ -638,22 +639,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, +@@ -736,6 +743,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"); diff --git a/queue-4.14/pci-aardvark-increase-polling-delay-to-1.5s-while-waiting-for-pio-response.patch b/queue-4.14/pci-aardvark-increase-polling-delay-to-1.5s-while-waiting-for-pio-response.patch new file mode 100644 index 00000000000..db9b9fa2e19 --- /dev/null +++ b/queue-4.14/pci-aardvark-increase-polling-delay-to-1.5s-while-waiting-for-pio-response.patch @@ -0,0 +1,55 @@ +From 02bcec3ea5591720114f586960490b04b093a09e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 22 Jul 2021 16:40:39 +0200 +Subject: PCI: aardvark: Increase polling delay to 1.5s while waiting for PIO response +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pali Rohár + +commit 02bcec3ea5591720114f586960490b04b093a09e upstream. + +Measurements in different conditions showed that aardvark hardware PIO +response can take up to 1.44s. Increase wait timeout from 1ms to 1.5s to +ensure that we do not miss responses from hardware. After 1.44s hardware +returns errors (e.g. Completer abort). + +The previous two patches fixed checking for PIO status, so now we can use +it to also catch errors which are reported by hardware after 1.44s. + +After applying this patch, kernel can detect and print PIO errors to dmesg: + + [ 6.879999] advk-pcie d0070000.pcie: Non-posted PIO Response Status: CA, 0xe00 @ 0x100004 + [ 6.896436] advk-pcie d0070000.pcie: Posted PIO Response Status: COMP_ERR, 0x804 @ 0x100004 + [ 6.913049] advk-pcie d0070000.pcie: Posted PIO Response Status: COMP_ERR, 0x804 @ 0x100010 + [ 6.929663] advk-pcie d0070000.pcie: Non-posted PIO Response Status: CA, 0xe00 @ 0x100010 + [ 6.953558] advk-pcie d0070000.pcie: Posted PIO Response Status: COMP_ERR, 0x804 @ 0x100014 + [ 6.970170] advk-pcie d0070000.pcie: Non-posted PIO Response Status: CA, 0xe00 @ 0x100014 + [ 6.994328] advk-pcie d0070000.pcie: Posted PIO Response Status: COMP_ERR, 0x804 @ 0x100004 + +Without this patch kernel prints only a generic error to dmesg: + + [ 5.246847] advk-pcie d0070000.pcie: config read/write timed out + +Link: https://lore.kernel.org/r/20210722144041.12661-3-pali@kernel.org +Signed-off-by: Pali Rohár +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Marek Behún +Cc: stable@vger.kernel.org # 7fbcb5da811b ("PCI: aardvark: Don't rely on jiffies while holding spinlock") +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/host/pci-aardvark.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/pci/host/pci-aardvark.c ++++ b/drivers/pci/host/pci-aardvark.c +@@ -185,7 +185,7 @@ + (PCIE_CONF_BUS(bus) | PCIE_CONF_DEV(PCI_SLOT(devfn)) | \ + PCIE_CONF_FUNC(PCI_FUNC(devfn)) | PCIE_CONF_REG(where)) + +-#define PIO_RETRY_CNT 500 ++#define PIO_RETRY_CNT 750000 /* 1.5 s */ + #define PIO_RETRY_DELAY 2 /* 2 us*/ + + #define LINK_WAIT_MAX_RETRIES 10 diff --git a/queue-4.14/series b/queue-4.14/series index 134db06a911..6c42c51330d 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -119,3 +119,5 @@ arm-9109-1-oabi-compat-add-epoll_pwait-handler.patch pci-restrict-asmedia-asm1062-sata-max-payload-size-supported.patch pci-return-0-data-on-pciconfig_read-cap_sys_admin-failure.patch pci-xilinx-nwl-enable-the-clock-through-ccf.patch +pci-aardvark-increase-polling-delay-to-1.5s-while-waiting-for-pio-response.patch +pci-aardvark-fix-masking-and-unmasking-legacy-intx-interrupts.patch