hw/microblaze: pass random seed to fdt
PATCH 1/1 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.
--- hw/microblaze/boot.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/microblaze/boot.c +5 -0
@@ -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);
Signature · 1 line
2.35.1
Quoted 4 lines · Jason A. Donenfeld
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.
Quoted 42 lines
Cc Edgar E. Iglesias <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>--- hw/microblaze/boot.c | 5 +++++ 1 file changed, 5 insertions(+)hw/microblaze/boot.c +5
-0@@ -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);--
2.35.1
Hey Edgar,
Quoted 10 lines · Edgar E. Iglesias
Quoted 4 lines · Jason A. Donenfeld
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 <[email protected]>
Thanks for looking at this. Paolo (CC'd) just sent a few similar changes for different archs in a pull, but not this one, on the supposition that you'd roll this into your next pull. If this isn't the case, please pipe up so Paolo can take it instead later.
Jason
Quoted 14 lines · Jason A. Donenfeld
Hey Edgar,
Quoted 3 lines · Edgar E. Iglesias
On Tue, Jul 19, 2022 at 2:23 PM Jason A. Donenfeld <[email protected]>
Quoted 6 lines · wrote:
Quoted 4 lines
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.
Quoted 9 lines
Quoted 1 line
Reviewed-by Edgar E. Iglesias <[email protected]>Thanks for looking at this. Paolo (CC'd) just sent a few similar changes for different archs in a pull, but not this one, on the supposition that you'd roll this into your next pull. If this isn't the case, please pipe up so Paolo can take it instead later.
Jason
Ah OK, Paolo, it would be great if you would take this via your tree!
Thanks,
Edgar
Quoted 1 line
Hi Edgar,
Quoted 1 line · Edgar E. Iglesias
Ah OK, Paolo, it would be great if you would take this via your tree!
It looks like Paolo never did this. So you might want to queue this somewhere, or bug him to take it, or something. I don't know how this works with 7.1-rc0 just being tagged, but I assume this means this has to wait until 7.2
Jason
Quoted 10 lines · Jason A. Donenfeld
Hi Edgar,
Quoted 1 line · Edgar E. Iglesias
Ah OK, Paolo, it would be great if you would take this via your tree!
It looks like Paolo never did this. So you might want to queue this somewhere, or bug him to take it, or something. I don't know how this works with 7.1-rc0 just being tagged, but I assume this means this has to wait until 7.2
Yes, it has missed the window by over a week now: soft freeze. You really should have kept all of these in one thread.
r~
Hi Richard,
Quoted 7 lines · Richard Henderson
Quoted 6 lines · Jason A. Donenfeld
Hi Edgar,
Quoted 1 line · Edgar E. Iglesias
Ah OK, Paolo, it would be great if you would take this via your tree!
Quoted 7 lines
Quoted 4 lines
It looks like Paolo never did this. So you might want to queue this somewhere, or bug him to take it, or something. I don't know how this works with 7.1-rc0 just being tagged, but I assume this means this has to wait until 7.2
Yes, it has missed the window by over a week now: soft freeze. You really should have kept all of these in one thread.
Shoulda woulda coulda. It doesn't really matter to me much when the microblaze one goes in, just that it can exist in some maintainer tree. I'd like to be able to remove this from my "pending patch list" that I have to monitor lest things be forgotten.
Jason
PATCH RESEND 1/1 hw/microblaze: pass random seed to fdt
In reply to Edgar E. IglesiasIf 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.
--- hw/microblaze/boot.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/microblaze/boot.c +5 -0
@@ -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);
Signature · 1 line
2.37.3
Quoted 42 lines · Jason A. Donenfeld
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 <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>--- hw/microblaze/boot.c | 5 +++++ 1 file changed, 5 insertions(+)hw/microblaze/boot.c +5
-1@@ -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); --
Quoted 2 lines
2.37.3
Bumping this patch. Could somebody queue this up?
Quoted 36 lines · Jason A. Donenfeld
Quoted 35 lines · Jason A. Donenfeld
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 <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>--- hw/microblaze/boot.c | 5 +++++ 1 file changed, 5 insertions(+)hw/microblaze/boot.c +2
-0@@ -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 ; }
Quoted 11 lines
Quoted 9 lines
hw/microblaze/boot.c +3
-1+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); --2.37.3
Bumping this patch. Could somebody queue this up?
Hi Jason,
I've just sent a pull-request with this patch.
Thanks,
Edgar