[PATCH 9/9] crypto: qat - improve aer error reset handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Disable worker threads and clear pci bus master in aer error handler.

This is to avoid new requests to be processed and allow dummy responses
generation for in-flight requests in user space before resetting a device.

Signed-off-by: Mun Chun Yep <mun.chun.yep@xxxxxxxxx>
Reviewed-by: Ahsan Atta <ahsan.atta@xxxxxxxxx>
Reviewed-by: Markas Rapoportas <markas.rapoportas@xxxxxxxxx>
---
 drivers/crypto/intel/qat/qat_common/adf_aer.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/crypto/intel/qat/qat_common/adf_aer.c b/drivers/crypto/intel/qat/qat_common/adf_aer.c
index b3d4b6b99c65..df0ff0caf419 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_aer.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_aer.c
@@ -28,6 +28,14 @@ static pci_ers_result_t adf_error_detected(struct pci_dev *pdev,
 		return PCI_ERS_RESULT_DISCONNECT;
 	}
 
+	if (accel_dev->hw_device->exit_arb) {
+		dev_info(&pdev->dev, "Disabling arbitration\n");
+		accel_dev->hw_device->exit_arb(accel_dev);
+	}
+	adf_error_notifier(accel_dev);
+	adf_pf2vf_notify_fatal_error(accel_dev);
+	pci_clear_master(pdev);
+
 	if (state == pci_channel_io_perm_failure) {
 		dev_err(&pdev->dev, "Can't recover from device error\n");
 		return PCI_ERS_RESULT_DISCONNECT;
@@ -111,9 +119,18 @@ static void adf_device_reset_worker(struct work_struct *work)
 		  container_of(work, struct adf_reset_dev_data, reset_work);
 	struct adf_accel_dev *accel_dev = reset_data->accel_dev;
 	unsigned long wait_jiffies = msecs_to_jiffies(10000);
+	struct pci_dev *pdev = accel_to_pci_dev(accel_dev);
 	struct adf_sriov_dev_data sriov_data;
 
 	adf_dev_restarting_notify(accel_dev);
+
+	/*
+	 * re-enable device to support pf/vf comms as it would be disabled
+	 * in the detect function of aer driver
+	 */
+	if (!pdev->is_busmaster)
+		pci_set_master(pdev);
+
 	if (adf_dev_restart(accel_dev)) {
 		/* The device hanged and we can't restart it so stop here */
 		dev_err(&GET_DEV(accel_dev), "Restart device failed\n");
-- 
2.34.1





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux