Skip to content

Commit c868e84

Browse files
committed
crypto: qat - expose deflate through acomp api for QAT GEN2
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author Giovanni Cabiddu <giovanni.cabiddu@intel.com> commit 1198ae5 Add infrastructure for implementing the acomp APIs in the QAT driver and expose the deflate algorithm for QAT GEN2 devices. This adds (1) the compression service which includes logic to create, allocate and handle compression instances; (2) logic to create configuration entries at probe time for the compression instances; (3) updates to the firmware API for allowing the compression service; and; (4) a back-end for deflate that implements the acomp api for QAT GEN2 devices. The implementation configures the device to produce data compressed statically, optimized for throughput over compression ratio. Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com> Reviewed-by: Adam Guerin <adam.guerin@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 1198ae5) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 2266421 commit c868e84

24 files changed

+1447
-12
lines changed

drivers/crypto/qat/qat_4xxx/adf_drv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ int adf_crypto_dev_config(struct adf_accel_dev *accel_dev)
155155
if (ret)
156156
goto err;
157157

158+
val = 0;
159+
ret = adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC, ADF_NUM_DC,
160+
&val, ADF_DEC);
161+
if (ret)
162+
goto err;
163+
158164
set_bit(ADF_STATUS_CONFIGURED, &accel_dev->status);
159165
return 0;
160166
err:

drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <adf_accel_devices.h>
44
#include <adf_common_drv.h>
55
#include <adf_gen2_config.h>
6+
#include <adf_gen2_dc.h>
67
#include <adf_gen2_hw_data.h>
78
#include <adf_gen2_pfvf.h>
89
#include "adf_c3xxx_hw_data.h"
@@ -129,6 +130,7 @@ void adf_init_hw_data_c3xxx(struct adf_hw_device_data *hw_data)
129130

130131
adf_gen2_init_pf_pfvf_ops(&hw_data->pfvf_ops);
131132
adf_gen2_init_hw_csr_ops(&hw_data->csr_ops);
133+
adf_gen2_init_dc_ops(&hw_data->dc_ops);
132134
}
133135

134136
void adf_clean_hw_data_c3xxx(struct adf_hw_device_data *hw_data)

drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <adf_accel_devices.h>
44
#include <adf_common_drv.h>
55
#include <adf_gen2_config.h>
6+
#include <adf_gen2_dc.h>
67
#include <adf_gen2_hw_data.h>
78
#include <adf_gen2_pfvf.h>
89
#include <adf_pfvf_vf_msg.h>
@@ -91,6 +92,7 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data)
9192
adf_devmgr_update_class_index(hw_data);
9293
adf_gen2_init_vf_pfvf_ops(&hw_data->pfvf_ops);
9394
adf_gen2_init_hw_csr_ops(&hw_data->csr_ops);
95+
adf_gen2_init_dc_ops(&hw_data->dc_ops);
9496
}
9597

9698
void adf_clean_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data)

drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <adf_accel_devices.h>
44
#include <adf_common_drv.h>
55
#include <adf_gen2_config.h>
6+
#include <adf_gen2_dc.h>
67
#include <adf_gen2_hw_data.h>
78
#include <adf_gen2_pfvf.h>
89
#include "adf_c62x_hw_data.h"
@@ -131,6 +132,7 @@ void adf_init_hw_data_c62x(struct adf_hw_device_data *hw_data)
131132

132133
adf_gen2_init_pf_pfvf_ops(&hw_data->pfvf_ops);
133134
adf_gen2_init_hw_csr_ops(&hw_data->csr_ops);
135+
adf_gen2_init_dc_ops(&hw_data->dc_ops);
134136
}
135137

136138
void adf_clean_hw_data_c62x(struct adf_hw_device_data *hw_data)

drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <adf_accel_devices.h>
44
#include <adf_common_drv.h>
55
#include <adf_gen2_config.h>
6+
#include <adf_gen2_dc.h>
67
#include <adf_gen2_hw_data.h>
78
#include <adf_gen2_pfvf.h>
89
#include <adf_pfvf_vf_msg.h>
@@ -91,6 +92,7 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data)
9192
adf_devmgr_update_class_index(hw_data);
9293
adf_gen2_init_vf_pfvf_ops(&hw_data->pfvf_ops);
9394
adf_gen2_init_hw_csr_ops(&hw_data->csr_ops);
95+
adf_gen2_init_dc_ops(&hw_data->dc_ops);
9496
}
9597

9698
void adf_clean_hw_data_c62xiov(struct adf_hw_device_data *hw_data)

drivers/crypto/qat/qat_common/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ intel_qat-objs := adf_cfg.o \
1515
adf_gen2_config.o \
1616
adf_gen4_hw_data.o \
1717
adf_gen4_pm.o \
18+
adf_gen2_dc.o \
1819
qat_crypto.o \
20+
qat_compression.o \
21+
qat_comp_algs.o \
1922
qat_algs.o \
2023
qat_asym_algs.o \
2124
qat_algs_send.o \

