[PATCH i-g-t 2/2] tests/intel/xe_pm: Test to validate vm unbind all flag with suspend and resume

Rodrigo Vivi rodrigo.vivi at intel.com
Thu Mar 21 20:44:43 UTC 2024


On Fri, Mar 15, 2024 at 10:35:36AM +0530, sai.gowtham.ch at intel.com wrote:
> From: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> 
> Test to validate vm unbind all operation with suspend and resume.

it looks to me that this is more a multiple vm_unbind then what
stated here since it looks like this case was already covered
by test_exec

> 
> Signed-off-by: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> ---
>  tests/intel/xe_pm.c | 37 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
> index ac402e757..f46120662 100644
> --- a/tests/intel/xe_pm.c
> +++ b/tests/intel/xe_pm.c
> @@ -605,6 +605,40 @@ static void test_mmap(device_t device, uint32_t placement, uint32_t flags)
>  	close(fw_handle);
>  }
>  
> +/**
> + * SUBTEST: unbind-all
> + * Description: Validate vm unbind functionality with suspend and resume
> + *
> + * Functionality: pm - s3

why only s3? why not rpm?

> + * Run type: FULL
> + */
> +static void unbind_all(device_t device, int n_vmas)

why not simply making n_vmas a test_exec param?	so you can have
more combinations ready already?

> +{
> +	uint32_t bo, bo_size = xe_get_default_alignment(device.fd_xe);
> +	uint64_t addr = 0x1a0000;
> +	uint32_t vm;
> +	int i;
> +
> +	struct drm_xe_sync sync[1] = {
> +		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ, .flags = DRM_XE_SYNC_FLAG_SIGNAL, },
> +	};
> +
> +	vm = xe_vm_create(device.fd_xe, 0, 0);
> +	bo = xe_bo_create(device.fd_xe, vm, bo_size, vram_if_possible(device.fd_xe, 0), 0);
> +
> +	for (i = 0; i < n_vmas; ++i)
> +		xe_vm_bind_async(device.fd_xe, vm, 0, bo, 0, addr + i * bo_size, bo_size, NULL, 0);
> +	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
> +	sync[0].handle = syncobj_create(device.fd_xe, 0);
> +	xe_vm_unbind_all_async(device.fd_xe, vm, 0, bo, sync, 1);
> +
> +	igt_assert(syncobj_wait(device.fd_xe, &sync[0].handle, 1, INT64_MAX, 0, NULL));
> +	syncobj_destroy(device.fd_xe, sync[0].handle);
> +
> +	gem_close(device.fd_xe, bo);
> +	xe_vm_destroy(device.fd_xe, vm);
> +}
> +
>  igt_main
>  {
>  	struct drm_xe_engine_class_instance *hwe;
> @@ -768,6 +802,9 @@ igt_main
>  		}
>  	}
>  
> +	igt_subtest("unbind-all")
> +		unbind_all(device, 2);
> +
>  	igt_fixture {
>  		close(sysfs_fd);
>  		igt_pm_set_d3cold_allowed(device.pci_slot_name, d3cold_allowed);
> -- 
> 2.39.1
> 


More information about the igt-dev mailing list