crypto: qat - add heartbeat counters check
authorDamian Muszynski <damian.muszynski@intel.com>
Fri, 30 Jun 2023 17:03:58 +0000 (19:03 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 20 Jul 2023 10:16:23 +0000 (22:16 +1200)
commitbec61a294dbec1c5929aa6f138cddcab68a62311
treea00931aa5b27309cfaa7f0d357034206b1c5cff0
parent359b84f8db942ef46d24de8aa397790c3fae22e0
crypto: qat - add heartbeat counters check

A firmware update for QAT GEN2 changed the format of a data
structure used to report the heartbeat counters.

To support all firmware versions, extend the heartbeat logic
with an algorithm that detects the number of counters returned
by firmware. The algorithm detects the number of counters to
be used (and size of the corresponding data structure) by the
comparison the expected size of the data in memory, with the data
which was written by the firmware.

Firmware detection is done one time during the first read of heartbeat
debugfs file to avoid increasing the time needed to load the module.

Signed-off-by: Damian Muszynski <damian.muszynski@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/intel/qat/qat_c3xxx/adf_c3xxx_hw_data.c
drivers/crypto/intel/qat/qat_c62x/adf_c62x_hw_data.c
drivers/crypto/intel/qat/qat_common/adf_accel_devices.h
drivers/crypto/intel/qat/qat_common/adf_heartbeat.c
drivers/crypto/intel/qat/qat_common/adf_heartbeat.h
drivers/crypto/intel/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c