From: Rohitashv Kumar <roohiit@amazon.de>
When QEMU is built with the machine type marked as the default compiled
out, there is no default machine at all and starting QEMU without an
explicit -machine fails with:
No machine specified, and there is no default
On x86 this happens with a custom --with-devices-x86_64 configuration
that drops the i440fx/pc machine but keeps q35: i440fx carries is_default,
so once it is gone nothing is the default even though q35 is available.
This series lets a machine advertise itself as a *fallback* default:
1/2 adds an is_default_fallback flag to MachineClass and makes
find_default_machine() use it only when no is_default machine is
present.
2/2 marks the latest non-default PC-family machine (q35) as the fallback.
There is intentionally no behaviour change for a normal build: the
is_default machine (i440fx) always wins when present. The fallback only
takes effect when the default machine is not compiled in.
This is an alternative to simply flipping the default from i440fx to q35,
which would change long-standing default behaviour for everyone. Only one
machine may advertise itself as the fallback (find_default_machine()
asserts this, mirroring the single is_default assertion); on x86 that is
q35. A priority-based is_default was also considered but seemed like more
churn for the same result.
Tested by building QEMU with and without the i440fx/pc machine: with it
present i440fx remains the default; with CONFIG_I440FX=n q35 becomes the
default instead of QEMU having no default machine.
Rohitashv Kumar (2):
hw/core/machine: add a fallback default machine
hw/i386: make the latest non-default PC machine the fallback default
include/hw/core/boards.h | 1 +
include/hw/i386/pc.h | 2 ++
system/vl.c | 7 ++++++-
3 files changed, 9 insertions(+), 1 deletion(-)
--
2.47.3