Skip to contentSkip to conversation

panthor: Enable compilation on big-endian arch

PATCH In review Kamil Konieczny 5 participants 6 messages Feb 19 – Mar 2 Library code

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 panthor: Enable compilation on big-endian arch

Compilation of Panthor was broken on big-endian due to a guard in pathor lib against such arch. Fix this and create and use function for skipping all panthor tests on such machines.

Also while at it, init fd so it could be safely used at last fixture.

v2: simplify test for big-endian, fix typo (Boris)

---
 lib/igt_panthor.c             | 11 +++++++++++
 lib/igt_panthor.h             |  6 ++----
 tests/panthor/panthor_gem.c   |  3 ++-
 tests/panthor/panthor_group.c |  3 ++-
 tests/panthor/panthor_query.c |  3 ++-
 tests/panthor/panthor_vm.c    |  3 ++-
 6 files changed, 21 insertions(+), 8 deletions(-)
lib/igt_panthor.c +11 -0
index 49b427d4f..7ffb61eb3 100644
@@ -6,6 +6,17 @@
 #include "ioctl_wrappers.h"
 #include "panthor_drm.h"
 
+/**
+ * igt_panthor_skip_on_big_endian:
+ *
+ * Skip Panthor test on big-endian machines.
+ */
+void igt_panthor_skip_on_big_endian(void)
+{
+	igt_skip_on_f(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__,
+		      "Panthor is unsupported on big-endian arch\n");
+}
+
 /**
  * igt_panthor_group_create:
  * @fd: device file descriptor
lib/igt_panthor.h +2 -4
index 97a2b7497..be8490840 100644
@@ -61,11 +61,9 @@ enum cs_flush_mode {
 };
 
 /* There's no plan to support big endian in the UMD, so keep
- * things simple and don't bother supporting it here either.
+ * things simple and don't bother supporting it.
  */
