Hi Igor,

On 24/11/23 14:13, Igor Mammedov wrote:
On Fri, 17 Nov 2023 08:17:02 +0100
Philippe Mathieu-Daudé <phi...@linaro.org> wrote:

Both 'netduinoplus2' and 'olimex-stm32-h405' machines ignore the
CPU type requested by the command line. This might confuse users,
since the following will create a machine with a Cortex-M4 CPU:

   $ qemu-system-aarch64 -M netduinoplus2 -cpu cortex-r5f

Set the MachineClass::valid_cpu_types field (introduced in commit
c9cf636d48 "machine: Add a valid_cpu_types property").
Remove the now unused MachineClass::default_cpu_type field.

Why default_cpu_type is removed?

"Since the SoC family can only use Cortex-M4 CPUs, hard-code the
 CPU type name at the SoC level"

what if user didn't user -cpu at all?

The CPU is hardcoded, default value is not used.

qemu-system-arm -M olimex-stm32-h405 -S -monitor stdio
QEMU 8.1.91 monitor - type 'help' for more information
(qemu) info qtree
...
  dev: armv7m, id ""
    gpio-in "NMI" 1
    gpio-out "SYSRESETREQ" 1
    gpio-in "" 96
    clock-in "cpuclk" freq_hz=168 MHz
    clock-in "refclk" freq_hz=21 MHz
    cpu-type = "cortex-m4-arm-cpu"
    ...



We now get:

   $ qemu-system-aarch64 -M netduinoplus2 -cpu cortex-r5f
   qemu-system-aarch64: Invalid CPU type: cortex-r5f-arm-cpu
   The valid types are: cortex-m4-arm-cpu

Since the SoC family can only use Cortex-M4 CPUs, hard-code the
CPU type name at the SoC level, removing the QOM property
entirely.

Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  include/hw/arm/stm32f405_soc.h | 4 ----
  hw/arm/netduinoplus2.c         | 7 ++++++-
  hw/arm/olimex-stm32-h405.c     | 8 ++++++--
  hw/arm/stm32f405_soc.c         | 8 +-------
  4 files changed, 13 insertions(+), 14 deletions(-)


Reply via email to