diff options
author | Jason A. Donenfeld | 2022-06-26 13:18:04 +0200 |
---|---|---|
committer | Laurent Vivier | 2022-07-06 12:30:41 +0200 |
commit | a988465d0eb7e2ee31a3679bbe3fbe71681820da (patch) | |
tree | c8bd43d7565293669d195147ee87e11cab488a6c /hw/m68k/virt.c | |
parent | m68k: use correct variable name in boot info string macro (diff) | |
download | qemu-a988465d0eb7e2ee31a3679bbe3fbe71681820da.tar.gz qemu-a988465d0eb7e2ee31a3679bbe3fbe71681820da.tar.xz qemu-a988465d0eb7e2ee31a3679bbe3fbe71681820da.zip |
m68k: virt: pass RNG seed via bootinfo block
This commit wires up bootinfo's RNG seed attribute so that Linux VMs can
have their RNG seeded from the earliest possible time in boot, just like
the "rng-seed" device tree property on those platforms. The link
contains the corresponding Linux patch.
Link: https://lore.kernel.org/lkml/20220626111509.330159-1-Jason@zx2c4.com/
Based-on: <20220625152318.120849-1-Jason@zx2c4.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Message-Id: <20220626111804.330745-1-Jason@zx2c4.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw/m68k/virt.c')
-rw-r--r-- | hw/m68k/virt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index e215aa3d42..0aa383fa6b 100644 --- a/hw/m68k/virt.c +++ b/hw/m68k/virt.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/guest-random.h" #include "sysemu/sysemu.h" #include "cpu.h" #include "hw/boards.h" @@ -120,6 +121,7 @@ static void virt_init(MachineState *machine) hwaddr io_base; int i; ResetInfo *reset_info; + uint8_t rng_seed[32]; if (ram_size > 3399672 * KiB) { /* @@ -245,6 +247,11 @@ static void virt_init(MachineState *machine) kernel_cmdline); } + /* Pass seed to RNG. */ + qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed)); + BOOTINFODATA(cs->as, parameters_base, BI_VIRT_RNG_SEED, + rng_seed, sizeof(rng_seed)); + /* load initrd */ if (initrd_filename) { initrd_size = get_image_size(initrd_filename); |