All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [PULL 9/9] hw/i386: pass RNG seed via setup_data entry
Date: Tue, 2 Aug 2022 11:28:15 +0800	[thread overview]
Message-ID: <dae86884-6cfa-a428-374c-60c42900aade@intel.com> (raw)
In-Reply-To: <20220721163621.761513-10-pbonzini@redhat.com>

On 7/22/2022 12:36 AM, Paolo Bonzini wrote:
> From: "Jason A. Donenfeld" <Jason@zx2c4.com>
> 
> Tiny machines optimized for fast boot time generally don't use EFI,
> which means a random seed has to be supplied some other way. For this
> purpose, Linux (≥5.20) supports passing a seed in the setup_data table
> with SETUP_RNG_SEED, specially intended for hypervisors, kexec, and
> specialized bootloaders. The linked commit shows the upstream kernel
> implementation.
> 
> At Paolo's request, we don't pass these to versioned machine types ≤7.0.
> 
> Link: https://git.kernel.org/tip/tip/c/68b8e9713c8
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Eduardo Habkost <eduardo@habkost.net>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Cc: Laurent Vivier <laurent@vivier.eu>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> Message-Id: <20220721125636.446842-1-Jason@zx2c4.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/i386/microvm.c                            |  2 +-
>   hw/i386/pc.c                                 |  4 +--
>   hw/i386/pc_piix.c                            |  2 ++
>   hw/i386/pc_q35.c                             |  2 ++
>   hw/i386/x86.c                                | 26 +++++++++++++++++---
>   include/hw/i386/pc.h                         |  3 +++
>   include/hw/i386/x86.h                        |  3 ++-
>   include/standard-headers/asm-x86/bootparam.h |  1 +
>   8 files changed, 35 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
> index dc929727dc..7fe8cce03e 100644
> --- a/hw/i386/microvm.c
> +++ b/hw/i386/microvm.c
> @@ -332,7 +332,7 @@ static void microvm_memory_init(MicrovmMachineState *mms)
>       rom_set_fw(fw_cfg);
>   
>       if (machine->kernel_filename != NULL) {
> -        x86_load_linux(x86ms, fw_cfg, 0, true);
> +        x86_load_linux(x86ms, fw_cfg, 0, true, false);
>       }
>   
>       if (mms->option_roms) {
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 774cb2bf07..d2b5823ffb 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -796,7 +796,7 @@ void xen_load_linux(PCMachineState *pcms)
>       rom_set_fw(fw_cfg);
>   
>       x86_load_linux(x86ms, fw_cfg, pcmc->acpi_data_size,
> -                   pcmc->pvh_enabled);
> +                   pcmc->pvh_enabled, pcmc->legacy_no_rng_seed);
>       for (i = 0; i < nb_option_roms; i++) {
>           assert(!strcmp(option_rom[i].name, "linuxboot.bin") ||
>                  !strcmp(option_rom[i].name, "linuxboot_dma.bin") ||
> @@ -992,7 +992,7 @@ void pc_memory_init(PCMachineState *pcms,
>   
>       if (linux_boot) {
>           x86_load_linux(x86ms, fw_cfg, pcmc->acpi_data_size,
> -                       pcmc->pvh_enabled);
> +                       pcmc->pvh_enabled, pcmc->legacy_no_rng_seed);
>       }
>   
>       for (i = 0; i < nb_option_roms; i++) {
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index a234989ac3..fbf9465318 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -438,9 +438,11 @@ DEFINE_I440FX_MACHINE(v7_1, "pc-i440fx-7.1", NULL,
>   
>   static void pc_i440fx_7_0_machine_options(MachineClass *m)
>   {
> +    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>       pc_i440fx_7_1_machine_options(m);
>       m->alias = NULL;
>       m->is_default = false;
> +    pcmc->legacy_no_rng_seed = true;
>       compat_props_add(m->compat_props, hw_compat_7_0, hw_compat_7_0_len);
>       compat_props_add(m->compat_props, pc_compat_7_0, pc_compat_7_0_len);
>   }
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index f96cbd04e2..12cc76aaf8 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -375,8 +375,10 @@ DEFINE_Q35_MACHINE(v7_1, "pc-q35-7.1", NULL,
>   
>   static void pc_q35_7_0_machine_options(MachineClass *m)
>   {
> +    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>       pc_q35_7_1_machine_options(m);
>       m->alias = NULL;
> +    pcmc->legacy_no_rng_seed = true;

Is making .legacy_no_rng_seed default false and opt-in it for old 
machines correct?

AFAICT, QEMU with machine-7.1 fails to boot with OVMF on my environment.



  reply	other threads:[~2022-08-02  3:29 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 16:36 [PULL 0/9] More fixes + random seed patches for QEMU 7.1 Paolo Bonzini
2022-07-21 16:36 ` [PULL 1/9] docs: Add caveats for Windows as the build platform Paolo Bonzini
2022-07-21 16:36 ` [PULL 2/9] accel/kvm: Avoid Coverity warning in query_stats() Paolo Bonzini
2022-07-21 16:36 ` [PULL 3/9] oss-fuzz: remove binaries from qemu-bundle tree Paolo Bonzini
2022-07-21 16:36 ` [PULL 4/9] oss-fuzz: ensure base_copy is a generic-fuzzer Paolo Bonzini
2022-07-21 16:36 ` [PULL 5/9] hw/nios2: virt: pass random seed to fdt Paolo Bonzini
2022-07-21 16:36 ` [PULL 6/9] hw/mips: boston: " Paolo Bonzini
2022-07-21 16:36 ` [PULL 7/9] hw/guest-loader: " Paolo Bonzini
2022-07-21 19:36   ` Alex Bennée
2022-07-21 20:20     ` Jason A. Donenfeld
2022-07-22  9:45       ` Alex Bennée
2022-07-22 11:26         ` Jason A. Donenfeld
2022-07-22 14:27           ` Alex Bennée
2022-07-22 16:32             ` Paolo Bonzini
2022-07-22 19:07             ` Jason A. Donenfeld
2022-07-22 12:04       ` Paolo Bonzini
2022-07-22 12:21         ` Jason A. Donenfeld
2022-07-21 16:36 ` [PULL 8/9] hw/rx: " Paolo Bonzini
2022-07-21 16:36 ` [PULL 9/9] hw/i386: pass RNG seed via setup_data entry Paolo Bonzini
2022-08-02  3:28   ` Xiaoyao Li [this message]
2022-08-02 13:21     ` Jason A. Donenfeld
2022-08-02 14:53       ` Xiaoyao Li
2022-08-02 15:06         ` Jason A. Donenfeld
2022-08-02 15:13           ` Jason A. Donenfeld
2022-08-03  1:34             ` Xiaoyao Li
2022-08-03 10:52             ` Daniel P. Berrangé
2022-08-03 13:11               ` Jason A. Donenfeld
2022-08-03 13:34                 ` Jason A. Donenfeld
2022-08-03 17:07                   ` Jason A. Donenfeld
2022-08-03 22:03                     ` Michael S. Tsirkin
2022-08-03 22:08                       ` Jason A. Donenfeld
2022-08-03 22:23                         ` Michael S. Tsirkin
2022-08-04  5:40                           ` Laszlo Ersek
2022-08-04 12:01   ` Daniel P. Berrangé
2022-08-04 12:13     ` Jason A. Donenfeld
2022-08-04 12:48       ` Daniel P. Berrangé
2022-08-04 16:56     ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dae86884-6cfa-a428-374c-60c42900aade@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=Jason@zx2c4.com \
    --cc=eduardo@habkost.net \
    --cc=f4bug@amsat.org \
    --cc=laurent@vivier.eu \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.