public inbox for igt-dev@lists.freedesktop.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>,
	"Janne Grunau" <j@jannau.net>,
	"Danilo Krummrich" <dakr@kernel.org>,
	kernel@collabora.com
Subject: [PATCH v1 2/4] panthor: Move issue_store_multiple into library file
Date: Fri, 13 Mar 2026 17:58:29 +0000	[thread overview]
Message-ID: <20260313175908.1752151-3-adrian.larumbe@collabora.com> (raw)
In-Reply-To: <20260313175908.1752151-1-adrian.larumbe@collabora.com>

Goal of this move is making it available for other test groups.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
 lib/igt_panthor.c             | 38 +++++++++++++++++++++++++++++++++++
 lib/igt_panthor.h             |  1 +
 tests/panthor/panthor_group.c | 34 +++----------------------------
 3 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/lib/igt_panthor.c b/lib/igt_panthor.c
index 49b427d4f162..3c96a40b7c45 100644
--- a/lib/igt_panthor.c
+++ b/lib/igt_panthor.c
@@ -371,3 +371,41 @@ void igt_panthor_free_bo(int fd, struct panthor_bo *bo)
 
 	gem_close(fd, bo->handle);
 }
+
+/**
+ * igt_panthor_issue_store_multiple:
+ * @cs: command stream kernel VA
+ * @device_va: device virtual address for the store instruction
+ * @constant: immediate operand value to embedded in store instruction
+ *
+ * Perform an immediate operand store in the VA of device_va
+ */
+size_t
+igt_panthor_issue_store_multiple(uint8_t *cs, uint64_t device_va, uint32_t constant)
+{
+	const uint8_t kernel_va_reg = 68;
+	const uint8_t constant_reg = 70;
+	uint64_t instrs[] = {
+		/* MOV48: Load the source register ([r68; r69]) with the kernel address */
+		cs_mov48(kernel_va_reg, device_va),
+		/* MOV32: Load a known constant into r70 */
+		cs_mov32(constant_reg, constant),
+		/* STORE_MULTIPLE: Store the first register to the address pointed
+		 * to by [r68; r69]
+		 */
+		cs_stm32(kernel_va_reg, constant_reg, 0),
+		/* FLUSH all Wait for all cores */
+		cs_wait(0xff, false),
+		/* MOV32: Clear r70 to 0 */
+		cs_mov32(constant_reg, 0),
+		/* FLUSH_CACHE: Clean and invalidate all caches */
+		cs_flush(CS_FLUSH_MODE_CLEAN_AND_INVALIDATE,
+			 CS_FLUSH_MODE_CLEAN_AND_INVALIDATE,
+			 CS_FLUSH_MODE_INVALIDATE,
+			 0, constant_reg, 1),
+		cs_wait(0xff, false),
+	};
+
+	memcpy(cs, instrs, sizeof(instrs));
+	return sizeof(instrs);
+}
diff --git a/lib/igt_panthor.h b/lib/igt_panthor.h
index 97a2b749707d..a4756e8e88ab 100644
--- a/lib/igt_panthor.h
+++ b/lib/igt_panthor.h
@@ -37,6 +37,7 @@ void igt_panthor_group_submit_simple(int fd, uint32_t group_handle,
 				     uint32_t stream_size, uint32_t syncobj_handle,
 				     int err);
 uint64_t igt_panthor_get_first_core(uint64_t cores_present);
+size_t igt_panthor_issue_store_multiple(uint8_t *cs, uint64_t device_va, uint32_t constant);
 
 static inline void igt_panthor_vm_bind(int fd, uint32_t vm_id, uint32_t bo_handle,
 				       uint64_t va, uint64_t size, uint32_t flags, int err)
diff --git a/tests/panthor/panthor_group.c b/tests/panthor/panthor_group.c
index 13636e60c0e7..f2058c59786c 100644
--- a/tests/panthor/panthor_group.c
+++ b/tests/panthor/panthor_group.c
@@ -10,36 +10,6 @@
 #include "igt_syncobj.h"
 #include "panthor_drm.h"
 
-static size_t
-issue_store_multiple(uint8_t *cs, uint64_t kernel_va, uint32_t constant)
-{
-	const uint8_t kernel_va_reg = 68;
-	const uint8_t constant_reg = 70;
-	uint64_t instrs[] = {
-		/* MOV48: Load the source register ([r68; r69]) with the kernel address */
-		cs_mov48(kernel_va_reg, kernel_va),
-		/* MOV32: Load a known constant into r70 */
-		cs_mov32(constant_reg, constant),
-		/* STORE_MULTIPLE: Store the first register to the address pointed
-		 * to by [r68; r69]
-		 */
-		cs_stm32(kernel_va_reg, constant_reg, 0),
-		/* FLUSH all Wait for all cores */
-		cs_wait(0xff, false),
-		/* MOV32: Clear r70 to 0 */
-		cs_mov32(constant_reg, 0),
-		/* FLUSH_CACHE: Clean and invalidate all caches */
-		cs_flush(CS_FLUSH_MODE_CLEAN_AND_INVALIDATE,
-			 CS_FLUSH_MODE_CLEAN_AND_INVALIDATE,
-			 CS_FLUSH_MODE_INVALIDATE,
-			 0, constant_reg, 1),
-		cs_wait(0xff, false),
-	};
-
-	memcpy(cs, instrs, sizeof(instrs));
-	return sizeof(instrs);
-}
-
 int igt_main() {
 	int fd;
 
@@ -94,7 +64,9 @@ int igt_main() {
 				    result_bo.size, DRM_PANTHOR_VM_BIND_OP_TYPE_MAP, 0);
 		result_gpu_addr = INITIAL_VA + 4096;
 
-		command_stream_size = issue_store_multiple(cmd_buf_bo.map, result_gpu_addr, 0xdeadbeef);
+		command_stream_size = igt_panthor_issue_store_multiple(cmd_buf_bo.map,
+								       result_gpu_addr,
+								       0xdeadbeef);
 
 		group_handle = igt_panthor_group_create_simple(fd, vm_id, 0);
 		igt_assert_neq(group_handle, 0);
-- 
2.53.0


  parent reply	other threads:[~2026-03-13 17:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 17:58 [PATCH v1 0/4] Test panthor repeated mappings Adrián Larumbe
2026-03-13 17:58 ` [PATCH v1 1/4] drm-uapi/panthor: Sync panthor uapi Adrián Larumbe
2026-03-16 12:21   ` Kamil Konieczny
2026-03-13 17:58 ` Adrián Larumbe [this message]
2026-03-13 17:58 ` [PATCH v1 3/4] test/panthor: Add support for repeated mappings Adrián Larumbe
2026-03-13 17:58 ` [PATCH v1 4/4] tests/panthor: Add VM_BIND repeat tests Adrián Larumbe
2026-03-13 18:28 ` ✓ Xe.CI.BAT: success for Test panthor repeated mappings Patchwork
2026-03-13 19:05 ` ✗ i915.CI.BAT: failure " Patchwork
2026-03-14 22:35 ` ✗ Xe.CI.FULL: " 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=20260313175908.1752151-3-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=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=j@jannau.net \
    --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