[Intel-xe] [PATCH 1/3] drm/xe: Handle unmapped userptr in analyze VM

Souza, Jose jose.souza at intel.com
Fri Jun 9 18:36:26 UTC 2023


On Fri, 2023-06-09 at 11:26 -0700, Matthew Brost wrote:
> A corner exists where a userptr may have no mapping when analyze VM is
> called, handle this case.

Reviewed-by: José Roberto de Souza <jose.souza at intel.com>

> 
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_vm.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index d1c380ad7f6b..e4311c48cc54 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -3453,9 +3453,13 @@ int xe_analyze_vm(struct drm_printer *p, struct xe_vm *vm, int gt_id)
>  		if (is_userptr) {
>  			struct xe_res_cursor cur;
>  
> -			xe_res_first_sg(vma->userptr.sg, 0, XE_PAGE_SIZE,
> -					&cur);
> -			addr = xe_res_dma(&cur);
> +			if (vma->userptr.sg) {
> +				xe_res_first_sg(vma->userptr.sg, 0, XE_PAGE_SIZE,
> +						&cur);
> +				addr = xe_res_dma(&cur);
> +			} else {
> +				addr = 0;
> +			}
>  		} else {
>  			addr = __xe_bo_addr(vma->bo, 0, XE_PAGE_SIZE, &is_vram);
>  		}



More information about the Intel-xe mailing list