summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriel Aviad <ariel.aviad@intel.com>2024-09-24 11:02:49 +0300
committerKoby Elbaz <koby.elbaz@intel.com>2025-09-25 09:09:31 +0300
commit65a3f5bc331ca7384900641b46cadff63805c10e (patch)
tree3c8aaf9cc37174e9567c040dfe1d8dea8cba997f
parenteeb38d0e91860fb47bc42a2cc44ffd80989a04fc (diff)
accel/habanalabs: add HL_GET_P_STATE passthrough type
Add a new passthrough type HL_GET_P_STATE to the cpucp generic ioctl to allow userspace to read the device performance state via firmware. Signed-off-by: Ariel Aviad <ariel.aviad@intel.com> Reviewed-by: Koby Elbaz <koby.elbaz@intel.com> Signed-off-by: Koby Elbaz <koby.elbaz@intel.com>
-rw-r--r--drivers/accel/habanalabs/common/habanalabs_ioctl.c3
-rw-r--r--include/linux/habanalabs/cpucp_if.h2
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/accel/habanalabs/common/habanalabs_ioctl.c b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
index ed0dee5aa9be..fdfdabc85e54 100644
--- a/drivers/accel/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
@@ -964,6 +964,9 @@ static int send_fw_generic_request(struct hl_device *hdev, struct hl_info_args *
case HL_GET_ERR_COUNTERS_CMD:
need_input_buff = true;
break;
+ case HL_GET_P_STATE:
+ need_input_buff = false;
+ break;
default:
return -EINVAL;
}
diff --git a/include/linux/habanalabs/cpucp_if.h b/include/linux/habanalabs/cpucp_if.h
index 29c50e7427d1..45f181bcf890 100644
--- a/include/linux/habanalabs/cpucp_if.h
+++ b/include/linux/habanalabs/cpucp_if.h
@@ -1426,10 +1426,12 @@ struct cpucp_monitor_dump {
*
* HL_PASSTHROUGHT_VERSIONS - Fetch all firmware versions.
* HL_GET_ERR_COUNTERS_CMD - Command to get error counters
+ * HL_GET_P_STATE - get performance state
*/
enum hl_passthrough_type {
HL_PASSTHROUGH_VERSIONS,
HL_GET_ERR_COUNTERS_CMD,
+ HL_GET_P_STATE,
};
#endif /* CPUCP_IF_H */