Commit 0648c4d0 authored by Hen Alon's avatar Hen Alon Committed by Oded Gabbay

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: default avatarHen Alon <halon@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent e0f45280
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <asm/msr.h>
static u32 hl_debug_struct_size[HL_DEBUG_OP_TIMESTAMP + 1] = { static u32 hl_debug_struct_size[HL_DEBUG_OP_TIMESTAMP + 1] = {
[HL_DEBUG_OP_ETR] = sizeof(struct hl_debug_params_etr), [HL_DEBUG_OP_ETR] = sizeof(struct hl_debug_params_etr),
[HL_DEBUG_OP_ETF] = sizeof(struct hl_debug_params_etf), [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) ...@@ -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.device_time = hdev->asic_funcs->get_device_time(hdev);
time_sync.host_time = ktime_get_raw_ns(); time_sync.host_time = ktime_get_raw_ns();
time_sync.tsc_time = rdtsc();
return copy_to_user(out, &time_sync, return copy_to_user(out, &time_sync,
min((size_t) max_size, sizeof(time_sync))) ? -EFAULT : 0; min((size_t) max_size, sizeof(time_sync))) ? -EFAULT : 0;
......
...@@ -991,6 +991,7 @@ struct hl_info_reset_count { ...@@ -991,6 +991,7 @@ struct hl_info_reset_count {
struct hl_info_time_sync { struct hl_info_time_sync {
__u64 device_time; __u64 device_time;
__u64 host_time; __u64 host_time;
__u64 tsc_time;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment