]> git.itanic.dy.fi Git - linux-stable/commit
powerpc/powernv/kvm: Use darn for H_RANDOM on Power9
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 27 Jul 2022 14:32:18 +0000 (00:32 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 28 Jul 2022 06:22:15 +0000 (16:22 +1000)
commit7ef3d06f1bc4a5e62273726f3dc2bd258ae1c71f
tree9be8973a631578df78cd7f4e65ece398ab110f74
parent90b5d4fe0b3ba7f589c6723c6bfb559d9e83956a
powerpc/powernv/kvm: Use darn for H_RANDOM on Power9

The existing logic in KVM to support guests calling H_RANDOM only works
on Power8, because it looks for an RNG in the device tree, but on Power9
we just use darn.

In addition the existing code needs to work in real mode, so we have the
special cased powernv_get_random_real_mode() to deal with that.

Instead just have KVM call ppc_md.get_random_seed(), and do the real
mode check inside of there, that way we use whatever RNG is available,
including darn on Power9.

Fixes: e928e9cb3601 ("KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM implementation.")
Cc: stable@vger.kernel.org # v4.1+
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tested-by: Sachin Sant <sachinp@linux.ibm.com>
[mpe: Rebase on previous commit, update change log appropriately]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220727143219.2684192-2-mpe@ellerman.id.au
arch/powerpc/include/asm/archrandom.h
arch/powerpc/kvm/book3s_hv_builtin.c
arch/powerpc/platforms/powernv/rng.c