Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 0/2] panthor: add dev_query tests for userspace buffer
@ 2026-10-15 23:44 Deborah Brouwer
  2026-10-15 23:44 ` [PATCH i-g-t 1/2] panthor: Return size from PANTHOR_DEV_QUERY Deborah Brouwer
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Deborah Brouwer @ 2026-10-15 23:44 UTC (permalink / raw)
  To: igt-dev
  Cc: boris.brezillon, adrian.larumbe, liviu.dudau, steven.price,
	daniel.almeida, kamil.konieczny, Deborah Brouwer

This series expands the tests for DRM_PANTHOR_DEV_QUERY_GPU_INFO
to check primarily buffer size discrepancies between user and kernel.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>

---
Deborah Brouwer (2):
      panthor: Return size from PANTHOR_DEV_QUERY
      panthor: test dev_query buffer size variations

 lib/igt_panthor.c             |  6 +++-
 lib/igt_panthor.h             |  2 +-
 tests/panthor/panthor_query.c | 64 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+), 2 deletions(-)
---
base-commit: 18811c476bfde62ffbb4c0af55cd6f57e36e0dca
change-id: 20261015-b4-dev_query-7a6c2aec8dde

Best regards,
-- 
Deborah Brouwer <deborah.brouwer@collabora.com>


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

* [PATCH i-g-t 1/2] panthor: Return size from PANTHOR_DEV_QUERY
  2026-10-15 23:44 [PATCH i-g-t 0/2] panthor: add dev_query tests for userspace buffer Deborah Brouwer
@ 2026-10-15 23:44 ` Deborah Brouwer
  2026-10-16  9:00   ` Liviu Dudau
  2026-10-15 23:44 ` [PATCH i-g-t 2/2] panthor: test dev_query buffer size variations Deborah Brouwer
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Deborah Brouwer @ 2026-10-15 23:44 UTC (permalink / raw)
  To: igt-dev
  Cc: boris.brezillon, adrian.larumbe, liviu.dudau, steven.price,
	daniel.almeida, kamil.konieczny, Deborah Brouwer

The size of the type being queried will be updated by the kernel driver
when the user pointer is null. Return the query size so that we can check
that it was correctly calculated.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
---
 lib/igt_panthor.c | 6 +++++-
 lib/igt_panthor.h | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/igt_panthor.c b/lib/igt_panthor.c
