Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v5 3/4] tests/xe_pm: Add d3-mmap IGT test
  2024-01-19 11:55 [PATCH i-g-t v5 0/4] Add d3 mmap test Anshuman Gupta
@ 2024-01-19 11:55 ` Anshuman Gupta
  0 siblings, 0 replies; 11+ messages in thread
From: Anshuman Gupta @ 2024-01-19 11:55 UTC (permalink / raw)
  To: igt-dev; +Cc: kamil.konieczny, rodrigo.vivi

Adding a test to validate mmap memory mappings along with runtime
suspend and resume for both xe device and it's pci parent bridge
in device hierarchy.

v2:
- Use 0xc00fee pattern. [Rodrigo]
- Test the pagefault case on read and write the mapping. [Rodrigo]

v3:
- Cosmetic comment. [Kamil]
- Use MAGIC macro for 0xc0ffe and 0xdeadbeef. [Kamil]
- Fix xe_bo_create() with respect to Xe uapi.
- Set auto_suspend delay to 1000ms and restore it.

v4:
- Set autosuspend delay to 1 sec for entire test. [Badal]

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 tests/intel/xe_pm.c | 99 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)

diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
index f793fd24e..9cb25d47c 100644
--- a/tests/intel/xe_pm.c
+++ b/tests/intel/xe_pm.c
@@ -30,6 +30,8 @@
 #define NO_RPM -1
 
 #define SIZE (4096 * 1024)
+#define MAGIC_1 0xc0ffee
+#define MAGIC_2 0xdeadbeef
 
 typedef struct {
 	int fd_xe;
@@ -476,6 +478,79 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 	igt_assert(in_d3(device, IGT_ACPI_D3Cold));
 }
 
+/**
+ * SUBTEST: d3-mmap-%s
+ * Description:
+ *	Validate mmap memory mapping with d3 state, for %arg[1] region,
+ *	if supported by device.
+ * arg[1]:
+ *
+ * @vram:	vram region
+ * @system:	system region
+ *
+ * Functionality: pm-d3
+ * Run type: FULL
+ */
+static void test_mmap(device_t device, uint32_t placement, uint32_t flags)
+{
+	size_t bo_size = 8192;
+	uint32_t *map = NULL;
+	uint32_t bo;
+	int i;
+
+	igt_require_f(placement, "Device doesn't support such memory region\n");
+
+	bo_size = ALIGN(bo_size, xe_get_default_alignment(device.fd_xe));
+
+	bo = xe_bo_create(device.fd_xe, 0, bo_size, placement, flags);
+	map = xe_bo_map(device.fd_xe, bo, bo_size);
+	igt_assert(map);
+	memset(map, 0, bo_size);
+
+	fw_handle = igt_debugfs_open(device.fd_xe, "forcewake_all", O_RDONLY);
+
+	igt_assert(fw_handle >= 0);
+	igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
+
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		map[i] = MAGIC_1;
+
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		igt_assert(map[i] == MAGIC_1);
+
+	/* Runtime suspend and validate the pattern and changed the pattern */
+	close(fw_handle);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		igt_assert(map[i] == MAGIC_1);
+
+	/* dgfx page-fault on mmaping should wake the gpu */
+	if (xe_has_vram(device.fd_xe))
+		igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
+
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		map[i] = MAGIC_2;
+
+	if (xe_has_vram(device.fd_xe))
+		igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
+
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+
+	/* Runtime resume and check the pattern */
+	fw_handle = igt_debugfs_open(device.fd_xe, "forcewake_all", O_RDONLY);
+	igt_assert(fw_handle >= 0);
+	igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		igt_assert(map[i] == MAGIC_2);
+
+	igt_assert(munmap(map, bo_size) == 0);
+	gem_close(device.fd_xe, bo);
+	close(fw_handle);
+}
+
 igt_main
 {
 	struct drm_xe_engine_class_instance *hwe;
@@ -591,6 +666,30 @@ igt_main
 			igt_install_exit_handler(vram_d3cold_threshold_restore);
 			test_vram_d3cold_threshold(device, sysfs_fd);
 		}
+
+		igt_describe("Validate mmap memory mappings with system region,"
+			     "when device along with parent bridge in d3");
+		igt_subtest("d3-mmap-system") {
+			test_mmap(device, system_memory(device.fd_xe), 0);
+		}
+
+		igt_describe("Validate mmap memory mappings with vram region,"
+			     "when device along with parent bridge in d3");
+		igt_subtest("d3-mmap-vram") {
+			int delay_ms;
+
+			if (device.pci_root != device.pci_xe) {
+				igt_pm_enable_pci_card_runtime_pm(device.pci_root, NULL);
+				igt_pm_set_d3cold_allowed(device.pci_slot_name, 1);
+			}
+
+			delay_ms = igt_pm_get_autosuspend_delay(device.pci_xe);
+
+			/* Give some auto suspend delay to validate rpm active during page fault */
+			igt_pm_set_autosuspend_delay(device.pci_xe, 1000);
+			test_mmap(device, vram_memory(device.fd_xe, 0), DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
+			igt_pm_set_autosuspend_delay(device.pci_xe, delay_ms);
+		}
 	}
 
 	igt_fixture {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH i-g-t v5 0/4] Add d3 mmap test
@ 2024-01-19 14:28 Anshuman Gupta
  2024-01-19 14:28 ` [PATCH i-g-t v5 1/4] test/xe_pm: Add exit handler to close fw handle Anshuman Gupta
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Anshuman Gupta @ 2024-01-19 14:28 UTC (permalink / raw)
  To: igt-dev

Add d3 mmap test
Resending it after adding RB on second patch and fixing the
HAX patch to get CI results.

Anshuman Gupta (4):
  test/xe_pm: Add exit handler to close fw handle
  lib/igt_pm: Add helper to get/set auto_suspenddelay_ms
  tests/xe_pm: Add d3-mmap IGT test
  HAX: Add d3-mmap to xe-fast-feedback

 lib/igt_pm.c                             |  53 +++++++--
 lib/igt_pm.h                             |   2 +
 tests/intel-ci/xe-fast-feedback.testlist |   2 +
 tests/intel/xe_pm.c                      | 133 +++++++++++++++++++++--
 4 files changed, 169 insertions(+), 21 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH i-g-t v5 1/4] test/xe_pm: Add exit handler to close fw handle
  2024-01-19 14:28 [PATCH i-g-t v5 0/4] Add d3 mmap test Anshuman Gupta
