crypto: qat - add sysfs PCI reset support for QAT devices
Subsystems (3)
cover crypto: qat - add sysfs PCI reset support for QAT devices
A PCI reset triggered through sysfs (/sys/bus/pci/devices/.../reset) leaves QAT devices in an unusable state because the driver has never implemented the reset_prepare() and reset_done() callbacks. The reset proceeds without quiescing the device or restoring it afterward. This series adds the missing sysfs reset support and fixes the deadlocks, state-management issues, and corner cases that surface when the reset path is actually exercised.
Note on stable backport:
Since this support was entirely absent rather than broken by a specific commit, there is no individual Fixes tag that can be cited. We believe this series warrants inclusion in stable to allow users to perform standard PCI resets on QAT devices without rendering them non-functional. We will need to revisit/retest when doing the backport as the PCI core may have changed.
In summary:
Patch #1: Skip VF disable and enable during device restart when the VF topology is already present. This avoids lock-order issues in PCI reset callbacks while keeping VF quiesce notification intact.
Patch #2: Move fatal error notification earlier in the AER path. This ensures subsystems and VFs are informed as soon as fatal error handling begins.
Patch #3: Centralize PCI bus-master enable into a single init path. Remove scattered pci_set_master()/pci_clear_master() calls so BME state is deterministic across reset flows.
Patch #4: Skip the shutdown and restart flow for devices that were already administratively down before PCI reset. PCI state is still restored, but the device remains down as expected.
Patch #5: Factor the common AER shutdown and recovery sequences into reset_prepare() and reset_done() helpers to simplify the reset path and prepare it for reuse.
Patch #6: Hook reset_prepare() and reset_done() into the QAT PCI error handler. This makes sysfs-triggered PCI reset follow the same quiesce and recovery flow as AER reset.
Ahsan Atta (6):
crypto: qat - keep VFs enabled during reset
crypto: qat - notify fatal error before AER reset preparation
crypto: qat - centralize bus master enable
crypto: qat - skip restart for down devices
crypto: qat - factor out AER reset helpers
crypto: qat - handle sysfs-triggered reset callbacks
drivers/crypto/intel/qat/qat_420xx/adf_drv.c | 2 - drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 2 - drivers/crypto/intel/qat/qat_6xxx/adf_drv.c | 2 - drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c | 1 - .../crypto/intel/qat/qat_c3xxxvf/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_c62x/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_c62xvf/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_common/adf_aer.c | 102 +++++++++++++----- .../intel/qat/qat_common/adf_common_drv.h | 1 + .../crypto/intel/qat/qat_common/adf_init.c | 2 + .../crypto/intel/qat/qat_common/adf_sriov.c | 12 ++- .../crypto/intel/qat/qat_dh895xcc/adf_drv.c | 1 - .../crypto/intel/qat/qat_dh895xccvf/adf_drv.c | 1 - 13 files changed, 87 insertions(+), 42 deletions(-)
base-commit: 6a69430dcc874c47fe5a25b70d87861c1cc9c0d8
Signature · 13 lines
2.45.0 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH 1/6 crypto: qat - keep VFs enabled during reset
When a reset is triggered via sysfs, the PCI core invokes the reset_prepare() callback while holding pci_dev_lock(), which includes the PCI configuration space access semaphore. If reset_prepare() calls adf_dev_down(), the call chain adf_dev_stop() -> adf_disable_sriov() -> pci_disable_sriov() attempts to acquire the same semaphore, resulting in a deadlock.
Avoid this by skipping pci_disable_sriov() when ADF_STATUS_RESTARTING is set. During reset the PCI topology is preserved, so VF devices remain valid and enumerated across the reset. VF notification and the quiesce handshake via adf_pf2vf_notify_restarting() are still performed unconditionally so that VFs stop submitting work before the PF shuts down.
Correspondingly, skip pci_enable_sriov() in adf_enable_sriov() when VFs are already present, since their PCI devices were preserved from before the restart.
This is in preparation for adding reset_prepare() and reset_done() callbacks in adf_aer.c.
--- drivers/crypto/intel/qat/qat_common/adf_sriov.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/crypto/intel/qat/qat_common/adf_sriov.c +11 -1
@@ -91,6 +91,10 @@ static int adf_enable_sriov(struct adf_accel_dev *accel_dev)/* Enable VF to PF interrupts for all VFs */ adf_enable_all_vf2pf_interrupts (accel_dev, totalvfs); +/* Do not enable SR-IOV if already enabled */ +if (pci_num_vf (pdev)) +return 0 ; +/* * Due to the hardware design, when SR-IOV and the ring arbiter * are enabled all the VFs supported in hardware must be enabled in
@@ -260,7 +264,13 @@ void adf_disable_sriov(struct adf_accel_dev *accel_dev)adf_pf2vf_notify_restarting (accel_dev);adf_pf2vf_wait_for_restarting_complete (accel_dev); -pci_disable_sriov (accel_to_pci_dev (accel_dev)); +/* +* When the device is restarting, preserve VF PCI devices across +* the reset by skipping pci_disable_sriov(). VFs are notified to +* quiesce regardless so the PF can safely shut down. +*/ +if (!test_bit (ADF_STATUS_RESTARTING , &accel_dev->status)) +pci_disable_sriov (accel_to_pci_dev (accel_dev));/* Block VF2PF work and disable VF to PF interrupts */ adf_disable_all_vf2pf_interrupts (accel_dev);
Signature · 13 lines
2.45.0 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH 2/6 crypto: qat - notify fatal error before AER reset preparation
In reply to Ahsan AttaSend fatal error notifications to subsystems and VFs as soon as AER error detection starts, before entering the reset preparation shutdown sequence.
This reduces notification latency and ensures peers are informed immediately on fatal detection, rather than after restart-state setup and arbitration teardown.
--- drivers/crypto/intel/qat/qat_common/adf_aer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_aer.c +2 -2
@@ -33,13 +33,13 @@ static pci_ers_result_t adf_error_detected(struct pci_dev *pdev,return PCI_ERS_RESULT_DISCONNECT ; } +adf_error_notifier (accel_dev); +adf_pf2vf_notify_fatal_error (accel_dev);set_bit (ADF_STATUS_RESTARTING , &accel_dev->status);if (accel_dev->hw_device->exit_arb) {dev_dbg (&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);adf_dev_restarting_notify (accel_dev);pci_clear_master (pdev);adf_dev_down (accel_dev);
Signature · 13 lines
2.45.0 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH 3/6 crypto: qat - centralize bus master enable
In reply to Ahsan AttaQAT driver currently toggles PCI bus mastering in multiple places (probe paths, and reset callbacks). This makes BME state depend on call ordering and on what PCI command bits were captured in saved PCI config state.
Make BME control explicit and deterministic:
- remove pci_set_master() from device-specific probe paths
- add adf_set_bme() and call it from adf_dev_init() so BME is enabled at one point before device bring-up
- drop redundant pci_set_master() and pci_clear_master from adf_aer.c and rely on the unified init path for BME enablement
This is in preparation for adding reset_prepare() and reset_done() hooks. In the PCI reset callback flow, the PCI core saves and restores device configuration state around reset_prepare() and reset_done(). This change is needed to ensure that we are able to properly shutdown or reinitialize the device post sysfs triggered resets.
--- drivers/crypto/intel/qat/qat_420xx/adf_drv.c | 2 -- drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 2 -- drivers/crypto/intel/qat/qat_6xxx/adf_drv.c | 2 -- drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_c3xxxvf/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_c62x/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_c62xvf/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_common/adf_aer.c | 10 +++++++--- drivers/crypto/intel/qat/qat_common/adf_common_drv.h | 1 + drivers/crypto/intel/qat/qat_common/adf_init.c | 2 ++ drivers/crypto/intel/qat/qat_dh895xcc/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_dh895xccvf/adf_drv.c | 1 - 12 files changed, 10 insertions(+), 15 deletions(-)
drivers/crypto/intel/qat/qat_420xx/adf_drv.c +0 -2
@@ -146,8 +146,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } } -pci_set_master (pdev); -if (pci_save_state (pdev)) {dev_err (&pdev->dev,"Failed to save pci state.\n" ); ret = -ENOMEM ;
drivers/crypto/intel/qat/qat_4xxx/adf_drv.c +0 -2
@@ -148,8 +148,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } } -pci_set_master (pdev); -if (pci_save_state (pdev)) {dev_err (&pdev->dev,"Failed to save pci state.\n" ); ret = -ENOMEM ;
drivers/crypto/intel/qat/qat_6xxx/adf_drv.c +0 -2
@@ -189,8 +189,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } } -pci_set_master (pdev); -/* * The PCI config space is saved at this point and will be restored * after a Function Level Reset (FLR) as the FLR does not completely
drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c +0 -1
@@ -167,7 +167,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_err_free_reg; } } -pci_set_master (pdev);if (pci_save_state (pdev)) {dev_err (&pdev->dev,"Failed to save pci state\n" );
drivers/crypto/intel/qat/qat_c3xxxvf/adf_drv.c +0 -1
@@ -163,7 +163,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_err_free_reg; } } -pci_set_master (pdev);/* Completion for VF2PF request/response message exchange */ init_completion (&accel_dev->vf.msg_received);
drivers/crypto/intel/qat/qat_c62x/adf_drv.c +0 -1
@@ -167,7 +167,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_err_free_reg; } } -pci_set_master (pdev);if (pci_save_state (pdev)) {dev_err (&pdev->dev,"Failed to save pci state\n" );
drivers/crypto/intel/qat/qat_c62xvf/adf_drv.c +0 -1
@@ -163,7 +163,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_err_free_reg; } } -pci_set_master (pdev);/* Completion for VF2PF request/response message exchange */ init_completion (&accel_dev->vf.msg_received);
drivers/crypto/intel/qat/qat_common/adf_aer.c +7 -3
@@ -41,7 +41,6 @@ static pci_ers_result_t adf_error_detected(struct pci_dev *pdev, accel_dev->hw_device->exit_arb (accel_dev); }adf_dev_restarting_notify (accel_dev); -pci_clear_master (pdev);adf_dev_down (accel_dev);return PCI_ERS_RESULT_NEED_RESET ;
@@ -106,6 +105,13 @@ void adf_dev_restore(struct adf_accel_dev *accel_dev) } } +void adf_set_bme (struct adf_accel_dev *accel_dev) +{ +struct pci_dev *pdev =accel_to_pci_dev (accel_dev); + +pci_set_master (pdev); +} +static void adf_device_sriov_worker (struct work_struct *work) { struct adf_sriov_dev_data *sriov_data =
@@ -198,8 +204,6 @@ static pci_ers_result_t adf_slot_reset(struct pci_dev *pdev)return PCI_ERS_RESULT_DISCONNECT ; } -if (!pdev->is_busmaster) -pci_set_master (pdev);pci_restore_state (pdev); res =adf_dev_up (accel_dev, false);if (res && res != -EALREADY )
drivers/crypto/intel/qat/qat_common/adf_common_drv.h +1 -0
@@ -77,6 +77,7 @@ extern const struct pci_error_handlers adf_err_handler;void adf_reset_sbr (struct adf_accel_dev *accel_dev);void adf_reset_flr (struct adf_accel_dev *accel_dev);void adf_dev_restore (struct adf_accel_dev *accel_dev); +void adf_set_bme (struct adf_accel_dev *accel_dev);int adf_init_aer (void );void adf_exit_aer (void );int adf_init_arb (struct adf_accel_dev *accel_dev);
drivers/crypto/intel/qat/qat_common/adf_init.c +2 -0
@@ -74,6 +74,8 @@ static int adf_dev_init(struct adf_accel_dev *accel_dev)return -EFAULT ; } +adf_set_bme (accel_dev); +if (!test_bit (ADF_STATUS_CONFIGURED , &accel_dev->status) && !accel_dev->is_vf) {dev_err (&GET_DEV (accel_dev),"Device not configured\n" );
drivers/crypto/intel/qat/qat_dh895xcc/adf_drv.c +0 -1
@@ -167,7 +167,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_err_free_reg; } } -pci_set_master (pdev);if (pci_save_state (pdev)) {dev_err (&pdev->dev,"Failed to save pci state\n" );
drivers/crypto/intel/qat/qat_dh895xccvf/adf_drv.c +0 -1
@@ -163,7 +163,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_err_free_reg; } } -pci_set_master (pdev);/* Completion for VF2PF request/response message exchange */ init_completion (&accel_dev->vf.msg_received);
Signature · 13 lines
2.45.0 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH 4/6 crypto: qat - skip restart for down devices
In reply to Ahsan AttaSkip the shutdown and restart flow when adf_slot_reset() is entered for a device that is already down. In that case, leave ADF_STATUS_RESTARTING clear and let adf_slot_reset() restore PCI function state without calling adf_dev_up(), re-enabling SR-IOV, or sending restarted notifications.
This is in preparation for adding reset_prepare() and reset_done() callbacks in adf_aer.c.
--- drivers/crypto/intel/qat/qat_common/adf_aer.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_common/adf_aer.c +8 -0
@@ -33,6 +33,9 @@ static pci_ers_result_t adf_error_detected(struct pci_dev *pdev,return PCI_ERS_RESULT_DISCONNECT ; } +if (!adf_dev_started (accel_dev)) +return PCI_ERS_RESULT_CAN_RECOVER ; +adf_error_notifier (accel_dev);adf_pf2vf_notify_fatal_error (accel_dev);set_bit (ADF_STATUS_RESTARTING , &accel_dev->status);
@@ -204,6 +207,9 @@ static pci_ers_result_t adf_slot_reset(struct pci_dev *pdev)return PCI_ERS_RESULT_DISCONNECT ; } +if (!adf_devmgr_in_reset (accel_dev)) + goto reset_complete; +pci_restore_state (pdev); res =adf_dev_up (accel_dev, false);if (res && res != -EALREADY )
@@ -213,6 +219,8 @@ static pci_ers_result_t adf_slot_reset(struct pci_dev *pdev)adf_pf2vf_notify_restarted (accel_dev);adf_dev_restarted_notify (accel_dev);clear_bit (ADF_STATUS_RESTARTING , &accel_dev->status); + +reset_complete:return PCI_ERS_RESULT_RECOVERED ; }
Signature · 13 lines
2.45.0 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH 5/6 crypto: qat - factor out AER reset helpers
In reply to Ahsan AttaMove the shutdown and recovery sequences out of adf_error_detected() and adf_slot_reset() into reset_prepare() and reset_done() helpers.
This makes the AER recovery path easier to follow and prepares the common reset flow for reuse by additional PCI reset callbacks without duplicating the logic.
No functional change intended.
--- drivers/crypto/intel/qat/qat_common/adf_aer.c | 86 ++++++++++++------- 1 file changed, 53 insertions(+), 33 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_aer.c +53 -33
@@ -17,27 +17,18 @@ struct adf_fatal_error_data {static struct workqueue_struct *device_reset_wq;static struct workqueue_struct *device_sriov_wq; -static pci_ers_result_t adf_error_detected (struct pci_dev *pdev, -pci_channel_state_t state) +static pci_ers_result_t reset_prepare (struct pci_dev *pdev) {struct adf_accel_dev *accel_dev =adf_devmgr_pci_to_accel_dev (pdev); -dev_info (&pdev->dev,"Acceleration driver hardware error detected.\n" );if (!accel_dev) {dev_err (&pdev->dev,"Can't find acceleration device\n" );return PCI_ERS_RESULT_DISCONNECT ; } -if (state == pci_channel_io_perm_failure) { -dev_err (&pdev->dev,"Can't recover from device error\n" ); -return PCI_ERS_RESULT_DISCONNECT ; - } -if (!adf_dev_started (accel_dev))return PCI_ERS_RESULT_CAN_RECOVER ; -adf_error_notifier (accel_dev); -adf_pf2vf_notify_fatal_error (accel_dev);set_bit (ADF_STATUS_RESTARTING , &accel_dev->status);if (accel_dev->hw_device->exit_arb) {dev_dbg (&pdev->dev,"Disabling arbitration\n" );
@@ -49,6 +40,57 @@ static pci_ers_result_t adf_error_detected(struct pci_dev *pdev,return PCI_ERS_RESULT_NEED_RESET ; } +static pci_ers_result_t reset_done (struct pci_dev *pdev) +{ +struct adf_accel_dev *accel_dev =adf_devmgr_pci_to_accel_dev (pdev); +int res; + +if (!accel_dev) { +dev_err (&pdev->dev,"Can't find acceleration device\n" ); +return PCI_ERS_RESULT_DISCONNECT ; + } + +if (!adf_devmgr_in_reset (accel_dev)) + goto reset_complete; + +pci_restore_state (pdev); + res =adf_dev_up (accel_dev, false); +if (res && res != -EALREADY ) +return PCI_ERS_RESULT_DISCONNECT ; + +adf_reenable_sriov (accel_dev); +adf_pf2vf_notify_restarted (accel_dev); +adf_dev_restarted_notify (accel_dev); +clear_bit (ADF_STATUS_RESTARTING , &accel_dev->status); + +reset_complete: +dev_info (&pdev->dev,"Device reset completed successfully\n" ); + +return PCI_ERS_RESULT_RECOVERED ; +} + +static pci_ers_result_t adf_error_detected (struct pci_dev *pdev, +pci_channel_state_t state) +{ +struct adf_accel_dev *accel_dev =adf_devmgr_pci_to_accel_dev (pdev); + +dev_info (&pdev->dev,"Acceleration driver hardware error detected.\n" ); +if (!accel_dev) { +dev_err (&pdev->dev,"Can't find acceleration device\n" ); +return PCI_ERS_RESULT_DISCONNECT ; + } + +if (state == pci_channel_io_perm_failure) { +dev_err (&pdev->dev,"Can't recover from device error\n" ); +return PCI_ERS_RESULT_DISCONNECT ; + } + +adf_error_notifier (accel_dev); +adf_pf2vf_notify_fatal_error (accel_dev); + +return reset_prepare (pdev); +} +/* reset dev data */ struct adf_reset_dev_data {int mode;
@@ -199,29 +241,7 @@ static int adf_dev_aer_schedule_reset(struct adf_accel_dev *accel_dev,static pci_ers_result_t adf_slot_reset (struct pci_dev *pdev) { -struct adf_accel_dev *accel_dev =adf_devmgr_pci_to_accel_dev (pdev); -int res =0 ; - -if (!accel_dev) { -pr_err ("QAT: Can't find acceleration device\n" ); -return PCI_ERS_RESULT_DISCONNECT ; - } - -if (!adf_devmgr_in_reset (accel_dev)) - goto reset_complete; - -pci_restore_state (pdev); - res =adf_dev_up (accel_dev, false); -if (res && res != -EALREADY ) -return PCI_ERS_RESULT_DISCONNECT ; - -adf_reenable_sriov (accel_dev); -adf_pf2vf_notify_restarted (accel_dev); -adf_dev_restarted_notify (accel_dev); -clear_bit (ADF_STATUS_RESTARTING , &accel_dev->status); - -reset_complete: -return PCI_ERS_RESULT_RECOVERED ; +return reset_done (pdev); }static void adf_resume (struct pci_dev *pdev)
Signature · 13 lines
2.45.0 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH 6/6 crypto: qat - handle sysfs-triggered reset callbacks
In reply to Ahsan AttaA reset requested through /sys/bus/pci/devices/.../reset invokes the driver reset_prepare() and reset_done() callbacks. The QAT driver does not implement those callbacks today, so the reset proceeds without quiescing the device or bringing it back up afterward, which leaves the device unusable.
Hook reset_prepare() and reset_done() into adf_err_handler so the common shutdown and recovery flow also runs for reset. Skip device quiesce if the device is already in a down state.
--- drivers/crypto/intel/qat/qat_common/adf_aer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/crypto/intel/qat/qat_common/adf_aer.c +12 -0
@@ -250,10 +250,22 @@ static void adf_resume(struct pci_dev *pdev)dev_info (&pdev->dev,"Device is up and running\n" ); } +static void adf_reset_prepare (struct pci_dev *pdev) +{ +reset_prepare (pdev); +} + +static void adf_reset_done (struct pci_dev *pdev) +{ +reset_done (pdev); +} +const struct pci_error_handlers adf_err_handler = { .error_detected = adf_error_detected, .slot_reset = adf_slot_reset, .resume = adf_resume, + .reset_prepare = adf_reset_prepare, + .reset_done = adf_reset_done, };EXPORT_SYMBOL_GPL (adf_err_handler);
Signature · 13 lines
2.45.0 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Herbert Xu
maintainerQuoted 65 lines · Ahsan Atta
A PCI reset triggered through sysfs (
/sys/bus/pci/devices/.../reset) leaves QAT devices in an unusable state because the driver has never implemented thereset_prepare()andreset_done()callbacks. The reset proceeds without quiescing the device or restoring it afterward. This series adds the missing sysfs reset support and fixes the deadlocks, state-management issues, and corner cases that surface when the reset path is actually exercised.Note on stable backport:
Since this support was entirely absent rather than broken by a specific commit, there is no individual Fixes tag that can be cited. We believe this series warrants inclusion in stable to allow users to perform standard PCI resets on QAT devices without rendering them non-functional. We will need to revisit/retest when doing the backport as the PCI core may have changed.In summary:
Patch #1: Skip VF disable and enable during device restart when the VF topology is already present. This avoids lock-order issues in PCI reset callbacks while keeping VF quiesce notification intact.Patch #2: Move fatal error notification earlier in the AER path. This ensures subsystems and VFs are informed as soon as fatal error handling begins.
Patch #3: Centralize PCI bus-master enable into a single init path. Remove scattered pci_set_master()/pci_clear_master() calls so BME state is deterministic across reset flows.
Patch #4: Skip the shutdown and restart flow for devices that were already administratively down before PCI reset. PCI state is still restored, but the device remains down as expected.
Patch #5: Factor the common AER shutdown and recovery sequences into
reset_prepare()andreset_done()helpers to simplify the reset path and prepare it for reuse.Patch #6: Hook
reset_prepare()andreset_done()into the QAT PCI error handler. This makes sysfs-triggered PCI reset follow the same quiesce and recovery flow as AER reset.Ahsan Atta (6):
crypto: qat - keep VFs enabled during reset
crypto: qat - notify fatal error before AER reset preparation
crypto: qat - centralize bus master enable
crypto: qat - skip restart for down devices
crypto: qat - factor out AER reset helpers
crypto: qat - handle sysfs-triggered reset callbacksdrivers/crypto/intel/qat/qat_420xx/adf_drv.c | 2 - drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 2 - drivers/crypto/intel/qat/qat_6xxx/adf_drv.c | 2 - drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c | 1 - .../crypto/intel/qat/qat_c3xxxvf/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_c62x/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_c62xvf/adf_drv.c | 1 - drivers/crypto/intel/qat/qat_common/adf_aer.c | 102 +++++++++++++----- .../intel/qat/qat_common/adf_common_drv.h | 1 + .../crypto/intel/qat/qat_common/adf_init.c | 2 + .../crypto/intel/qat/qat_common/adf_sriov.c | 12 ++- .../crypto/intel/qat/qat_dh895xcc/adf_drv.c | 1 - .../crypto/intel/qat/qat_dh895xccvf/adf_drv.c | 1 - 13 files changed, 87 insertions(+), 42 deletions(-)
Quoted 3 lines
base-commit:
6a69430dcc874c47fe5a25b70d87861c1cc9c0d8Signature · 1 line
2.45.0
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt