PCI/AER: Rationalize error status register clearing
authorKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Tue, 24 Mar 2020 00:26:08 +0000 (17:26 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 28 Mar 2020 18:19:05 +0000 (13:19 -0500)
The AER interfaces to clear error status registers were a confusing mess:

  - pci_cleanup_aer_uncorrect_error_status() cleared non-fatal errors
    from the Uncorrectable Error Status register.

  - pci_aer_clear_fatal_status() cleared fatal errors from the
    Uncorrectable Error Status register.

  - pci_cleanup_aer_error_status_regs() cleared the Root Error Status
    register (for Root Ports), the Uncorrectable Error Status register,
    and the Correctable Error Status register.

Rename them to make them consistent:

  From                                     To
  ---------------------------------------- -------------------------------
  pci_cleanup_aer_uncorrect_error_status() pci_aer_clear_nonfatal_status()
  pci_aer_clear_fatal_status()             pci_aer_clear_fatal_status()
  pci_cleanup_aer_error_status_regs()      pci_aer_clear_status()

Since pci_cleanup_aer_error_status_regs() (renamed to
pci_aer_clear_status()) is only used within drivers/pci/, move the
declaration from <linux/aer.h> to drivers/pci/pci.h.

[bhelgaas: commit log, add renames]
Link: https://lore.kernel.org/r/d1310a75dc3d28f7e8da4e99c45fbd3e60fe238e.1585000084.git.sathyanarayanan.kuppuswamy@linux.intel.com
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Documentation/PCI/pcieaer-howto.rst
drivers/net/ethernet/intel/ice/ice_main.c
drivers/ntb/hw/idt/ntb_hw_idt.c
drivers/pci/pci.c
drivers/pci/pci.h
drivers/pci/pcie/aer.c
drivers/pci/pcie/dpc.c
drivers/pci/pcie/err.c
drivers/scsi/lpfc/lpfc_attr.c
include/linux/aer.h

index afbd8c1c321dd492fbda906542992b0b1aaf6ffe..0b36b9ebfa4b4296ec1a4fc55ac9b443a7bdea3c 100644 (file)
@@ -232,9 +232,9 @@ messages to root port when an error is detected.
 
 ::
 
-  int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);`
+  int pci_aer_clear_nonfatal_status(struct pci_dev *dev);`
 
-pci_cleanup_aer_uncorrect_error_status cleanups the uncorrectable
+pci_aer_clear_nonfatal_status clears non-fatal errors in the uncorrectable
 error status register.
 
 Frequent Asked Questions
index 5ae671609f98a0ac532ef5f967d7ab0b0ca8a203..effca3fa92e0b5aa034d040e89f467b12f025771 100644 (file)
@@ -3495,10 +3495,10 @@ static pci_ers_result_t ice_pci_err_slot_reset(struct pci_dev *pdev)
                        result = PCI_ERS_RESULT_DISCONNECT;
        }
 
-       err = pci_cleanup_aer_uncorrect_error_status(pdev);
+       err = pci_aer_clear_nonfatal_status(pdev);
        if (err)
                dev_dbg(&pdev->dev,
-                       "pci_cleanup_aer_uncorrect_error_status failed, error %d\n",
+                       "pci_aer_clear_nonfatal_status() failed, error %d\n",
                        err);
                /* non-fatal, continue */
 
index dcf23468053507ba642c610fa8e4392caee4a0db..edae52384b8ab2e7e536a52e87b37525c3f4a7c4 100644 (file)
@@ -2674,8 +2674,8 @@ static int idt_init_pci(struct idt_ntb_dev *ndev)
        ret = pci_enable_pcie_error_reporting(pdev);
        if (ret != 0)
                dev_warn(&pdev->dev, "PCIe AER capability disabled\n");
-       else /* Cleanup uncorrectable error status before getting to init */
-               pci_cleanup_aer_uncorrect_error_status(pdev);
+       else /* Cleanup nonfatal error status before getting to init */
+               pci_aer_clear_nonfatal_status(pdev);
 
        /* First enable the PCI device */
        ret = pcim_enable_device(pdev);
index d828ca835a98cca2d310bc43304815b093f375d9..6c6e8c73fd8f42df4599411a0558f7c7dc50ebcf 100644 (file)
@@ -1503,7 +1503,7 @@ void pci_restore_state(struct pci_dev *dev)
        pci_restore_rebar_state(dev);
        pci_restore_dpc_state(dev);
 
-       pci_cleanup_aer_error_status_regs(dev);
+       pci_aer_clear_status(dev);
        pci_restore_aer_state(dev);
 
        pci_restore_config_space(dev);
index 25265bf80a83f292cb90a767e66da4d635c41a13..bd46f23e3db15a55e6a4f9f15b42ad1cd3a1ad19 100644 (file)
@@ -656,6 +656,7 @@ void pci_aer_exit(struct pci_dev *dev);
 extern const struct attribute_group aer_stats_attr_group;
 void pci_aer_clear_fatal_status(struct pci_dev *dev);
 void pci_aer_clear_device_status(struct pci_dev *dev);
