[PATCH v3 14/19] drm/xe/svm: Support DRM_XE_SVM_ATTR_PAT memory attribute

Matthew Brost matthew.brost at intel.com
Fri May 30 00:24:30 UTC 2025


On Tue, May 27, 2025 at 10:09:58PM +0530, Himal Prasad Ghimiray wrote:
> This attributes sets the pat_index for the svm used vma range, which is
> utilized to ascertain the coherence.
> 
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_vm_madvise.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm_madvise.c b/drivers/gpu/drm/xe/xe_vm_madvise.c
> index 1b31e41b3331..0f0b94cb43f2 100644
> --- a/drivers/gpu/drm/xe/xe_vm_madvise.c
> +++ b/drivers/gpu/drm/xe/xe_vm_madvise.c
> @@ -98,7 +98,13 @@ static int madvise_pat_index(struct xe_device *xe, struct xe_vm *vm,
>  			     struct xe_vma **vmas, int num_vmas,
>  			     struct drm_xe_madvise_ops ops)
>  {
> -	/* Implementation pending */
> +	int i;
> +
> +	xe_assert(vm->xe, ops.type == DRM_XE_VMA_ATTR_PAT);
> +
> +	for (i = 0; i < num_vmas; i++)
> +		vmas[i]->attr.pat_index = ops.pat_index.val;
> +

Again as discussed in other patches maybe drop the return value on the
vfuncs.

But you will need to validate the pat_index ahead of this like VM bind
does:

coh_mode = xe_pat_index_get_coh_mode(xe, pat_index);
if (XE_IOCTL_DBG(xe, !coh_mode)) { /* hw reserved */
	err = -EINVAL;
	goto free_bind_ops;
}

if (XE_WARN_ON(coh_mode > XE_COH_AT_LEAST_1WAY)) {
	err = -EINVAL;
	goto free_bind_ops;
}

Matt

>  	return 0;
>  }
>  
> -- 
> 2.34.1
> 


More information about the Intel-xe mailing list