* [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM
@ 2022-04-01 12:18 Ralf Ramsauer
2022-04-12 0:03 ` Alistair Francis
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ralf Ramsauer @ 2022-04-01 12:18 UTC (permalink / raw)
To: qemu-devel, Daniel P . Berrangé, Alistair Francis
Cc: Anup Patel, Peter Maydell, Anup Patel, Ralf Ramsauer,
Palmer Dabbelt, Stefan Huber, Jiangyifei
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.
Better exit in that case to not confuse the user.
Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
---
hw/riscv/virt.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index da50cbed43..09609c96e8 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1308,12 +1308,18 @@ static void virt_machine_init(MachineState *machine)
/*
* Only direct boot kernel is currently supported for KVM VM,
- * so the "-bios" parameter is ignored and treated like "-bios none"
- * when KVM is enabled.
+ * so the "-bios" parameter is not supported when KVM is enabled.
*/
if (kvm_enabled()) {
- g_free(machine->firmware);
- machine->firmware = g_strdup("none");
+ if (machine->firmware) {
+ if (strcmp(machine->firmware, "none")) {
+ error_report("Machine mode firmware is not supported in "
+ "combination with KVM.");
+ exit(1);
+ }
+ } else {
+ machine->firmware = g_strdup("none");
+ }
}
if (riscv_is_32bit(&s->soc[0])) {
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM
2022-04-01 12:18 [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM Ralf Ramsauer
@ 2022-04-12 0:03 ` Alistair Francis
2022-04-12 1:10 ` Bin Meng
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2022-04-12 0:03 UTC (permalink / raw)
To: Ralf Ramsauer
Cc: Anup Patel, Peter Maydell, Daniel P . Berrangé,
Anup Patel, qemu-devel@nongnu.org Developers, Palmer Dabbelt,
Stefan Huber, Jiangyifei
On Fri, Apr 1, 2022 at 10:18 PM 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.
>
> Better exit in that case to not confuse the user.
>
> Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> hw/riscv/virt.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index da50cbed43..09609c96e8 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1308,12 +1308,18 @@ static void virt_machine_init(MachineState *machine)
>
> /*
> * Only direct boot kernel is currently supported for KVM VM,
> - * so the "-bios" parameter is ignored and treated like "-bios none"
> - * when KVM is enabled.
> + * so the "-bios" parameter is not supported when KVM is enabled.
> */
> if (kvm_enabled()) {
> - g_free(machine->firmware);
> - machine->firmware = g_strdup("none");
> + if (machine->firmware) {
> + if (strcmp(machine->firmware, "none")) {
> + error_report("Machine mode firmware is not supported in "
> + "combination with KVM.");
> + exit(1);
> + }
> + } else {
> + machine->firmware = g_strdup("none");
> + }
> }
>
> if (riscv_is_32bit(&s->soc[0])) {
> --
> 2.32.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM
2022-04-01 12:18 [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM Ralf Ramsauer
2022-04-12 0:03 ` Alistair Francis
@ 2022-04-12 1:10 ` Bin Meng
2022-04-12 3:01 ` Anup Patel
2022-04-12 4:22 ` Alistair Francis
3 siblings, 0 replies; 5+ messages in thread
From: Bin Meng @ 2022-04-12 1:10 UTC (permalink / raw)
To: Ralf Ramsauer
Cc: Anup Patel, Peter Maydell, Daniel P . Berrangé,
Anup Patel, qemu-devel@nongnu.org Developers, Palmer Dabbelt,
Stefan Huber, Alistair Francis, Jiangyifei
On Fri, Apr 1, 2022 at 8:19 PM 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.
>
> Better exit in that case to not confuse the user.
>
> Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
> ---
> hw/riscv/virt.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM
2022-04-01 12:18 [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM Ralf Ramsauer
2022-04-12 0:03 ` Alistair Francis
2022-04-12 1:10 ` Bin Meng
@ 2022-04-12 3:01 ` Anup Patel
2022-04-12 4:22 ` Alistair Francis
3 siblings, 0 replies; 5+ messages in thread
From: Anup Patel @ 2022-04-12 3:01 UTC (permalink / raw)
To: Ralf Ramsauer
Cc: Anup Patel, Peter Maydell, Daniel P . Berrangé,
QEMU Developers, Palmer Dabbelt, Stefan Huber, Alistair Francis,
Jiangyifei
On Fri, Apr 1, 2022 at 5:48 PM 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.
>
> Better exit in that case to not confuse the user.
>
> Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
Looks good to me.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
> ---
> hw/riscv/virt.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index da50cbed43..09609c96e8 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1308,12 +1308,18 @@ static void virt_machine_init(MachineState *machine)
>
> /*
> * Only direct boot kernel is currently supported for KVM VM,
> - * so the "-bios" parameter is ignored and treated like "-bios none"
> - * when KVM is enabled.
> + * so the "-bios" parameter is not supported when KVM is enabled.
> */
> if (kvm_enabled()) {
> - g_free(machine->firmware);
> - machine->firmware = g_strdup("none");
> + if (machine->firmware) {
> + if (strcmp(machine->firmware, "none")) {
> + error_report("Machine mode firmware is not supported in "
> + "combination with KVM.");
> + exit(1);
> + }
> + } else {
> + machine->firmware = g_strdup("none");
> + }
> }
>
> if (riscv_is_32bit(&s->soc[0])) {
> --
> 2.32.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM
2022-04-01 12:18 [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM Ralf Ramsauer
` (2 preceding siblings ...)
2022-04-12 3:01 ` Anup Patel
@ 2022-04-12 4:22 ` Alistair Francis
3 siblings, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2022-04-12 4:22 UTC (permalink / raw)
To: Ralf Ramsauer
Cc: Anup Patel, Peter Maydell, Daniel P . Berrangé,
Anup Patel, qemu-devel@nongnu.org Developers, Palmer Dabbelt,
Stefan Huber, Jiangyifei
On Fri, Apr 1, 2022 at 10:18 PM 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.
>
> Better exit in that case to not confuse the user.
>
> Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
Thanks!
Applied to riscv-to-apply.next
Alistair
> ---
> hw/riscv/virt.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index da50cbed43..09609c96e8 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1308,12 +1308,18 @@ static void virt_machine_init(MachineState *machine)
>
> /*
> * Only direct boot kernel is currently supported for KVM VM,
> - * so the "-bios" parameter is ignored and treated like "-bios none"
> - * when KVM is enabled.
> + * so the "-bios" parameter is not supported when KVM is enabled.
> */
> if (kvm_enabled()) {
> - g_free(machine->firmware);
> - machine->firmware = g_strdup("none");
> + if (machine->firmware) {
> + if (strcmp(machine->firmware, "none")) {
> + error_report("Machine mode firmware is not supported in "
> + "combination with KVM.");
> + exit(1);
> + }
> + } else {
> + machine->firmware = g_strdup("none");
> + }
> }
>
> if (riscv_is_32bit(&s->soc[0])) {
> --
> 2.32.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-12 4:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 12:18 [PATCH v3] hw/riscv: virt: Exit if the user provided -bios in combination with KVM Ralf Ramsauer
2022-04-12 0:03 ` Alistair Francis
2022-04-12 1:10 ` Bin Meng
2022-04-12 3:01 ` Anup Patel
2022-04-12 4:22 ` Alistair Francis
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.