[PATCH i-g-t 2/3] tests/intel/xe_pm: Validate vm-bind prefetch flag with suspend and resume

Rodrigo Vivi rodrigo.vivi at intel.com
Tue Apr 16 20:58:11 UTC 2024


On Mon, Apr 15, 2024 at 09:29:56PM -0400, Rodrigo Vivi wrote:
> On Mon, Apr 15, 2024 at 02:10:34PM +0530, sai.gowtham.ch at intel.com wrote:
> > From: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> > 
> > Test functionality of vm_bind prefetch with S&R.
> > 
> > Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > Signed-off-by: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> > ---
> >  tests/intel/xe_pm.c | 19 ++++++++++++++++---
> >  1 file changed, 16 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
> > index fafd7a52e..8857265a9 100644
> > --- a/tests/intel/xe_pm.c
> > +++ b/tests/intel/xe_pm.c
> > @@ -34,6 +34,7 @@
> >  #define MAGIC_2 0xdeadbeef
> >  
> >  #define USERPTR (0x1 << 0)
> > +#define PREFETCH (0x1 << 2)
> 
> what happen to the bit 1?
> 
> >  
> >  typedef struct {
> >  	int fd_xe;
> > @@ -289,6 +290,7 @@ static void close_fw_handle(int sig)
> >   * arg[2]:
> >   *
> >   * @usrptr:	usrptr
> > + * @prefetch:	prefetch
> >   */
> >  static void
> >  test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
> > @@ -341,9 +343,15 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
> >  		data = aligned_alloc(xe_get_default_alignment(device.fd_xe), bo_size);
> >  		memset(data, 0, bo_size);
> >  	} else {
> > -		bo = xe_bo_create(device.fd_xe, vm, bo_size,
> > -				  vram_if_possible(device.fd_xe, eci->gt_id),
> > -				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
> > +		if (flags & PREFETCH)
> > +			bo = xe_bo_create(device.fd_xe, 0, bo_size,
> > +					  all_memory_regions(device.fd_xe) |
> > +					  vram_if_possible(device.fd_xe, 0),
> > +					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
> > +		else
> > +			bo = xe_bo_create(device.fd_xe, vm, bo_size,
> > +					  vram_if_possible(device.fd_xe, eci->gt_id),
> > +					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
> >  		data = xe_bo_map(device.fd_xe, bo, bo_size);
> >  	}
> >  
> > @@ -362,6 +370,10 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
> >  		xe_vm_bind_userptr_async(device.fd_xe, vm, bind_exec_queues[0],
> >  					 to_user_pointer(data), addr, bo_size, sync, 1);
> >  
> > +	if (flags & PREFETCH)
> > +		xe_vm_prefetch_async(device.fd_xe, vm, bind_exec_queues[0], 0, addr,
> > +				     bo_size, sync, 1, 0);
> 
> anything else missing here?
> apparently the patch still failed badly and I lost my machine now...
> will check again tomorrow with some debugs.

nevermind. nothing needed here and the problem was just my machine/image here.

with define PREFETCH (0x1 << 1)

feel free to use:

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> 
> > +
> >  	if (check_rpm && runtime_usage_available(device.pci_xe))
> >  		igt_assert(igt_pm_get_runtime_usage(device.pci_xe) > rpm_usage);
> >  
> > @@ -617,6 +629,7 @@ igt_main
> >  		unsigned int flags;
> >  	} vm_op[] = {
> >  		{ "usrptr", USERPTR },
> > +		{ "prefetch", PREFETCH },
> >  		{ NULL },
> >  	};
> >  
> > -- 
> > 2.39.1
> > 


More information about the igt-dev mailing list