Skip to content

Commit 9213bf1

Browse files
sumanku3gregkh
authored andcommitted
crypto: qat - fix firmware loading failure for GEN6 devices
[ Upstream commit e7dcb72 ] 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: 17fd751 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a7b716d commit 9213bf1

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

drivers/crypto/intel/qat/qat_common/adf_accel_engine.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
22
/* Copyright(c) 2014 - 2020 Intel Corporation */
3+
#include <linux/delay.h>
34
#include <linux/firmware.h>
45
#include <linux/pci.h>
56
#include "adf_cfg.h"
@@ -162,8 +163,14 @@ int adf_ae_stop(struct adf_accel_dev *accel_dev)
162163
static int adf_ae_reset(struct adf_accel_dev *accel_dev, int ae)
163164
{
164165
struct adf_fw_loader_data *loader_data = accel_dev->fw_loader;
166+
unsigned long reset_delay;
165167

166168
qat_hal_reset(loader_data->fw_loader);
169+
170+
reset_delay = loader_data->fw_loader->chip_info->reset_delay_us;
171+
if (reset_delay)
172+
fsleep(reset_delay);
173+
167174
if (qat_hal_clr_reset(loader_data->fw_loader))
168175
return -EFAULT;
169176

drivers/crypto/intel/qat/qat_common/icp_qat_fw_loader_handle.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct icp_qat_fw_loader_chip_info {
2727
int mmp_sram_size;
2828
bool nn;
2929
bool lm2lm3;
30+
u16 reset_delay_us;
3031
u32 lm_size;
3132
u32 icp_rst_csr;
3233
u32 icp_rst_mask;

drivers/crypto/intel/qat/qat_common/qat_hal.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define RST_CSR_QAT_LSB 20
2121
#define RST_CSR_AE_LSB 0
2222
#define MC_TIMESTAMP_ENABLE (0x1 << 7)
23+
#define MIN_RESET_DELAY_US 3
2324

2425
#define IGNORE_W1C_MASK ((~(1 << CE_BREAKPOINT_BITPOS)) & \
2526
(~(1 << CE_CNTL_STORE_PARITY_ERROR_BITPOS)) & \
@@ -713,8 +714,10 @@ static int qat_hal_chip_init(struct icp_qat_fw_loader_handle *handle,
713714
handle->chip_info->wakeup_event_val = 0x80000000;
714715
handle->chip_info->fw_auth = true;
715716
handle->chip_info->css_3k = true;
716-
if (handle->pci_dev->device == PCI_DEVICE_ID_INTEL_QAT_6XXX)
717+
if (handle->pci_dev->device == PCI_DEVICE_ID_INTEL_QAT_6XXX) {
717718
handle->chip_info->dual_sign = true;
719+
handle->chip_info->reset_delay_us = MIN_RESET_DELAY_US;
720+
}
718721
handle->chip_info->tgroup_share_ustore = true;
719722
handle->chip_info->fcu_ctl_csr = FCU_CONTROL_4XXX;
720723
handle->chip_info->fcu_sts_csr = FCU_STATUS_4XXX;

0 commit comments

Comments
 (0)