There are two places where the user specified CPU type is checked to see if it's supported or allowed by the board: machine_run_board_init() and mc->init(). We don't have to maintain two duplicate sets of logic. This series intends to move the check to machine_run_board_init().
PATCH[1-3] Improves the check in machine_run_board_init() PATCH[4-8] Move the check mc->init() to machine_run_board_init() v1: https://lists.nongnu.org/archive/html/qemu-arm/2023-07/msg00302.html Testing ======= With the following command lines, the output messages are varied before and after the series is applied. /home/gshan/sandbox/src/qemu/main/build/qemu-system-aarch64 \ -accel tcg -machine virt,gic-version=3,nvdimm=on \ -cpu cortex-a8 -smp maxcpus=2,cpus=1 \ : Before the series is applied: qemu-system-aarch64: mach-virt: CPU type cortex-a8-arm-cpu not supported After the series is applied: qemu-system-aarch64: Invalid CPU type: cortex-a8-arm-cpu The valid models are: cortex-a7, cortex-a15, cortex-a35, cortex-a55, cortex-a72, cortex-a76, a64fx, neoverse-n1, neoverse-v1, cortex-a53, cortex-a57, max Changelog ========= v2: * Constify mc->valid_cpu_types (Richard) * Print the supported CPU models, instead of typenames (Peter) * Misc improvements for the hleper to do the check (Igor) * More patches to move the check (Marcin) Gavin Shan (8): machine: Use error handling when CPU type is checked machine: Introduce helper is_cpu_type_supported() machine: Print supported CPU models instead of typenames hw/arm/virt: Check CPU type in machine_run_board_init() hw/arm/virt: Unsupported host CPU model on TCG hw/arm/sbsa-ref: Check CPU type in machine_run_board_init() hw/arm: Check CPU type in machine_run_board_init() hw/riscv/shakti_c: Check CPU type in machine_run_board_init() hw/arm/bananapi_m2u.c | 18 ++++++--- hw/arm/cubieboard.c | 18 ++++++--- hw/arm/mps2-tz.c | 34 ++++++++++++++--- hw/arm/mps2.c | 44 ++++++++++++++++++--- hw/arm/msf2-som.c | 18 ++++++--- hw/arm/musca.c | 19 ++++++---- hw/arm/npcm7xx_boards.c | 19 ++++++---- hw/arm/orangepi.c | 18 ++++++--- hw/arm/sbsa-ref.c | 29 ++++++-------- hw/arm/virt.c | 43 ++++++++++++--------- hw/core/machine.c | 84 +++++++++++++++++++++++------------------ hw/m68k/q800.c | 8 +++- hw/riscv/shakti_c.c | 17 ++++++--- include/hw/boards.h | 3 +- 14 files changed, 243 insertions(+), 129 deletions(-) -- 2.41.0