[PATCH 1/2] xe: Allow a GGTT mapped batch to be submitted to user exec queue
Matthew Brost
matthew.brost at intel.com
Wed Dec 4 21:03:13 UTC 2024
On Tue, Nov 26, 2024 at 04:31:26PM -0800, Umesh Nerlige Ramappa wrote:
> For a OA use case, one of the HW registers needs to be modified by
> submitting an MI_LOAD_REGISTER_IMM command to the users exec queue, so
> that the register is modified in the user's hardware context. In order
> to do this a batch that is mapped in GGTT, needs to be submitted to the
> user exec queue. Since all user submissions use q->vm and hence PPGTT,
> add some plumbing to enable submission of batches mapped in GGTT.
>
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
> ---
> drivers/gpu/drm/xe/xe_ring_ops.c | 5 ++++-
> drivers/gpu/drm/xe/xe_sched_job.c | 1 +
> drivers/gpu/drm/xe/xe_sched_job_types.h | 2 ++
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_ring_ops.c b/drivers/gpu/drm/xe/xe_ring_ops.c
> index 0be4f489d3e1..9f327f27c072 100644
> --- a/drivers/gpu/drm/xe/xe_ring_ops.c
> +++ b/drivers/gpu/drm/xe/xe_ring_ops.c
> @@ -221,7 +221,10 @@ static int emit_pipe_imm_ggtt(u32 addr, u32 value, bool stall_only, u32 *dw,
>
> static u32 get_ppgtt_flag(struct xe_sched_job *job)
> {
> - return job->q->vm ? BIT(8) : 0;
> + if (job->q->vm && !job->ggtt)
> + return BIT(8);
> +
> + return 0;
> }
>
> static int emit_copy_timestamp(struct xe_lrc *lrc, u32 *dw, int i)
> diff --git a/drivers/gpu/drm/xe/xe_sched_job.c b/drivers/gpu/drm/xe/xe_sched_job.c
> index 1905ca590965..5710d9ab36fa 100644
> --- a/drivers/gpu/drm/xe/xe_sched_job.c
> +++ b/drivers/gpu/drm/xe/xe_sched_job.c
> @@ -109,6 +109,7 @@ struct xe_sched_job *xe_sched_job_create(struct xe_exec_queue *q,
> if (!job)
> return ERR_PTR(-ENOMEM);
>
> + job->ggtt = false;
Nit: Not needed as the job zero alloc'd.
Otherwise LGTM:
Reviewed-by: Matthew Brost <matthew.brost at intel.com>
> job->q = q;
> kref_init(&job->refcount);
> xe_exec_queue_get(job->q);
> diff --git a/drivers/gpu/drm/xe/xe_sched_job_types.h b/drivers/gpu/drm/xe/xe_sched_job_types.h
> index f13f333f00be..d942b20a9f29 100644
> --- a/drivers/gpu/drm/xe/xe_sched_job_types.h
> +++ b/drivers/gpu/drm/xe/xe_sched_job_types.h
> @@ -56,6 +56,8 @@ struct xe_sched_job {
> u32 migrate_flush_flags;
> /** @ring_ops_flush_tlb: The ring ops need to flush TLB before payload. */
> bool ring_ops_flush_tlb;
> + /** @ggtt: mapped in ggtt. */
> + bool ggtt;
> /** @ptrs: per instance pointers. */
> struct xe_job_ptrs ptrs[];
> };
> --
> 2.34.1
>
More information about the Intel-xe
mailing list