@ 2024-01-19 14:28 ` Anshuman Gupta
  2024-01-19 14:28 ` [PATCH i-g-t v5 2/4] lib/igt_pm: Add helper to get/set auto_suspenddelay_ms Anshuman Gupta
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Anshuman Gupta @ 2024-01-19 14:28 UTC (permalink / raw)
  To: igt-dev; +Cc: Rodrigo Vivi

Adding an exit handler to close the fw handle to make sure we don't
leak the fw in CI environment. Adding a IGT subtest group for the
test using the fw handle to runtime wake the device.
Scaling forcewake close exit handler for vram-d3cold-threshold
subtest, while doing so add the missing subtest Functionality
as well.

Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 tests/intel/xe_pm.c | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
index 4afe37d93..f793fd24e 100644
--- a/tests/intel/xe_pm.c
+++ b/tests/intel/xe_pm.c
@@ -40,6 +40,7 @@ typedef struct {
 } device_t;
 
 uint64_t orig_threshold;
+int fw_handle = -1;
 
 static void dpms_on_off(device_t device, int mode)
 {
@@ -195,6 +196,14 @@ static bool out_of_d3(device_t device, enum igt_acpi_d_state state)
 	return true;
 }
 
+static void close_fw_handle(int sig)
+{
+	if (fw_handle < 0)
+		return;
+
+	close(fw_handle);
+}
+
 /**
  * SUBTEST: %s-basic
  * Description: set GPU state to %arg[1] and test suspend/autoresume
@@ -411,9 +420,9 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 	};
 	uint64_t vram_used_mb = 0, vram_total_mb = 0, threshold;
 	uint32_t bo, placement;
-	int handle, i;
 	bool active;
 	void *map;
+	int i;
 
 	igt_require(xe_has_vram(device.fd_xe));
 
@@ -457,10 +466,10 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 	 * the device from runtime suspend.
 	 * Therefore open and close fw handle to wake the device.
 	 */
-	handle = igt_debugfs_open(device.fd_xe, "forcewake_all", O_RDONLY);
-	igt_assert(handle >= 0);
+	fw_handle = igt_debugfs_open(device.fd_xe, "forcewake_all", O_RDONLY);
+	igt_assert(fw_handle >= 0);
 	active = igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE;
-	close(handle);
+	close(fw_handle);
 	igt_assert(active);
 
 	/* Test D3Cold again after freeing up the Xe BO */
@@ -570,11 +579,18 @@ igt_main
 		}
 	}
 
-	igt_describe("Validate whether card is limited to d3hot, if vram used > vram threshold");
-	igt_subtest("vram-d3cold-threshold") {
-		orig_threshold = get_vram_d3cold_threshold(sysfs_fd);
-		igt_install_exit_handler(vram_d3cold_threshold_restore);
-		test_vram_d3cold_threshold(device, sysfs_fd);
+	igt_subtest_group {
+		igt_fixture {
+			igt_install_exit_handler(close_fw_handle);
+		}
+
+		igt_describe("Validate whether card is limited to d3hot,"
+			     "if vram used > vram threshold");
+		igt_subtest("vram-d3cold-threshold") {
+			orig_threshold = get_vram_d3cold_threshold(sysfs_fd);
+			igt_install_exit_handler(vram_d3cold_threshold_restore);
+			test_vram_d3cold_threshold(device, sysfs_fd);
+		}
 	}
 
 	igt_fixture {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH i-g-t v5 2/4] lib/igt_pm: Add helper to get/set auto_suspenddelay_ms
  2024-01-19 14:28 [PATCH i-g-t v5 0/4] Add d3 mmap test Anshuman Gupta
  2024-01-19 14:28 ` [PATCH i-g-t v5 1/4] test/xe_pm: Add exit handler to close fw handle Anshuman Gupta
@ 2024-01-19 14:28 ` Anshuman Gupta
  2024-01-19 14:36   ` Kamil Konieczny
  2024-01-19 14:28 ` [PATCH i-g-t v5 3/4] tests/xe_pm: Add d3-mmap IGT test Anshuman Gupta
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Anshuman Gupta @ 2024-01-19 14:28 UTC (permalink / raw)
  To: igt-dev; +Cc: Rodrigo Vivi

Sometimes we want to test pm igt test with an explicit auto
suspend delay, therefore adding helpers to get/set the pci_dev
auto_suspenddelay_ms.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 lib/igt_pm.c | 53 ++++++++++++++++++++++++++++++++++++++++------------
 lib/igt_pm.h |  2 ++
 2 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index c2d98fceb..d436c2c50 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -1068,18 +1068,6 @@ static void igt_pm_write_power_attr(int fd, const char *val, int len)
 	igt_assert(strncmp(buf, val, len) == 0);
 }
 
-static int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev)
-{
-	char delay_str[64];
-	int delay, delay_fd;
-
-	delay_fd = igt_pm_get_power_attr_fd(pci_dev, "autosuspend_delay_ms");
-	if (igt_pm_read_power_attr(delay_fd, delay_str, 64, true))
-		igt_assert(sscanf(delay_str, "%d", &delay) > 0);
-
-	return delay;
-}
-
 static void
 igt_pm_setup_pci_dev_power_attrs(struct pci_device *pci_dev,
 				 struct igt_pm_pci_dev_pwrattr *pwrattr, int delay_ms)
@@ -1165,6 +1153,47 @@ igt_pm_setup_pci_card_power_attrs(struct pci_device *pci_dev, bool save_attrs, i
 	pci_iterator_destroy(iter);
 }
 
