crypto: qat - fix and make common ring to service map in QAT GEN4
Subsystems (2)
cover crypto: qat - fix and make common ring to service map in QAT GEN4
This set is revamping the method that generates the ring-to-service maps in QAT. The initial two patches rectify the existing algorithm version for use cases when the dcc service was enabled. The final patch eliminates the function's duplication in device-specific code and relocates it to a shared file.
Damian Muszynski (3):
crypto: qat - fix ring to service map for dcc in 4xxx
crypto: qat - fix ring to service map for dcc in 420xx
crypto: qat - make ring to service map common for QAT GEN4
.../intel/qat/qat_420xx/adf_420xx_hw_data.c | 64 +++++-------------- .../intel/qat/qat_4xxx/adf_4xxx_hw_data.c | 64 +++++-------------- .../intel/qat/qat_common/adf_accel_devices.h | 1 + .../intel/qat/qat_common/adf_gen4_hw_data.c | 56 ++++++++++++++++ .../intel/qat/qat_common/adf_gen4_hw_data.h | 1 + 5 files changed, 90 insertions(+), 96 deletions(-)
base-commit: 48f0668106f3664f4101c9f24fdb3b8c13f5880d
Signature · 1 line
2.43.0
PATCH 1/3 crypto: qat - fix ring to service map for dcc in 4xxx
If a device is configured for data compression chaining (dcc), half of the engines are loaded with the symmetric crypto image and the rest are loaded with the compression image.
However, in such configuration all rings can handle compression requests.
Fix the ring to service mapping so that when a device is configured for dcc, the ring to service mapping reports that all rings in a bank can be used for compression.
--- drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c +8 -0
@@ -331,6 +331,13 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev)if (!fw_config)return 0 ; +/* If dcc, all rings handle compression requests */ +if (adf_get_service_enabled (accel_dev) ==SVC_DCC ) { +for (i =0 ; i <RP_GROUP_COUNT ; i++) + rps[i] =COMP ; + goto set_mask; + } +for (i =0 ; i <RP_GROUP_COUNT ; i++) {switch (fw_config[i].ae_mask) {case ADF_AE_GROUP_0 :
@@ -359,6 +366,7 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev) } } +set_mask: ring_to_svc_map = rps[RP_GROUP_0 ] <<ADF_CFG_SERV_RING_PAIR_0_SHIFT | rps[RP_GROUP_1 ] <<ADF_CFG_SERV_RING_PAIR_1_SHIFT | rps[RP_GROUP_0] << ADF_CFG_SERV_RING_PAIR_2_SHIFT |
Signature · 1 line
2.43.0
PATCH 2/3 crypto: qat - fix ring to service map for dcc in 420xx
In reply to Damian MuszynskiIf a device is configured for data compression chaining (dcc), half of the engines are loaded with the symmetric crypto image and the rest are loaded with the compression image.
However, in such configuration all rings can handle compression requests.
Fix the ring to service mapping so that when a device is configured for dcc, the ring to service mapping reports that all rings in a bank can be used for compression.
--- drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c +8 -0
@@ -372,6 +372,13 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev)if (!fw_config)return 0 ; +/* If dcc, all rings handle compression requests */ +if (adf_get_service_enabled (accel_dev) ==SVC_DCC ) { +for (i =0 ; i <RP_GROUP_COUNT ; i++) + rps[i] =COMP ; + goto set_mask; + } +for (i =0 ; i <RP_GROUP_COUNT ; i++) {switch (fw_config[i].ae_mask) {case ADF_AE_GROUP_0 :
@@ -400,6 +407,7 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev) } } +set_mask: ring_to_svc_map = rps[RP_GROUP_0 ] <<ADF_CFG_SERV_RING_PAIR_0_SHIFT | rps[RP_GROUP_1 ] <<ADF_CFG_SERV_RING_PAIR_1_SHIFT | rps[RP_GROUP_0] << ADF_CFG_SERV_RING_PAIR_2_SHIFT |
Signature · 1 line
2.43.0
PATCH 3/3 crypto: qat - make ring to service map common for QAT GEN4
In reply to Damian MuszynskiThe function get_ring_to_svc_map() is present in both 420xx and 4xxx drivers. Rework the logic to make it generic to GEN4 devices and move it to qat_common/adf_gen4_hw_data.c.
--- .../intel/qat/qat_420xx/adf_420xx_hw_data.c | 72 +++++-------------- .../intel/qat/qat_4xxx/adf_4xxx_hw_data.c | 72 +++++-------------- .../intel/qat/qat_common/adf_accel_devices.h | 1 + .../intel/qat/qat_common/adf_gen4_hw_data.c | 56 +++++++++++++++ .../intel/qat/qat_common/adf_gen4_hw_data.h | 1 + 5 files changed, 90 insertions(+), 112 deletions(-)
drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c +16 -56
@@ -361,61 +361,6 @@ static u32 get_ena_thd_mask(struct adf_accel_dev *accel_dev, u32 obj_num) } } -static u16 get_ring_to_svc_map (struct adf_accel_dev *accel_dev) -{ -enum adf_cfg_service_type rps[RP_GROUP_COUNT ] = { }; -const struct adf_fw_config *fw_config; -u16 ring_to_svc_map; -int i, j; - - fw_config =get_fw_config (accel_dev); -if (!fw_config) -return 0 ; - -/* If dcc, all rings handle compression requests */ -if (adf_get_service_enabled (accel_dev) ==SVC_DCC ) { -for (i =0 ; i <RP_GROUP_COUNT ; i++) - rps[i] =COMP ; - goto set_mask; - } - -for (i =0 ; i <RP_GROUP_COUNT ; i++) { -switch (fw_config[i].ae_mask) { -case ADF_AE_GROUP_0 : - j =RP_GROUP_0 ; -break ; -case ADF_AE_GROUP_1 : - j =RP_GROUP_1 ; -break ; -default : -return 0 ; - } - -switch (fw_config[i].obj) { -case ADF_FW_SYM_OBJ : - rps[j] =SYM ; -break ; -case ADF_FW_ASYM_OBJ : - rps[j] =ASYM ; -break ; -case ADF_FW_DC_OBJ : - rps[j] =COMP ; -break ; -default : - rps[j] =0 ; -break ; - } - } - -set_mask: - ring_to_svc_map = rps[RP_GROUP_0 ] <<ADF_CFG_SERV_RING_PAIR_0_SHIFT | - rps[RP_GROUP_1 ] <<ADF_CFG_SERV_RING_PAIR_1_SHIFT | - rps[RP_GROUP_0 ] <<ADF_CFG_SERV_RING_PAIR_2_SHIFT | - rps[RP_GROUP_1 ] <<ADF_CFG_SERV_RING_PAIR_3_SHIFT ; - -return ring_to_svc_map; -} -static const char *uof_get_name (struct adf_accel_dev *accel_dev,u32 obj_num,const char *const fw_objs[],int num_objs) {
@@ -441,6 +386,20 @@ static const char *uof_get_name_420xx(struct adf_accel_dev *accel_dev, u32 obj_nreturn uof_get_name (accel_dev, obj_num, adf_420xx_fw_objs, num_fw_objs); } +static int uof_get_obj_type (struct adf_accel_dev *accel_dev,u32 obj_num) +{ +const struct adf_fw_config *fw_config; + +if (obj_num >=uof_get_num_objs (accel_dev)) +return -EINVAL ; + + fw_config =get_fw_config (accel_dev); +if (!fw_config) +return -EINVAL ; + +return fw_config[obj_num].obj; +} +static u32 uof_get_ae_mask (struct adf_accel_dev *accel_dev,u32 obj_num) {const struct adf_fw_config *fw_config;
@@ -504,12 +463,13 @@ void adf_init_hw_data_420xx(struct adf_hw_device_data *hw_data, u32 dev_id) hw_data->fw_mmp_name =ADF_420XX_MMP ; hw_data->uof_get_name = uof_get_name_420xx; hw_data->uof_get_num_objs = uof_get_num_objs; + hw_data->uof_get_obj_type = uof_get_obj_type; hw_data->uof_get_ae_mask = uof_get_ae_mask; hw_data->get_rp_group = get_rp_group; hw_data->get_ena_thd_mask = get_ena_thd_mask; hw_data->set_msix_rttable = adf_gen4_set_msix_default_rttable; hw_data->set_ssm_wdtimer = adf_gen4_set_ssm_wdtimer; - hw_data->get_ring_to_svc_map = get_ring_to_svc_map; + hw_data->get_ring_to_svc_map = adf_gen4_get_ring_to_svc_map; hw_data->disable_iov = adf_disable_sriov; hw_data->ring_pair_reset = adf_gen4_ring_pair_reset; hw_data->enable_pm = adf_gen4_enable_pm;
drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c +16 -56
94 lines not on this page · raw message
drivers/crypto/intel/qat/qat_common/adf_accel_devices.h +1 -0
@@ -248,6 +248,7 @@ struct adf_hw_device_data {void (*set_msix_rttable)(struct adf_accel_dev *accel_dev);const char *(*uof_get_name)(struct adf_accel_dev *accel_dev,u32 obj_num);u32 (*uof_get_num_objs)(struct adf_accel_dev *accel_dev); +int (*uof_get_obj_type)(struct adf_accel_dev *accel_dev,u32 obj_num);u32 (*uof_get_ae_mask)(struct adf_accel_dev *accel_dev,u32 obj_num);int (*get_rp_group)(struct adf_accel_dev *accel_dev,u32 ae_mask);u32 (*get_ena_thd_mask)(struct adf_accel_dev *accel_dev,u32 obj_num);
drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c +56 -0
65 lines not on this page · raw message
drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.h +1 -0
@@ -235,5 +235,6 @@ int adf_gen4_ring_pair_reset(struct adf_accel_dev *accel_dev, u32 bank_number);void adf_gen4_set_msix_default_rttable (struct adf_accel_dev *accel_dev);void adf_gen4_set_ssm_wdtimer (struct adf_accel_dev *accel_dev);int adf_gen4_init_thd2arb_map (struct adf_accel_dev *accel_dev); +u16 adf_gen4_get_ring_to_svc_map (struct adf_accel_dev *accel_dev);#endif
Signature · 1 line
2.43.0
Herbert Xu
maintainerQuoted 19 lines · Damian Muszynski
This set is revamping the method that generates the ring-to-service maps in QAT. The initial two patches rectify the existing algorithm version for use cases when the dcc service was enabled. The final patch eliminates the function's duplication in device-specific code and relocates it to a shared file.
Damian Muszynski (3):
crypto: qat - fix ring to service map for dcc in 4xxx
crypto: qat - fix ring to service map for dcc in 420xx
crypto: qat - make ring to service map common for QAT GEN4.../intel/qat/qat_420xx/adf_420xx_hw_data.c | 64 +++++-------------- .../intel/qat/qat_4xxx/adf_4xxx_hw_data.c | 64 +++++-------------- .../intel/qat/qat_common/adf_accel_devices.h | 1 + .../intel/qat/qat_common/adf_gen4_hw_data.c | 56 ++++++++++++++++ .../intel/qat/qat_common/adf_gen4_hw_data.h | 1 + 5 files changed, 90 insertions(+), 96 deletions(-)
Quoted 3 lines
base-commit:
48f0668106f3664f4101c9f24fdb3b8c13f5880dSignature · 1 line
2.43.0
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