diff mbox series

[v2,2/2] PCI/ERR: Add reset support for non fatal errors

Message ID 18ab6cc7b34dab7630978195248ea031540ba9f1.1591307288.git.sathyanarayanan.kuppuswamy@linux.intel.com
State New
Headers show
Series [v2,1/2] PCI/ERR: Fix fatal error recovery for non-hotplug capable devices | expand

Commit Message

Kuppuswamy, Sathyanarayanan June 4, 2020, 9:50 p.m. UTC
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

PCI_ERS_RESULT_NEED_RESET error status implies the device is
requesting a slot reset and a notification about slot reset
completion via ->slot_reset() callback.

But in non-fatal errors case, if report_error_detected() or
report_mmio_enabled() functions requests PCI_ERS_RESULT_NEED_RESET
then current pcie_do_recovery() implementation does not do the
requested explicit slot reset, instead just calls the ->slot_reset()
callback on all affected devices. Notifying about the slot reset
completion without resetting it incorrect. So add this support.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
 drivers/pci/pcie/err.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Yicong Yang June 28, 2020, 12:57 p.m. UTC | #1
Hi Sathy,

one minor comments below.

On 2020/6/5 5:50, sathyanarayanan.kuppuswamy@linux.intel.com wrote:
> From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>
> PCI_ERS_RESULT_NEED_RESET error status implies the device is
> requesting a slot reset and a notification about slot reset
> completion via ->slot_reset() callback.
>
> But in non-fatal errors case, if report_error_detected() or
> report_mmio_enabled() functions requests PCI_ERS_RESULT_NEED_RESET
> then current pcie_do_recovery() implementation does not do the
> requested explicit slot reset, instead just calls the ->slot_reset()
> callback on all affected devices. Notifying about the slot reset
> completion without resetting it incorrect. So add this support.
>
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> ---
>  drivers/pci/pcie/err.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
> index 5fe8561c7185..94d1c2ff7b40 100644
> --- a/drivers/pci/pcie/err.c
> +++ b/drivers/pci/pcie/err.c
> @@ -206,6 +206,9 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
>  		 * functions to reset slot before calling
>  		 * drivers' slot_reset callbacks?
>  		 */
> +		if (state != pci_channel_io_frozen)
> +			pci_reset_bus(dev);
> +

If it's the implementation to reset the slot, should we remove the TODO comments?
JYI.

Thanks,
Yicong


>  		status = PCI_ERS_RESULT_RECOVERED;
>  		pci_dbg(dev, "broadcast slot_reset message\n");
>  		pci_walk_bus(bus, report_slot_reset, &status);
diff mbox series

Patch

diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
index 5fe8561c7185..94d1c2ff7b40 100644
--- a/drivers/pci/pcie/err.c
+++ b/drivers/pci/pcie/err.c
@@ -206,6 +206,9 @@  pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
 		 * functions to reset slot before calling
 		 * drivers' slot_reset callbacks?
 		 */
+		if (state != pci_channel_io_frozen)
+			pci_reset_bus(dev);
+
 		status = PCI_ERS_RESULT_RECOVERED;
 		pci_dbg(dev, "broadcast slot_reset message\n");
 		pci_walk_bus(bus, report_slot_reset, &status);