[RFC 04/29] drm/xe/svm: Make to_xe_range a public function

Matthew Brost matthew.brost at intel.com
Fri Mar 28 02:57:06 UTC 2025


On Fri, Mar 14, 2025 at 01:32:01PM +0530, Himal Prasad Ghimiray wrote:
> The to_xe_range function will be used in other files. Therefore, make it
> public and add kernel-doc documentation
> 
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_svm.c |  5 -----
>  drivers/gpu/drm/xe/xe_svm.h | 14 ++++++++++++++
>  2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> index 2d2b385b691e..2b041f44730b 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -93,11 +93,6 @@ static void xe_svm_range_free(struct drm_gpusvm_range *range)
>  	kfree(range);
>  }
>  
> -static struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
> -{
> -	return container_of(r, struct xe_svm_range, base);
> -}
> -
>  static void
>  xe_svm_garbage_collector_add_range(struct xe_vm *vm, struct xe_svm_range *range,
>  				   const struct mmu_notifier_range *mmu_range)
> diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
> index 976059545173..1af245400799 100644
> --- a/drivers/gpu/drm/xe/xe_svm.h
> +++ b/drivers/gpu/drm/xe/xe_svm.h
> @@ -139,6 +139,20 @@ int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
>  
>  #endif
>  
> +/**
> + * to_xe_range - Convert a drm_gpusvm_range pointer to a xe_svm_range
> + * @r: Pointer to the drm_gpusvm_range structure
> + *
> + * This function takes a pointer to a drm_gpusvm_range structure and
> + * converts it to a pointer to the containing xe_svm_range structure.
> + *
> + * Return: Pointer to the xe_svm_range structure
> + */
> +static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
> +{
> +	return container_of(r, struct xe_svm_range, base);
> +}
> +
>  /**
>   * xe_svm_range_has_dma_mapping() - SVM range has DMA mapping
>   * @range: SVM range
> -- 
> 2.34.1
> 


More information about the Intel-xe mailing list