[igt-dev] [PATCH 4/4] tests/xe/xe_tile_prop: adds new test to verify per tile vram addr_range
Ghimiray, Himal Prasad
himal.prasad.ghimiray at intel.com
Thu Jun 22 05:17:27 UTC 2023
> -----Original Message-----
> From: Kumar, Janga Rahul <janga.rahul.kumar at intel.com>
> Sent: 21 June 2023 14:40
> To: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>; igt-
> dev at lists.freedesktop.org
> Subject: RE: [igt-dev] [PATCH 4/4] tests/xe/xe_tile_prop: adds new test to
> verify per tile vram addr_range
>
>
>
> > -----Original Message-----
> > From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of
> > Himal Prasad Ghimiray
> > Sent: 13 June 2023 19:12
> > To: igt-dev at lists.freedesktop.org
> > Subject: [igt-dev] [PATCH 4/4] tests/xe/xe_tile_prop: adds new test to
> > verify per tile vram addr_range
> >
> > For each tile the test reads the sysfs entry addr_range and compares
> > the value with vram size exposed from query ioctl.
> >
> > Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> > ---
> > tests/meson.build | 1 +
> > tests/xe/xe_tile_prop.c | 66
> > +++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 67 insertions(+)
> > create mode 100644 tests/xe/xe_tile_prop.c
> >
> > diff --git a/tests/meson.build b/tests/meson.build index
> > f71be1db..ec8f4632
> > 100644
> > --- a/tests/meson.build
> > +++ b/tests/meson.build
> > @@ -266,6 +266,7 @@ xe_progs = [
> > 'xe_pm',
> > 'xe_prime_self_import',
> > 'xe_query',
> > + 'xe_tile_prop',
> Pls update to xe_sysfs_tile_prop ( as test is mainly trying to collect and
> validate the sysfs info)
Sure.
>
> Thanks,
> Rahul
> > 'xe_vm',
> > 'xe_waitfence',
> > ]
> > diff --git a/tests/xe/xe_tile_prop.c b/tests/xe/xe_tile_prop.c new
> > file mode
> > 100644 index 00000000..80b1b794
> > --- /dev/null
> > +++ b/tests/xe/xe_tile_prop.c
> > @@ -0,0 +1,66 @@
> > +// SPDX-License-Identifier: MIT
> > +/*
> > + * Copyright © 2023 Intel Corporation */
> > +
> > +/**
> > + * TEST: Verify addr_range of each tiles
> > + * SUBTEST: addr_range
> > + * Description:
> > + * Read sysfs entry for addr_range and compare with
> > + * calculated addr_range. addr_range should be sum
> > + * vram size and stolen memory.
> > + */
> > +
> > +#include <string.h>
> > +#include <sys/time.h>
> > +
> > +#include "igt.h"
> > +#include "igt_sysfs.h"
> > +
> > +#include "xe_drm.h"
> > +#include "xe/xe_ioctl.h"
> > +#include "xe/xe_query.h"
> > +
> > +static void test_vram_addr_range(int sysfs, int tile_num, u64
> > +vram_size) {
> > + int err = -EAGAIN;
> > + u64 addr_range;
> > + char path[40];
> > +
> > + sprintf(path, "device/tile%d/addr_range", tile_num);
> > + while (err == -EAGAIN)
> > + err = igt_sysfs_scanf(sysfs, path, "%lx", &addr_range);
> > +
> > + igt_assert_lt(vram_size, addr_range); }
> > +
> > +igt_main
> > +{
> > + int fd;
> > + 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);
> > + igt_assert(sysfs != -1);
> > + }
> > +
> > + igt_subtest("addr_range") {
> > + igt_require(xe_has_vram(fd));
> > + xe_for_each_tile(fd, tile) {
> > + vram_size = xe_vram_size(fd, tile);
> > + test_vram_addr_range(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