mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Theil <theil.markus@gmail.com>
To: linux-kernel@vger.kernel.org, andi.shyti@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org, netdev@vger.kernel.org,
	Jason@zx2c4.com, tytso@mit.edu,
	Markus Theil <theil.markus@gmail.com>
Subject: [PATCH v2 1/3] drm/i915/selftests: use prandom in selftest
Date: Tue, 11 Feb 2025 07:33:30 +0100	[thread overview]
Message-ID: <20250211063332.16542-2-theil.markus@gmail.com> (raw)
In-Reply-To: <20250211063332.16542-1-theil.markus@gmail.com>

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>
---
 drivers/gpu/drm/i915/selftests/i915_gem.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem.c b/drivers/gpu/drm/i915/selftests/i915_gem.c
index 0727492576be..14efa6edd9e6 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem.c
@@ -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);
 	}
-- 
2.47.2


  reply	other threads:[~2025-02-11  6:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 13:35 [PATCH] prandom: remove next_pseudo_random32 Markus Theil
2025-02-10 13:39 ` Jason A. Donenfeld
2025-02-10 23:07   ` Andi Shyti
2025-02-11  6:13     ` Markus Theil
2025-02-11  6:33   ` [PATCH v2 0/3] " Markus Theil
2025-02-11  6:33     ` Markus Theil [this message]
2025-02-13 17:19       ` [PATCH v2 1/3] drm/i915/selftests: use prandom in selftest Andi Shyti
2025-03-19 17:13         ` Jason A. Donenfeld
2025-03-21 12:37           ` Jani Nikula
2025-03-21 12:52             ` Jason A. Donenfeld
2025-02-11  6:33     ` [PATCH v2 2/3] media: vivid: use prandom Markus Theil
2025-02-11  6:33     ` [PATCH v2 3/3] prandom: remove next_pseudo_random32 Markus Theil
2025-02-13 14:27     ` [PATCH v2 0/3] " Krzysztof Karas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250211063332.16542-2-theil.markus@gmail.com \
    --to=theil.markus@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®