Skip to content

Commit 7f06679

Browse files
pilotAlpalherbertx
authored andcommitted
crypto: qat - add admin msgs for telemetry
Extend the admin interface with two new public APIs to enable and disable the telemetry feature: adf_send_admin_tl_start() and adf_send_admin_tl_stop(). The first, sends to the firmware, through the ICP_QAT_FW_TL_START message, the IO address where the firmware will write telemetry metrics and a list of ring pairs (maximum 4) to be monitored. It returns the number of accelerators of each type supported by this hardware. After this message is sent, the firmware starts periodically reporting telemetry data using by writing into the dma buffer specified as input. The second, sends the admin message ICP_QAT_FW_TL_STOP which stops the reporting of telemetry data. This patch is based on earlier work done by Wojciech Ziemba. Signed-off-by: Lucas Segarra Fernandez <lucas.segarra.fernandez@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Damian Muszynski <damian.muszynski@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent b6e4b6e commit 7f06679

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

drivers/crypto/intel/qat/qat_common/adf_admin.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,43 @@ int adf_get_cnv_stats(struct adf_accel_dev *accel_dev, u16 ae, u16 *err_cnt,
498498
return ret;
499499
}
500500

501+
int adf_send_admin_tl_start(struct adf_accel_dev *accel_dev,
502+
dma_addr_t tl_dma_addr, size_t layout_sz, u8 *rp_indexes,
503+
struct icp_qat_fw_init_admin_slice_cnt *slice_count)
504+
{
505+
u32 ae_mask = GET_HW_DATA(accel_dev)->admin_ae_mask;
506+
struct icp_qat_fw_init_admin_resp resp = { };
507+
struct icp_qat_fw_init_admin_req req = { };
508+
int ret;
509+
510+
req.cmd_id = ICP_QAT_FW_TL_START;
511+
req.init_cfg_ptr = tl_dma_addr;
512+
req.init_cfg_sz = layout_sz;
513+
514+
if (rp_indexes)
515+
memcpy(&req.rp_indexes, rp_indexes, sizeof(req.rp_indexes));
516+
517+
ret = adf_send_admin(accel_dev, &req, &resp, ae_mask);
518+
if (ret)
519+
return ret;
520+
521+
memcpy(slice_count, &resp.slices, sizeof(*slice_count));
522+
523+
return 0;
524+
}
525+
526+
int adf_send_admin_tl_stop(struct adf_accel_dev *accel_dev)
527+
{
528+
struct adf_hw_device_data *hw_data = GET_HW_DATA(accel_dev);
529+
struct icp_qat_fw_init_admin_resp resp = { };
530+
struct icp_qat_fw_init_admin_req req = { };
531+
u32 ae_mask = hw_data->admin_ae_mask;
532+
533+
req.cmd_id = ICP_QAT_FW_TL_STOP;
534+
535+
return adf_send_admin(accel_dev, &req, &resp, ae_mask);
536+
}
537+
501538
int adf_init_admin_comms(struct adf_accel_dev *accel_dev)
502539
{
503540
struct adf_admin_comms *admin;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@ int adf_send_admin_rl_delete(struct adf_accel_dev *accel_dev, u16 node_id,
2323
int adf_get_fw_timestamp(struct adf_accel_dev *accel_dev, u64 *timestamp);
2424
int adf_get_pm_info(struct adf_accel_dev *accel_dev, dma_addr_t p_state_addr, size_t buff_size);
2525
int adf_get_cnv_stats(struct adf_accel_dev *accel_dev, u16 ae, u16 *err_cnt, u16 *latest_err);
26+
int adf_send_admin_tl_start(struct adf_accel_dev *accel_dev,
27+
dma_addr_t tl_dma_addr, size_t layout_sz, u8 *rp_indexes,
28+
struct icp_qat_fw_init_admin_slice_cnt *slice_count);
29+
int adf_send_admin_tl_stop(struct adf_accel_dev *accel_dev);
2630

2731
#endif

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,22 @@ enum icp_qat_fw_init_admin_cmd_id {
2929
ICP_QAT_FW_RL_ADD = 134,
3030
ICP_QAT_FW_RL_UPDATE = 135,
3131
ICP_QAT_FW_RL_REMOVE = 136,
32+
ICP_QAT_FW_TL_START = 137,
33+
ICP_QAT_FW_TL_STOP = 138,
3234
};
3335

3436
enum icp_qat_fw_init_admin_resp_status {
3537
ICP_QAT_FW_INIT_RESP_STATUS_SUCCESS = 0,
3638
ICP_QAT_FW_INIT_RESP_STATUS_FAIL
3739
};
3840

41+
struct icp_qat_fw_init_admin_tl_rp_indexes {
42+
__u8 rp_num_index_0;
43+
__u8 rp_num_index_1;
44+
__u8 rp_num_index_2;
45+
__u8 rp_num_index_3;
46+
};
47+
3948
struct icp_qat_fw_init_admin_slice_cnt {
4049
__u8 cpr_cnt;
4150
__u8 xlt_cnt;
@@ -87,6 +96,7 @@ struct icp_qat_fw_init_admin_req {
8796
__u8 rp_count;
8897
};
8998
__u32 idle_filter;
99+
struct icp_qat_fw_init_admin_tl_rp_indexes rp_indexes;
90100
};
91101

92102
__u32 resrvd4;

0 commit comments

Comments
 (0)