+int pci_aer_clear_status(struct pci_dev *dev);
 int pci_aer_raw_clear_status(struct pci_dev *dev);
 #else
 static inline void pci_no_aer(void) { }
@@ -663,6 +664,7 @@ static inline void pci_aer_init(struct pci_dev *d) { }
 static inline void pci_aer_exit(struct pci_dev *d) { }
 static inline void pci_aer_clear_fatal_status(struct pci_dev *dev) { }
 static inline void pci_aer_clear_device_status(struct pci_dev *dev) { }
+static inline int pci_aer_clear_status(struct pci_dev *dev) { return -EINVAL; }
 static inline int pci_aer_raw_clear_status(struct pci_dev *dev) { return -EINVAL; }
 #endif
 
index bd9f122165e070287ca810d9ae6b9a0ebcaae7b8..f4274d30123569a9774ec311e055e49aa97202f1 100644 (file)
@@ -377,7 +377,7 @@ void pci_aer_clear_device_status(struct pci_dev *dev)
        pcie_capability_write_word(dev, PCI_EXP_DEVSTA, sta);
 }
 
-int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
+int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
 {
        int pos;
        u32 status, sev;
@@ -398,7 +398,7 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status);
+EXPORT_SYMBOL_GPL(pci_aer_clear_nonfatal_status);
 
 void pci_aer_clear_fatal_status(struct pci_dev *dev)
 {
@@ -457,7 +457,7 @@ int pci_aer_raw_clear_status(struct pci_dev *dev)
        return 0;
 }
 
-int pci_cleanup_aer_error_status_regs(struct pci_dev *dev)
+int pci_aer_clear_status(struct pci_dev *dev)
 {
        if (pcie_aer_get_firmware_first(dev))
                return -EIO;
@@ -530,7 +530,7 @@ void pci_aer_init(struct pci_dev *dev)
        n = pcie_cap_has_rtctl(dev) ? 5 : 4;
        pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_ERR, sizeof(u32) * n);
 
-       pci_cleanup_aer_error_status_regs(dev);
+       pci_aer_clear_status(dev);
 }
 
 void pci_aer_exit(struct pci_dev *dev)
index 22998ee2f7ea1c7bd367f170712304d88f8489dc..762170423fddae99333f95c1cb449d35f089b88d 100644 (file)
@@ -221,7 +221,7 @@ void dpc_process_error(struct pci_dev *pdev)
                 dpc_get_aer_uncorrect_severity(pdev, &info) &&
                 aer_get_device_error_info(pdev, &info)) {
                aer_print_error(pdev, &info);
-               pci_cleanup_aer_uncorrect_error_status(pdev);
+               pci_aer_clear_nonfatal_status(pdev);
                pci_aer_clear_fatal_status(pdev);
        }
 }
index 0c40488da651a330ec36bf8cec2ebcefbff4e446..14bb8f54723eddf34be207db6c9ff326496027e7 100644 (file)
@@ -198,7 +198,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
        pci_walk_bus(bus, report_resume, &status);
 
        pci_aer_clear_device_status(dev);
-       pci_cleanup_aer_uncorrect_error_status(dev);
+       pci_aer_clear_nonfatal_status(dev);
        pci_info(dev, "device recovery successful\n");
        return status;
 
index 46f56f30f77ef3d14b2cfb466cf1a5bc5fda73a0..847300de7ff12b97d10c4f27b123960bf046c169 100644 (file)
@@ -4783,7 +4783,7 @@ static DEVICE_ATTR_RW(lpfc_aer_support);
  * Description:
  * If the @buf contains 1 and the device currently has the AER support
  * enabled, then invokes the kernel AER helper routine
- * pci_cleanup_aer_uncorrect_error_status to clean up the uncorrectable
+ * pci_aer_clear_nonfatal_status() to clean up the uncorrectable
  * error status register.
  *
  * Notes:
@@ -4809,7 +4809,7 @@ lpfc_aer_cleanup_state(struct device *dev, struct device_attribute *attr,
                return -EINVAL;
 
        if (phba->hba_flag & HBA_AER_ENABLED)
-               rc = pci_cleanup_aer_uncorrect_error_status(phba->pcidev);
+               rc = pci_aer_clear_nonfatal_status(phba->pcidev);
 
        if (rc == 0)
                return strlen(buf);
index fa19e01f418a603e4dad4787e9d36028387391cd..97f64ba1b34a9d695be4d6d60b539aaf1ada88ba 100644 (file)
@@ -44,8 +44,7 @@ struct aer_capability_regs {
 /* 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_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
-int pci_cleanup_aer_error_status_regs(struct pci_dev *dev);
+int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
 void pci_save_aer_state(struct pci_dev *dev);
 void pci_restore_aer_state(struct pci_dev *dev);
 #else
@@ -57,11 +56,7 @@ static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev)
 {
        return -EINVAL;
 }
-static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
-{
-       return -EINVAL;
-}
-static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev)
+static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
 {
        return -EINVAL;
 }