Skip to contentSkip to conversation

crypto: qat - add qat_4xxx driver

PATCH In review Giovanni Cabiddu 2 participants 5 messages Nov 13, 2020 – Nov 20, 2020 Crypto API

lore
Share & tools
lore
#0 lore raw

cover crypto: qat - add qat_4xxx driver

Add support for QAT 4xxx devices.

The first patch reworks the logic that loads the firmware images to allow for for devices that require multiple firmware images to work. The second patch introduces an hook to program the vector routing table, which is introduced in QAT 4XXX, to allow to change the vector associated with the interrupt source.
The third patch implements the QAT 4xxx driver.

Giovanni Cabiddu (3):
crypto: qat - target fw images to specific AEs
crypto: qat - add hook to initialize vector routing table
crypto: qat - add qat_4xxx driver

 drivers/crypto/qat/Kconfig                    |  11 +
 drivers/crypto/qat/Makefile                   |   1 +
 drivers/crypto/qat/qat_4xxx/Makefile          |   4 +
 .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.c    | 218 ++++++++++++
 .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.h    |  75 ++++
 drivers/crypto/qat/qat_4xxx/adf_drv.c         | 320 ++++++++++++++++++
 drivers/crypto/qat/qat_common/Makefile        |   1 +
 .../crypto/qat/qat_common/adf_accel_devices.h |   5 +
 .../crypto/qat/qat_common/adf_accel_engine.c  |  58 +++-
 .../crypto/qat/qat_common/adf_cfg_common.h    |   3 +-
 .../crypto/qat/qat_common/adf_gen4_hw_data.c  | 101 ++++++
 .../crypto/qat/qat_common/adf_gen4_hw_data.h  |  99 ++++++
 drivers/crypto/qat/qat_common/adf_isr.c       |   3 +
 13 files changed, 893 insertions(+), 6 deletions(-)
 create mode 100644 drivers/crypto/qat/qat_4xxx/Makefile
 create mode 100644 drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c
 create mode 100644 drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.h
 create mode 100644 drivers/crypto/qat/qat_4xxx/adf_drv.c
 create mode 100644 drivers/crypto/qat/qat_common/adf_gen4_hw_data.c
 create mode 100644 drivers/crypto/qat/qat_common/adf_gen4_hw_data.h
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/3 crypto: qat - target fw images to specific AEs

Introduce support for devices that require multiple firmware images. If a device requires more than a firmware image to operate, load the image to the appropriate Acceleration Engine (AE).

---
 .../crypto/qat/qat_common/adf_accel_devices.h |  3 +
 .../crypto/qat/qat_common/adf_accel_engine.c  | 58 +++++++++++++++++--
 2 files changed, 56 insertions(+), 5 deletions(-)
