[PATCH 5/7] drm/xe: Add helper to capture engine timestamp

Lucas De Marchi lucas.demarchi at intel.com
Wed Apr 17 03:14:28 UTC 2024


On Tue, Apr 16, 2024 at 03:56:29PM GMT, Umesh Nerlige Ramappa wrote:
>On Mon, Apr 15, 2024 at 08:04:52PM -0700, Lucas De Marchi wrote:
>>Just like CTX_TIMESTAMP is used to calculate runtime, add a helper to
>>get the timestamp for the engine so it can be used to calculate the
>>"engine time" with the same unit as the runtime is recorded.
>>
>>Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
>
>Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
>
>>---
>>drivers/gpu/drm/xe/xe_hw_engine.c | 7 +++++++
>>drivers/gpu/drm/xe/xe_hw_engine.h | 2 ++
>> files changed, 9 insertions(+)
>>
>>diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
>>index ab227fa8984a..528b271c9f23 100644
>>--- a/drivers/gpu/drm/xe/xe_hw_engine.c
>>+++ b/drivers/gpu/drm/xe/xe_hw_engine.c
>>@@ -981,3 +981,10 @@ const char *xe_hw_engine_class_to_str(enum xe_engine_class class)
>>
>>	return NULL;
>>}
>>+
>>+u64 xe_hw_engine_read_timestamp(struct xe_hw_engine *hwe)
>>+{
>>+	struct xe_reg reg = RING_TIMESTAMP(hwe->mmio_base);
>>+
>>+	return xe_mmio_read64_2x32(hwe->gt, reg);

given the past issues with reading 64b registers, I'm wondering if we
shouldn't export a xe_hw_engine_read_timestamp32 and use just the lower
part. Since the CTX_TIMESTAMP will wrap around first, just using 32b
for RING_TIMESTAMP should be sufficient.

Lucas De Marchi


More information about the Intel-xe mailing list