aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-09-08 11:40:30 +0200
committerEdgar E. Iglesias <edgar.iglesias@amd.com>2022-09-21 19:59:56 +0200
commitb91b6b5a2cd83a096116929dfc8e016091080adc (patch)
treef4d58b8ee841ad4a595c98d22f35d2c1795d770f /hw
parent2906f933dd1de6d94c54881cc16ea7390a6ba300 (diff)
downloadqemu-b91b6b5a2cd83a096116929dfc8e016091080adc.zip
qemu-b91b6b5a2cd83a096116929dfc8e016091080adc.tar.gz
qemu-b91b6b5a2cd83a096116929dfc8e016091080adc.tar.bz2
hw/microblaze: pass random seed to fdt
If the FDT contains /chosen/rng-seed, then the Linux RNG will use it to initialize early. Set this using the usual guest random number generation function. This FDT node is part of the DT specification. Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/microblaze/boot.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
index 8b92a98..25ad547 100644
--- a/hw/microblaze/boot.c
+++ b/hw/microblaze/boot.c
@@ -30,6 +30,7 @@
#include "qemu/option.h"
#include "qemu/config-file.h"
#include "qemu/error-report.h"
+#include "qemu/guest-random.h"
#include "sysemu/device_tree.h"
#include "sysemu/reset.h"
#include "hw/boards.h"
@@ -75,6 +76,7 @@ static int microblaze_load_dtb(hwaddr addr,
int fdt_size;
void *fdt = NULL;
int r;
+ uint8_t rng_seed[32];
if (dtb_filename) {
fdt = load_device_tree(dtb_filename, &fdt_size);
@@ -83,6 +85,9 @@ static int microblaze_load_dtb(hwaddr addr,
return 0;
}
+ qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));
+ qemu_fdt_setprop(fdt, "/chosen", "rng-seed", rng_seed, sizeof(rng_seed));
+
if (kernel_cmdline) {
r = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
kernel_cmdline);