[PATCH v2 19/32] drm/xe/vma: Move pat_index to vma attributes

Matthew Brost matthew.brost at intel.com
Wed May 14 18:37:06 UTC 2025


On Mon, Apr 07, 2025 at 03:47:06PM +0530, Himal Prasad Ghimiray wrote:
> The PAT index determines how PTEs are encoded and can be modified by
> madvise. Therefore, it is now part of the vma attributes.
> 
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>

I think this patch makes sense assuming we land the previous patch.

Matt 

> ---
>  drivers/gpu/drm/xe/xe_pt.c       |  2 +-
>  drivers/gpu/drm/xe/xe_vm.c       |  6 +++---
>  drivers/gpu/drm/xe/xe_vm_types.h | 10 ++++------
>  3 files changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index 59dc065fae93..2479d830d90a 100644
> --- a/drivers/gpu/drm/xe/xe_pt.c
> +++ b/drivers/gpu/drm/xe/xe_pt.c
> @@ -518,7 +518,7 @@ xe_pt_stage_bind_entry(struct xe_ptw *parent, pgoff_t offset,
>  {
>  	struct xe_pt_stage_bind_walk *xe_walk =
>  		container_of(walk, typeof(*xe_walk), base);
> -	u16 pat_index = xe_walk->vma->pat_index;
> +	u16 pat_index = xe_walk->vma->attr.pat_index;
>  	struct xe_pt *xe_parent = container_of(parent, typeof(*xe_parent), base);
>  	struct xe_vm *vm = xe_walk->vm;
>  	struct xe_pt *xe_child;
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 1ff9e477e061..59e2a951db25 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -1224,7 +1224,7 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm,
>  	if (vm->xe->info.has_atomic_enable_pte_bit)
>  		vma->gpuva.flags |= XE_VMA_ATOMIC_PTE_BIT;
>  
> -	vma->pat_index = pat_index;
> +	vma->attr.pat_index = pat_index;
>  
>  	if (bo) {
>  		struct drm_gpuvm_bo *vm_bo;
> @@ -2657,7 +2657,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
>  
>  			if (op->base.remap.prev) {
>  				vma = new_vma(vm, op->base.remap.prev,
> -					      old->pat_index, flags);
> +					      old->attr.pat_index, flags);
>  				if (IS_ERR(vma))
>  					return PTR_ERR(vma);
>  
> @@ -2687,7 +2687,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
>  
>  			if (op->base.remap.next) {
>  				vma = new_vma(vm, op->base.remap.next,
> -					      old->pat_index, flags);
> +					      old->attr.pat_index, flags);
>  				if (IS_ERR(vma))
>  					return PTR_ERR(vma);
>  
> diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
> index 5f5feffecb82..2fcc48d9d776 100644
> --- a/drivers/gpu/drm/xe/xe_vm_types.h
> +++ b/drivers/gpu/drm/xe/xe_vm_types.h
> @@ -88,6 +88,10 @@ struct xe_vma_mem_attr {
>  	} preferred_loc;
>  	/** @atomic_access: The atomic access type for the vma */
>  	u32 atomic_access;
> +	/**
> +	 * @pat_index: The pat index to use when encoding the PTEs for this vma.
> +	 */
> +	u16 pat_index;
>  };
>  
>  struct xe_vma {
> @@ -131,11 +135,6 @@ struct xe_vma {
>  	/** @tile_staged: bind is staged for this VMA */
>  	u8 tile_staged;
>  
> -	/**
> -	 * @pat_index: The pat index to use when encoding the PTEs for this vma.
> -	 */
> -	u16 pat_index;
> -
>  	/**
>  	 * @ufence: The user fence that was provided with MAP.
>  	 * Needs to be signalled before UNMAP can be processed.
> @@ -147,7 +146,6 @@ struct xe_vma {
>  	 * and encoding of the PTEs for this vma.
>  	 */
>  	struct xe_vma_mem_attr attr;
> -
>  };
>  
>  /**
> -- 
> 2.34.1
> 


More information about the Intel-xe mailing list