All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/microblaze: pass random seed to fdt
@ 2022-07-19 12:23 Jason A. Donenfeld
  2022-07-20  7:13 ` Edgar E. Iglesias
  0 siblings, 1 reply; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-07-19 12:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jason A. Donenfeld, Edgar E . Iglesias

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.

Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 hw/microblaze/boot.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
index 8b92a9801a..25ad54754e 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);
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] hw/microblaze: pass random seed to fdt
  2022-07-19 12:23 [PATCH] hw/microblaze: pass random seed to fdt Jason A. Donenfeld
@ 2022-07-20  7:13 ` Edgar E. Iglesias
  2022-07-21 16:43   ` Jason A. Donenfeld
  0 siblings, 1 reply; 10+ messages in thread
From: Edgar E. Iglesias @ 2022-07-20  7:13 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1585 bytes --]

On Tue, Jul 19, 2022 at 2:23 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:

> 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@amd.com>



>
> Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  hw/microblaze/boot.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
> index 8b92a9801a..25ad54754e 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);
> --
> 2.35.1
>
>

[-- Attachment #2: Type: text/html, Size: 2556 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hw/microblaze: pass random seed to fdt
  2022-07-20  7:13 ` Edgar E. Iglesias
@ 2022-07-21 16:43   ` Jason A. Donenfeld
  2022-07-21 18:43     ` Edgar E. Iglesias
  0 siblings, 1 reply; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-07-21 16:43 UTC (permalink / raw)
  To: Edgar E. Iglesias; +Cc: qemu-devel, Paolo Bonzini

Hey Edgar,

On Wed, Jul 20, 2022 at 9:13 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
>
> On Tue, Jul 19, 2022 at 2:23 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>>
>> 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@amd.com>

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hw/microblaze: pass random seed to fdt
  2022-07-21 16:43   ` Jason A. Donenfeld
@ 2022-07-21 18:43     ` Edgar E. Iglesias
  2022-07-27  1:49       ` Jason A. Donenfeld
  2022-09-08  9:40       ` [PATCH RESEND] " Jason A. Donenfeld
  0 siblings, 2 replies; 10+ messages in thread
From: Edgar E. Iglesias @ 2022-07-21 18:43 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: qemu-devel, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

On Thu, Jul 21, 2022, 6:44 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:

> Hey Edgar,
>
> On Wed, Jul 20, 2022 at 9:13 AM Edgar E. Iglesias
> <edgar.iglesias@gmail.com> wrote:
> >
> >
> > On Tue, Jul 19, 2022 at 2:23 PM Jason A. Donenfeld <Jason@zx2c4.com>
> wrote:
> >>
> >> 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@amd.com>
>
> 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

>

[-- Attachment #2: Type: text/html, Size: 1870 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hw/microblaze: pass random seed to fdt
  2022-07-21 18:43     ` Edgar E. Iglesias
@ 2022-07-27  1:49       ` Jason A. Donenfeld
  2022-07-27  3:13         ` Richard Henderson
  2022-09-08  9:40       ` [PATCH RESEND] " Jason A. Donenfeld
  1 sibling, 1 reply; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-07-27  1:49 UTC (permalink / raw)
  To: Edgar E. Iglesias; +Cc: qemu-devel, Paolo Bonzini

Hi Edgar,

On Thu, Jul 21, 2022 at 8:43 PM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
> 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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hw/microblaze: pass random seed to fdt
  2022-07-27  1:49       ` Jason A. Donenfeld
@ 2022-07-27  3:13         ` Richard Henderson
  2022-07-27 11:51           ` Jason A. Donenfeld
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2022-07-27  3:13 UTC (permalink / raw)
  To: Jason A. Donenfeld, Edgar E. Iglesias; +Cc: qemu-devel, Paolo Bonzini

On 7/26/22 18:49, Jason A. Donenfeld wrote:
> Hi Edgar,
> 
> On Thu, Jul 21, 2022 at 8:43 PM Edgar E. Iglesias
> <edgar.iglesias@gmail.com> wrote:
>> 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~


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hw/microblaze: pass random seed to fdt
  2022-07-27  3:13         ` Richard Henderson
@ 2022-07-27 11:51           ` Jason A. Donenfeld
  0 siblings, 0 replies; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-07-27 11:51 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Edgar E. Iglesias, qemu-devel, Paolo Bonzini

Hi Richard,

On Tue, Jul 26, 2022 at 08:13:09PM -0700, Richard Henderson wrote:
> On 7/26/22 18:49, Jason A. Donenfeld wrote:
> > Hi Edgar,
> > 
> > On Thu, Jul 21, 2022 at 8:43 PM Edgar E. Iglesias
> > <edgar.iglesias@gmail.com> wrote:
> >> 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.

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH RESEND] hw/microblaze: pass random seed to fdt
  2022-07-21 18:43     ` Edgar E. Iglesias
  2022-07-27  1:49       ` Jason A. Donenfeld
@ 2022-09-08  9:40       ` Jason A. Donenfeld
  2022-09-21 10:32         ` Jason A. Donenfeld
  1 sibling, 1 reply; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-09-08  9:40 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini, Richard Henderson
  Cc: Jason A. Donenfeld, Edgar E . Iglesias

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>
---
 hw/microblaze/boot.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
index 8b92a9801a..25ad54754e 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);
-- 
2.37.3



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH RESEND] hw/microblaze: pass random seed to fdt
  2022-09-08  9:40       ` [PATCH RESEND] " Jason A. Donenfeld
@ 2022-09-21 10:32         ` Jason A. Donenfeld
  2022-09-21 20:27           ` Edgar E. Iglesias
  0 siblings, 1 reply; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-09-21 10:32 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini, Richard Henderson; +Cc: Edgar E . Iglesias

On Thu, Sep 8, 2022 at 11:40 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> 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>
> ---
>  hw/microblaze/boot.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
> index 8b92a9801a..25ad54754e 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);
> --
> 2.37.3
>

Bumping this patch. Could somebody queue this up?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RESEND] hw/microblaze: pass random seed to fdt
  2022-09-21 10:32         ` Jason A. Donenfeld
@ 2022-09-21 20:27           ` Edgar E. Iglesias
  0 siblings, 0 replies; 10+ messages in thread
From: Edgar E. Iglesias @ 2022-09-21 20:27 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: qemu-devel, Paolo Bonzini, Richard Henderson

On Wed, Sep 21, 2022 at 12:32:37PM +0200, Jason A. Donenfeld wrote:
> On Thu, Sep 8, 2022 at 11:40 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> >
> > 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>
> > ---
> >  hw/microblaze/boot.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
> > index 8b92a9801a..25ad54754e 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);
> > --
> > 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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-09-21 20:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 12:23 [PATCH] hw/microblaze: pass random seed to fdt Jason A. Donenfeld
2022-07-20  7:13 ` Edgar E. Iglesias
2022-07-21 16:43   ` Jason A. Donenfeld
2022-07-21 18:43     ` Edgar E. Iglesias
2022-07-27  1:49       ` Jason A. Donenfeld
2022-07-27  3:13         ` Richard Henderson
2022-07-27 11:51           ` Jason A. Donenfeld
2022-09-08  9:40       ` [PATCH RESEND] " Jason A. Donenfeld
2022-09-21 10:32         ` Jason A. Donenfeld
2022-09-21 20:27           ` Edgar E. Iglesias

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.