Skip to content

Commit fab9516

Browse files
aguerinIntelherbertx
authored andcommitted
crypto: qat - fix crypto capability detection for 4xxx
When extending the capability detection logic for 4xxx devices the SMx algorithms were accidentally missed. Enable these SMx capabilities by default for QAT GEN4 devices. Check for device variants where the SMx algorithms are explicitly disabled by the GEN4 hardware. This is indicated in fusectl1 register. Mask out SM3 and SM4 based on a bit specific to those algorithms. Mask out SM2 if the PKE slice is not present. Fixes: 4b44d28 ("crypto: qat - extend crypto capability detection for 4xxx") Signed-off-by: Adam Guerin <[email protected]> Reviewed-by: Giovanni Cabiddu <[email protected]> Reviewed-by: Fiona Trahe <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent b0cc749 commit fab9516

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ static u32 get_accel_cap(struct adf_accel_dev *accel_dev)
225225
ICP_ACCEL_CAPABILITIES_HKDF |
226226
ICP_ACCEL_CAPABILITIES_CHACHA_POLY |
227227
ICP_ACCEL_CAPABILITIES_AESGCM_SPC |
228+
ICP_ACCEL_CAPABILITIES_SM3 |
229+
ICP_ACCEL_CAPABILITIES_SM4 |
228230
ICP_ACCEL_CAPABILITIES_AES_V2;
229231

230232
/* A set bit in fusectl1 means the feature is OFF in this SKU */
@@ -248,12 +250,19 @@ static u32 get_accel_cap(struct adf_accel_dev *accel_dev)
248250
capabilities_sym &= ~ICP_ACCEL_CAPABILITIES_CIPHER;
249251
}
250252

253+
if (fusectl1 & ICP_ACCEL_4XXX_MASK_SMX_SLICE) {
254+
capabilities_sym &= ~ICP_ACCEL_CAPABILITIES_SM3;
255+
capabilities_sym &= ~ICP_ACCEL_CAPABILITIES_SM4;
256+
}
257+
251258
capabilities_asym = ICP_ACCEL_CAPABILITIES_CRYPTO_ASYMMETRIC |
252259
ICP_ACCEL_CAPABILITIES_CIPHER |
260+
ICP_ACCEL_CAPABILITIES_SM2 |
253261
ICP_ACCEL_CAPABILITIES_ECEDMONT;
254262

255263
if (fusectl1 & ICP_ACCEL_4XXX_MASK_PKE_SLICE) {
256264
capabilities_asym &= ~ICP_ACCEL_CAPABILITIES_CRYPTO_ASYMMETRIC;
265+
capabilities_asym &= ~ICP_ACCEL_CAPABILITIES_SM2;
257266
capabilities_asym &= ~ICP_ACCEL_CAPABILITIES_ECEDMONT;
258267
}
259268

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ enum icp_qat_capabilities_mask {
9797
ICP_ACCEL_CAPABILITIES_SHA3_EXT = BIT(15),
9898
ICP_ACCEL_CAPABILITIES_AESGCM_SPC = BIT(16),
9999
ICP_ACCEL_CAPABILITIES_CHACHA_POLY = BIT(17),
100-
/* Bits 18-21 are currently reserved */
100+
ICP_ACCEL_CAPABILITIES_SM2 = BIT(18),
101+
ICP_ACCEL_CAPABILITIES_SM3 = BIT(19),
102+
ICP_ACCEL_CAPABILITIES_SM4 = BIT(20),
103+
/* Bit 21 is currently reserved */
101104
ICP_ACCEL_CAPABILITIES_CNV_INTEGRITY = BIT(22),
102105
ICP_ACCEL_CAPABILITIES_CNV_INTEGRITY64 = BIT(23),
103106
ICP_ACCEL_CAPABILITIES_LZ4_COMPRESSION = BIT(24),

0 commit comments

Comments
 (0)