crypto: hisilicon - add device load query functionality to debugfs

The accelerator device supports usage statistics. This patch enables
obtaining the accelerator's usage through the "dev_usage" file.
The returned number expressed as a percentage as a percentage.

Signed-off-by: Zongyu Wu <wuzongyu1@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Zongyu Wu
2026-03-13 17:40:39 +08:00
committed by Herbert Xu
parent 3414c80977
commit b44c7129f1
8 changed files with 135 additions and 0 deletions

View File

@@ -133,6 +133,8 @@
#define SEC_AEAD_BITMAP (GENMASK_ULL(7, 6) | GENMASK_ULL(18, 17) | \
GENMASK_ULL(45, 43))
#define SEC_MAX_CHANNEL_NUM 1
struct sec_hw_error {
u32 int_msk;
const char *msg;
@@ -1288,6 +1290,14 @@ static int sec_pre_store_cap_reg(struct hisi_qm *qm)
return 0;
}
static void sec_set_channels(struct hisi_qm *qm)
{
struct qm_channel *channel_data = &qm->channel_data;
channel_data->channel_num = SEC_MAX_CHANNEL_NUM;
channel_data->channel_name[0] = "SEC";
}
static int sec_qm_init(struct hisi_qm *qm, struct pci_dev *pdev)
{
u64 alg_msk;
@@ -1325,6 +1335,7 @@ static int sec_qm_init(struct hisi_qm *qm, struct pci_dev *pdev)
return ret;
}
sec_set_channels(qm);
/* Fetch and save the value of capability registers */
ret = sec_pre_store_cap_reg(qm);
if (ret) {