]> git.baikalelectronics.ru Git - kernel.git/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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:25 +0000 (14:24 +0200)
commitc93eaf62c05323836396e1e0188da68831c0857f
tree0330580c2cdc064abf77ef98e88e4eec76202ab9
parentf70845e77111566cdf8e5b0795bf28f1d3af97a6
powerpc/powernv/kvm: Use darn for H_RANDOM on Power9

[ Upstream commit 9b487f25e1133f6718ae207082dbbfa745e4e879 ]

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: 1746d4c9c4c7 ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/include/asm/archrandom.h
arch/powerpc/kvm/book3s_hv_builtin.c
arch/powerpc/platforms/powernv/rng.c