From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id E7AB410E4E7 for ; Fri, 7 Jul 2023 01:10:55 +0000 (UTC) Date: Thu, 06 Jul 2023 18:10:47 -0700 Message-ID: <87bkgocyqw.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Himal Prasad Ghimiray In-Reply-To: <20230706104500.595707-5-himal.prasad.ghimiray@intel.com> References: <20230706104500.595707-1-himal.prasad.ghimiray@intel.com> <20230706104500.595707-5-himal.prasad.ghimiray@intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, Upadhyay Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: 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) > +{ > + 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); > + 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. > + 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 >