index 11d8ec342..5aca0a020 100644
--- a/lib/igt_panthor.c
+++ b/lib/igt_panthor.c
@@ -178,8 +178,10 @@ void igt_panthor_group_submit_simple(int fd, uint32_t group_handle,
  * @err: expected error code, or 0 for success
  *
  * Query GPU information.
+ *
+ * Returns: the size of the type being queried.
  */
-void igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err)
+uint32_t igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err)
 {
 	struct drm_panthor_dev_query query = {
 		.type = type,
@@ -191,6 +193,8 @@ void igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err)
 		do_ioctl_err(fd, DRM_IOCTL_PANTHOR_DEV_QUERY, &query, err);
 	else
 		do_ioctl(fd, DRM_IOCTL_PANTHOR_DEV_QUERY, &query);
+
+	return query.size;
 }
 
 /**
diff --git a/lib/igt_panthor.h b/lib/igt_panthor.h
index ba4a9bf1e..2ecce57de 100644
--- a/lib/igt_panthor.h
+++ b/lib/igt_panthor.h
@@ -16,7 +16,7 @@ struct panthor_bo {
 	void *map;
 };
 
-void igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err);
+uint32_t igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err);
 void igt_panthor_vm_create_userva_range(int fd, uint32_t *vm_id, int err, uint64_t *uva_range);
 void igt_panthor_vm_destroy(int fd, uint32_t vm_id, int err);
 void igt_panthor_vm_bind_offset(int fd, uint32_t vm_id, uint32_t bo_handle, uint64_t va,

-- 
2.56.0


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

* [PATCH i-g-t 2/2] panthor: test dev_query buffer size variations
  2026-10-15 23:44 [PATCH i-g-t 0/2] panthor: add dev_query tests for userspace buffer Deborah Brouwer
  2026-10-15 23:44 ` [PATCH i-g-t 1/2] panthor: Return size from PANTHOR_DEV_QUERY Deborah Brouwer
@ 2026-10-15 23:44 ` Deborah Brouwer
  2026-10-16  9:06   ` Liviu Dudau
  2026-10-16  0:25 ` ✗ Xe.CI.BAT: failure for panthor: add dev_query tests for userspace buffer Patchwork
  2026-10-16  0:37 ` ✓ i915.CI.BAT: success " Patchwork
  3 siblings, 1 reply; 7+ messages in thread
From: Deborah Brouwer @ 2026-10-15 23:44 UTC (permalink / raw)
  To: igt-dev
  Cc: boris.brezillon, adrian.larumbe, liviu.dudau, steven.price,
	daniel.almeida, kamil.konieczny, Deborah Brouwer

Add tests to check that the kernel driver will gracefully handle userspace
buffers that are smaller or larger than the kernel driver expected.

Also, add a test to ensure that the kernel driver is enforcing the
minimum buffer size and that the kernel driver will provide the size
when the userpointer is null.

This ensures UAPI compliance for DRM_IOCTL_PANTHOR_DEV_QUERY.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
---
 tests/panthor/panthor_query.c | 64 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/tests/panthor/panthor_query.c b/tests/panthor/panthor_query.c
index afd58a5bd..8ff2e9652 100644
--- a/tests/panthor/panthor_query.c
+++ b/tests/panthor/panthor_query.c
@@ -7,6 +7,10 @@
 #include "panthor_drm.h"
 #include <stdint.h>
 
+#define GPU_INFO_MIN_SIZE \
+	(offsetof(struct drm_panthor_gpu_info, tiler_present) + \
+	 sizeof(((struct drm_panthor_gpu_info *)0)->tiler_present))
+
 int igt_main() {
 	int fd = -1;
 
@@ -20,10 +24,70 @@ int igt_main() {
 		struct drm_panthor_gpu_info gpu = {};
 
 		igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO, &gpu, sizeof(gpu), 0);
+		igt_assert_neq(gpu.gpu_id, 0);
+	}
+
+	igt_describe("Ensure kernel returns a GPU_INFO size.");
+	igt_subtest("query-size-null-pointer") {
+		uint32_t size;
+
+		size = igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO, NULL, 0, 0);
+
+		/*
+		 * The kernel returns its output structure size, which may be out
+		 * of sync with the header used to build these tests, so don't expect
+		 * that the sizes will match necessarily.
+		 */
+		igt_assert(size >= GPU_INFO_MIN_SIZE);
+	}
+
+	igt_describe("Ensure kernel enforces GPU_INFO minimum size.");
+	igt_subtest("query-size-too-small") {
+		struct drm_panthor_gpu_info gpu = {};
+
+		igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO,
+				  &gpu, GPU_INFO_MIN_SIZE - 1, EINVAL);
+	}
+
+	igt_describe("Ensure kernel accepts GPU_INFO minimum size.");
+	igt_subtest("query-min-size") {
+		struct drm_panthor_gpu_info gpu = {};
+
+		igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO,
+				  &gpu, GPU_INFO_MIN_SIZE, 0);
 
 		igt_assert_neq(gpu.gpu_id, 0);
 	}
 
+	igt_describe("Ensure kernel zeros out unused part of buffer.");
+	igt_subtest("query-too-big") {
+		uint32_t size;
+		size_t buf_size;
+		uint8_t *buf;
+
+		/*
+		 * Create a buffer that is larger than necessary.
+		 * Start with the size returned by the kernel in case it is out of
+		 * sync with these tests. Then add an extra 16 bytes and initialize
+		 * the entire buffer to non-zero values.
+		 */
+		size = igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO,
+					 NULL, 0, 0);
+		buf_size = (size_t)size + 16;
+		buf = malloc(buf_size);
+		igt_assert(buf);
+		memset(buf, 0xff, buf_size);
+
+		igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO,
+				  buf, buf_size, 0);
+
+		/* Check that the extra bytes were zeroed. */
+		for (size_t i = size; i < buf_size; i++)
+			igt_assert_eq(buf[i], 0);
+
+		free(buf);
+	}
+
 	igt_fixture() {
 		drm_close_driver(fd);
 	}

-- 
2.56.0


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

