aboutsummaryrefslogtreecommitdiff
path: root/SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-11-28 09:25:22 +0100
committerJan200101 <sentrycraft123@gmail.com>2023-11-28 09:25:22 +0100
commit6229f58d19ef9e8c060cc9d9974ef6fcf1bcb528 (patch)
tree5d375a5d3b74c7b8320cd0bde47d2947a3446a9b /SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch
parent6d1c932b1ab6892c861ea92d93914a175e187b08 (diff)
downloadkernel-fsync-6229f58d19ef9e8c060cc9d9974ef6fcf1bcb528.tar.gz
kernel-fsync-6229f58d19ef9e8c060cc9d9974ef6fcf1bcb528.zip
kernel 6.6.2
Diffstat (limited to 'SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch')
-rw-r--r--SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch108
1 files changed, 108 insertions, 0 deletions
diff --git a/SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch b/SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch
new file mode 100644
index 0000000..6eac856
--- /dev/null
+++ b/SOURCES/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch
@@ -0,0 +1,108 @@
+From 7d86ca8db51f6b75b5c1470d6294c6f24221f560 Mon Sep 17 00:00:00 2001
+From: GloriousEggroll <gloriouseggroll@gmail.com>
+Date: Mon, 30 Oct 2023 22:36:19 -0600
+Subject: [PATCH] Revert "nvme-pci: drop redundant
+ pci_enable_pcie_error_reporting()"
+
+This reverts commits:
+1ad11eafc63ac16e667853bee4273879226d2d1b
+7ec4b34be4234599cf1241ef807cdb7c3636f6fe
+69b264df8a412820e98867dbab871c6526c5e5aa
+
+---
+ drivers/nvme/host/pci.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
+index 3f0c9ee09a12..bc11bfe6f87a 100644
+--- a/drivers/nvme/host/pci.c
++++ b/drivers/nvme/host/pci.c
+@@ -5,6 +5,7 @@
+ */
+
+ #include <linux/acpi.h>
++#include <linux/aer.h>
+ #include <linux/async.h>
+ #include <linux/blkdev.h>
+ #include <linux/blk-mq.h>
+@@ -2537,6 +2538,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
+
+ nvme_map_cmb(dev);
+
++ pci_enable_pcie_error_reporting(pdev);
+ pci_save_state(pdev);
+
+ result = nvme_pci_configure_admin_queue(dev);
+@@ -2601,8 +2603,10 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
+ nvme_suspend_io_queues(dev);
+ nvme_suspend_queue(dev, 0);
+ pci_free_irq_vectors(pdev);
+- if (pci_is_enabled(pdev))
++ if (pci_is_enabled(pdev)) {
++ pci_disable_pcie_error_reporting(pdev);
+ pci_disable_device(pdev);
++ }
+ nvme_reap_pending_cqes(dev);
+
+ nvme_cancel_tagset(&dev->ctrl);
+--
+2.41.0
+diff --git a/include/linux/aer.h b/include/linux/aer.h
+index 29cc10220..94ce49a5f 100644
+--- a/include/linux/aer.h
++++ b/include/linux/aer.h
+@@ -41,9 +41,20 @@ struct aer_capability_regs {
+ };
+
+ #if defined(CONFIG_PCIEAER)
++/* PCIe port driver needs this function to enable AER */
++int pci_enable_pcie_error_reporting(struct pci_dev *dev);
++int pci_disable_pcie_error_reporting(struct pci_dev *dev);
+ int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
+ int pcie_aer_is_native(struct pci_dev *dev);
+ #else
++static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
++{
++ return -EINVAL;
++}
++static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev)
++{
++ return -EINVAL;
++}
+ static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
+ {
+ return -EINVAL;
+
+diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
+index 9c8fd69ae..0dc7be481 100644
+--- a/drivers/pci/pcie/aer.c
++++ b/drivers/pci/pcie/aer.c
+@@ -231,7 +231,7 @@ int pcie_aer_is_native(struct pci_dev *dev)
+ }
+ EXPORT_SYMBOL_NS_GPL(pcie_aer_is_native, CXL);
+
+-static int pci_enable_pcie_error_reporting(struct pci_dev *dev)
++int pci_enable_pcie_error_reporting(struct pci_dev *dev)
+ {
+ int rc;
+
+@@ -241,6 +241,19 @@ static int pci_enable_pcie_error_reporting(struct pci_dev *dev)
+ rc = pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_AER_FLAGS);
+ return pcibios_err_to_errno(rc);
+ }
++EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting);
++
++int pci_disable_pcie_error_reporting(struct pci_dev *dev)
++{
++ int rc;
++
++ if (!pcie_aer_is_native(dev))
++ return -EIO;
++
++ rc = pcie_capability_clear_word(dev, PCI_EXP_DEVCTL, PCI_EXP_AER_FLAGS);
++ return pcibios_err_to_errno(rc);
++}
++EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting);
+
+ int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
+ {