Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Upadhyay <tejas.upadhyay@intel.com>
Subject: [igt-dev] [PATCH v2 4/4] tests/xe/xe_sysfs_tile_prop: adds new test to verify per tile vram addr_range
Date: Fri, 23 Jun 2023 17:19:46 +0530	[thread overview]
Message-ID: <20230623114946.3803540-5-himal.prasad.ghimiray@intel.com> (raw)
In-Reply-To: <20230623114946.3803540-1-himal.prasad.ghimiray@intel.com>

For each tile the test reads the sysfs entry physical_vram_size_bytes
and compares the value with vram size exposed from query ioctl.

v2:
- Change sysfs entry name. (Tejas)
- Change test name to xe_sysfs_tile_prop. (Rahul)

Cc: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
Cc: Upadhyay <tejas.upadhyay@intel.com>
Cc: Janga Rahul Kumar <janga.rahul.kumar@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 tests/meson.build             |  1 +
 tests/xe/xe_sysfs_tile_prop.c | 67 +++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 tests/xe/xe_sysfs_tile_prop.c

diff --git a/tests/meson.build b/tests/meson.build
index 61dcc076..569f1d22 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -267,6 +267,7 @@ xe_progs = [
 	'xe_pm',
 	'xe_prime_self_import',
 	'xe_query',
+	'xe_sysfs_tile_prop',
 	'xe_vm',
 	'xe_waitfence',
 ]
diff --git a/tests/xe/xe_sysfs_tile_prop.c b/tests/xe/xe_sysfs_tile_prop.c
new file mode 100644
index 00000000..f205970f
--- /dev/null
+++ b/tests/xe/xe_sysfs_tile_prop.c
@@ -0,0 +1,67 @@
+// 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];
+
+	igt_assert(snprintf(path, sizeof(path), "device/tile%d/physical_vram_size_bytes",
+			    tile_num) < sizeof(path));
+	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, total_tiles;
+	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, total_tiles) {
+			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

  parent reply	other threads:[~2023-06-23 11:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 11:49 [igt-dev] [PATCH v2 0/4] Handle GT and tile seperation in IGT Himal Prasad Ghimiray
2023-06-23 11:49 ` [igt-dev] [PATCH v2 1/4] lib/igt_sysfs: Add support to query number of tiles Himal Prasad Ghimiray
2023-06-26 10:24   ` Upadhyay, Tejas
2023-06-26 20:24     ` Dixit, Ashutosh
2023-06-23 11:49 ` [igt-dev] [PATCH v2 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes Himal Prasad Ghimiray
2023-06-26 10:48   ` Upadhyay, Tejas
2023-06-26 22:34     ` Dixit, Ashutosh
2023-06-27  4:22       ` Ghimiray, Himal Prasad
2023-06-27  6:02         ` Dixit, Ashutosh
2023-06-27  7:06           ` Ghimiray, Himal Prasad
2023-07-01 17:44             ` Dixit, Ashutosh
2023-07-04  5:42               ` Ghimiray, Himal Prasad
2023-06-23 11:49 ` [igt-dev] [PATCH v2 3/4] tests/xe/xe_guc_pc: Change the sysfs paths Himal Prasad Ghimiray
2023-06-26 10:49   ` Upadhyay, Tejas
2023-06-23 11:49 ` Himal Prasad Ghimiray [this message]
2023-06-26 10:59   ` [igt-dev] [PATCH v2 4/4] tests/xe/xe_sysfs_tile_prop: adds new test to verify per tile vram addr_range Upadhyay, Tejas
2023-06-26 11:20     ` Ghimiray, Himal Prasad
2023-06-23 12:44 ` [igt-dev] ✓ Fi.CI.BAT: success for Handle GT and tile seperation in IGT Patchwork
2023-06-23 18:13 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230623114946.3803540-5-himal.prasad.ghimiray@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tejas.upadhyay@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox