mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-12 16:06:42 +02:00
remove esmil-6.10-rc1.jh7110.patch, mostly applied to mainline add few patches from https://github.com/drmpeg/linux which are not yet in mainline kernel
80 lines
3.2 KiB
Diff
80 lines
3.2 KiB
Diff
From 7716903f7e63c2fd918f3cabdb1d1399df1e8d57 Mon Sep 17 00:00:00 2001
|
|
From: Kevin Xie <kevin.xie@starfivetech.com>
|
|
Date: Tue, 27 Feb 2024 18:35:21 +0800
|
|
Subject: [PATCH] PCI: starfive: Offload the NVMe timeout workaround to host
|
|
drivers.
|
|
|
|
As the Starfive JH7110 hardware can't keep two inbound post write in
|
|
order all the time, such as MSI messages and NVMe completions. If the
|
|
NVMe completion update later than the MSI, an NVMe IRQ handle will miss.
|
|
|
|
As a workaround, we will wait a while before going to the generic
|
|
handle here.
|
|
|
|
Verified with NVMe SSD, USB SSD, R8169 NIC.
|
|
The performance are stable and even higher after this patch.
|
|
|
|
Signed-off-by: Kevin Xie <kevin.xie@starfivetech.com>
|
|
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
|
|
Link: https://lore.kernel.org/r/20240227103522.80915-23-minda.chen@starfivetech.com
|
|
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
|
|
---
|
|
drivers/pci/controller/plda/pcie-plda-host.c | 12 ++++++++++++
|
|
drivers/pci/controller/plda/pcie-plda.h | 1 +
|
|
drivers/pci/controller/plda/pcie-starfive.c | 1 +
|
|
3 files changed, 14 insertions(+)
|
|
|
|
diff --git a/drivers/pci/controller/plda/pcie-plda-host.c b/drivers/pci/controller/plda/pcie-plda-host.c
|
|
index a18923d7cea6e7..9e077ddf45c07e 100644
|
|
--- a/drivers/pci/controller/plda/pcie-plda-host.c
|
|
+++ b/drivers/pci/controller/plda/pcie-plda-host.c
|
|
@@ -13,6 +13,7 @@
|
|
#include <linux/msi.h>
|
|
#include <linux/pci_regs.h>
|
|
#include <linux/pci-ecam.h>
|
|
+#include <linux/delay.h>
|
|
|
|
#include "pcie-plda.h"
|
|
|
|
@@ -44,6 +45,17 @@ static void plda_handle_msi(struct irq_desc *desc)
|
|
bridge_base_addr + ISTATUS_LOCAL);
|
|
status = readl_relaxed(bridge_base_addr + ISTATUS_MSI);
|
|
for_each_set_bit(bit, &status, msi->num_vectors) {
|
|
+ /*
|
|
+ * As the Starfive JH7110 hardware can't keep two
|
|
+ * inbound post write in order all the time, such as
|
|
+ * MSI messages and NVMe completions.
|
|
+ * If the NVMe completion update later than the MSI,
|
|
+ * an NVMe IRQ handle will miss.
|
|
+ * As a workaround, we will wait a while before
|
|
+ * going to the generic handle here.
|
|
+ */
|
|
+ if (port->msi_quirk_delay_us)
|
|
+ udelay(port->msi_quirk_delay_us);
|
|
ret = generic_handle_domain_irq(msi->dev_domain, bit);
|
|
if (ret)
|
|
dev_err_ratelimited(dev, "bad MSI IRQ %d\n",
|
|
diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h
|
|
index 0e7dc0d8e5ba11..074aecce54a2dd 100644
|
|
--- a/drivers/pci/controller/plda/pcie-plda.h
|
|
+++ b/drivers/pci/controller/plda/pcie-plda.h
|
|
@@ -187,6 +187,7 @@ struct plda_pcie_rp {
|
|
int msi_irq;
|
|
int intx_irq;
|
|
int num_events;
|
|
+ u16 msi_quirk_delay_us;
|
|
};
|
|
|
|
struct plda_event {
|
|
diff --git a/drivers/pci/controller/plda/pcie-starfive.c b/drivers/pci/controller/plda/pcie-starfive.c
|
|
index c9933ecf683382..5d8927f27684a2 100644
|
|
--- a/drivers/pci/controller/plda/pcie-starfive.c
|
|
+++ b/drivers/pci/controller/plda/pcie-starfive.c
|
|
@@ -406,6 +406,7 @@ static int starfive_pcie_probe(struct platform_device *pdev)
|
|
|
|
plda->host_ops = &sf_host_ops;
|
|
plda->num_events = PLDA_MAX_EVENT_NUM;
|
|
+ plda->msi_quirk_delay_us = 1;
|
|
/* mask doorbell event */
|
|
plda->events_bitmap = GENMASK(PLDA_INT_EVENT_NUM - 1, 0)
|
|
& ~BIT(PLDA_AXI_DOORBELL)
|