Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Adrián Larumbe" <adrian.larumbe@collabora.com>
To: igt-dev@lists.freedesktop.org,
	Petri Latvala <adrinael@adrinael.net>,
	Arkadiusz Hiler <arek@hiler.eu>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
	Bhanuprakash Modem <bhanuprakash.modem@gmail.com>
Cc: "Boris Brezillon" <boris.brezillon@collabora.com>,
	"Steven Price" <steven.price@arm.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Adrián Larumbe" <adrian.larumbe@collabora.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	kernel@collabora.com
Subject: [PATCH v2 3/3] tests/panthor: Add Panthor sparse VM_BIND tests
Date: Fri,  8 May 2026 18:25:35 +0100	[thread overview]
Message-ID: <20260508172537.3456595-4-adrian.larumbe@collabora.com> (raw)
In-Reply-To: <20260508172537.3456595-1-adrian.larumbe@collabora.com>

In a separate file for the time being, but should eventually be
incorporated into panthor_vm.c.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
 tests/panthor/meson.build         |   1 +
 tests/panthor/panthor_vm_sparse.c | 316 ++++++++++++++++++++++++++++++
 2 files changed, 317 insertions(+)
 create mode 100644 tests/panthor/panthor_vm_sparse.c

diff --git a/tests/panthor/meson.build b/tests/panthor/meson.build
index 42a46e9934a9..f9509ecd8816 100644
--- a/tests/panthor/meson.build
+++ b/tests/panthor/meson.build
@@ -3,6 +3,7 @@ panthor_progs = [
 	'panthor_group',
 	'panthor_query',
 	'panthor_vm',
+        'panthor_vm_sparse',
 ]
 
 foreach prog : panthor_progs
diff --git a/tests/panthor/panthor_vm_sparse.c b/tests/panthor/panthor_vm_sparse.c
new file mode 100644
index 000000000000..fe7d25542f41
--- /dev/null
+++ b/tests/panthor/panthor_vm_sparse.c
@@ -0,0 +1,316 @@
+// SPDX-License-Identifier: MIT
+// SPDX-FileCopyrightText: Copyright (C) 2025 Collabora Ltd.
+
+#include "igt.h"
+#include "igt_core.h"
+#include "igt_panthor.h"
+#include "panthor_drm.h"
+
+int
+igt_main()
+{
+	int fd;
+
+	igt_fixture() {
+		fd = drm_open_driver(DRIVER_PANTHOR);
+	}
+
+	igt_subtest("vm_bind_sparse") {
+		uint32_t vm_id;
+		uint64_t map_size = SZ_4K * 4;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, SZ_2M, map_size, 0);
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_partial_unmap_start_size_unaligned") {
+		uint32_t vm_id;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+		igt_panthor_vm_bind(fd, vm_id, 0, INITIAL_VA, SZ_4K * 2,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_UNMAP, 0);
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_partial_unmap_start_size_aligned") {
+		uint32_t vm_id;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+		igt_panthor_vm_bind(fd, vm_id, 0, INITIAL_VA, SZ_2M,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_UNMAP, 0);
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest
+	    ("vm_bind_sparse_partial_unmap_start_size_unaligned_no_gpupage_multiple") {
+		uint32_t vm_id;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+		igt_panthor_vm_bind(fd, vm_id, 0, INITIAL_VA, 4 * SZ_64K,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_UNMAP, 0);
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_partial_unmap_below_start") {
+		uint32_t vm_id;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+		igt_panthor_vm_bind(fd, vm_id, 0, INITIAL_VA - SZ_2M, SZ_2M * 3,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_UNMAP, 0);
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_partial_unmap_above_start") {
+		uint32_t vm_id;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+		igt_panthor_vm_bind(fd, vm_id, 0, INITIAL_VA + SZ_2M, SZ_2M,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_UNMAP, 0);
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle, INITIAL_VA + SZ_2M, SZ_2M * 2,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap_start_unaligned") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle, INITIAL_VA + map_size - SZ_1M,
+				    SZ_4M, DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap_start_size_unaligned") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle, INITIAL_VA + map_size - SZ_1M,
+				    SZ_1M, DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap_start_size_aligned") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle,
+				    INITIAL_VA + map_size - SZ_2M, SZ_4M,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap_aligned_split_original_va") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle, INITIAL_VA + SZ_2M,
+				    SZ_2M, DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap_start_aligned_size_unaligned") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle, INITIAL_VA + SZ_2M,
+				    SZ_1M, DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap_aligned_intersect_left") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle,
+				    INITIAL_VA - SZ_2M, SZ_2M * 2,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap_size_unaligned_intersect_left") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle,
+				    INITIAL_VA - SZ_2M, SZ_1M * 2,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap_start_aligned_intersect_right") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle,
+				    INITIAL_VA + map_size - SZ_2M, SZ_2M + SZ_4K * 6,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_remap_wrap_around_va") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = SZ_2M * 3;
+		const int INITIAL_VA = SZ_4M;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, SZ_8M, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle, INITIAL_VA - SZ_2M,
+				    SZ_8M, DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_subtest("vm_bind_sparse_high_vas") {
+		uint32_t vm_id;
+		struct panthor_bo bo;
+		uint64_t map_size = 16 * SZ_4K;
+		const uint64_t INITIAL_VA = 0x7fffffff0000;
+
+		igt_panthor_vm_create(fd, &vm_id, 0);
+		igt_assert(vm_id != 0);
+
+		igt_panthor_vm_bind_sparse(fd, vm_id, INITIAL_VA, map_size, 0);
+
+		/* Now attempt normal VM_BIND's that intersect with the previous chunk */
+		igt_panthor_bo_create(fd, &bo, map_size, 0, 0);
+		igt_panthor_vm_bind(fd, vm_id, bo.handle, INITIAL_VA, SZ_4K,
+				    DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
+
+		igt_panthor_vm_destroy(fd, vm_id, 0);
+	}
+
+	igt_fixture() {
+		drm_close_driver(fd);
+	}
+}
-- 
2.53.0


  parent reply	other threads:[~2026-05-08 17:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 17:25 [PATCH v2 0/3] Test panthor sparse mappings Adrián Larumbe
2026-05-08 17:25 ` [PATCH v2 1/3] drm-uapi/panthor: sync with kernel 5731bca6a656 Adrián Larumbe
2026-05-13 14:04   ` Kamil Konieczny
2026-05-08 17:25 ` [PATCH v2 2/3] panthor: Add IGT library helper for Panthor sparse mappings Adrián Larumbe
2026-05-13 14:00   ` Kamil Konieczny
2026-05-08 17:25 ` Adrián Larumbe [this message]
2026-05-13 13:54   ` [PATCH v2 3/3] tests/panthor: Add Panthor sparse VM_BIND tests Kamil Konieczny
2026-05-13 14:48   ` Kamil Konieczny
2026-05-09  0:55 ` ✓ i915.CI.BAT: success for Test panthor sparse mappings Patchwork
2026-05-09  1:14 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-09 14:25 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-05-10  2:32 ` ✓ i915.CI.Full: success " 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=20260508172537.3456595-4-adrian.larumbe@collabora.com \
    --to=adrian.larumbe@collabora.com \
    --cc=adrinael@adrinael.net \
    --cc=arek@hiler.eu \
    --cc=bhanuprakash.modem@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=daniel.almeida@collabora.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=kernel@collabora.com \
    --cc=liviu.dudau@arm.com \
    --cc=steven.price@arm.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