crypto: qat - add fw_counters debugfs file
Subsystems (2)
Giovanni Cabiddu
maintainerPATCH RESEND 1/1 crypto: qat - add fw_counters debugfs file
From: Lucas Segarra Fernandez <[email protected]>
Expose FW counters statistics by providing the "fw_counters" file under debugfs. Currently the statistics include the number of requests sent to the FW and the number of responses received from the FW for each Acceleration Engine, for all the QAT product line.
This patch is based on earlier work done by Marco Chiappero.
Co-developed-by Adam Guerin <[email protected]>
Signed-off-by Adam Guerin <[email protected]>
Signed-off-by Lucas Segarra Fernandez <[email protected]>
Reviewed-by Giovanni Cabiddu <[email protected]>
Reviewed-by Andy Shevchenko <[email protected]>
--- Documentation/ABI/testing/debugfs-driver-qat | 10 + drivers/crypto/intel/qat/qat_common/Makefile | 1 + .../intel/qat/qat_common/adf_accel_devices.h | 1 + .../crypto/intel/qat/qat_common/adf_admin.c | 18 ++ .../intel/qat/qat_common/adf_common_drv.h | 1 + .../crypto/intel/qat/qat_common/adf_dbgfs.c | 7 + .../intel/qat/qat_common/adf_fw_counters.c | 264 ++++++++++++++++++ .../intel/qat/qat_common/adf_fw_counters.h | 11 + 8 files changed, 313 insertions(+) create mode 100644 Documentation/ABI/testing/debugfs-driver-qat create mode 100644 drivers/crypto/intel/qat/qat_common/adf_fw_counters.c create mode 100644 drivers/crypto/intel/qat/qat_common/adf_fw_counters.h
Documentation/ABI/testing/debugfs-driver-qat new file +10 -0
@@ -0,0 +1,10 @@ +What: /sys/kernel/debug/qat_<device>_<BDF>/qat/fw_counters +Date: June 2023 +KernelVersion: 6.5 +Contact: [email protected] +Description: (RO) Read returns the number of requests sent to the FW and the number of responses + received from the FW for each Acceleration Engine + Reported firmware counters:: + + <N>: Number of requests sent from Acceleration Engine N to FW and responses + Acceleration Engine N received from FW
drivers/crypto/intel/qat/qat_common/Makefile +1 -0
@@ -28,6 +28,7 @@ intel_qat-objs := adf_cfg.o \ qat_bl.o intel_qat-$(CONFIG_DEBUG_FS) += adf_transport_debug.o \ + adf_fw_counters.o \ adf_dbgfs.o intel_qat-$(CONFIG_PCI_IOV) += adf_sriov.o adf_vf_isr.o adf_pfvf_utils.o \
drivers/crypto/intel/qat/qat_common/adf_accel_devices.h +1 -0
@@ -292,6 +292,7 @@ struct adf_accel_dev {unsigned long status;atomic_t ref_count;struct dentry *debugfs_dir; +struct dentry *fw_cntr_dbgfile;struct list_head list;struct module *owner;struct adf_accel_pci accel_pci_dev;
drivers/crypto/intel/qat/qat_common/adf_admin.c +18 -0
@@ -223,6 +223,24 @@ static int adf_get_dc_capabilities(struct adf_accel_dev *accel_dev,return 0 ; } +int adf_get_ae_fw_counters (struct adf_accel_dev *accel_dev,u16 ae,u64 *reqs,u64 *resps) +{ +struct icp_qat_fw_init_admin_resp resp = { }; +struct icp_qat_fw_init_admin_req req = { }; +int ret; + + req.cmd_id =ICP_QAT_FW_COUNTERS_GET ; + + ret =adf_put_admin_msg_sync (accel_dev, ae, &req, &resp); +if (ret || resp.status) +return -EFAULT ; + + *reqs = resp.req_rec_count; + *resps = resp.resp_sent_count; + +return 0 ; +} +/** * adf_send_admin_init() - Function sends init message to FW * @accel_dev: Pointer to acceleration device.
drivers/crypto/intel/qat/qat_common/adf_common_drv.h +1 -0
@@ -94,6 +94,7 @@ void adf_exit_aer(void);int adf_init_admin_comms (struct adf_accel_dev *accel_dev);void adf_exit_admin_comms (struct adf_accel_dev *accel_dev);int adf_send_admin_init (struct adf_accel_dev *accel_dev); +int adf_get_ae_fw_counters (struct adf_accel_dev *accel_dev,u16 ae,u64 *reqs,u64 *resps);int adf_init_admin_pm (struct adf_accel_dev *accel_dev,u32 idle_delay);int adf_init_arb (struct adf_accel_dev *accel_dev);void adf_exit_arb (struct adf_accel_dev *accel_dev);
drivers/crypto/intel/qat/qat_common/adf_dbgfs.c +7 -0
@@ -6,6 +6,7 @@#include "adf_cfg.h" #include "adf_common_drv.h" #include "adf_dbgfs.h" +#include "adf_fw_counters.h" /** * adf_dbgfs_init() - add persistent debugfs entries
@@ -56,6 +57,9 @@ void adf_dbgfs_add(struct adf_accel_dev *accel_dev) {if (!accel_dev->debugfs_dir)return ; + +if (!accel_dev->is_vf) +adf_fw_counters_dbgfs_add (accel_dev); }/**
@@ -66,4 +70,7 @@ void adf_dbgfs_rm(struct adf_accel_dev *accel_dev) {if (!accel_dev->debugfs_dir)return ; + +if (!accel_dev->is_vf) +adf_fw_counters_dbgfs_rm (accel_dev); }
drivers/crypto/intel/qat/qat_common/adf_fw_counters.c new file +264 -0
264 lines not on this page · raw message
drivers/crypto/intel/qat/qat_common/adf_fw_counters.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright(c) 2023 Intel Corporation */ +#ifndef ADF_FW_COUNTERS_H +#define ADF_FW_COUNTERS_H + +struct adf_accel_dev ; + +void adf_fw_counters_dbgfs_add (struct adf_accel_dev *accel_dev); +void adf_fw_counters_dbgfs_rm (struct adf_accel_dev *accel_dev); + +#endif
Signature · 1 line
2.40.1