[igt-dev] [PATCH i-g-t v7 4/4] tests/xe/xe_sysfs_tile_prop: adds new test to verify per tile vram addr_range

Ghimiray, Himal Prasad himal.prasad.ghimiray at intel.com
Fri Jul 7 05:04:43 UTC 2023



> -----Original Message-----
> From: Dixit, Ashutosh <ashutosh.dixit at intel.com>
> Sent: 07 July 2023 06:41
> To: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>
> Cc: igt-dev at lists.freedesktop.org; Upadhyay, Tejas
> <tejas.upadhyay at intel.com>
> Subject: Re: [igt-dev] [PATCH i-g-t v7 4/4] tests/xe/xe_sysfs_tile_prop: adds
> new test to verify per tile vram addr_range
> 
> On Thu, 06 Jul 2023 03:45:00 -0700, Himal Prasad Ghimiray wrote:
> >
> > diff --git a/tests/xe/xe_sysfs_tile_prop.c
> > b/tests/xe/xe_sysfs_tile_prop.c
> 
> Let's call this either xe_sysfs_tile_properties.c or xe_sysfs_tile.c
> 
> > +static void test_vram_physical_vram_size_bytes(int sysfs, int
> > +tile_num, u64 vram_size)
> 
> Pass tilefd into this function, see below, so
> 
> static void test_vram_physical_vram_size_bytes(int tilefd, u64 vram_size)
> 

Will address in next patch.

> > +{
> > +	u64 physical_vram_size_bytes;
> > +	char path[40];
> > +
> > +	igt_assert(snprintf(path, sizeof(path),
> "device/tile%d/physical_vram_size_bytes",
> > +			    tile_num) < sizeof(path));
> 
> No need for all this.
> 
> > +	igt_assert(igt_sysfs_scanf(sysfs, path, "%lx",
> > +&physical_vram_size_bytes) > 0);
> 
> This just becomes
> 
> 	igt_assert(igt_sysfs_scanf(tilefd, "physical_vram_size_bytes", "%lx",
> &physical_vram_size_bytes) > 0);
> 

Ok.

> > +	igt_assert_lt_u64(vram_size, physical_vram_size_bytes); }
> > +
> > +igt_main
> > +{
> > +	int fd, tmp;
> 
> s/tmp/tilefd/
> 
> > +	int tile;
> > +	static int sysfs = -1;
> > +	u64 vram_size;
> > +
> > +	igt_fixture {
> > +		fd = drm_open_driver(DRIVER_XE);
> > +		xe_device_get(fd);
> > +
> > +		sysfs = igt_sysfs_open(fd);
> 
> No need to do this, we already have tilefd in xe_for_each_tile, we can pass
> that into test_vram_physical_vram_size_bytes.
> 

Sure.

> > +		igt_assert(sysfs != -1);
> > +	}
> > +
> > +	igt_subtest("physical_vram_size_bytes") {
> > +		igt_require(xe_has_vram(fd));
> > +		xe_for_each_tile(fd, tmp, tile) {
> > +			vram_size = xe_vram_size(fd, tile);
> > +			test_vram_physical_vram_size_bytes(sysfs, tile,
> vram_size);
> > +		}
> > +	}
> > +
> > +	igt_fixture {
> > +		close(sysfs);
> > +		xe_device_put(fd);
> > +		close(fd);
> > +	}
> > +}
> > --
> > 2.25.1
> >


More information about the igt-dev mailing list