[Intel-xe] [PATCH v4 8/9] drm/xe/xe2: Modify xe_bo_test for system memory

Matt Roper matthew.d.roper at intel.com
Thu Dec 7 00:23:14 UTC 2023


On Wed, Dec 06, 2023 at 10:01:25AM +0530, Himal Prasad Ghimiray wrote:
> Modify test to valid ccs clear and copy during evict/restore on
> igfx.

As on the previous patch, what exactly does "evict/restore" refer to in
this setting?

> 
> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> ---
>  drivers/gpu/drm/xe/tests/xe_bo.c | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c b/drivers/gpu/drm/xe/tests/xe_bo.c
> index 549ab343de80..5e4e19a246dc 100644
> --- a/drivers/gpu/drm/xe/tests/xe_bo.c
> +++ b/drivers/gpu/drm/xe/tests/xe_bo.c
> @@ -112,16 +112,21 @@ static void ccs_test_run_gt(struct xe_device *xe, struct xe_gt *gt,
>  			    struct kunit *test)
>  {
>  	struct xe_bo *bo;
> -	u32 vram_bit;
> +	u32 mem_bit;
>  	int ret;
>  
>  	/* TODO: Sanity check */
> -	vram_bit = XE_BO_CREATE_VRAM0_BIT << gt_to_tile(gt)->id;
> -	kunit_info(test, "Testing gt id %u vram id %u\n", gt->info.id,
> -		   gt_to_tile(gt)->id);
>  
> -	bo = xe_bo_create_locked(xe, NULL, NULL, SZ_1M, ttm_bo_type_device,
> -				 vram_bit);
> +	mem_bit = IS_DGFX(xe) ? XE_BO_CREATE_VRAM0_BIT << gt_to_tile(gt)->id :
> +				XE_BO_CREATE_SYSTEM_BIT;
> +
> +	if (IS_DGFX(xe))
> +		kunit_info(test, "Testing gt id %u vram id %u\n", gt->info.id, gt_to_tile(gt)->id);
> +	else
> +		kunit_info(test, "Testing system memory\n");
> +
> +	bo = xe_bo_create_user(xe, NULL, NULL, SZ_1M, DRM_XE_GEM_CPU_CACHING_WC,
> +			       ttm_bo_type_device, mem_bit);
>  	if (IS_ERR(bo)) {
>  		KUNIT_FAIL(test, "Failed to create bo.\n");
>  		return;
> @@ -160,8 +165,12 @@ static int ccs_test_run_device(struct xe_device *xe)
>  
>  	xe_device_mem_access_get(xe);
>  
> -	for_each_gt(gt, xe, id)
> +	for_each_gt(gt, xe, id) {
> +		/* For igfx run only for primary gt */

Even on a dgpu why would we want to run on non-primary GTs?  Should this
whole loop be switched to for_each_tile() instead?  There doesn't seem
to be anything GT-centric in this whole test, so it seems like we should
be passing around and operating on tile pointers instead of GT pointers.


Matt

> +		if (!IS_DGFX(xe) && id > 0)
> +			continue;
>  		ccs_test_run_gt(xe, gt, test);
> +	}
>  
>  	xe_device_mem_access_put(xe);
>  
> -- 
> 2.25.1
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


More information about the Intel-xe mailing list