FILE
adf_telemetry.h
File preview with syntax highlighting.
linux-6.19.14/drivers/crypto/intel/qat/qat_common/adf_telemetry.h
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* Copyright (c) 2023 Intel Corporation. */ 3#ifndef ADF_TELEMETRY_H 4#define ADF_TELEMETRY_H 5 6#include <linux/bits.h> 7#include <linux/mutex.h> 8#include <linux/types.h> 9#include <linux/workqueue.h> 10 11#include "icp_qat_fw_init_admin.h" 12 13struct adf_accel_dev; 14struct adf_tl_dbg_counter; 15struct dentry; 16 17#define ADF_TL_SL_CNT_COUNT \ 18 (sizeof(struct icp_qat_fw_init_admin_slice_cnt) / sizeof(__u8)) 19 20#define TL_CAPABILITY_BIT BIT(1) 21/* Interval within device writes data to DMA region. Value in milliseconds. */ 22#define ADF_TL_DATA_WR_INTERVAL_MS 1000 23/* Interval within timer interrupt should be handled. Value in milliseconds. */ 24#define ADF_TL_TIMER_INT_MS (ADF_TL_DATA_WR_INTERVAL_MS / 2) 25 26#define ADF_TL_RP_REGS_DISABLED (0xff) 27 28struct adf_tl_hw_data { 29 size_t layout_sz; 30 size_t slice_reg_sz; 31 size_t cmdq_reg_sz; 32 size_t rp_reg_sz; 33 size_t msg_cnt_off; 34 const struct adf_tl_dbg_counter *dev_counters; 35 const struct adf_tl_dbg_counter *sl_util_counters; 36 const struct adf_tl_dbg_counter *sl_exec_counters; 37 const struct adf_tl_dbg_counter **cmdq_counters; 38 const struct adf_tl_dbg_counter *rp_counters; 39 u8 num_hbuff; 40 u8 cpp_ns_per_cycle; 41 u8 bw_units_to_bytes; 42 u8 num_dev_counters; 43 u8 num_rp_counters; 44 u8 num_cmdq_counters; 45 u8 max_rp; 46 u8 max_sl_cnt; 47 struct icp_qat_fw_init_admin_slice_cnt multiplier; 48}; 49 50struct adf_telemetry { 51 struct adf_accel_dev *accel_dev; 52 atomic_t state; 53 u32 hbuffs; 54 int hb_num; 55 u32 msg_cnt; 56 dma_addr_t regs_data_p; /* bus address for DMA mapping */ 57 void *regs_data; /* virtual address for DMA mapping */ 58 /** 59 * @regs_hist_buff: array of pointers to copies of the last @hbuffs 60 * values of @regs_data 61 */ 62 void **regs_hist_buff; 63 struct dentry *dbg_dir; 64 u8 *rp_num_indexes; 65 /** 66 * @regs_hist_lock: protects from race conditions between write and read 67 * to the copies referenced by @regs_hist_buff 68 */ 69 struct mutex regs_hist_lock; 70 /** 71 * @wr_lock: protects from concurrent writes to debugfs telemetry files 72 */ 73 struct mutex wr_lock; 74 struct delayed_work work_ctx; 75 struct icp_qat_fw_init_admin_slice_cnt slice_cnt; 76 struct icp_qat_fw_init_admin_slice_cnt cmdq_cnt; 77}; 78 79#ifdef CONFIG_DEBUG_FS 80int adf_tl_init(struct adf_accel_dev *accel_dev); 81int adf_tl_start(struct adf_accel_dev *accel_dev); 82void adf_tl_stop(struct adf_accel_dev *accel_dev); 83void adf_tl_shutdown(struct adf_accel_dev *accel_dev); 84int adf_tl_run(struct adf_accel_dev *accel_dev, int state); 85int adf_tl_halt(struct adf_accel_dev *accel_dev); 86#else 87static inline int adf_tl_init(struct adf_accel_dev *accel_dev) 88{ 89 return 0; 90} 91 92static inline int adf_tl_start(struct adf_accel_dev *accel_dev) 93{ 94 return 0; 95} 96 97static inline void adf_tl_stop(struct adf_accel_dev *accel_dev) 98{ 99} 100 101static inline void adf_tl_shutdown(struct adf_accel_dev *accel_dev) 102{ 103} 104#endif /* CONFIG_DEBUG_FS */ 105#endif /* ADF_TELEMETRY_H */
~/
Read-only file preview.