Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: qat - config VFs based on ring-to-svc mapping

Change the configuration logic for the VF driver to leverage the
ring-to-service mappings now received via PFVF.

While the driver config logic is not yet capable of supporting
configurations other than the default mapping, make sure that both VF
and PF share the same default configuration in order to work properly.

Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Marco Chiappero and committed by
Herbert Xu
925b3069 e1b176af

+34 -13
-4
drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
··· 173 173 /* Completion for VF2PF request/response message exchange */ 174 174 init_completion(&accel_dev->vf.msg_received); 175 175 176 - ret = qat_crypto_dev_config(accel_dev); 177 - if (ret) 178 - goto out_err_free_reg; 179 - 180 176 ret = adf_dev_init(accel_dev); 181 177 if (ret) 182 178 goto out_err_dev_shutdown;
-4
drivers/crypto/qat/qat_c62xvf/adf_drv.c
··· 173 173 /* Completion for VF2PF request/response message exchange */ 174 174 init_completion(&accel_dev->vf.msg_received); 175 175 176 - ret = qat_crypto_dev_config(accel_dev); 177 - if (ret) 178 - goto out_err_free_reg; 179 - 180 176 ret = adf_dev_init(accel_dev); 181 177 if (ret) 182 178 goto out_err_dev_shutdown;
+1
drivers/crypto/qat/qat_common/adf_common_drv.h
··· 114 114 int qat_crypto_register(void); 115 115 int qat_crypto_unregister(void); 116 116 int qat_crypto_dev_config(struct adf_accel_dev *accel_dev); 117 + int qat_crypto_vf_dev_config(struct adf_accel_dev *accel_dev); 117 118 struct qat_crypto_instance *qat_crypto_get_instance_node(int node); 118 119 void qat_crypto_put_instance(struct qat_crypto_instance *inst); 119 120 void qat_alg_callback(void *resp);
+8 -1
drivers/crypto/qat/qat_common/adf_init.c
··· 69 69 return -EFAULT; 70 70 } 71 71 72 - if (!test_bit(ADF_STATUS_CONFIGURED, &accel_dev->status)) { 72 + if (!test_bit(ADF_STATUS_CONFIGURED, &accel_dev->status) && 73 + !accel_dev->is_vf) { 73 74 dev_err(&GET_DEV(accel_dev), "Device not configured\n"); 74 75 return -EFAULT; 75 76 } ··· 121 120 ret = hw_data->pfvf_ops.enable_comms(accel_dev); 122 121 if (ret) 123 122 return ret; 123 + 124 + if (!test_bit(ADF_STATUS_CONFIGURED, &accel_dev->status) && 125 + accel_dev->is_vf) { 126 + if (qat_crypto_vf_dev_config(accel_dev)) 127 + return -EFAULT; 128 + } 124 129 125 130 /* 126 131 * Subservice initialisation is divided into two stages: init and start.
+25
drivers/crypto/qat/qat_common/qat_crypto.c
··· 8 8 #include "adf_transport_access_macros.h" 9 9 #include "adf_cfg.h" 10 10 #include "adf_cfg_strings.h" 11 + #include "adf_gen2_hw_data.h" 11 12 #include "qat_crypto.h" 12 13 #include "icp_qat_fw.h" 13 14 ··· 103 102 atomic_inc(&inst->refctr); 104 103 } 105 104 return inst; 105 + } 106 + 107 + /** 108 + * qat_crypto_vf_dev_config() 109 + * create dev config required to create crypto inst. 110 + * 111 + * @accel_dev: Pointer to acceleration device. 112 + * 113 + * Function creates device configuration required to create 114 + * asym, sym or, crypto instances 115 + * 116 + * Return: 0 on success, error code otherwise. 117 + */ 118 + int qat_crypto_vf_dev_config(struct adf_accel_dev *accel_dev) 119 + { 120 + u16 ring_to_svc_map = GET_HW_DATA(accel_dev)->ring_to_svc_map; 121 + 122 + if (ring_to_svc_map != ADF_GEN2_DEFAULT_RING_TO_SRV_MAP) { 123 + dev_err(&GET_DEV(accel_dev), 124 + "Unsupported ring/service mapping present on PF"); 125 + return -EFAULT; 126 + } 127 + 128 + return qat_crypto_dev_config(accel_dev); 106 129 } 107 130 108 131 /**
-4
drivers/crypto/qat/qat_dh895xccvf/adf_drv.c
··· 173 173 /* Completion for VF2PF request/response message exchange */ 174 174 init_completion(&accel_dev->vf.msg_received); 175 175 176 - ret = qat_crypto_dev_config(accel_dev); 177 - if (ret) 178 - goto out_err_free_reg; 179 - 180 176 ret = adf_dev_init(accel_dev); 181 177 if (ret) 182 178 goto out_err_dev_shutdown;