* ✗ Xe.CI.BAT: failure for panthor: add dev_query tests for userspace buffer
  2026-10-15 23:44 [PATCH i-g-t 0/2] panthor: add dev_query tests for userspace buffer Deborah Brouwer
  2026-10-15 23:44 ` [PATCH i-g-t 1/2] panthor: Return size from PANTHOR_DEV_QUERY Deborah Brouwer
  2026-10-15 23:44 ` [PATCH i-g-t 2/2] panthor: test dev_query buffer size variations Deborah Brouwer
@ 2026-10-16  0:25 ` Patchwork
  2026-10-16  0:37 ` ✓ i915.CI.BAT: success " Patchwork
  3 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2026-10-16  0:25 UTC (permalink / raw)
  To: Deborah Brouwer; +Cc: igt-dev

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

== Series Details ==

Series: panthor: add dev_query tests for userspace buffer
URL   : https://patchwork.freedesktop.org/series/176253/
State : failure

== Summary ==

ERROR: The runconfig 'XEIGT_9150_BAT' does not exist in the database

== Logs ==

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

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

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

* ✓ i915.CI.BAT: success for panthor: add dev_query tests for userspace buffer
  2026-10-15 23:44 [PATCH i-g-t 0/2] panthor: add dev_query tests for userspace buffer Deborah Brouwer
                   ` (2 preceding siblings ...)
  2026-10-16  0:25 ` ✗ Xe.CI.BAT: failure for panthor: add dev_query tests for userspace buffer Patchwork
@ 2026-10-16  0:37 ` Patchwork
  3 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2026-10-16  0:37 UTC (permalink / raw)
  To: Deborah Brouwer; +Cc: igt-dev

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

== Series Details ==

Series: panthor: add dev_query tests for userspace buffer
URL   : https://patchwork.freedesktop.org/series/176253/
State : success

== Summary ==

CI Bug Log - changes from IGT_9150 -> IGTPW_15997
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

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

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

  Additional (1): bat-adls-6 
  Missing    (2): bat-dg2-13 fi-glk-j4005 

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

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

### IGT changes ###

#### Issues hit ####

  * igt@gem_lmem_swapping@verify-random:
    - bat-adls-6:         NOTRUN -> [SKIP][1] ([i915#4613]) +3 other tests skip
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15997/bat-adls-6/igt@gem_lmem_swapping@verify-random.html

  * igt@gem_tiled_pread_basic@basic:
    - bat-adls-6:         NOTRUN -> [SKIP][2] ([i915#15656])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15997/bat-adls-6/igt@gem_tiled_pread_basic@basic.html

  * igt@intel_hwmon@hwmon-read:
    - bat-adls-6:         NOTRUN -> [SKIP][3] ([i915#7707]) +1 other test skip
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15997/bat-adls-6/igt@intel_hwmon@hwmon-read.html

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

  * igt@kms_dsc@dsc-basic:
    - bat-adls-6:         NOTRUN -> [SKIP][5] ([i915#16361])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15997/bat-adls-6/igt@kms_dsc@dsc-basic.html

  * igt@kms_force_connector_basic@force-load-detect:
    - bat-adls-6:         NOTRUN -> [SKIP][6]
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15997/bat-adls-6/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_pm_backlight@basic-brightness:
    - bat-adls-6:         NOTRUN -> [SKIP][7] ([i915#5354])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15997/bat-adls-6/igt@kms_pm_backlight@basic-brightness.html

  * igt@kms_psr@psr-primary-mmap-gtt:
    - bat-adls-6:         NOTRUN -> [SKIP][8] ([i915#1072] / [i915#9732]) +3 other tests skip
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15997/bat-adls-6/igt@kms_psr@psr-primary-mmap-gtt.html

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

  * igt@prime_vgem@basic-fence-read:
    - bat-adls-6:         NOTRUN -> [SKIP][10] ([i915#3291]) +2 other tests skip
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15997/bat-adls-6/igt@prime_vgem@basic-fence-read.html

  
  [i915#1072]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1072
  [i915#15656]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15656
  [i915#16361]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/16361
  [i915#3291]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3291
  [i915#3555]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3555
  [i915#4103]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4103
  [i915#4613]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4613
  [i915#5354]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5354
  [i915#7707]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/7707
  [i915#9732]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9732


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

  * CI: CI-20190529 -> None
  * IGT: IGT_9150 -> IGTPW_15997
  * Linux: CI_DRM_19344 -> CI_DRM_19346

  CI-20190529: 20190529
  CI_DRM_19344: 551605da81c33c1a2352b6a6116360609798f171 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_19346: 80c7a1d738b654b45717944325a57ff9e2ae3de4 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_15997: 15997
  IGT_9150: 18811c476bfde62ffbb4c0af55cd6f57e36e0dca @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

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

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

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

* Re: [PATCH i-g-t 1/2] panthor: Return size from PANTHOR_DEV_QUERY
  2026-10-15 23:44 ` [PATCH i-g-t 1/2] panthor: Return size from PANTHOR_DEV_QUERY Deborah Brouwer
