]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: qat - fix firmware loading failure for GEN6 devices
authorSuman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>
Thu, 5 Mar 2026 08:58:59 +0000 (08:58 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 15 Mar 2026 04:23:12 +0000 (13:23 +0900)
QAT GEN6 hardware requires a minimum 3 us delay during the acceleration
engine reset sequence to ensure the hardware fully settles.
Without this delay, the firmware load may fail intermittently.

Add a delay after placing the AE into reset and before clearing the reset,
matching the hardware requirements and ensuring stable firmware loading.
Earlier generations remain unaffected.

Fixes: 17fd7514ae68 ("crypto: qat - add qat_6xxx driver")
Signed-off-by: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/intel/qat/qat_common/adf_accel_engine.c
drivers/crypto/intel/qat/qat_common/icp_qat_fw_loader_handle.h
drivers/crypto/intel/qat/qat_common/qat_hal.c

index f9f1018a28236d58e0e71dfbabb20eb100939857..09d4f547e082c3da9a3ef05f02dd74267ae13a10 100644 (file)
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
 /* Copyright(c) 2014 - 2020 Intel Corporation */
+#include <linux/delay.h>
 #include <linux/firmware.h>
 #include <linux/pci.h>
 #include "adf_cfg.h"
@@ -162,8 +163,14 @@ int adf_ae_stop(struct adf_accel_dev *accel_dev)
 static int adf_ae_reset(struct adf_accel_dev *accel_dev, int ae)
 {
        struct adf_fw_loader_data *loader_data = accel_dev->fw_loader;
+       unsigned long reset_delay;
 
        qat_hal_reset(loader_data->fw_loader);
+
+       reset_delay = loader_data->fw_loader->chip_info->reset_delay_us;
+       if (reset_delay)
+               fsleep(reset_delay);
+
        if (qat_hal_clr_reset(loader_data->fw_loader))
                return -EFAULT;
 
index 6887930c7995ef0164751e89f07c24175571d50a..e74cafa95f1cc752b0ca8b81aa88569ce5b147c9 100644 (file)
@@ -27,6 +27,7 @@ struct icp_qat_fw_loader_chip_info {
        int mmp_sram_size;
        bool nn;
        bool lm2lm3;
+       u16 reset_delay_us;
        u32 lm_size;
        u32 icp_rst_csr;
        u32 icp_rst_mask;
index 0f5a2690690a1e48132f90cc81b7fa59c4978249..1c3d1311f1c7adcd219688cefa0287d89a5a5291 100644 (file)
@@ -20,6 +20,7 @@
 #define RST_CSR_QAT_LSB                        20
 #define RST_CSR_AE_LSB                 0
 #define MC_TIMESTAMP_ENABLE            (0x1 << 7)
+#define MIN_RESET_DELAY_US             3
 
 #define IGNORE_W1C_MASK ((~(1 << CE_BREAKPOINT_BITPOS)) & \
        (~(1 << CE_CNTL_STORE_PARITY_ERROR_BITPOS)) & \
@@ -713,8 +714,10 @@ static int qat_hal_chip_init(struct icp_qat_fw_loader_handle *handle,
                handle->chip_info->wakeup_event_val = 0x80000000;
                handle->chip_info->fw_auth = true;
                handle->chip_info->css_3k = true;
-               if (handle->pci_dev->device == PCI_DEVICE_ID_INTEL_QAT_6XXX)
+               if (handle->pci_dev->device == PCI_DEVICE_ID_INTEL_QAT_6XXX) {
                        handle->chip_info->dual_sign = true;
+                       handle->chip_info->reset_delay_us = MIN_RESET_DELAY_US;
+               }
                handle->chip_info->tgroup_share_ustore = true;
                handle->chip_info->fcu_ctl_csr = FCU_CONTROL_4XXX;
                handle->chip_info->fcu_sts_csr = FCU_STATUS_4XXX;