+/**
+ * igt_pm_get_autosuspend_delay:
+ * @pci_dev: pci_dev.
+ * Get pci_dev autosuspend delay value from pci sysfs "autosuspend_delay_ms".
+ *
+ * Returns:
+ * autosuspend_delay_ms.
+ */
+int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev)
+{
+	char delay_str[64];
+	int delay, delay_fd;
+
+	delay_fd = igt_pm_get_power_attr_fd(pci_dev, "autosuspend_delay_ms");
+	if (igt_pm_read_power_attr(delay_fd, delay_str, 64, true))
+		igt_assert(sscanf(delay_str, "%d", &delay) > 0);
+
+	return delay;
+}
+
+/**
+ * igt_pm_set_autosuspend_delay:
+ * @pci_dev: pci_dev.
+ * @delay_ms: autosuspend delay in ms.
+ * Set pci_dev autosuspend delay value through pci sysfs "autosuspend_delay_ms".
+ */
+void igt_pm_set_autosuspend_delay(struct pci_device *pci_dev, int delay_ms)
+{
+	char delay_str[64];
+	int delay_fd;
+
+	delay_fd = igt_pm_get_power_attr_fd(pci_dev, "autosuspend_delay_ms");
+
+	if (delay_ms >= 0) {
+		int wc;
+
+		wc = snprintf(delay_str, 64, "%d\n", delay_ms);
+		igt_pm_write_power_attr(delay_fd, delay_str, wc);
+	}
+}
+
 /**
  * igt_pm_enable_pci_card_runtime_pm:
  * @root: root port pci_dev.
diff --git a/lib/igt_pm.h b/lib/igt_pm.h
index 306a9eb46..8394315c6 100644
--- a/lib/igt_pm.h
+++ b/lib/igt_pm.h
@@ -77,6 +77,8 @@ int igt_pm_get_pcie_acpihp_slot(struct pci_device *pci_dev);
 bool igt_pm_acpi_d3cold_supported(struct pci_device *pci_dev);
 enum igt_acpi_d_state
 igt_pm_get_acpi_real_d_state(struct pci_device *pci_dev);
+int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev);
+void igt_pm_set_autosuspend_delay(struct pci_device *pci_dev, int delay_ms);
 void igt_pm_enable_pci_card_runtime_pm(struct pci_device *root,
 				       struct pci_device *i915);
 void igt_pm_get_d3cold_allowed(const char *pci_slot_name, uint32_t *value);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH i-g-t v5 3/4] tests/xe_pm: Add d3-mmap IGT test
  2024-01-19 14:28 [PATCH i-g-t v5 0/4] Add d3 mmap test Anshuman Gupta
  2024-01-19 14:28 ` [PATCH i-g-t v5 1/4] test/xe_pm: Add exit handler to close fw handle Anshuman Gupta
  2024-01-19 14:28 ` [PATCH i-g-t v5 2/4] lib/igt_pm: Add helper to get/set auto_suspenddelay_ms Anshuman Gupta
@ 2024-01-19 14:28 ` Anshuman Gupta
  2024-01-19 15:33   ` Nilawar, Badal
  2024-01-19 14:28 ` [PATCH i-g-t v5 4/4] HAX: Add d3-mmap to xe-fast-feedback Anshuman Gupta
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Anshuman Gupta @ 2024-01-19 14:28 UTC (permalink / raw)
  To: igt-dev; +Cc: Rodrigo Vivi

Adding a test to validate mmap memory mappings along with runtime
suspend and resume for both xe device and it's pci parent bridge
in device hierarchy.

v2:
- Use 0xc00fee pattern. [Rodrigo]
- Test the pagefault case on read and write the mapping. [Rodrigo]

v3:
- Cosmetic comment. [Kamil]
- Use MAGIC macro for 0xc0ffe and 0xdeadbeef. [Kamil]
- Fix xe_bo_create() with respect to Xe uapi.
- Set auto_suspend delay to 1000ms and restore it.

v4:
- Set autosuspend delay to 1 sec for entire test. [Badal]

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 tests/intel/xe_pm.c | 99 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)

diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
index f793fd24e..9cb25d47c 100644
--- a/tests/intel/xe_pm.c
+++ b/tests/intel/xe_pm.c
@@ -30,6 +30,8 @@
 #define NO_RPM -1
 
 #define SIZE (4096 * 1024)
+#define MAGIC_1 0xc0ffee
+#define MAGIC_2 0xdeadbeef
 
 typedef struct {
 	int fd_xe;
@@ -476,6 +478,79 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 	igt_assert(in_d3(device, IGT_ACPI_D3Cold));
 }
 
+/**
+ * SUBTEST: d3-mmap-%s
+ * Description:
+ *	Validate mmap memory mapping with d3 state, for %arg[1] region,
+ *	if supported by device.
+ * arg[1]:
+ *
+ * @vram:	vram region
+ * @system:	system region
+ *
+ * Functionality: pm-d3
+ * Run type: FULL
+ */
+static void test_mmap(device_t device, uint32_t placement, uint32_t flags)
+{
+	size_t bo_size = 8192;
+	uint32_t *map = NULL;
+	uint32_t bo;
+	int i;
+
+	igt_require_f(placement, "Device doesn't support such memory region\n");
+
+	bo_size = ALIGN(bo_size, xe_get_default_alignment(device.fd_xe));
+
+	bo = xe_bo_create(device.fd_xe, 0, bo_size, placement, flags);
+	map = xe_bo_map(device.fd_xe, bo, bo_size);
+	igt_assert(map);
+	memset(map, 0, bo_size);
+
+	fw_handle = igt_debugfs_open(device.fd_xe, "forcewake_all", O_RDONLY);
+
+	igt_assert(fw_handle >= 0);
+	igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
+
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		map[i] = MAGIC_1;
+
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		igt_assert(map[i] == MAGIC_1);
+
+	/* Runtime suspend and validate the pattern and changed the pattern */
+	close(fw_handle);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		igt_assert(map[i] == MAGIC_1);
+
+	/* dgfx page-fault on mmaping should wake the gpu */
+	if (xe_has_vram(device.fd_xe))
+		igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
+
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		map[i] = MAGIC_2;
+
+	if (xe_has_vram(device.fd_xe))
+		igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
+
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+
+	/* Runtime resume and check the pattern */
+	fw_handle = igt_debugfs_open(device.fd_xe, "forcewake_all", O_RDONLY);
+	igt_assert(fw_handle >= 0);
+	igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
+	for (i = 0; i < bo_size / sizeof(*map); i++)
+		igt_assert(map[i] == MAGIC_2);
+
+	igt_assert(munmap(map, bo_size) == 0);
+	gem_close(device.fd_xe, bo);
+	close(fw_handle);
+}
+
 igt_main
 {
 	struct drm_xe_engine_class_instance *hwe;
@@ -591,6 +666,30 @@ igt_main
 			igt_install_exit_handler(vram_d3cold_threshold_restore);
 			test_vram_d3cold_threshold(device, sysfs_fd);
 		}
