[PATCH 00/11] vl: compound properties for machines

Paolo Bonzini posted 11 patches 2 days, 10 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/next-importer-push tags/patchew/20210610133538.608390-1-pbonzini@redhat.com
Maintainers: Markus Armbruster <armbru@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Eric Blake <eblake@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>
hw/core/machine.c           | 184 +++++++++++---------
hw/i386/pc.c                | 108 ++++++------
hw/i386/x86.c               |  15 +-
include/hw/boards.h         |   4 +-
include/hw/i386/pc.h        |   3 -
include/hw/i386/x86.h       |   1 -
include/qemu/option.h       |   6 +-
include/qom/object.h        |  23 +++
qapi/machine.json           |  27 +++
qom/object_interfaces.c     |  58 +++++--
softmmu/vl.c                | 336 ++++++++++++++++++------------------
tests/qtest/numa-test.c     |  22 +--
tests/unit/test-keyval.c    |  56 ++++++
tests/unit/test-qemu-opts.c |  35 ----
util/keyval.c               |  90 +++++++++-
util/qemu-option.c          |  51 ++----
16 files changed, 584 insertions(+), 435 deletions(-)

[PATCH 00/11] vl: compound properties for machines

Posted by Paolo Bonzini 2 days, 10 hours ago
This series converts -M to keyval parsing, so that they can use
compound properties.  The series also converts -smp to a
compound property.

This is also a preparatory work for SGX support, which would like to use
an array-type machine property.

Patches 1-3 introduce the infrastructure and the new functions that
will be used for "-M help" and to use keyval with "merge_lists = true"
semantics.

Patch 4 does the actual switch of -M to keyval and patch 5 removes now
dead code from qemu-option

Patches 6-11 finally validate the concept by implementing -smp as a
compound property; that is "-smp X=Y" is converted to "-machine smp.X=Y"
automatically.  Really the only interesting patches are 9 and 11,
while the others are just cleanups.

The series does not support JSON syntax for -M because we need
to consider what happens if string-based dictionaries (produced by -M
key=val) have to be merged with strongly-typed dictionaries (produced
by -M {'key': 123}).

The plan is to only allow exactly one -M option when JSON syntax is in
use; the problem is that this is a forwards-compatibility landmine.
As soon as -smp is converted, for example, -smp becomes a shortcut for -M
and it is now forbidden to use -M '{....}' together with -smp.  It would
be impossible to know which options in the future will become incompatible
with -M JSON syntax.  Therefore, support for JSON syntax is delayed
until after the main options are converted to QOM compound properties.
These could be -boot, -acpitable, -smbios, -m, -semihosting-config,
-rtc and -fw_cfg.

Paolo

Paolo Bonzini (11):
  qom: export more functions for use with non-UserCreatable objects
  keyval: introduce keyval_merge
  keyval: introduce keyval_parse_into
  vl: switch -M parsing to keyval
  qemu-option: remove now-dead code
  machine: move dies from X86MachineState to CpuTopology
  machine: move common smp_parse code to caller
  machine: add error propagation to mc->smp_parse
  machine: pass QAPI struct to mc->smp_parse
  machine: reject -smp dies!=1 for non-PC machines
  machine: add smp compound property

 hw/core/machine.c           | 184 +++++++++++---------
 hw/i386/pc.c                | 108 ++++++------
 hw/i386/x86.c               |  15 +-
 include/hw/boards.h         |   4 +-
 include/hw/i386/pc.h        |   3 -
 include/hw/i386/x86.h       |   1 -
 include/qemu/option.h       |   6 +-
 include/qom/object.h        |  23 +++
 qapi/machine.json           |  27 +++
 qom/object_interfaces.c     |  58 +++++--
 softmmu/vl.c                | 336 ++++++++++++++++++------------------
 tests/qtest/numa-test.c     |  22 +--
 tests/unit/test-keyval.c    |  56 ++++++
 tests/unit/test-qemu-opts.c |  35 ----
 util/keyval.c               |  90 +++++++++-
 util/qemu-option.c          |  51 ++----
 16 files changed, 584 insertions(+), 435 deletions(-)

-- 
2.31.1