Commit ec752f5d authored by Oza Pawandeep's avatar Oza Pawandeep Committed by Bjorn Helgaas

PCI/AER: Clear device status bits during ERR_FATAL and ERR_NONFATAL

Clear the device status bits while handling both ERR_FATAL and ERR_NONFATAL
cases.
Signed-off-by: default avatarOza Pawandeep <poza@codeaurora.org>
[bhelgaas: rename to pci_aer_clear_device_status(), declare internal to PCI
core instead of exposing it everywhere]
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 43ec03a9
...@@ -486,11 +486,13 @@ void pci_aer_init(struct pci_dev *dev); ...@@ -486,11 +486,13 @@ void pci_aer_init(struct pci_dev *dev);
void pci_aer_exit(struct pci_dev *dev); void pci_aer_exit(struct pci_dev *dev);
extern const struct attribute_group aer_stats_attr_group; extern const struct attribute_group aer_stats_attr_group;
void pci_aer_clear_fatal_status(struct pci_dev *dev); void pci_aer_clear_fatal_status(struct pci_dev *dev);
void pci_aer_clear_device_status(struct pci_dev *dev);
#else #else
static inline void pci_no_aer(void) { } static inline void pci_no_aer(void) { }
static inline int pci_aer_init(struct pci_dev *d) { return -ENODEV; } static inline int pci_aer_init(struct pci_dev *d) { return -ENODEV; }
static inline void pci_aer_exit(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_fatal_status(struct pci_dev *dev) { }
static inline void pci_aer_clear_device_status(struct pci_dev *dev) { }
#endif #endif
#endif /* DRIVERS_PCI_H */ #endif /* DRIVERS_PCI_H */
...@@ -382,6 +382,14 @@ int pci_disable_pcie_error_reporting(struct pci_dev *dev) ...@@ -382,6 +382,14 @@ int pci_disable_pcie_error_reporting(struct pci_dev *dev)
} }
EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting); EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting);
void pci_aer_clear_device_status(struct pci_dev *dev)
{
u16 sta;
pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &sta);
pcie_capability_write_word(dev, PCI_EXP_DEVSTA, sta);
}
int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
{ {
int pos; int pos;
...@@ -1532,12 +1540,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev) ...@@ -1532,12 +1540,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
*/ */
static void aer_error_resume(struct pci_dev *dev) static void aer_error_resume(struct pci_dev *dev)
{ {
u16 reg16; pci_aer_clear_device_status(dev);
/* Clean up Root device status */
pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &reg16);
pcie_capability_write_word(dev, PCI_EXP_DEVSTA, reg16);
pci_cleanup_aer_uncorrect_error_status(dev); pci_cleanup_aer_uncorrect_error_status(dev);
} }
......
...@@ -252,6 +252,7 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, ...@@ -252,6 +252,7 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev,
dev->error_state = state; dev->error_state = state;
pci_walk_bus(dev->subordinate, cb, &result_data); pci_walk_bus(dev->subordinate, cb, &result_data);
if (cb == report_resume) { if (cb == report_resume) {
pci_aer_clear_device_status(dev);
pci_cleanup_aer_uncorrect_error_status(dev); pci_cleanup_aer_uncorrect_error_status(dev);
dev->error_state = pci_channel_io_normal; dev->error_state = pci_channel_io_normal;
} }
...@@ -312,6 +313,7 @@ void pcie_do_fatal_recovery(struct pci_dev *dev, u32 service) ...@@ -312,6 +313,7 @@ void pcie_do_fatal_recovery(struct pci_dev *dev, u32 service)
* of the bridge and clear the error status of the bridge. * of the bridge and clear the error status of the bridge.
*/ */
pci_aer_clear_fatal_status(dev); pci_aer_clear_fatal_status(dev);
pci_aer_clear_device_status(dev);
} }
if (result == PCI_ERS_RESULT_RECOVERED) { if (result == PCI_ERS_RESULT_RECOVERED) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment