summaryrefslogtreecommitdiff
path: root/drivers/gpu/tests
AgeCommit message (Collapse)Author
2026-03-09gpu/tests/gpu_buddy: Add gpu_test_buddy_alloc_range for exact-range allocationSanjay Yadav
Add a new kunit test gpu_test_buddy_alloc_range() that exercises the __gpu_buddy_alloc_range() exact-range allocation path, triggered when start + size == end with flags=0. The test covers: - Basic exact-range allocation of the full mm - Exact-range allocation of equal sub-ranges (quarters) - Minimum chunk-size exact ranges at start, middle, and end offsets - Non power-of-two mm size with multiple roots, including cross-root exact-range allocation - Randomized exact-range allocations of N contiguous page-aligned slices in random order - Negative: partially allocated range must reject overlapping exact alloc - Negative: checkerboard allocation pattern rejects exact range over partially occupied pairs - Negative: misaligned start, unaligned size, and out-of-bounds end - Free and re-allocate the same exact range across multiple iterations - Various power-of-two exact ranges at natural alignment Cc: Christian König <christian.koenig@amd.com> Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Suggested-by: Matthew Auld <matthew.auld@intel.com> Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Link: https://patch.msgid.link/20260302150947.47535-2-sanjay.kumar.yadav@intel.com
2026-03-09drm/buddy: Add KUnit test for offset-aligned allocationsArunpravin Paneer Selvam
Add KUnit test to validate offset-aligned allocations in the DRM buddy allocator. Validate offset-aligned allocation: The test covers allocations with sizes smaller than the alignment constraint and verifies correct size preservation, offset alignment, and behavior across multiple allocation sizes. It also exercises fragmentation by freeing alternating blocks and confirms that allocation fails once all aligned offsets are consumed. Stress subtree_max_alignment propagation: Exercise subtree_max_alignment tracking by allocating blocks with descending alignment constraints and freeing them in reverse order. This verifies that free-tree augmentation correctly propagates the maximum offset alignment present in each subtree at every stage. v2: - Move the patch to gpu/tests/gpu_buddy_test.c file. v3: - Fixed build warnings reported by kernel test robot <lkp@intel.com> v4:(Matthew) - Use IS_ALIGNED() instead of manual alignment checks - Simplify order iteration loop for readability - Remove extra newline Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patch.msgid.link/20260306060155.2114-2-Arunpravin.PaneerSelvam@amd.com
2026-02-27drm/tests: Mark slow tests as slowMaxime Ripard
Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such. Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patch.msgid.link/20260224110310.1854608-1-mripard@kernel.org Signed-off-by: Maxime Ripard <mripard@kernel.org>
2026-02-06gpu: Move DRM buddy allocator one level up (part two)Joel Fernandes
Move the DRM buddy allocator one level up so that it can be used by GPU drivers (example, nova-core) that have usecases other than DRM (such as VFIO vGPU support). Modify the API, structures and Kconfigs to use "gpu_buddy" terminology. Adapt the drivers and tests to use the new API. The commit cannot be split due to bisectability, however no functional change is intended. Verified by running K-UNIT tests and build tested various configurations. Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> [airlied: I've split this into two so git can find copies easier. I've also just nuked drm_random library, that stuff needs to be done elsewhere and only the buddy tests seem to be using it]. Signed-off-by: Dave Airlie <airlied@redhat.com>
2026-02-06gpu: Move DRM buddy allocator one level up (part one)Joel Fernandes
Move the DRM buddy allocator one level up so that it can be used by GPU drivers (example, nova-core) that have usecases other than DRM (such as VFIO vGPU support). Modify the API, structures and Kconfigs to use "gpu_buddy" terminology. Adapt the drivers and tests to use the new API. The commit cannot be split due to bisectability, however no functional change is intended. Verified by running K-UNIT tests and build tested various configurations. Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> [airlied: I've split this into two so git can find copies easier. I've also just nuked drm_random library, that stuff needs to be done elsewhere and only the buddy tests seem to be using it]. Signed-off-by: Dave Airlie <airlied@redhat.com>