summaryrefslogtreecommitdiffstats
path: root/include/uapi/misc
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@gmail.com>2019-08-28 17:32:04 +0300
committerOded Gabbay <oded.gabbay@gmail.com>2019-09-05 14:55:27 +0300
commit75b3cb2bb080372d043e8f0c0aeae8f52461136b (patch)
tree48d38cc87865d9f654c305ac8db16f41a33f21ee /include/uapi/misc
parent413cf576fd50297429e967b050d63067c997645c (diff)
downloadlinux-75b3cb2bb080372d043e8f0c0aeae8f52461136b.tar.bz2
habanalabs: add uapi to retrieve device utilization
Users and sysadmins usually want to know what is the device utilization as a level 0 indication if they are efficiently using the device. Add a new opcode to the INFO IOCTL that will return the device utilization over the last period of 100-1000ms. The return value is 0-100, representing as percentage the total utilization rate. Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com> Reviewed-by: Omer Shpigelman <oshpigelman@habana.ai>
Diffstat (limited to 'include/uapi/misc')
-rw-r--r--include/uapi/misc/habanalabs.h49
1 files changed, 34 insertions, 15 deletions
diff --git a/include/uapi/misc/habanalabs.h b/include/uapi/misc/habanalabs.h
index 266bf85056d4..73ee212d7fa6 100644
--- a/include/uapi/misc/habanalabs.h
+++ b/include/uapi/misc/habanalabs.h
@@ -77,22 +77,29 @@ enum hl_device_status {
/* Opcode for management ioctl
*
- * HW_IP_INFO - Receive information about different IP blocks in the
- * device.
- * HL_INFO_HW_EVENTS - Receive an array describing how many times each event
- * occurred since the last hard reset.
- * HL_INFO_DRAM_USAGE - Retrieve the dram usage inside the device and of the
- * specific context. This is relevant only for GOYA device.
- * HL_INFO_HW_IDLE - Retrieve information about the idle status of each
- * internal engine.
+ * HW_IP_INFO - Receive information about different IP blocks in the
+ * device.
+ * HL_INFO_HW_EVENTS - Receive an array describing how many times each event
+ * occurred since the last hard reset.
+ * HL_INFO_DRAM_USAGE - Retrieve the dram usage inside the device and of the
+ * specific context. This is relevant only for devices
+ * where the dram is managed by the kernel driver
+ * HL_INFO_HW_IDLE - Retrieve information about the idle status of each
+ * 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.
*/
-#define HL_INFO_HW_IP_INFO 0
-#define HL_INFO_HW_EVENTS 1
-#define HL_INFO_DRAM_USAGE 2
-#define HL_INFO_HW_IDLE 3
-#define HL_INFO_DEVICE_STATUS 4
+#define HL_INFO_HW_IP_INFO 0
+#define HL_INFO_HW_EVENTS 1
+#define HL_INFO_DRAM_USAGE 2
+#define HL_INFO_HW_IDLE 3
+#define HL_INFO_DEVICE_STATUS 4
+#define HL_INFO_DEVICE_UTILIZATION 6
#define HL_INFO_VERSION_MAX_LEN 128
@@ -134,6 +141,11 @@ struct hl_info_device_status {
__u32 pad;
};
+struct hl_info_device_utilization {
+ __u32 utilization;
+ __u32 pad;
+};
+
struct hl_info_args {
/* Location of relevant struct in userspace */
__u64 return_pointer;
@@ -149,8 +161,15 @@ struct hl_info_args {
/* HL_INFO_* */
__u32 op;
- /* Context ID - Currently not in use */
- __u32 ctx_id;
+ union {
+ /* Context ID - Currently not in use */
+ __u32 ctx_id;
+ /* Period value for utilization rate (100ms - 1000ms, in 100ms
+ * resolution.
+ */
+ __u32 period_ms;
+ };
+
__u32 pad;
};