[igt-dev] [PATCH i-g-t] tests/intel/xe_pat: add sanity check for NULL mappings

Souza, Jose jose.souza at intel.com
Fri Dec 1 17:18:37 UTC 2023


On Fri, 2023-12-01 at 15:14 +0000, Matthew Auld wrote:
> Any platform supported pat_index should be compatible with NULL bindings
> from KMD pov. Make sure that holds true.

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

> 
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
> Cc: José Roberto de Souza <jose.souza at intel.com>
> ---
>  tests/intel/xe_pat.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/tests/intel/xe_pat.c b/tests/intel/xe_pat.c
> index 78bd96d11..5c61a5169 100644
> --- a/tests/intel/xe_pat.c
> +++ b/tests/intel/xe_pat.c
> @@ -113,12 +113,30 @@ static void pat_index_all(int fd)
>  						   size, DRM_XE_VM_BIND_OP_MAP, 0, NULL, 0, 0,
>  						   pat_index, 0),
>  				      -EINVAL);
> +
> +			igt_assert_eq(__xe_vm_bind(fd, vm, 0, 0, 0, 0x40000,
> +						   size, DRM_XE_VM_BIND_OP_MAP,
> +						   DRM_XE_VM_BIND_FLAG_NULL, NULL, 0, 0,
> +						   pat_index, 0),
> +				      -EINVAL);
>  		} else {
>  			igt_assert_eq(__xe_vm_bind(fd, vm, 0, bo, 0, 0x40000,
>  						   size, DRM_XE_VM_BIND_OP_MAP, 0, NULL, 0, 0,
>  						   pat_index, 0),
>  				      0);
>  			xe_vm_unbind_sync(fd, vm, 0, 0x40000, size);
> +
> +			/*
> +			 * There is no real memory being mapped here, so any
> +			 * platform supported pat_index should be acceptable for
> +			 * NULL mappings.
> +			 */
> +			igt_assert_eq(__xe_vm_bind(fd, vm, 0, 0, 0, 0x40000,
> +						   size, DRM_XE_VM_BIND_OP_MAP,
> +						   DRM_XE_VM_BIND_FLAG_NULL, NULL, 0, 0,
> +						   pat_index, 0),
> +				      0);
> +			xe_vm_unbind_sync(fd, vm, 0, 0x40000, size);
>  		}
>  	}
>  
> @@ -127,6 +145,12 @@ static void pat_index_all(int fd)
>  				   pat_index, 0),
>  		      -EINVAL);
>  
> +	igt_assert_eq(__xe_vm_bind(fd, vm, 0, 0, 0, 0x40000,
> +				   size, DRM_XE_VM_BIND_OP_MAP,
> +				   DRM_XE_VM_BIND_FLAG_NULL, NULL, 0, 0,
> +				   pat_index, 0),
> +		      -EINVAL);
> +
>  	gem_close(fd, bo);
>  
>  	/* coh_none is never allowed with cpu_caching WB. */



More information about the igt-dev mailing list