@ 2026-10-16  9:00   ` Liviu Dudau
  0 siblings, 0 replies; 7+ messages in thread
From: Liviu Dudau @ 2026-10-16  9:00 UTC (permalink / raw)
  To: Deborah Brouwer
  Cc: igt-dev, boris.brezillon, adrian.larumbe, steven.price,
	daniel.almeida, kamil.konieczny

On Thu, Oct 15, 2026 at 04:44:57PM -0700, Deborah Brouwer wrote:
> The size of the type being queried will be updated by the kernel driver
> when the user pointer is null. Return the query size so that we can check
> that it was correctly calculated.
> 
> Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu

> ---
>  lib/igt_panthor.c | 6 +++++-
>  lib/igt_panthor.h | 2 +-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_panthor.c b/lib/igt_panthor.c
> index 11d8ec342..5aca0a020 100644
> --- a/lib/igt_panthor.c
> +++ b/lib/igt_panthor.c
> @@ -178,8 +178,10 @@ void igt_panthor_group_submit_simple(int fd, uint32_t group_handle,
>   * @err: expected error code, or 0 for success
>   *
>   * Query GPU information.
> + *
> + * Returns: the size of the type being queried.
>   */
> -void igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err)
> +uint32_t igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err)
>  {
>  	struct drm_panthor_dev_query query = {
>  		.type = type,
> @@ -191,6 +193,8 @@ void igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err)
>  		do_ioctl_err(fd, DRM_IOCTL_PANTHOR_DEV_QUERY, &query, err);
>  	else
>  		do_ioctl(fd, DRM_IOCTL_PANTHOR_DEV_QUERY, &query);
> +
> +	return query.size;
>  }
>  
>  /**
> diff --git a/lib/igt_panthor.h b/lib/igt_panthor.h
> index ba4a9bf1e..2ecce57de 100644
> --- a/lib/igt_panthor.h
> +++ b/lib/igt_panthor.h
> @@ -16,7 +16,7 @@ struct panthor_bo {
>  	void *map;
>  };
>  
> -void igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err);
> +uint32_t igt_panthor_query(int fd, int32_t type, void *data, size_t size, int err);
>  void igt_panthor_vm_create_userva_range(int fd, uint32_t *vm_id, int err, uint64_t *uva_range);
>  void igt_panthor_vm_destroy(int fd, uint32_t vm_id, int err);
>  void igt_panthor_vm_bind_offset(int fd, uint32_t vm_id, uint32_t bo_handle, uint64_t va,
> 
> -- 
> 2.56.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

* Re: [PATCH i-g-t 2/2] panthor: test dev_query buffer size variations
  2026-10-15 23:44 ` [PATCH i-g-t 2/2] panthor: test dev_query buffer size variations Deborah Brouwer