+
+		igt_describe("Validate mmap memory mappings with system region,"
+			     "when device along with parent bridge in d3");
+		igt_subtest("d3-mmap-system") {
+			test_mmap(device, system_memory(device.fd_xe), 0);
+		}
+
+		igt_describe("Validate mmap memory mappings with vram region,"
+			     "when device along with parent bridge in d3");
+		igt_subtest("d3-mmap-vram") {
+			int delay_ms;
+
+			if (device.pci_root != device.pci_xe) {
+				igt_pm_enable_pci_card_runtime_pm(device.pci_root, NULL);
+				igt_pm_set_d3cold_allowed(device.pci_slot_name, 1);
+			}
+
+			delay_ms = igt_pm_get_autosuspend_delay(device.pci_xe);
+
+			/* Give some auto suspend delay to validate rpm active during page fault */
+			igt_pm_set_autosuspend_delay(device.pci_xe, 1000);
+			test_mmap(device, vram_memory(device.fd_xe, 0), DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
+			igt_pm_set_autosuspend_delay(device.pci_xe, delay_ms);
+		}
 	}
 
 	igt_fixture {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH i-g-t v5 4/4] HAX: Add d3-mmap to xe-fast-feedback
  2024-01-19 14:28 [PATCH i-g-t v5 0/4] Add d3 mmap test Anshuman Gupta
                   ` (2 preceding siblings ...)
  2024-01-19 14:28 ` [PATCH i-g-t v5 3/4] tests/xe_pm: Add d3-mmap IGT test Anshuman Gupta
@ 2024-01-19 14:28 ` Anshuman Gupta
  2024-01-19 15:26 ` ✗ Fi.CI.BAT: failure for Add d3 mmap test (rev4) Patchwork
  2024-01-19 15:39 ` ✓ CI.xeBAT: success " Patchwork
  5 siblings, 0 replies; 11+ messages in thread
From: Anshuman Gupta @ 2024-01-19 14:28 UTC (permalink / raw)
  To: igt-dev

Adding d3-mmap to xe-fast-feedback.

Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 tests/intel-ci/xe-fast-feedback.testlist | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/intel-ci/xe-fast-feedback.testlist b/tests/intel-ci/xe-fast-feedback.testlist
index f297fe965..1d5ecb19d 100644
--- a/tests/intel-ci/xe-fast-feedback.testlist
+++ b/tests/intel-ci/xe-fast-feedback.testlist
@@ -115,6 +115,8 @@ igt@xe_mmap@system
 igt@xe_mmap@vram
 igt@xe_mmap@vram-system
 igt@xe_pm_residency@gt-c6-on-idle
+igt@xe_pm@d3-mmap-system
+igt@xe_pm@d3-mmap-vram
 igt@xe_prime_self_import@basic-with_one_bo
 igt@xe_prime_self_import@basic-with_fd_dup
 #igt@xe_prime_self_import@basic-llseek-size
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH i-g-t v5 2/4] lib/igt_pm: Add helper to get/set auto_suspenddelay_ms
  2024-01-19 14:28 ` [PATCH i-g-t v5 2/4] lib/igt_pm: Add helper to get/set auto_suspenddelay_ms Anshuman Gupta
@ 2024-01-19 14:36   ` Kamil Konieczny
  2024-01-19 15:14     ` Gupta, Anshuman
  0 siblings, 1 reply; 11+ messages in thread
From: Kamil Konieczny @ 2024-01-19 14:36 UTC (permalink / raw)
  To: igt-dev; +Cc: Rodrigo Vivi