drivers/crypto/qat/qat_common/adf_accel_devices.h +3 -0
index 5694422ec66c..1484f10dbfdf 100644
@@ -175,6 +175,9 @@ struct adf_hw_device_data {
 	void (*enable_ints)(struct adf_accel_dev *accel_dev);
 	int (*enable_vf2pf_comms)(struct adf_accel_dev *accel_dev);
 	void (*reset_device)(struct adf_accel_dev *accel_dev);
+	char *(*uof_get_name)(u32 obj_num);
+	u32 (*uof_get_num_objs)(void);
+	u32 (*uof_get_ae_mask)(u32 obj_num);
 	struct adf_hw_csr_ops csr_ops;
 	const char *fw_name;
 	const char *fw_mmp_name;
drivers/crypto/qat/qat_common/adf_accel_engine.c +53 -5

80 lines not on this page · raw message

Signature · 1 line
2.28.0
#2 lore raw

PATCH 2/3 crypto: qat - add hook to initialize vector routing table

In reply to Giovanni Cabiddu

Add an hook to initialize the vector routing table with the default values before MSIx is enabled.
The new function set_msix_rttable() is called only if present in the struct adf_hw_device_data of the device. This is to allow for QAT devices that do not support that functionality.

---
 drivers/crypto/qat/qat_common/adf_accel_devices.h | 1 +
 drivers/crypto/qat/qat_common/adf_isr.c           | 3 +++
 2 files changed, 4 insertions(+)
drivers/crypto/qat/qat_common/adf_accel_devices.h +1 -0
index 1484f10dbfdf..26164d71f1d6 100644
@@ -175,6 +175,7 @@ struct adf_hw_device_data {
 	void (*enable_ints)(struct adf_accel_dev *accel_dev);
 	int (*enable_vf2pf_comms)(struct adf_accel_dev *accel_dev);
 	void (*reset_device)(struct adf_accel_dev *accel_dev);
+	void (*set_msix_rttable)(struct adf_accel_dev *accel_dev);
 	char *(*uof_get_name)(u32 obj_num);
 	u32 (*uof_get_num_objs)(void);
 	u32 (*uof_get_ae_mask)(u32 obj_num);
drivers/crypto/qat/qat_common/adf_isr.c +3 -0
index 5444f0ea0a1d..c45853463530 100644
@@ -21,6 +21,9 @@ static int adf_enable_msix(struct adf_accel_dev *accel_dev)
 	struct adf_hw_device_data *hw_data = accel_dev->hw_device;
 	u32 msix_num_entries = 1;
 
+	if (hw_data->set_msix_rttable)
+		hw_data->set_msix_rttable(accel_dev);
+
 	/* If SR-IOV is disabled, add entries for each bank */
 	if (!accel_dev->pf.vf_info) {
 		int i;
Signature · 1 line
2.28.0
#3 lore raw

PATCH 3/3 crypto: qat - add qat_4xxx driver

In reply to Giovanni Cabiddu

Add support for QAT 4xxx devices.

---
 drivers/crypto/qat/Kconfig                    |  11 +
 drivers/crypto/qat/Makefile                   |   1 +
 drivers/crypto/qat/qat_4xxx/Makefile          |   4 +
 .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.c    | 218 ++++++++++++
 .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.h    |  75 ++++
 drivers/crypto/qat/qat_4xxx/adf_drv.c         | 320 ++++++++++++++++++
 drivers/crypto/qat/qat_common/Makefile        |   1 +
 .../crypto/qat/qat_common/adf_accel_devices.h |   1 +
 .../crypto/qat/qat_common/adf_cfg_common.h    |   3 +-
 .../crypto/qat/qat_common/adf_gen4_hw_data.c  | 101 ++++++
 .../crypto/qat/qat_common/adf_gen4_hw_data.h  |  99 ++++++
 11 files changed, 833 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/qat/qat_4xxx/Makefile
 create mode 100644 drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c
 create mode 100644 drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.h
 create mode 100644 drivers/crypto/qat/qat_4xxx/adf_drv.c
 create mode 100644 drivers/crypto/qat/qat_common/adf_gen4_hw_data.c
 create mode 100644 drivers/crypto/qat/qat_common/adf_gen4_hw_data.h
drivers/crypto/qat/Kconfig +11 -0
index 2006322345de..beb379b23dc3 100644
@@ -46,6 +46,17 @@ config CRYPTO_DEV_QAT_C62X
 	  To compile this as a module, choose M here: the module
 	  will be called qat_c62x.
 
+config CRYPTO_DEV_QAT_4XXX
+	tristate "Support for Intel(R) QAT_4XXX"
+	depends on X86 && PCI
+	select CRYPTO_DEV_QAT
+	help
+	  Support for Intel(R) QuickAssist Technology QAT_4xxx
+	  for accelerating crypto and compression workloads.
+
+	  To compile this as a module, choose M here: the module
+	  will be called qat_4xxx.
+
 config CRYPTO_DEV_QAT_DH895xCCVF
 	tristate "Support for Intel(R) DH895xCC Virtual Function"
 	depends on X86 && PCI
drivers/crypto/qat/Makefile +1 -0
index 7dd15e751d02..258c8a626ce0 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_CRYPTO_DEV_QAT) += qat_common/
 obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCC) += qat_dh895xcc/
 obj-$(CONFIG_CRYPTO_DEV_QAT_C3XXX) += qat_c3xxx/
 obj-$(CONFIG_CRYPTO_DEV_QAT_C62X) += qat_c62x/
+obj-$(CONFIG_CRYPTO_DEV_QAT_4XXX) += qat_4xxx/
 obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCCVF) += qat_dh895xccvf/
 obj-$(CONFIG_CRYPTO_DEV_QAT_C3XXXVF) += qat_c3xxxvf/
 obj-$(CONFIG_CRYPTO_DEV_QAT_C62XVF) += qat_c62xvf/
drivers/crypto/qat/qat_4xxx/Makefile new file +4 -0
new file mode 100644
index 000000000000..ff9c8b5897ea
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+ccflags-y := -I $(srctree)/$(src)/../qat_common
+obj-$(CONFIG_CRYPTO_DEV_QAT_4XXX) += qat_4xxx.o
+qat_4xxx-objs := adf_drv.o adf_4xxx_hw_data.o
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c new file +218 -0

