summaryrefslogtreecommitdiff
path: root/drivers/accel/habanalabs/common/habanalabs_ioctl.c
diff options
context:
space:
mode:
authorHen Alon <halon@habana.ai>2023-08-09 17:29:41 +0300
committerOded Gabbay <ogabbay@kernel.org>2023-10-09 12:37:21 +0300
commit0648c4d0806fe167fe699299573100507ae99502 (patch)
tree0919aefec63dc5b16dfd13f02728295d66820342 /drivers/accel/habanalabs/common/habanalabs_ioctl.c
parente0f452802bdaaf45dcb24080053f2b3a9c7c464a (diff)
accel/habanalabs: add tsc clock sampling to clock sync info
Add tsc clock to clock sync info, to enable using this clock for sampling and sync it with device time. Signed-off-by: Hen Alon <halon@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/accel/habanalabs/common/habanalabs_ioctl.c')
-rw-r--r--drivers/accel/habanalabs/common/habanalabs_ioctl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/accel/habanalabs/common/habanalabs_ioctl.c b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
index 8c3f1e2de2fe..8ef36effb95b 100644
--- a/drivers/accel/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
@@ -17,6 +17,8 @@
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
+#include <asm/msr.h>
+
static u32 hl_debug_struct_size[HL_DEBUG_OP_TIMESTAMP + 1] = {
[HL_DEBUG_OP_ETR] = sizeof(struct hl_debug_params_etr),
[HL_DEBUG_OP_ETF] = sizeof(struct hl_debug_params_etf),
@@ -320,6 +322,7 @@ static int time_sync_info(struct hl_device *hdev, struct hl_info_args *args)
time_sync.device_time = hdev->asic_funcs->get_device_time(hdev);
time_sync.host_time = ktime_get_raw_ns();
+ time_sync.tsc_time = rdtsc();
return copy_to_user(out, &time_sync,
min((size_t) max_size, sizeof(time_sync))) ? -EFAULT : 0;