summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@gmail.com>2019-10-10 14:48:59 +0200
committerOded Gabbay <oded.gabbay@gmail.com>2019-11-21 10:35:45 +0100
commit62c1e124a9e03ccb8bb39efe1d092c2376967528 (patch)
treec6fc20d051587eb6f10a3698467bcb58548d39ac /include
parenthabanalabs: set TPC Icache to 16 cache lines (diff)
downloadlinux-62c1e124a9e03ccb8bb39efe1d092c2376967528.tar.xz
linux-62c1e124a9e03ccb8bb39efe1d092c2376967528.zip
habanalabs: add opcode to INFO IOCTL to return clock rate
Add a new opcode to the INFO IOCTL to allow the user application to retrieve the ASIC's current and maximum clock rate. The rate is returned in MHz. Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com> Reviewed-by: Tomer Tayar <ttayar@habana.ai>
Diffstat (limited to 'include')
-rw-r--r--include/uapi/misc/habanalabs.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/uapi/misc/habanalabs.h b/include/uapi/misc/habanalabs.h
index 53e4ff73578e..783793c8be1c 100644
--- a/include/uapi/misc/habanalabs.h
+++ b/include/uapi/misc/habanalabs.h
@@ -88,13 +88,16 @@ enum hl_device_status {
* internal engine.
* HL_INFO_DEVICE_STATUS - Retrieve the device's status. This opcode doesn't
* require an open context.
- * HL_INFO_DEVICE_UTILIZATION - Retrieve the total utilization of the device
- * over the last period specified by the user.
- * The period can be between 100ms to 1s, in
- * resolution of 100ms. The return value is a
- * percentage of the utilization rate.
+ * HL_INFO_DEVICE_UTILIZATION - Retrieve the total utilization of the device
+ * over the last period specified by the user.
+ * The period can be between 100ms to 1s, in
+ * resolution of 100ms. The return value is a
+ * percentage of the utilization rate.
* HL_INFO_HW_EVENTS_AGGREGATE - Receive an array describing how many times each
* event occurred since the driver was loaded.
+ * HL_INFO_CLK_RATE - Retrieve the current and maximum clock rate
+ * of the device in MHz. The maximum clock rate is
+ * configurable via sysfs parameter
*/
#define HL_INFO_HW_IP_INFO 0
#define HL_INFO_HW_EVENTS 1
@@ -103,6 +106,7 @@ enum hl_device_status {
#define HL_INFO_DEVICE_STATUS 4
#define HL_INFO_DEVICE_UTILIZATION 6
#define HL_INFO_HW_EVENTS_AGGREGATE 7
+#define HL_INFO_CLK_RATE 8
#define HL_INFO_VERSION_MAX_LEN 128
@@ -149,6 +153,11 @@ struct hl_info_device_utilization {
__u32 pad;
};
+struct hl_info_clk_rate {
+ __u32 cur_clk_rate_mhz;
+ __u32 max_clk_rate_mhz;
+};
+
struct hl_info_args {
/* Location of relevant struct in userspace */
__u64 return_pointer;