Messages in this thread | | | Subject | Re: [PATCH v17 09/12] PCI/AER: Allow clearing Error Status Register in FF mode | From | "Kuppuswamy, Sathyanarayanan" <> | Date | Thu, 5 Mar 2020 21:45:46 -0800 |
| |
On 3/3/2020 6:36 PM, sathyanarayanan.kuppuswamy@linux.intel.com wrote: > From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > > As per PCI firmware specification r3.2 System Firmware Intermediary > (SFI) _OSC and DPC Updates ECR > (https://members.pcisig.com/wg/PCI-SIG/document/13563), sec titled "DPC > Event Handling Implementation Note", page 10, Error Disconnect Recover > (EDR) support allows OS to handle error recovery and clearing Error > Registers even in FF mode. So create new API pci_aer_raw_clear_status() > which allows clearing AER registers without FF mode checks. > > Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > --- > drivers/pci/pci.h | 2 ++ > drivers/pci/pcie/aer.c | 22 ++++++++++++++++++---- > 2 files changed, 20 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h > index e57e78b619f8..c239e6dd2542 100644 > --- a/drivers/pci/pci.h > +++ b/drivers/pci/pci.h > @@ -655,6 +655,7 @@ 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_cleanup_aer_error_status_regs(struct pci_dev *dev); > +int pci_aer_raw_clear_status(struct pci_dev *dev); > #else > static inline void pci_no_aer(void) { } > static inline void pci_aer_init(struct pci_dev *d) { } > @@ -665,6 +666,7 @@ static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) > { > return -EINVAL; > } > +int pci_aer_raw_clear_status(struct pci_dev *dev) { return -EINVAL; } Its missing static specifier. It needs to be fixed. I can fix it in next version. Bjorn, if there is no need for next version, can you please make this change ? > #endif > > #ifdef CONFIG_ACPI > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > index c0540c3761dc..41afefa562b7 100644 > --- a/drivers/pci/pcie/aer.c > +++ b/drivers/pci/pcie/aer.c > @@ -420,7 +420,16 @@ void pci_aer_clear_fatal_status(struct pci_dev *dev) > pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); > } > > -int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) > +/** > + * pci_aer_raw_clear_status - Clear AER error registers. > + * @dev: the PCI device > + * > + * NOTE: Allows clearing error registers in both FF and > + * non FF modes. > + * > + * Returns 0 on success, or negative on failure. > + */ > +int pci_aer_raw_clear_status(struct pci_dev *dev) > { > int pos; > u32 status; > @@ -433,9 +442,6 @@ int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) > if (!pos) > return -EIO; > > - if (pcie_aer_get_firmware_first(dev)) > - 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); > @@ -451,6 +457,14 @@ int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) > return 0; > } > > +int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) > +{ > + if (pcie_aer_get_firmware_first(dev)) > + return -EIO; > + > + return pci_aer_raw_clear_status(dev); > +} > + > void pci_save_aer_state(struct pci_dev *dev) > { > struct pci_cap_saved_state *save_state; >
-- Sathyanarayanan Kuppuswamy Linux Kernel Developer
| |