qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/arm/msf2-som: Exit when the cpu is not the expected one
@ 2019-06-17 16:01 Philippe Mathieu-Daudé
  2019-06-17 17:15 ` Alistair Francis
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-06-17 16:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Eduardo Habkost, Alistair Francis,
	Subbaraya Sundeep, qemu-arm, Igor Mammedov,
	Philippe Mathieu-Daudé

This machine correctly defines its default_cpu_type to cortex-m3
and report an error if the user requested another cpu_type,
however it does not exit, and this can confuse users trying
to use another core:

  $ qemu-system-arm -M emcraft-sf2 -cpu cortex-m4 -kernel test-m4.elf
  qemu-system-arm: This board can only be used with CPU cortex-m3-arm-cpu
  [output related to M3 core ...]

The CPU is indeed a M3 core:

  (qemu) info qom-tree
  /machine (emcraft-sf2-machine)
    /unattached (container)
      /device[0] (msf2-soc)
        /armv7m (armv7m)
          /cpu (cortex-m3-arm-cpu)

Add the missing exit() call to return to the shell.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/arm/msf2-som.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c
index 8c550a8bdd..2c9984bb3b 100644
--- a/hw/arm/msf2-som.c
+++ b/hw/arm/msf2-som.c
@@ -53,6 +53,7 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
     if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) {
         error_report("This board can only be used with CPU %s",
                      mc->default_cpu_type);
+        exit(1);
     }
 
     memory_region_init_ram(ddr, NULL, "ddr-ram", DDR_SIZE,
-- 
2.20.1



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

* Re: [Qemu-devel] [PATCH] hw/arm/msf2-som: Exit when the cpu is not the expected one
  2019-06-17 16:01 [Qemu-devel] [PATCH] hw/arm/msf2-som: Exit when the cpu is not the expected one Philippe Mathieu-Daudé
@ 2019-06-17 17:15 ` Alistair Francis
  2019-06-17 17:20 ` Eduardo Habkost
  2019-07-01 11:14 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Alistair Francis @ 2019-06-17 17:15 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Eduardo Habkost, Alistair Francis,
	qemu-devel@nongnu.org Developers, Subbaraya Sundeep, qemu-arm,
	Igor Mammedov

On Mon, Jun 17, 2019 at 9:19 AM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> This machine correctly defines its default_cpu_type to cortex-m3
> and report an error if the user requested another cpu_type,
> however it does not exit, and this can confuse users trying
> to use another core:
>
>   $ qemu-system-arm -M emcraft-sf2 -cpu cortex-m4 -kernel test-m4.elf
>   qemu-system-arm: This board can only be used with CPU cortex-m3-arm-cpu
>   [output related to M3 core ...]
>
> The CPU is indeed a M3 core:
>
>   (qemu) info qom-tree
>   /machine (emcraft-sf2-machine)
>     /unattached (container)
>       /device[0] (msf2-soc)
>         /armv7m (armv7m)
>           /cpu (cortex-m3-arm-cpu)
>
> Add the missing exit() call to return to the shell.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

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

Alistair

> ---
>  hw/arm/msf2-som.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c
> index 8c550a8bdd..2c9984bb3b 100644
> --- a/hw/arm/msf2-som.c
> +++ b/hw/arm/msf2-som.c
> @@ -53,6 +53,7 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
>      if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) {
>          error_report("This board can only be used with CPU %s",
>                       mc->default_cpu_type);
> +        exit(1);
>      }
>
>      memory_region_init_ram(ddr, NULL, "ddr-ram", DDR_SIZE,
> --
> 2.20.1
>
>


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

* Re: [Qemu-devel] [PATCH] hw/arm/msf2-som: Exit when the cpu is not the expected one
  2019-06-17 16:01 [Qemu-devel] [PATCH] hw/arm/msf2-som: Exit when the cpu is not the expected one Philippe Mathieu-Daudé
  2019-06-17 17:15 ` Alistair Francis
@ 2019-06-17 17:20 ` Eduardo Habkost
  2019-07-01 11:14 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Eduardo Habkost @ 2019-06-17 17:20 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Alistair Francis, qemu-devel, Subbaraya Sundeep,
	qemu-arm, Igor Mammedov

On Mon, Jun 17, 2019 at 06:01:36PM +0200, Philippe Mathieu-Daudé wrote:
> This machine correctly defines its default_cpu_type to cortex-m3
> and report an error if the user requested another cpu_type,
> however it does not exit, and this can confuse users trying
> to use another core:
> 
>   $ qemu-system-arm -M emcraft-sf2 -cpu cortex-m4 -kernel test-m4.elf
>   qemu-system-arm: This board can only be used with CPU cortex-m3-arm-cpu
>   [output related to M3 core ...]
> 
> The CPU is indeed a M3 core:
> 
>   (qemu) info qom-tree
>   /machine (emcraft-sf2-machine)
>     /unattached (container)
>       /device[0] (msf2-soc)
>         /armv7m (armv7m)
>           /cpu (cortex-m3-arm-cpu)
> 
> Add the missing exit() call to return to the shell.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo


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

* Re: [Qemu-devel] [PATCH] hw/arm/msf2-som: Exit when the cpu is not the expected one
  2019-06-17 16:01 [Qemu-devel] [PATCH] hw/arm/msf2-som: Exit when the cpu is not the expected one Philippe Mathieu-Daudé
  2019-06-17 17:15 ` Alistair Francis
  2019-06-17 17:20 ` Eduardo Habkost
@ 2019-07-01 11:14 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2019-07-01 11:14 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, Alistair Francis, QEMU Developers,
	Subbaraya Sundeep, qemu-arm, Igor Mammedov

On Mon, 17 Jun 2019 at 17:01, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> This machine correctly defines its default_cpu_type to cortex-m3
> and report an error if the user requested another cpu_type,
> however it does not exit, and this can confuse users trying
> to use another core:
>
>   $ qemu-system-arm -M emcraft-sf2 -cpu cortex-m4 -kernel test-m4.elf
>   qemu-system-arm: This board can only be used with CPU cortex-m3-arm-cpu
>   [output related to M3 core ...]
>
> The CPU is indeed a M3 core:
>
>   (qemu) info qom-tree
>   /machine (emcraft-sf2-machine)
>     /unattached (container)
>       /device[0] (msf2-soc)
>         /armv7m (armv7m)
>           /cpu (cortex-m3-arm-cpu)
>
> Add the missing exit() call to return to the shell.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---



Applied to target-arm.next, thanks.

-- PMM


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

end of thread, other threads:[~2019-07-01 11:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-17 16:01 [Qemu-devel] [PATCH] hw/arm/msf2-som: Exit when the cpu is not the expected one Philippe Mathieu-Daudé
2019-06-17 17:15 ` Alistair Francis
2019-06-17 17:20 ` Eduardo Habkost
2019-07-01 11:14 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).