[PATCH v2] hw/riscv: virt: Warn the user if -bios is provided when using KVM

Ralf Ramsauer posted 1 patch 2 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220323223150.1600194-1-ralf.ramsauer@oth-regensburg.de
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>
hw/riscv/virt.c | 4 ++++
1 file changed, 4 insertions(+)
[PATCH v2] hw/riscv: virt: Warn the user if -bios is provided when using KVM
Posted by Ralf Ramsauer 2 years, 1 month ago
The -bios option is silently ignored if used in combination with -enable-kvm.
The reason is that the machine starts in S-Mode, and the bios typically runs in
M-Mode.

Warn the user that the bios won't be loaded.

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
---
 hw/riscv/virt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index da50cbed43..0c477addbc 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1312,6 +1312,10 @@ static void virt_machine_init(MachineState *machine)
      * when KVM is enabled.
      */
     if (kvm_enabled()) {
+        if (machine->firmware && strcmp(machine->firmware, "none")) {
+            warn_report("Machine mode firmware is not supported in combination "
+                        "with KVM. Ignoring -bios.");
+        }
         g_free(machine->firmware);
         machine->firmware = g_strdup("none");
     }
-- 
2.35.1
Re: [PATCH v2] hw/riscv: virt: Warn the user if -bios is provided when using KVM
Posted by Alistair Francis 2 years, 1 month ago
On Thu, Mar 24, 2022 at 8:31 AM Ralf Ramsauer
<ralf.ramsauer@oth-regensburg.de> wrote:
>
> The -bios option is silently ignored if used in combination with -enable-kvm.
> The reason is that the machine starts in S-Mode, and the bios typically runs in
> M-Mode.
>
> Warn the user that the bios won't be loaded.
>
> Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>

Thanks!

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/riscv/virt.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index da50cbed43..0c477addbc 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1312,6 +1312,10 @@ static void virt_machine_init(MachineState *machine)
>       * when KVM is enabled.
>       */
>      if (kvm_enabled()) {
> +        if (machine->firmware && strcmp(machine->firmware, "none")) {
> +            warn_report("Machine mode firmware is not supported in combination "
> +                        "with KVM. Ignoring -bios.");
> +        }
>          g_free(machine->firmware);
>          machine->firmware = g_strdup("none");
>      }
> --
> 2.35.1
>