aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
diff options
context:
space:
mode:
authorPaul Burton <[email protected]>2019-03-22 18:04:04 +0000
committerPaul Burton <[email protected]>2019-03-25 21:02:12 +0000
commite6331a321aafcc291a60ceedf4d6b0051a6117ca (patch)
tree1acdcd75af79d27874f544444c03148528d5121f /drivers/gpu/drm/amd/display/modules/freesync/freesync.c
parentarch: mips: Kconfig: pedantic formatting (diff)
downloadkernel-e6331a321aafcc291a60ceedf4d6b0051a6117ca.tar.gz
kernel-e6331a321aafcc291a60ceedf4d6b0051a6117ca.zip
MIPS: KVM: Use prandom_u32_max() to generate tlbwr index
Emulation of the tlbwr instruction, which writes a TLB entry to a random index in the TLB, currently uses get_random_bytes() to generate a 4 byte random number which we then mask to form the index. This is overkill in a couple of ways: - We don't need 4 bytes here since we mask the value to form a 6 bit number anyway, so we waste /dev/random entropy generating 3 random bytes that are unused. - We don't need crypto-grade randomness here - the architecture spec allows implementations to use any algorithm & merely encourages that some pseudo-randomness be used rather than a simple counter. The fast prandom_u32() function fits that criteria well. So rather than using get_random_bytes() & consuming /dev/random entropy, switch to using the faster prandom_u32_max() which provides what we need here whilst also performing the masking/modulo for us. Signed-off-by: Paul Burton <[email protected]> Reported-by: George Spelvin <[email protected]> Cc: James Hogan <[email protected]> Cc: [email protected]
Diffstat (limited to 'drivers/gpu/drm/amd/display/modules/freesync/freesync.c')
0 files changed, 0 insertions, 0 deletions