1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/crypto/intel/qat/qat_common/adf_pm_dbgfs.c
Lucas Segarra Fernandez e079231676 crypto: qat - add pm_status debugfs file
QAT devices implement a mechanism that allows them to go autonomously
to a low power state depending on the load.

Expose power management info by providing the "pm_status" file under
debugfs. This includes PM state, PM event log, PM event counters, PM HW
CSRs, per-resource type constrain counters and per-domain power gating
status specific to the QAT device.

This information is retrieved from (1) the FW by means of
ICP_QAT_FW_PM_INFO command, (2) CSRs and (3) counters collected by the
device driver.

In addition, add logic to keep track and report power management event
interrupts and acks/nacks sent to FW to allow/prevent state transitions.

Signed-off-by: Lucas Segarra Fernandez <lucas.segarra.fernandez@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2023-10-13 18:31:07 +08:00

48 lines
1.1 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright(c) 2023 Intel Corporation */
#include <linux/debugfs.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include "adf_accel_devices.h"
#include "adf_pm_dbgfs.h"
static ssize_t pm_status_read(struct file *f, char __user *buf, size_t count,
loff_t *pos)
{
struct adf_accel_dev *accel_dev = file_inode(f)->i_private;
struct adf_pm pm = accel_dev->power_management;
if (pm.print_pm_status)
return pm.print_pm_status(accel_dev, buf, count, pos);
return count;
}
static const struct file_operations pm_status_fops = {
.owner = THIS_MODULE,
.read = pm_status_read,
};
void adf_pm_dbgfs_add(struct adf_accel_dev *accel_dev)
{
struct adf_pm *pm = &accel_dev->power_management;
if (!pm->present || !pm->print_pm_status)
return;
pm->debugfs_pm_status = debugfs_create_file("pm_status", 0400,
accel_dev->debugfs_dir,
accel_dev, &pm_status_fops);
}
void adf_pm_dbgfs_rm(struct adf_accel_dev *accel_dev)
{
struct adf_pm *pm = &accel_dev->power_management;
if (!pm->present)
return;
debugfs_remove(pm->debugfs_pm_status);
pm->debugfs_pm_status = NULL;
}