Changes v1 -> v2: * Rewrite documentation, with suggestions from Markus * Try to reduce churn and keep the existing default_cpu_version static variable * Replace x86_cpu_class_get_alias_of() with x86_cpu_model_resolve_alias()
Link to v1: https://lore.kernel.org/qemu-devel/20191025022553.25298-1-ehabk...@redhat.com We had introduced versioned CPU models in QEMU 4.1, including a method for querying for CPU model versions using query-cpu-definitions. This solution had one problem: fetching CPU alias information for multiple machine types required restarting QEMU for each machine being queried. This series adds a new `machine` parameter to query-cpu-definitions, that can be used to query CPU model alias information for multiple machines without restarting QEMU. About CPU model versioning vs query-cpu-model-expansion ------------------------------------------------------- There had been some discussion[1] about using a mechanism for this similar to what's done in s390x, based on query-cpu-model-expansion. I had considered that approach in the beginning, but this would require query-cpu-model-expansion type=static to resolve to a useful base CPU model that is static. Unfortunately, we have no useful static CPU model in x86 yet, except for "base", because of the complex accelerator-dependent rules that affect expansion of CPU models. Maybe in the future we'll be able to define static versions of each CPU model, and unify the CPU model versioning approaches in all architectures. While we don't have this, we need to work with what we have. What we have today in x86 are CPU models that are not static and not accelerator-independent. [1] https://lore.kernel.org/qemu-devel/dbf9e4c1-0acf-9469-84f9-f80c41e2c...@redhat.com/ Eduardo Habkost (7): machine: machine_find_class() function i386: Add X86CPUModel.alias_of field i386: Replace x86_cpu_class_get_alias_of() with x86_cpu_model_resolve_alias() i386: Add default_version parameter to CPU version functions i386: Wrap QMP code in !CONFIG_USER_ONLY i386: Don't use default_cpu_version inside x86_cpu_definition_entry() cpu: Add `machine` parameter to query-cpu-definitions qapi/machine-target.json | 14 ++- include/hw/boards.h | 2 + hw/core/machine.c | 16 ++++ softmmu/vl.c | 17 +--- target/arm/helper.c | 4 +- target/i386/cpu.c | 105 +++++++++++++++------ target/mips/helper.c | 4 +- target/s390x/cpu_models.c | 4 +- target/ppc/translate_init.c.inc | 4 +- tests/acceptance/x86_cpu_model_versions.py | 48 ++++++++++ 10 files changed, 167 insertions(+), 51 deletions(-) -- 2.28.0