[PATCH i-g-t 1/2] lib/xe/xe_spin: Add support to store/write ctx time stamps
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Tue Mar 19 11:21:44 UTC 2024
On Fri, Mar 15, 2024 at 10:34:37AM +0530, sai.gowtham.ch at intel.com wrote:
> From: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
>
> support to Store or write ctx time stamps when a spinner is
> triggers, which makes user to understand if spinner is still
> submitting workload to a context.
>
> Signed-off-by: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> ---
> lib/xe/xe_spin.c | 12 ++++++++++++
> lib/xe/xe_spin.h | 2 ++
> 2 files changed, 14 insertions(+)
>
> diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
> index 1ca54ea19..b73e72633 100644
> --- a/lib/xe/xe_spin.c
> +++ b/lib/xe/xe_spin.c
> @@ -72,6 +72,7 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
> uint64_t end_addr = opts->addr + offsetof(struct xe_spin, end);
> uint64_t ticks_delta_addr = opts->addr + offsetof(struct xe_spin, ticks_delta);
> uint64_t pad_addr = opts->addr + offsetof(struct xe_spin, pad);
> + uint64_t timestamp_addr = opts->addr + offsetof(struct xe_spin, time_stamp);
> int b = 0;
>
> spin->start = 0;
> @@ -98,6 +99,17 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
> if (opts->preempt)
> spin->batch[b++] = (0x5 << 23);
>
> + if (opts->write_timestamp) {
> + spin->batch[b++] = MI_LOAD_REGISTER_REG | MI_LRR_DST_CS_MMIO | MI_LRR_SRC_CS_MMIO;
> + spin->batch[b++] = CTX_TIMESTAMP;
> + spin->batch[b++] = CS_GPR(NOW_TS);
> +
> + spin->batch[b++] = MI_STORE_REGISTER_MEM | MI_SRM_CS_MMIO | 2;
> + spin->batch[b++] = CS_GPR(NOW_TS);
> + spin->batch[b++] = timestamp_addr;
> + spin->batch[b++] = timestamp_addr >> 32;
> + }
> +
> if (opts->ctx_ticks) {
> spin->batch[b++] = MI_LOAD_REGISTER_IMM(1) | MI_LRI_CS_MMIO;
> spin->batch[b++] = CS_GPR(NOW_TS) + 4;
> diff --git a/lib/xe/xe_spin.h b/lib/xe/xe_spin.h
> index 5c8c45143..5af2ded0b 100644
> --- a/lib/xe/xe_spin.h
> +++ b/lib/xe/xe_spin.h
> @@ -29,6 +29,7 @@ struct xe_spin_opts {
> uint64_t addr;
> bool preempt;
> uint32_t ctx_ticks;
> + bool write_timestamp;
> };
>
> /* Mapped GPU object */
> @@ -38,6 +39,7 @@ struct xe_spin {
> uint32_t start;
> uint32_t end;
> uint32_t ticks_delta;
> + uint32_t time_stamp;
Rename it to timestamp, then:
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
--
Zbigniew
> };
>
> igt_spin_t *xe_spin_create(int fd, const struct igt_spin_factory *opt);
> --
> 2.39.1
>
More information about the igt-dev
mailing list