These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / pci / pcie / aer / aerdrv_core.c
index 5653ea9..4e14de0 100644 (file)
@@ -74,6 +74,34 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
 }
 EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status);
 
+int pci_cleanup_aer_error_status_regs(struct pci_dev *dev)
+{
+       int pos;
+       u32 status;
+       int port_type;
+
+       if (!pci_is_pcie(dev))
+               return -ENODEV;
+
+       pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
+       if (!pos)
+               return -EIO;
+
+       port_type = pci_pcie_type(dev);
+       if (port_type == PCI_EXP_TYPE_ROOT_PORT) {
+               pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, &status);
+               pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, status);
+       }
+
+       pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS, &status);
+       pci_write_config_dword(dev, pos + PCI_ERR_COR_STATUS, status);
+
+       pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status);
+       pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status);
+
+       return 0;
+}
+
 /**
  * add_error_device - list device to be handled
  * @e_info: pointer to error info
@@ -425,8 +453,7 @@ static pci_ers_result_t reset_link(struct pci_dev *dev)
 
        if (driver && driver->reset_link) {
                status = driver->reset_link(udev);
-       } else if (pci_pcie_type(udev) == PCI_EXP_TYPE_DOWNSTREAM ||
-               pci_pcie_type(udev) == PCI_EXP_TYPE_ROOT_PORT) {
+       } else if (udev->has_secondary_link) {
                status = default_reset_link(udev);
        } else {
                dev_printk(KERN_DEBUG, &dev->dev,
@@ -784,8 +811,6 @@ void aer_isr(struct work_struct *work)
        while (get_e_source(rpc, &e_src))
                aer_isr_one_error(p_device, &e_src);
        mutex_unlock(&rpc->rpc_mutex);
-
-       wake_up(&rpc->wait_release);
 }
 
 /**