drivers/crypto/qat/qat_common/adf_accel_devices.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ struct adf_pfvf_ops {
163163
u32 pfvf_offset, u8 compat_ver);
164164
};
165165

166+
struct adf_dc_ops {
167+
void (*build_deflate_ctx)(void *ctx);
168+
};
169+
166170
struct adf_hw_device_data {
167171
struct adf_hw_device_class *dev_class;
168172
u32 (*get_accel_mask)(struct adf_hw_device_data *self);
@@ -202,6 +206,7 @@ struct adf_hw_device_data {
202206
int (*dev_config)(struct adf_accel_dev *accel_dev);
203207
struct adf_pfvf_ops pfvf_ops;
204208
struct adf_hw_csr_ops csr_ops;
209+
struct adf_dc_ops dc_ops;
205210
const char *fw_name;
206211
const char *fw_mmp_name;
207212
u32 fuses;
@@ -247,6 +252,7 @@ struct adf_hw_device_data {
247252
#define GET_MAX_ACCELENGINES(accel_dev) (GET_HW_DATA(accel_dev)->num_engines)
248253
#define GET_CSR_OPS(accel_dev) (&(accel_dev)->hw_device->csr_ops)
249254
#define GET_PFVF_OPS(accel_dev) (&(accel_dev)->hw_device->pfvf_ops)
255+
#define GET_DC_OPS(accel_dev) (&(accel_dev)->hw_device->dc_ops)
250256
#define accel_to_pci_dev(accel_ptr) accel_ptr->accel_pci_dev.pci_dev
251257

252258
struct adf_admin_comms;
@@ -266,13 +272,21 @@ struct adf_accel_vf_info {
266272
u8 vf_compat_ver;
267273
};
268274

275+
struct adf_dc_data {
276+
u8 *ovf_buff;
277+
size_t ovf_buff_sz;
278+
dma_addr_t ovf_buff_p;
279+
};
280+
269281
struct adf_accel_dev {
270282
struct adf_etr_data *transport;
271283
struct adf_hw_device_data *hw_device;
272284
struct adf_cfg_device_data *cfg;
273285
struct adf_fw_loader_data *fw_loader;
274286
struct adf_admin_comms *admin;
287+
struct adf_dc_data *dc_data;
275288
struct list_head crypto_list;
289+
struct list_head compression_list;
276290
unsigned long status;
277291
atomic_t ref_count;
278292
struct dentry *debugfs_dir;

drivers/crypto/qat/qat_common/adf_cfg_strings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define ADF_ETRMGR_BANK "Bank"
2121
#define ADF_RING_SYM_BANK_NUM "BankSymNumber"
2222
#define ADF_RING_ASYM_BANK_NUM "BankAsymNumber"
23+
#define ADF_RING_DC_BANK_NUM "BankDcNumber"
2324
#define ADF_CY "Cy"
2425
#define ADF_DC "Dc"
2526
#define ADF_CFG_DC "dc"

drivers/crypto/qat/qat_common/adf_common_drv.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ void qat_algs_unregister(void);
120120
int qat_asym_algs_register(void);
121121
void qat_asym_algs_unregister(void);
122122

123+
struct qat_compression_instance *qat_compression_get_instance_node(int node);
124+
void qat_compression_put_instance(struct qat_compression_instance *inst);
125+
int qat_compression_register(void);
126+
int qat_compression_unregister(void);
127+
int qat_comp_algs_register(void);
128+
void qat_comp_algs_unregister(void);
129+
void qat_comp_alg_callback(void *resp);
130+
123131
int adf_isr_resource_alloc(struct adf_accel_dev *accel_dev);
124132
void adf_isr_resource_free(struct adf_accel_dev *accel_dev);
125133
int adf_vf_isr_resource_alloc(struct adf_accel_dev *accel_dev);

drivers/crypto/qat/qat_common/adf_ctl_drv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,13 @@ static int __init adf_register_ctl_device_driver(void)
438438
if (qat_crypto_register())
439439
goto err_crypto_register;
440440

441+
if (qat_compression_register())
442+
goto err_compression_register;
443+
441444
return 0;
442445

446+
err_compression_register:
447+
qat_crypto_unregister();
443448
err_crypto_register:
444449
adf_exit_vf_wq();
445450
err_vf_wq:
@@ -463,6 +468,7 @@ static void __exit adf_unregister_ctl_device_driver(void)
463468
adf_exit_vf_wq();
464469
adf_exit_pf_wq();
465470
qat_crypto_unregister();
471+
qat_compression_unregister();
466472
adf_clean_vf_map(false);
467473
mutex_destroy(&adf_ctl_lock);
468474
}

0 commit comments

Comments
 (0)