@ 2026-10-16  9:06   ` Liviu Dudau
  0 siblings, 0 replies; 7+ messages in thread
From: Liviu Dudau @ 2026-10-16  9:06 UTC (permalink / raw)
  To: Deborah Brouwer
  Cc: igt-dev, boris.brezillon, adrian.larumbe, steven.price,
	daniel.almeida, kamil.konieczny

On Thu, Oct 15, 2026 at 04:44:58PM -0700, Deborah Brouwer wrote:
> Add tests to check that the kernel driver will gracefully handle userspace
> buffers that are smaller or larger than the kernel driver expected.
> 
> Also, add a test to ensure that the kernel driver is enforcing the
> minimum buffer size and that the kernel driver will provide the size
> when the userpointer is null.
> 
> This ensures UAPI compliance for DRM_IOCTL_PANTHOR_DEV_QUERY.
> 
> Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
> ---
>  tests/panthor/panthor_query.c | 64 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 64 insertions(+)
> 
> diff --git a/tests/panthor/panthor_query.c b/tests/panthor/panthor_query.c
> index afd58a5bd..8ff2e9652 100644
> --- a/tests/panthor/panthor_query.c
> +++ b/tests/panthor/panthor_query.c
> @@ -7,6 +7,10 @@
>  #include "panthor_drm.h"
>  #include <stdint.h>
>  
> +#define GPU_INFO_MIN_SIZE \
> +	(offsetof(struct drm_panthor_gpu_info, tiler_present) + \
> +	 sizeof(((struct drm_panthor_gpu_info *)0)->tiler_present))
> +
>  int igt_main() {
>  	int fd = -1;
>  
> @@ -20,10 +24,70 @@ int igt_main() {
>  		struct drm_panthor_gpu_info gpu = {};
>  
>  		igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO, &gpu, sizeof(gpu), 0);
> +		igt_assert_neq(gpu.gpu_id, 0);
> +	}
> +
> +	igt_describe("Ensure kernel returns a GPU_INFO size.");
> +	igt_subtest("query-size-null-pointer") {
> +		uint32_t size;
> +
> +		size = igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO, NULL, 0, 0);
> +
> +		/*
> +		 * The kernel returns its output structure size, which may be out
> +		 * of sync with the header used to build these tests, so don't expect
> +		 * that the sizes will match necessarily.
> +		 */
> +		igt_assert(size >= GPU_INFO_MIN_SIZE);
> +	}
> +
> +	igt_describe("Ensure kernel enforces GPU_INFO minimum size.");
> +	igt_subtest("query-size-too-small") {
> +		struct drm_panthor_gpu_info gpu = {};
> +
> +		igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO,
> +				  &gpu, GPU_INFO_MIN_SIZE - 1, EINVAL);
> +	}
> +
> +	igt_describe("Ensure kernel accepts GPU_INFO minimum size.");
> +	igt_subtest("query-min-size") {
> +		struct drm_panthor_gpu_info gpu = {};
> +
> +		igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO,
> +				  &gpu, GPU_INFO_MIN_SIZE, 0);

This last test feels redundant. We've checked that the kernel expects a struct of
at least GPU_INFO_MIN_SIZE and we've checked that smaller sizes are rejected. If
GPU_INFO_MIN_SIZE is rejected that means we are no longer supporting that size
and user space should be upgraded, not necessarily that the kernel has a bug.


Best regards,
Liviu

>  
>  		igt_assert_neq(gpu.gpu_id, 0);
>  	}
>  
> +	igt_describe("Ensure kernel zeros out unused part of buffer.");
> +	igt_subtest("query-too-big") {
> +		uint32_t size;
> +		size_t buf_size;
> +		uint8_t *buf;
> +
> +		/*
> +		 * Create a buffer that is larger than necessary.
> +		 * Start with the size returned by the kernel in case it is out of
> +		 * sync with these tests. Then add an extra 16 bytes and initialize
> +		 * the entire buffer to non-zero values.
> +		 */
> +		size = igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO,
> +					 NULL, 0, 0);
> +		buf_size = (size_t)size + 16;
> +		buf = malloc(buf_size);
> +		igt_assert(buf);
> +		memset(buf, 0xff, buf_size);
> +
> +		igt_panthor_query(fd, DRM_PANTHOR_DEV_QUERY_GPU_INFO,
> +				  buf, buf_size, 0);
> +
> +		/* Check that the extra bytes were zeroed. */
> +		for (size_t i = size; i < buf_size; i++)
> +			igt_assert_eq(buf[i], 0);
> +
> +		free(buf);
> +	}
> +
>  	igt_fixture() {
>  		drm_close_driver(fd);
>  	}
> 
> -- 
> 2.56.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

end of thread, other threads:[~2026-10-16  9:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 23:44 [PATCH i-g-t 0/2] panthor: add dev_query tests for userspace buffer Deborah Brouwer
2026-10-15 23:44 ` [PATCH i-g-t 1/2] panthor: Return size from PANTHOR_DEV_QUERY Deborah Brouwer
2026-10-16  9:00   ` Liviu Dudau
2026-10-15 23:44 ` [PATCH i-g-t 2/2] panthor: test dev_query buffer size variations Deborah Brouwer
2026-10-16  9:06   ` Liviu Dudau
2026-10-16  0:25 ` ✗ Xe.CI.BAT: failure for panthor: add dev_query tests for userspace buffer Patchwork
2026-10-16  0:37 ` ✓ i915.CI.BAT: success " Patchwork

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