Hi Anshuman,
On 2024-01-19 at 19:58:21 +0530, Anshuman Gupta wrote:
> Sometimes we want to test pm igt test with an explicit auto
> suspend delay, therefore adding helpers to get/set the pci_dev
> auto_suspenddelay_ms.
> 
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  lib/igt_pm.c | 53 ++++++++++++++++++++++++++++++++++++++++------------
>  lib/igt_pm.h |  2 ++
>  2 files changed, 43 insertions(+), 12 deletions(-)
> 
> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> index c2d98fceb..d436c2c50 100644
> --- a/lib/igt_pm.c
> +++ b/lib/igt_pm.c
> @@ -1068,18 +1068,6 @@ static void igt_pm_write_power_attr(int fd, const char *val, int len)
>  	igt_assert(strncmp(buf, val, len) == 0);
>  }
>  
> -static int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev)
> -{
> -	char delay_str[64];
> -	int delay, delay_fd;
> -
> -	delay_fd = igt_pm_get_power_attr_fd(pci_dev, "autosuspend_delay_ms");
> -	if (igt_pm_read_power_attr(delay_fd, delay_str, 64, true))
> -		igt_assert(sscanf(delay_str, "%d", &delay) > 0);
> -
> -	return delay;
> -}
> -
>  static void
>  igt_pm_setup_pci_dev_power_attrs(struct pci_device *pci_dev,
>  				 struct igt_pm_pci_dev_pwrattr *pwrattr, int delay_ms)
> @@ -1165,6 +1153,47 @@ igt_pm_setup_pci_card_power_attrs(struct pci_device *pci_dev, bool save_attrs, i
>  	pci_iterator_destroy(iter);
>  }
>  
> +/**
> + * igt_pm_get_autosuspend_delay:
> + * @pci_dev: pci_dev.
> + * Get pci_dev autosuspend delay value from pci sysfs "autosuspend_delay_ms".
> + *
> + * Returns:
> + * autosuspend_delay_ms.
> + */
> +int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev)
> +{
> +	char delay_str[64];
> +	int delay, delay_fd;
> +
> +	delay_fd = igt_pm_get_power_attr_fd(pci_dev, "autosuspend_delay_ms");
> +	if (igt_pm_read_power_attr(delay_fd, delay_str, 64, true))
> +		igt_assert(sscanf(delay_str, "%d", &delay) > 0);
> +

Close delay_fd before exit.

> +	return delay;
> +}
> +
> +/**
> + * igt_pm_set_autosuspend_delay:
> + * @pci_dev: pci_dev.
> + * @delay_ms: autosuspend delay in ms.
> + * Set pci_dev autosuspend delay value through pci sysfs "autosuspend_delay_ms".
> + */
> +void igt_pm_set_autosuspend_delay(struct pci_device *pci_dev, int delay_ms)
> +{
> +	char delay_str[64];
> +	int delay_fd;
> +
> +	delay_fd = igt_pm_get_power_attr_fd(pci_dev, "autosuspend_delay_ms");
> +
> +	if (delay_ms >= 0) {
> +		int wc;
> +
> +		wc = snprintf(delay_str, 64, "%d\n", delay_ms);
> +		igt_pm_write_power_attr(delay_fd, delay_str, wc);
> +	}

Same here, close delay_fd

Regards,
Kamil

> +}
> +
>  /**
>   * igt_pm_enable_pci_card_runtime_pm:
>   * @root: root port pci_dev.
> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> index 306a9eb46..8394315c6 100644
> --- a/lib/igt_pm.h
> +++ b/lib/igt_pm.h
> @@ -77,6 +77,8 @@ int igt_pm_get_pcie_acpihp_slot(struct pci_device *pci_dev);
>  bool igt_pm_acpi_d3cold_supported(struct pci_device *pci_dev);
>  enum igt_acpi_d_state
>  igt_pm_get_acpi_real_d_state(struct pci_device *pci_dev);
> +int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev);
> +void igt_pm_set_autosuspend_delay(struct pci_device *pci_dev, int delay_ms);
>  void igt_pm_enable_pci_card_runtime_pm(struct pci_device *root,
>  				       struct pci_device *i915);
>  void igt_pm_get_d3cold_allowed(const char *pci_slot_name, uint32_t *value);
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH i-g-t v5 2/4] lib/igt_pm: Add helper to get/set auto_suspenddelay_ms
  2024-01-19 14:36   ` Kamil Konieczny
@ 2024-01-19 15:14     ` Gupta, Anshuman
  0 siblings, 0 replies; 11+ messages in thread
From: Gupta, Anshuman @ 2024-01-19 15:14 UTC (permalink / raw)
  To: Kamil Konieczny, igt-dev@lists.freedesktop.org; +Cc: Vivi, Rodrigo



> -----Original Message-----
> From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> Sent: Friday, January 19, 2024 8:06 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Gupta, Anshuman <anshuman.gupta@intel.com>; Vivi, Rodrigo
> <rodrigo.vivi@intel.com>
> Subject: Re: [PATCH i-g-t v5 2/4] lib/igt_pm: Add helper to get/set
> auto_suspenddelay_ms
> 
> Hi Anshuman,
> On 2024-01-19 at 19:58:21 +0530, Anshuman Gupta wrote:
> > Sometimes we want to test pm igt test with an explicit auto suspend
> > delay, therefore adding helpers to get/set the pci_dev
> > auto_suspenddelay_ms.
> >
> > Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> > ---
> >  lib/igt_pm.c | 53
> > ++++++++++++++++++++++++++++++++++++++++------------
> >  lib/igt_pm.h |  2 ++
> >  2 files changed, 43 insertions(+), 12 deletions(-)
> >
> > diff --git a/lib/igt_pm.c b/lib/igt_pm.c index c2d98fceb..d436c2c50
> > 100644
> > --- a/lib/igt_pm.c
> > +++ b/lib/igt_pm.c
> > @@ -1068,18 +1068,6 @@ static void igt_pm_write_power_attr(int fd,
> const char *val, int len)
> >  	igt_assert(strncmp(buf, val, len) == 0);  }
> >
> > -static int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev)
> > -{
> > -	char delay_str[64];
> > -	int delay, delay_fd;
> > -
> > -	delay_fd = igt_pm_get_power_attr_fd(pci_dev,
> "autosuspend_delay_ms");
> > -	if (igt_pm_read_power_attr(delay_fd, delay_str, 64, true))
> > -		igt_assert(sscanf(delay_str, "%d", &delay) > 0);
> > -
> > -	return delay;
> > -}
> > -
> >  static void
> >  igt_pm_setup_pci_dev_power_attrs(struct pci_device *pci_dev,
> >  				 struct igt_pm_pci_dev_pwrattr *pwrattr, int
> delay_ms) @@ -1165,6
> > +1153,47 @@ igt_pm_setup_pci_card_power_attrs(struct pci_device
> *pci_dev, bool save_attrs, i
> >  	pci_iterator_destroy(iter);
> >  }
> >
> > +/**
> > + * igt_pm_get_autosuspend_delay:
> > + * @pci_dev: pci_dev.
> > + * Get pci_dev autosuspend delay value from pci sysfs
> "autosuspend_delay_ms".
> > + *
> > + * Returns:
> > + * autosuspend_delay_ms.
> > + */
> > +int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev) {
> > +	char delay_str[64];
> > +	int delay, delay_fd;
> > +
> > +	delay_fd = igt_pm_get_power_attr_fd(pci_dev,
> "autosuspend_delay_ms");
> > +	if (igt_pm_read_power_attr(delay_fd, delay_str, 64, true))
> > +		igt_assert(sscanf(delay_str, "%d", &delay) > 0);
> > +
> 
> Close delay_fd before exit.
Thanks for catching this, will fix this.
Anshuman
> 
> > +	return delay;
> > +}
> > +
> > +/**
> > + * igt_pm_set_autosuspend_delay:
> > + * @pci_dev: pci_dev.
> > + * @delay_ms: autosuspend delay in ms.
> > + * Set pci_dev autosuspend delay value through pci sysfs
> "autosuspend_delay_ms".
> > + */
> > +void igt_pm_set_autosuspend_delay(struct pci_device *pci_dev, int
> > +delay_ms) {
> > +	char delay_str[64];
> > +	int delay_fd;
> > +
> > +	delay_fd = igt_pm_get_power_attr_fd(pci_dev,
> > +"autosuspend_delay_ms");
> > +
> > +	if (delay_ms >= 0) {
> > +		int wc;
> > +
> > +		wc = snprintf(delay_str, 64, "%d\n", delay_ms);
> > +		igt_pm_write_power_attr(delay_fd, delay_str, wc);
> > +	}
> 
> Same here, close delay_fd
> 
> Regards,
> Kamil
> 
> > +}
> > +
> >  /**
> >   * igt_pm_enable_pci_card_runtime_pm:
> >   * @root: root port pci_dev.
> > diff --git a/lib/igt_pm.h b/lib/igt_pm.h index 306a9eb46..8394315c6
> > 100644
> > --- a/lib/igt_pm.h
> > +++ b/lib/igt_pm.h
> > @@ -77,6 +77,8 @@ int igt_pm_get_pcie_acpihp_slot(struct pci_device
> > *pci_dev);  bool igt_pm_acpi_d3cold_supported(struct pci_device
> > *pci_dev);  enum igt_acpi_d_state  igt_pm_get_acpi_real_d_state(struct
> > pci_device *pci_dev);
> > +int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev); void
> > +igt_pm_set_autosuspend_delay(struct pci_device *pci_dev, int
> > +delay_ms);
> >  void igt_pm_enable_pci_card_runtime_pm(struct pci_device *root,
> >  				       struct pci_device *i915);
> >  void igt_pm_get_d3cold_allowed(const char *pci_slot_name, uint32_t
> > *value);
> > --
> > 2.25.1
> >

^ permalink raw reply	[flat|nested] 11+ messages in thread

* ✗ Fi.CI.BAT: failure for Add d3 mmap test (rev4)
  2024-01-19 14:28 [PATCH i-g-t v5 0/4] Add d3 mmap test Anshuman Gupta
                   ` (3 preceding siblings ...)
  2024-01-19 14:28 ` [PATCH i-g-t v5 4/4] HAX: Add d3-mmap to xe-fast-feedback Anshuman Gupta
@ 2024-01-19 15:26 ` Patchwork
  2024-01-19 15:39 ` ✓ CI.xeBAT: success " Patchwork
  5 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2024-01-19 15:26 UTC (permalink / raw)
  To: Gupta, Anshuman; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 8929 bytes --]

== Series Details ==

Series: Add d3 mmap test (rev4)
URL   : https://patchwork.freedesktop.org/series/124115/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_14146 -> IGTPW_10564
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_10564 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_10564, please notify your bug team (I915-ci-infra@lists.freedesktop.org) to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/index.html

Participating hosts (37 -> 38)
------------------------------

  Additional (2): bat-dg2-8 fi-bsw-nick 
  Missing    (1): fi-snb-2520m 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_10564:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live@gt_heartbeat:
    - bat-jsl-3:          [PASS][1] -> [DMESG-FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14146/bat-jsl-3/igt@i915_selftest@live@gt_heartbeat.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-jsl-3/igt@i915_selftest@live@gt_heartbeat.html

  * igt@i915_selftest@live@gt_timelines:
    - bat-adlm-1:         [PASS][3] -> [INCOMPLETE][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14146/bat-adlm-1/igt@i915_selftest@live@gt_timelines.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-adlm-1/igt@i915_selftest@live@gt_timelines.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * igt@i915_selftest@live@requests:
    - {bat-adls-6}:       [PASS][5] -> [INCOMPLETE][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14146/bat-adls-6/igt@i915_selftest@live@requests.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-adls-6/igt@i915_selftest@live@requests.html

  
Known issues
------------

  Here are the changes found in IGTPW_10564 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_lmem_swapping@parallel-random-engines:
    - fi-bsw-nick:        NOTRUN -> [SKIP][7] ([fdo#109271]) +15 other tests skip
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/fi-bsw-nick/igt@gem_lmem_swapping@parallel-random-engines.html

  * igt@gem_mmap@basic:
    - bat-dg2-8:          NOTRUN -> [SKIP][8] ([i915#4083])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@gem_mmap@basic.html

  * igt@gem_mmap_gtt@basic:
    - bat-dg2-8:          NOTRUN -> [SKIP][9] ([i915#4077]) +2 other tests skip
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@gem_mmap_gtt@basic.html

  * igt@gem_tiled_pread_basic:
    - bat-dg2-8:          NOTRUN -> [SKIP][10] ([i915#4079]) +1 other test skip
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@gem_tiled_pread_basic.html

  * igt@i915_pm_rps@basic-api:
    - bat-dg2-8:          NOTRUN -> [SKIP][11] ([i915#6621])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@i915_pm_rps@basic-api.html

  * igt@i915_suspend@basic-s3-without-i915:
    - bat-dg2-8:          NOTRUN -> [SKIP][12] ([i915#6645])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@i915_suspend@basic-s3-without-i915.html

  * igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
    - bat-dg2-8:          NOTRUN -> [SKIP][13] ([i915#5190])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html

  * igt@kms_addfb_basic@basic-y-tiled-legacy:
    - bat-dg2-8:          NOTRUN -> [SKIP][14] ([i915#4215] / [i915#5190])
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@kms_addfb_basic@basic-y-tiled-legacy.html

  * igt@kms_addfb_basic@framebuffer-vs-set-tiling:
    - bat-dg2-8:          NOTRUN -> [SKIP][15] ([i915#4212]) +7 other tests skip
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@kms_addfb_basic@framebuffer-vs-set-tiling.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
    - bat-dg2-8:          NOTRUN -> [SKIP][16] ([i915#4103] / [i915#4213]) +1 other test skip
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy.html

  * igt@kms_force_connector_basic@force-load-detect:
    - bat-dg2-8:          NOTRUN -> [SKIP][17] ([fdo#109285])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_force_connector_basic@prune-stale-modes:
    - bat-dg2-8:          NOTRUN -> [SKIP][18] ([i915#5274])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@kms_force_connector_basic@prune-stale-modes.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-a-hdmi-a-1:
    - bat-rpls-2:         [PASS][19] -> [ABORT][20] ([i915#10117])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14146/bat-rpls-2/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-a-hdmi-a-1.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-rpls-2/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-a-hdmi-a-1.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-1:
    - bat-dg2-8:          NOTRUN -> [INCOMPLETE][21] ([i915#9280])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-1.html

  * igt@kms_pm_backlight@basic-brightness:
    - bat-dg2-8:          NOTRUN -> [SKIP][22] ([i915#5354])
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@kms_pm_backlight@basic-brightness.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - bat-dg2-8:          NOTRUN -> [SKIP][23] ([i915#3555])
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@kms_setmode@basic-clone-single-crtc.html

  * igt@prime_vgem@basic-fence-flip:
    - bat-dg2-8:          NOTRUN -> [SKIP][24] ([i915#3708])
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@prime_vgem@basic-fence-flip.html

  * igt@prime_vgem@basic-fence-mmap:
    - bat-dg2-8:          NOTRUN -> [SKIP][25] ([i915#3708] / [i915#4077]) +1 other test skip
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@prime_vgem@basic-fence-mmap.html

  * igt@prime_vgem@basic-write:
    - bat-dg2-8:          NOTRUN -> [SKIP][26] ([i915#3291] / [i915#3708]) +2 other tests skip
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/bat-dg2-8/igt@prime_vgem@basic-write.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [i915#10117]: https://gitlab.freedesktop.org/drm/intel/issues/10117
  [i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
  [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
  [i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
  [i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
  [i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
  [i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
  [i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
  [i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
  [i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
  [i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
  [i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
  [i915#9280]: https://gitlab.freedesktop.org/drm/intel/issues/9280
  [i915#9673]: https://gitlab.freedesktop.org/drm/intel/issues/9673
  [i915#9732]: https://gitlab.freedesktop.org/drm/intel/issues/9732


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7683 -> IGTPW_10564

  CI-20190529: 20190529
  CI_DRM_14146: 873aee20af09054189670092b2d6fe03824777b5 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_10564: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/index.html
  IGT_7683: 7683


Testlist changes
----------------

+igt@xe_pm@d3-mmap-system
+igt@xe_pm@d3-mmap-vram

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/index.html

[-- Attachment #2: Type: text/html, Size: 10255 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH i-g-t v5 3/4] tests/xe_pm: Add d3-mmap IGT test
  2024-01-19 14:28 ` [PATCH i-g-t v5 3/4] tests/xe_pm: Add d3-mmap IGT test Anshuman Gupta
@ 2024-01-19 15:33   ` Nilawar, Badal
  0 siblings, 0 replies; 11+ messages in thread
From: Nilawar, Badal @ 2024-01-19 15:33 UTC (permalink / raw)
  To: Anshuman Gupta, igt-dev; +Cc: Rodrigo Vivi



On 19-01-2024 19:58, Anshuman Gupta wrote:
> Adding a test to validate mmap memory mappings along with runtime
> suspend and resume for both xe device and it's pci parent bridge
> in device hierarchy.
> 
> v2:
> - Use 0xc00fee pattern. [Rodrigo]
> - Test the pagefault case on read and write the mapping. [Rodrigo]
> 
> v3:
> - Cosmetic comment. [Kamil]
> - Use MAGIC macro for 0xc0ffe and 0xdeadbeef. [Kamil]
> - Fix xe_bo_create() with respect to Xe uapi.
> - Set auto_suspend delay to 1000ms and restore it.
> 
> v4:
> - Set autosuspend delay to 1 sec for entire test. [Badal]
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>   tests/intel/xe_pm.c | 99 +++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 99 insertions(+)
> 
> diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
> index f793fd24e..9cb25d47c 100644
> --- a/tests/intel/xe_pm.c
> +++ b/tests/intel/xe_pm.c
> @@ -30,6 +30,8 @@
>   #define NO_RPM -1
>   
>   #define SIZE (4096 * 1024)
> +#define MAGIC_1 0xc0ffee
> +#define MAGIC_2 0xdeadbeef
>   
>   typedef struct {
>   	int fd_xe;
> @@ -476,6 +478,79 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
>   	igt_assert(in_d3(device, IGT_ACPI_D3Cold));
>   }
>   
> +/**
> + * SUBTEST: d3-mmap-%s
> + * Description:
> + *	Validate mmap memory mapping with d3 state, for %arg[1] region,
> + *	if supported by device.
> + * arg[1]:
> + *
> + * @vram:	vram region
> + * @system:	system region
> + *
> + * Functionality: pm-d3
> + * Run type: FULL
> + */
> +static void test_mmap(device_t device, uint32_t placement, uint32_t flags)
> +{
> +	size_t bo_size = 8192;
> +	uint32_t *map = NULL;
> +	uint32_t bo;
> +	int i;
> +
> +	igt_require_f(placement, "Device doesn't support such memory region\n");
> +
> +	bo_size = ALIGN(bo_size, xe_get_default_alignment(device.fd_xe));
> +
> +	bo = xe_bo_create(device.fd_xe, 0, bo_size, placement, flags);
> +	map = xe_bo_map(device.fd_xe, bo, bo_size);
> +	igt_assert(map);
> +	memset(map, 0, bo_size);
> +
> +	fw_handle = igt_debugfs_open(device.fd_xe, "forcewake_all", O_RDONLY);
> +
> +	igt_assert(fw_handle >= 0);
> +	igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
> +
> +	for (i = 0; i < bo_size / sizeof(*map); i++)
> +		map[i] = MAGIC_1;
> +
> +	for (i = 0; i < bo_size / sizeof(*map); i++)
> +		igt_assert(map[i] == MAGIC_1);
> +
> +	/* Runtime suspend and validate the pattern and changed the pattern */
> +	close(fw_handle);
> +	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
> +
> +	for (i = 0; i < bo_size / sizeof(*map); i++)
> +		igt_assert(map[i] == MAGIC_1);
> +
> +	/* dgfx page-fault on mmaping should wake the gpu */
> +	if (xe_has_vram(device.fd_xe))
> +		igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
> +
> +	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
> +
> +	for (i = 0; i < bo_size / sizeof(*map); i++)
> +		map[i] = MAGIC_2;
> +
> +	if (xe_has_vram(device.fd_xe))
> +		igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
> +
> +	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
> +
> +	/* Runtime resume and check the pattern */
> +	fw_handle = igt_debugfs_open(device.fd_xe, "forcewake_all", O_RDONLY);
> +	igt_assert(fw_handle >= 0);
> +	igt_assert(igt_get_runtime_pm_status() == IGT_RUNTIME_PM_STATUS_ACTIVE);
> +	for (i = 0; i < bo_size / sizeof(*map); i++)
> +		igt_assert(map[i] == MAGIC_2);
> +
> +	igt_assert(munmap(map, bo_size) == 0);
> +	gem_close(device.fd_xe, bo);
> +	close(fw_handle);
> +}
> +
>   igt_main
>   {
>   	struct drm_xe_engine_class_instance *hwe;
> @@ -591,6 +666,30 @@ igt_main
>   			igt_install_exit_handler(vram_d3cold_threshold_restore);
>   			test_vram_d3cold_threshold(device, sysfs_fd);
>   		}
> +
> +		igt_describe("Validate mmap memory mappings with system region,"
> +			     "when device along with parent bridge in d3");
> +		igt_subtest("d3-mmap-system") {
> +			test_mmap(device, system_memory(device.fd_xe), 0);
> +		}
> +
> +		igt_describe("Validate mmap memory mappings with vram region,"
> +			     "when device along with parent bridge in d3");
> +		igt_subtest("d3-mmap-vram") {
> +			int delay_ms;
> +
> +			if (device.pci_root != device.pci_xe) {
> +				igt_pm_enable_pci_card_runtime_pm(device.pci_root, NULL);
> +				igt_pm_set_d3cold_allowed(device.pci_slot_name, 1);
> +			}
> +
> +			delay_ms = igt_pm_get_autosuspend_delay(device.pci_xe);
> +
> +			/* Give some auto suspend delay to validate rpm active during page fault */
> +			igt_pm_set_autosuspend_delay(device.pci_xe, 1000);
> +			test_mmap(device, vram_memory(device.fd_xe, 0), DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
> +			igt_pm_set_autosuspend_delay(device.pci_xe, delay_ms);
LGTM:
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>

Thanks,
Badal
> +		}
>   	}
>   
>   	igt_fixture {

^ permalink raw reply	[flat|nested] 11+ messages in thread

* ✓ CI.xeBAT: success for Add d3 mmap test (rev4)
  2024-01-19 14:28 [PATCH i-g-t v5 0/4] Add d3 mmap test Anshuman Gupta
                   ` (4 preceding siblings ...)
  2024-01-19 15:26 ` ✗ Fi.CI.BAT: failure for Add d3 mmap test (rev4) Patchwork
@ 2024-01-19 15:39 ` Patchwork
  5 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2024-01-19 15:39 UTC (permalink / raw)
  To: Gupta, Anshuman; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]

== Series Details ==

Series: Add d3 mmap test (rev4)
URL   : https://patchwork.freedesktop.org/series/124115/
State : success

== Summary ==

CI Bug Log - changes from XEIGT_7683_BAT -> XEIGTPW_10564_BAT
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  

Participating hosts (4 -> 4)
------------------------------

  No changes in participating hosts

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in XEIGTPW_10564_BAT:

### IGT changes ###

#### Possible regressions ####

  * {igt@xe_pm@d3-mmap-system} (NEW):
    - bat-adlp-7:         NOTRUN -> [FAIL][1]
   [1]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10564/bat-adlp-7/igt@xe_pm@d3-mmap-system.html
    - bat-pvc-2:          NOTRUN -> [FAIL][2]
   [2]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10564/bat-pvc-2/igt@xe_pm@d3-mmap-system.html
    - bat-dg2-oem2:       NOTRUN -> [FAIL][3] +1 other test fail
   [3]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10564/bat-dg2-oem2/igt@xe_pm@d3-mmap-system.html
    - bat-atsm-2:         NOTRUN -> [FAIL][4]
   [4]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10564/bat-atsm-2/igt@xe_pm@d3-mmap-system.html

  * {igt@xe_pm@d3-mmap-vram} (NEW):
    - bat-adlp-7:         NOTRUN -> [SKIP][5]
   [5]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10564/bat-adlp-7/igt@xe_pm@d3-mmap-vram.html

  
New tests
---------

  New tests have been introduced between XEIGT_7683_BAT and XEIGTPW_10564_BAT:

### New IGT tests (2) ###

  * igt@xe_pm@d3-mmap-system:
    - Statuses : 4 fail(s)
    - Exec time: [0.14, 10.58] s

  * igt@xe_pm@d3-mmap-vram:
    - Statuses : 1 fail(s) 2 pass(s) 1 skip(s)
    - Exec time: [0.0, 10.57] s

  

  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).



Build changes
-------------

  * IGT: IGT_7683 -> IGTPW_10564
  * Linux: xe-644-238e8655c184b7cf16731690b59da560641a07ad -> xe-653-873aee20af09054189670092b2d6fe03824777b5

  IGTPW_10564: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10564/index.html
  IGT_7683: 7683
  xe-644-238e8655c184b7cf16731690b59da560641a07ad: 238e8655c184b7cf16731690b59da560641a07ad
  xe-653-873aee20af09054189670092b2d6fe03824777b5: 873aee20af09054189670092b2d6fe03824777b5

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10564/index.html

[-- Attachment #2: Type: text/html, Size: 3189 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-01-19 15:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-19 14:28 [PATCH i-g-t v5 0/4] Add d3 mmap test Anshuman Gupta
2024-01-19 14:28 ` [PATCH i-g-t v5 1/4] test/xe_pm: Add exit handler to close fw handle Anshuman Gupta
2024-01-19 14:28 ` [PATCH i-g-t v5 2/4] lib/igt_pm: Add helper to get/set auto_suspenddelay_ms Anshuman Gupta
2024-01-19 14:36   ` Kamil Konieczny
2024-01-19 15:14     ` Gupta, Anshuman
2024-01-19 14:28 ` [PATCH i-g-t v5 3/4] tests/xe_pm: Add d3-mmap IGT test Anshuman Gupta
2024-01-19 15:33   ` Nilawar, Badal
2024-01-19 14:28 ` [PATCH i-g-t v5 4/4] HAX: Add d3-mmap to xe-fast-feedback Anshuman Gupta
2024-01-19 15:26 ` ✗ Fi.CI.BAT: failure for Add d3 mmap test (rev4) Patchwork
2024-01-19 15:39 ` ✓ CI.xeBAT: success " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-01-19 11:55 [PATCH i-g-t v5 0/4] Add d3 mmap test Anshuman Gupta
2024-01-19 11:55 ` [PATCH i-g-t v5 3/4] tests/xe_pm: Add d3-mmap IGT test Anshuman Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox