The AER driver uses constants for Correctable, Non-Fatal and Fatal Error
severity which look as if they match something in the spec, but are
actually just made-up numbers.

Use the bit number in the Device Status Register instead (PCIe r7.1 sec
7.5.3.5).  A subsequent commit takes advantage of this by using BIT() to
conveniently compute the register bit corresponding to a given severity.

While at it, drop the DPC_FATAL constant which was introduced by commit
b09803b5e546 ("PCI/DPC: Use the generic pcie_do_fatal_recovery() path")
but never saw any use in 8 years.

Signed-off-by: Lukas Wunner <[email protected]>
---
 drivers/pci/pcie/aer.c  | 2 +-
 include/linux/aer.h     | 8 ++++----
 include/ras/ras_event.h | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 34a8eddc427a..6bc843ab9b37 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -504,9 +504,9 @@ void pci_aer_exit(struct pci_dev *dev)
  * AER error strings
  */
 static const char * const aer_error_severity_string[] = {
+       "Correctable",
        "Uncorrectable (Non-Fatal)",
        "Uncorrectable (Fatal)",
-       "Correctable"
 };
 
 static const char *aer_error_layer[] = {
diff --git a/include/linux/aer.h b/include/linux/aer.h
index df0f5c382286..795c55132008 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -11,10 +11,10 @@
 #include <linux/errno.h>
 #include <linux/types.h>
 
-#define AER_NONFATAL                   0
-#define AER_FATAL                      1
-#define AER_CORRECTABLE                        2
-#define DPC_FATAL                      3
+/* Must match bit number in Device Status Register (PCIe r7.1, sec 7.5.3.5) */
+#define AER_CORRECTABLE                        0
+#define AER_NONFATAL                   1
+#define AER_FATAL                      2
 
 /*
  * AER and DPC capabilities TLP Logging register sizes (PCIe r6.2, sec 7.8.4
diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
index fdb785fa4613..1e03ade99386 100644
--- a/include/ras/ras_event.h
+++ b/include/ras/ras_event.h
@@ -302,7 +302,7 @@ TRACE_EVENT(non_standard_event,
  *                     ([domain:]bus:device.function).
  * u32 status -                Either the correctable or uncorrectable register
  *                     indicating what error or errors have been seen
- * u8 severity -       error severity 0:NONFATAL 1:FATAL 2:CORRECTED
+ * u8 severity -       error severity 0:CORRECTED 1:NONFATAL 2:FATAL
  */
 
 #define aer_correctable_errors                                 \
-- 
2.53.0


Reply via email to