]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/selftests: use prandom in selftest
authorMarkus Theil <theil.markus@gmail.com>
Tue, 11 Feb 2025 06:33:30 +0000 (07:33 +0100)
committerAndi Shyti <andi.shyti@linux.intel.com>
Thu, 13 Feb 2025 14:25:49 +0000 (15:25 +0100)
This is part of a prandom cleanup, which removes
next_pseudo_random32 and replaces it with the standard PRNG.

Signed-off-by: Markus Theil <theil.markus@gmail.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250211063332.16542-2-theil.markus@gmail.com
drivers/gpu/drm/i915/selftests/i915_gem.c

index 0727492576be285b542dd205e2a0be4c979efa30..14efa6edd9e63c02abf9e4f93b82fd0683179d53 100644 (file)
@@ -45,13 +45,15 @@ static void trash_stolen(struct drm_i915_private *i915)
        struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
        const u64 slot = ggtt->error_capture.start;
        const resource_size_t size = resource_size(&i915->dsm.stolen);
+       struct rnd_state prng;
        unsigned long page;
-       u32 prng = 0x12345678;
 
        /* XXX: fsck. needs some more thought... */
        if (!i915_ggtt_has_aperture(ggtt))
                return;
 
+       prandom_seed_state(&prng, 0x12345678);
+
        for (page = 0; page < size; page += PAGE_SIZE) {
                const dma_addr_t dma = i915->dsm.stolen.start + page;
                u32 __iomem *s;
@@ -64,8 +66,7 @@ static void trash_stolen(struct drm_i915_private *i915)
 
                s = io_mapping_map_atomic_wc(&ggtt->iomap, slot);
                for (x = 0; x < PAGE_SIZE / sizeof(u32); x++) {
-                       prng = next_pseudo_random32(prng);
-                       iowrite32(prng, &s[x]);
+                       iowrite32(prandom_u32_state(&prng), &s[x]);
                }
                io_mapping_unmap_atomic(s);
        }