218 lines not on this page · raw message

drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.h new file +75 -0

75 lines not on this page · raw message

drivers/crypto/qat/qat_4xxx/adf_drv.c new file +320 -0

320 lines not on this page · raw message

drivers/crypto/qat/qat_common/Makefile +1 -0
index 25d28516dcdd..9c57abdf56b7 100644
@@ -11,6 +11,7 @@ intel_qat-objs := adf_cfg.o \
 	adf_admin.o \
 	adf_hw_arbiter.o \
 	adf_gen2_hw_data.o \
+	adf_gen4_hw_data.o \
 	qat_crypto.o \
 	qat_algs.o \
 	qat_asym_algs.o \
drivers/crypto/qat/qat_common/adf_accel_devices.h +1 -0
index 26164d71f1d6..c46a5805b294 100644
@@ -15,6 +15,7 @@
 #define ADF_C62XVF_DEVICE_NAME "c6xxvf"
 #define ADF_C3XXX_DEVICE_NAME "c3xxx"
 #define ADF_C3XXXVF_DEVICE_NAME "c3xxxvf"
+#define ADF_4XXX_DEVICE_NAME "4xxx"
 #define ADF_4XXX_PCI_DEVICE_ID 0x4940
 #define ADF_4XXXIOV_PCI_DEVICE_ID 0x4941
 #define ADF_ERRSOU3 (0x3A000 + 0x0C)
drivers/crypto/qat/qat_common/adf_cfg_common.h +2 -1
index 1ef46ccfba47..4fabb70b1f18 100644
@@ -32,7 +32,8 @@ enum adf_device_type {
 	DEV_C62X,
 	DEV_C62XVF,
 	DEV_C3XXX,
-	DEV_C3XXXVF
+	DEV_C3XXXVF,
+	DEV_4XXX,
 };
 
 struct adf_dev_status_info {
drivers/crypto/qat/qat_common/adf_gen4_hw_data.c new file +101 -0

101 lines not on this page · raw message

drivers/crypto/qat/qat_common/adf_gen4_hw_data.h new file +99 -0

99 lines not on this page · raw message

Signature · 1 line
2.28.0
maintainer
#4 lore raw
In reply to Giovanni Cabiddu
Quoted 26 lines · Giovanni Cabiddu

Add support for QAT 4xxx devices.

The first patch reworks the logic that loads the firmware images to allow for for devices that require multiple firmware images to work. The second patch introduces an hook to program the vector routing table, which is introduced in QAT 4XXX, to allow to change the vector associated with the interrupt source.
The third patch implements the QAT 4xxx driver.

Giovanni Cabiddu (3):
crypto: qat - target fw images to specific AEs
crypto: qat - add hook to initialize vector routing table
crypto: qat - add qat_4xxx driver

 drivers/crypto/qat/Kconfig                    |  11 +
 drivers/crypto/qat/Makefile                   |   1 +
 drivers/crypto/qat/qat_4xxx/Makefile          |   4 +
 .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.c    | 218 ++++++++++++
 .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.h    |  75 ++++
 drivers/crypto/qat/qat_4xxx/adf_drv.c         | 320 ++++++++++++++++++
 drivers/crypto/qat/qat_common/Makefile        |   1 +
 .../crypto/qat/qat_common/adf_accel_devices.h |   5 +
 .../crypto/qat/qat_common/adf_accel_engine.c  |  58 +++-
 .../crypto/qat/qat_common/adf_cfg_common.h    |   3 +-
 .../crypto/qat/qat_common/adf_gen4_hw_data.c  | 101 ++++++
 .../crypto/qat/qat_common/adf_gen4_hw_data.h  |  99 ++++++
Quoted 8 lines
 drivers/crypto/qat/qat_common/adf_isr.c       |   3 +
 13 files changed, 893 insertions(+), 6 deletions(-)
 create mode 100644 drivers/crypto/qat/qat_4xxx/Makefile
 create mode 100644 drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c
 create mode 100644 drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.h
 create mode 100644 drivers/crypto/qat/qat_4xxx/adf_drv.c
 create mode 100644 drivers/crypto/qat/qat_common/adf_gen4_hw_data.c
 create mode 100644 drivers/crypto/qat/qat_common/adf_gen4_hw_data.h

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