-#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#error "big endian not supported"
-#endif
+void igt_panthor_skip_on_big_endian(void);
 
 struct cs_instr {
 	union {
tests/panthor/panthor_gem.c +2 -1
index 57ba4bc82..6388addb0 100644
@@ -8,9 +8,10 @@
 #include "igt_panthor.h"
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
tests/panthor/panthor_group.c +2 -1
index 13636e60c..c79f8d629 100644
@@ -41,9 +41,10 @@ issue_store_multiple(uint8_t *cs, uint64_t kernel_va, uint32_t constant)
 }
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
tests/panthor/panthor_query.c +2 -1
index fa4f8ef26..afd58a5bd 100644
@@ -8,9 +8,10 @@
 #include <stdint.h>
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
tests/panthor/panthor_vm.c +2 -1
index 76a669843..92b105b9e 100644
@@ -7,9 +7,10 @@
 #include "panthor_drm.h"
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
Signature · 1 line
2.53.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · On Thu, 19 Feb 2026 16:05:24 +0100 Kamil Konieczny…

Compilation of Panthor was broken on big-endian due to a guard in pathor lib against such arch. Fix this and create and use function for skipping all panthor tests on such machines.

Also while at it, init fd so it could be safely used at last fixture.

Quoted 6 lines

v2: simplify test for big-endian, fix typo (Boris)

Thanks!

Boris

Quoted 113 lines
---
 lib/igt_panthor.c             | 11 +++++++++++
 lib/igt_panthor.h             |  6 ++----
 tests/panthor/panthor_gem.c   |  3 ++-
 tests/panthor/panthor_group.c |  3 ++-
 tests/panthor/panthor_query.c |  3 ++-
 tests/panthor/panthor_vm.c    |  3 ++-
 6 files changed, 21 insertions(+), 8 deletions(-)
lib/igt_panthor.c +11 -0
index 49b427d4f..7ffb61eb3 100644
@@ -6,6 +6,17 @@
 #include "ioctl_wrappers.h"
 #include "panthor_drm.h"
 
+/**
+ * igt_panthor_skip_on_big_endian:
+ *
+ * Skip Panthor test on big-endian machines.
+ */
+void igt_panthor_skip_on_big_endian(void)
+{
+	igt_skip_on_f(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__,
+		      "Panthor is unsupported on big-endian arch\n");
+}
+
 /**
  * igt_panthor_group_create:
  * @fd: device file descriptor
lib/igt_panthor.h +2 -4
index 97a2b7497..be8490840 100644
@@ -61,11 +61,9 @@ enum cs_flush_mode {
 };
 
 /* There's no plan to support big endian in the UMD, so keep
- * things simple and don't bother supporting it here either.
+ * things simple and don't bother supporting it.
  */
-#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#error "big endian not supported"
-#endif
+void igt_panthor_skip_on_big_endian(void);
 
 struct cs_instr {
 	union {
tests/panthor/panthor_gem.c +2 -1
index 57ba4bc82..6388addb0 100644
@@ -8,9 +8,10 @@
 #include "igt_panthor.h"
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
tests/panthor/panthor_group.c +2 -1
index 13636e60c..c79f8d629 100644
@@ -41,9 +41,10 @@ issue_store_multiple(uint8_t *cs, uint64_t kernel_va, uint32_t constant)
 }
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
tests/panthor/panthor_query.c +2 -1
index fa4f8ef26..afd58a5bd 100644
@@ -8,9 +8,10 @@
 #include <stdint.h>
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
tests/panthor/panthor_vm.c +2 -1
index 76a669843..92b105b9e 100644
@@ -7,9 +7,10 @@
 #include "panthor_drm.h"
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
Reviewed-by on v2 1/1
#2 lore raw
In reply to Kamil Konieczny
Quoted 133 lines · Kamil Konieczny

Compilation of Panthor was broken on big-endian due to a guard in pathor lib against such arch. Fix this and create and use function for skipping all panthor tests on such machines.

Also while at it, init fd so it could be safely used at last fixture.

v2: simplify test for big-endian, fix typo (Boris)

---

lib/igt_panthor.c             | 11 +++++++++++
lib/igt_panthor.h             |  6 ++----
tests/panthor/panthor_gem.c   |  3 ++-
tests/panthor/panthor_group.c |  3 ++-
tests/panthor/panthor_query.c |  3 ++-
tests/panthor/panthor_vm.c    |  3 ++-
6 files changed, 21 insertions(+), 8 deletions(-)
lib/igt_panthor.c +11 -0
index 49b427d4f..7ffb61eb3 100644
@@ -6,6 +6,17 @@
 #include "ioctl_wrappers.h"
 #include "panthor_drm.h"
 
+/**
+ * igt_panthor_skip_on_big_endian:
+ *
+ * Skip Panthor test on big-endian machines.
+ */
+void igt_panthor_skip_on_big_endian(void)
+{
+ igt_skip_on_f(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__,
+      "Panthor is unsupported on big-endian arch\n");
+}
+
 /**
 * igt_panthor_group_create:
 * @fd: device file descriptor
lib/igt_panthor.h +2 -4
index 97a2b7497..be8490840 100644
@@ -61,11 +61,9 @@ enum cs_flush_mode {
 };
 
 /* There's no plan to support big endian in the UMD, so keep
- * things simple and don't bother supporting it here either.
+ * things simple and don't bother supporting it.
 */
-#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#error "big endian not supported"
-#endif
+void igt_panthor_skip_on_big_endian(void);
 
 struct cs_instr {
 union {
tests/panthor/panthor_gem.c +2 -1
index 57ba4bc82..6388addb0 100644
@@ -8,9 +8,10 @@
 #include "igt_panthor.h"
 
 int igt_main() {
- int fd;
+ int fd = -1;
 
 igt_fixture() {
+ igt_panthor_skip_on_big_endian();
 fd = drm_open_driver(DRIVER_PANTHOR);
 }
 
tests/panthor/panthor_group.c +2 -1
index 13636e60c..c79f8d629 100644
@@ -41,9 +41,10 @@ issue_store_multiple(uint8_t *cs, uint64_t kernel_va, uint32_t constant)
 }
 
 int igt_main() {
- int fd;
+ int fd = -1;
 
 igt_fixture() {
+ igt_panthor_skip_on_big_endian();
 fd = drm_open_driver(DRIVER_PANTHOR);
 }
 
tests/panthor/panthor_query.c +2 -1
index fa4f8ef26..afd58a5bd 100644
@@ -8,9 +8,10 @@
 #include <stdint.h>
 
 int igt_main() {
- int fd;
+ int fd = -1;
 
 igt_fixture() {
+ igt_panthor_skip_on_big_endian();
 fd = drm_open_driver(DRIVER_PANTHOR);
 }
 
tests/panthor/panthor_vm.c +2 -1
index 76a669843..92b105b9e 100644
@@ -7,9 +7,10 @@
 #include "panthor_drm.h"
 
 int igt_main() {
- int fd;
+ int fd = -1;
 
 igt_fixture() {
+ igt_panthor_skip_on_big_endian();
 fd = drm_open_driver(DRIVER_PANTHOR);
 }
 
Signature · 1 line
2.53.0
#4 lore raw
In reply to Kamil Konieczny
Quoted 6 lines · Kamil Konieczny

Compilation of Panthor was broken on big-endian due to a guard in pathor lib against such arch. Fix this and create and use function for skipping all panthor tests on such machines.

Also while at it, init fd so it could be safely used at last fixture.

What about DRIVER_ANY tests?

Seems like the cleaner option would be to amend drm_open_driver() with something like:

if (chipset & DRIVER_PANTHOR)
skip on big endian

instead of sprinkling the skips everywhere.

Quoted 24 lines

v2: simplify test for big-endian, fix typo (Boris)

---
 lib/igt_panthor.c             | 11 +++++++++++
 lib/igt_panthor.h             |  6 ++----
 tests/panthor/panthor_gem.c   |  3 ++-
 tests/panthor/panthor_group.c |  3 ++-
 tests/panthor/panthor_query.c |  3 ++-
 tests/panthor/panthor_vm.c    |  3 ++-
 6 files changed, 21 insertions(+), 8 deletions(-)
lib/igt_panthor.c +0 -0
index 49b427d4f..7ffb61eb3 100644
@@ -6,6 +6,17 @@
 #include "ioctl_wrappers.h"
 #include "panthor_drm.h"
 

lib/igt_panthor.c line 18

Quoted 10 lines
lib/igt_panthor.c +10 -0
+/**
+ * igt_panthor_skip_on_big_endian:
+ *
+ * Skip Panthor test on big-endian machines.
+ */
+void igt_panthor_skip_on_big_endian(void)
+{
+	igt_skip_on_f(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__,
+		      "Panthor is unsupported on big-endian arch\n");
+}

Why does this have to encode Panthor in the name, when it in fact does not check anything about Panthor? What the function *does* is skip on big endian, regardless of GPU, so the function name is misleading.

Quoted 85 lines
lib/igt_panthor.c +1 -0
+
 /**
  * igt_panthor_group_create:
  * @fd: device file descriptor
lib/igt_panthor.h +2 -4
index 97a2b7497..be8490840 100644
@@ -61,11 +61,9 @@ enum cs_flush_mode {
 };
 
 /* There's no plan to support big endian in the UMD, so keep
- * things simple and don't bother supporting it here either.
+ * things simple and don't bother supporting it.
  */
-#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#error "big endian not supported"
-#endif
+void igt_panthor_skip_on_big_endian(void);
 
 struct cs_instr {
 	union {
tests/panthor/panthor_gem.c +2 -1
index 57ba4bc82..6388addb0 100644
@@ -8,9 +8,10 @@
 #include "igt_panthor.h"
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
tests/panthor/panthor_group.c +2 -1
index 13636e60c..c79f8d629 100644
@@ -41,9 +41,10 @@ issue_store_multiple(uint8_t *cs, uint64_t kernel_va, uint32_t constant)
 }
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
tests/panthor/panthor_query.c +2 -1
index fa4f8ef26..afd58a5bd 100644
@@ -8,9 +8,10 @@
 #include <stdint.h>
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
 
tests/panthor/panthor_vm.c +2 -1
index 76a669843..92b105b9e 100644
@@ -7,9 +7,10 @@
 #include "panthor_drm.h"
 
 int igt_main() {
-	int fd;
+	int fd = -1;
 
 	igt_fixture() {
+		igt_panthor_skip_on_big_endian();
 		fd = drm_open_driver(DRIVER_PANTHOR);
 	}
Signature · 1 line
Jani Nikula, Intel
#5 lore raw
Quoted 10 lines · On Mon, 23 Feb 2026 12:49:38 +0200 Jani Nikula <[email protected]> wrote:
Quoted 6 lines · Kamil Konieczny

Compilation of Panthor was broken on big-endian due to a guard in pathor lib against such arch. Fix this and create and use function for skipping all panthor tests on such machines.

Also while at it, init fd so it could be safely used at last fixture.

What about DRIVER_ANY tests?

Quoted 7 lines

Seems like the cleaner option would be to amend drm_open_driver() with something like:

if (chipset & DRIVER_PANTHOR)
skip on big endian

instead of sprinkling the skips everywhere.

FWIW, I'm fine with this approach too.