[PATCH 08/13] drm/xe: Add some members to xe_vma_ops

Zeng, Oak oak.zeng at intel.com
Fri Apr 19 14:24:14 UTC 2024


This patch is:

Reviewed-by: Oak Zeng <oak.zeng at intel.com>

> -----Original Message-----
> From: Brost, Matthew <matthew.brost at intel.com>
> Sent: Wednesday, April 10, 2024 1:41 AM
> To: intel-xe at lists.freedesktop.org
> Cc: Brost, Matthew <matthew.brost at intel.com>; Zeng, Oak
> <oak.zeng at intel.com>
> Subject: [PATCH 08/13] drm/xe: Add some members to xe_vma_ops
> 
> This will help with moving to single jobs for many bind operations.
> 
> v2:
>  - Rebase
> 
> Cc: Oak Zeng <oak.zeng at intel.com>
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_vm.c       | 19 ++++++++++++++-----
>  drivers/gpu/drm/xe/xe_vm_types.h |  8 ++++++++
>  2 files changed, 22 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 54a69fbfbb00..09871538484b 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -844,7 +844,9 @@ static int xe_vm_ops_add_rebind(struct xe_vma_ops
> *vops, struct xe_vma *vma,
> 
>  static struct dma_fence *ops_execute(struct xe_vm *vm,
>  				     struct xe_vma_ops *vops);
> -static void xe_vma_ops_init(struct xe_vma_ops *vops);
> +static void xe_vma_ops_init(struct xe_vma_ops *vops, struct xe_vm *vm,
> +			    struct xe_exec_queue *q,
> +			    struct xe_sync_entry *syncs, u32 num_syncs);
> 
>  int xe_vm_rebind(struct xe_vm *vm, bool rebind_worker)
>  {
> @@ -859,7 +861,7 @@ int xe_vm_rebind(struct xe_vm *vm, bool
> rebind_worker)
>  	    list_empty(&vm->rebind_list))
>  		return 0;
> 
> -	xe_vma_ops_init(&vops);
> +	xe_vma_ops_init(&vops, vm, NULL, NULL, 0);
> 
>  	xe_vm_assert_held(vm);
>  	list_for_each_entry(vma, &vm->rebind_list, combined_links.rebind)
> {
> @@ -905,7 +907,7 @@ struct dma_fence *xe_vma_rebind(struct xe_vm
> *vm, struct xe_vma *vma, u8 tile_ma
>  	xe_vm_assert_held(vm);
>  	xe_assert(vm->xe, xe_vm_in_fault_mode(vm));
> 
> -	xe_vma_ops_init(&vops);
> +	xe_vma_ops_init(&vops, vm, NULL, NULL, 0);
> 
>  	err = xe_vm_ops_add_rebind(&vops, vma, tile_mask);
>  	if (err)
> @@ -3115,9 +3117,16 @@ static int vm_bind_ioctl_signal_fences(struct
> xe_vm *vm,
>  	return err;
>  }
> 
> -static void xe_vma_ops_init(struct xe_vma_ops *vops)
> +static void xe_vma_ops_init(struct xe_vma_ops *vops, struct xe_vm *vm,
> +			    struct xe_exec_queue *q,
> +			    struct xe_sync_entry *syncs, u32 num_syncs)
>  {
> +	memset(vops, 0, sizeof(*vops));
>  	INIT_LIST_HEAD(&vops->list);
> +	vops->vm = vm;
> +	vops->q = q;
> +	vops->syncs = syncs;
> +	vops->num_syncs = num_syncs;
>  }
> 
>  int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file
> *file)
> @@ -3284,7 +3293,7 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void
> *data, struct drm_file *file)
>  		goto free_syncs;
>  	}
> 
> -	xe_vma_ops_init(&vops);
> +	xe_vma_ops_init(&vops, vm, q, syncs, num_syncs);
>  	for (i = 0; i < args->num_binds; ++i) {
>  		u64 range = bind_ops[i].range;
>  		u64 addr = bind_ops[i].addr;
> diff --git a/drivers/gpu/drm/xe/xe_vm_types.h
> b/drivers/gpu/drm/xe/xe_vm_types.h
> index e9cd6da6263a..ce1a63a5e3e7 100644
> --- a/drivers/gpu/drm/xe/xe_vm_types.h
> +++ b/drivers/gpu/drm/xe/xe_vm_types.h
> @@ -360,6 +360,14 @@ struct xe_vma_op {
>  struct xe_vma_ops {
>  	/** @list: list of VMA operations */
>  	struct list_head list;
> +	/** @vm: VM */
> +	struct xe_vm *vm;
> +	/** @q: exec queue these operations */
> +	struct xe_exec_queue *q;
> +	/** @syncs: syncs these operation */
> +	struct xe_sync_entry *syncs;
> +	/** @num_syncs: number of syncs */
> +	u32 num_syncs;
>  };
> 
>  #endif
> --
> 2.34.1



More information about the Intel-xe mailing list