Re: [PATCH i-g-t v5 09/10] tests/imagination: Add DEV_QUERY quirks and enhancements tests
Kamil Konieczny <[email protected]> Tue, 28 Jul 2026 16:47:03 +0200
| Newsgroups | org.freedesktop.lists.igt-dev |
|---|---|
| Message-ID | <[email protected]> |
Hi Robert, On 2026-07-28 at 09:19:04 +0200, Robert Mazur wrote: > From: Donald Robson <[email protected]> > > Add subtests for DEV_QUERY quirks and enhancements for array copy > and invalid padding error paths. > > Signed-off-by: Donald Robson <[email protected]> > Signed-off-by: Robert Mazur <[email protected]> > Acked-by: Kamil Konieczny <[email protected]> I applid 1...8 but this one still has problem with compilation on 32-bit armhf: s.p/pvr_quirks_enhancements.c.o -MF tests/imagination/pvr_quirks_enhancements.p/pvr_quirks_enhancements.c.o.d -o tests/imagination/pvr_quirks_enhancements.p/pvr_quirks_enhancements.c.o -c ../tests/imagination/pvr_quirks_enhancements.c ../tests/imagination/pvr_quirks_enhancements.c: In function '__igt_unique____real_main13': ../tests/imagination/pvr_quirks_enhancements.c:44:35: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 44 | enhancements_get.enhancements = (uint64_t)enhancements; | ^ ../tests/imagination/pvr_quirks_enhancements.c:67:23: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 67 | quirks_get.quirks = (uint64_t)quirks; | ^ cc1: some warnings being treated as errors Please fix and resend last two patches as a separate series. Regards, Kamil > --- > tests/imagination/meson.build | 1 + > tests/imagination/pvr_quirks_enhancements.c | 112 ++++++++++++++++++++++++++++ > 2 files changed, 113 insertions(+) > > diff --git a/tests/imagination/meson.build b/tests/imagination/meson.build > index 69ef0a8c6..dc08a5d8b 100644 > --- a/tests/imagination/meson.build > +++ b/tests/imagination/meson.build > @@ -4,6 +4,7 @@ pvr_progs = [ 'pvr_dev_query', > 'pvr_gpu_info', > 'pvr_heap_info', > 'pvr_hwrt', > + 'pvr_quirks_enhancements', > 'pvr_vm_context', > ] > > diff --git a/tests/imagination/pvr_quirks_enhancements.c b/tests/imagination/pvr_quirks_enhancements.c > new file mode 100644 > index 000000000..35e5ff190 > --- /dev/null > +++ b/tests/imagination/pvr_quirks_enhancements.c > @@ -0,0 +1,112 @@ > +// SPDX-License-Identifier: GPL-2.0 or MIT > +/* Copyright (c) 2026 Imagination Technologies Ltd. All Rights Reserved */ > + > +#include <errno.h> > +#include <stdbool.h> > +#include <stdint.h> > + > +#include "igt.h" > +#include "igt_pvr.h" > + > +#include "pvr_drm.h" > + > +int igt_main() > +{ > + int fd; > + > + igt_fixture() > + { > + fd = drm_open_driver(DRIVER_POWERVR); > + } > + > + igt_describe("Test copying enhancements from the kernel"); > + igt_subtest("enhancements-array-copy") > + { > + struct drm_pvr_dev_query_enhancements enhancements_get = {0}; > + uint32_t *enhancements; > + > + /* Enhancements. */ > + igt_pvr_ioctl_dev_query(fd, DRM_PVR_DEV_QUERY_ENHANCEMENTS_GET, > + sizeof(enhancements_get), > + &enhancements_get, 0); > + /* > + * Supplementary check - alloc one extra space as a watermark > + * to check the copy does not overflow. We only need to check > + * this once for the whole UAPI, as a macro is used to do this. > + */ > + enhancements = calloc(enhancements_get.count + 1, > + sizeof(*enhancements)); > + igt_assert(enhancements); > + > + /* Set watermark. */ > + enhancements[enhancements_get.count] = 0xABCDEFAB; > + > + enhancements_get.enhancements = (uint64_t)enhancements; > + igt_pvr_ioctl_dev_query(fd, DRM_PVR_DEV_QUERY_ENHANCEMENTS_GET, > + sizeof(enhancements_get), > + &enhancements_get, 0); > + > + for (int i = 0; i < enhancements_get.count; i++) > + igt_assert_neq(enhancements[i], 0); > + > + /* Check the watermark is intact. */ > + igt_assert_eq(enhancements[enhancements_get.count], 0xABCDEFAB); > + } > + > + igt_describe("Test copying quirks from the kernel"); > + igt_subtest("quirks-array-copy") > + { > + struct drm_pvr_dev_query_quirks quirks_get = {0}; > + uint32_t *quirks; > + > + igt_pvr_ioctl_dev_query(fd, DRM_PVR_DEV_QUERY_QUIRKS_GET, > + sizeof(quirks_get), &quirks_get, 0); > + quirks = calloc(quirks_get.count, sizeof(*quirks)); > + igt_assert(quirks); > + > + quirks_get.quirks = (uint64_t)quirks; > + igt_pvr_ioctl_dev_query(fd, DRM_PVR_DEV_QUERY_QUIRKS_GET, > + sizeof(quirks_get), > + &quirks_get, 0); > + > + for (int i = 0; i < quirks_get.count; i++) > + igt_assert_neq(quirks[i], 0); > + > + igt_assert_lte(quirks_get.musthave_count, quirks_get.count); > + } > + > + igt_describe("Test enhancements query with invalid padding"); > + igt_subtest("enhancements-bad-padding") > + { > + struct drm_pvr_dev_query_enhancements enhancements_get = { > + ._padding_a = 1, > + }; > + > + igt_pvr_ioctl_dev_query(fd, DRM_PVR_DEV_QUERY_ENHANCEMENTS_GET, > + sizeof(enhancements_get), > + &enhancements_get, EINVAL); > + > + enhancements_get._padding_a = 0; > + enhancements_get._padding_c = 1; > + > + igt_pvr_ioctl_dev_query(fd, DRM_PVR_DEV_QUERY_ENHANCEMENTS_GET, > + sizeof(enhancements_get), > + &enhancements_get, EINVAL); > + } > + > + igt_describe("Test quirks query with invalid padding"); > + igt_subtest("quirks-bad-padding") > + { > + struct drm_pvr_dev_query_quirks quirks_get = { > + ._padding_c = 1, > + }; > + > + igt_pvr_ioctl_dev_query(fd, DRM_PVR_DEV_QUERY_QUIRKS_GET, > + sizeof(quirks_get), &quirks_get, EINVAL); > + } > + > + igt_fixture() > + { > + drm_close_driver(fd); > + } > +} > > -- > 2.43.0 >