Skip to content

qemu-machine as a QOM object

Marcel Apfelbaum qemu-devel 3 versions – Applied

Status from this message: Thanks, applied to qom-next with gtk-doc changes:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 18 repliesApplied
  2. v2 RFC9 patches 28 repliesSuperseded
  3. v1 RFC5 patches 3 repliesSuperseded

Changes in v3 from the cover letter

Split the series into two parts, because the first part can be submitted as was already accepted (after this review).
- The second part involves the replacement of machine opts queries with QOM queries and I will resend it separately.
Addressed Andreas Färber's comments:
- Dropped the Qemu prefix everywhere
- Coding style issues (I really hope I got them all!)
- machine class:' -machine' sufix instead of 'machine-' prefix
- Regarding replacement of the init order machine_init/type_init:
- I answered on the mail thread that I saw no issues.
- I also stated there that I think that type_init should be before machine_init because the later is using the QOM subsystem.
Addressed Paolo Bonzini's comments:
- Added the current_machine to the QOM tree as '/machine'.
- Passed current_machine->init_args to machine->init.
- I will continue the series following his suggestions (Thanks!).

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3hw/core: introduced qemu machine as QOM objecthw/core/Makefile.objs hw/core/machine.c include/hw/boards.h+82 -12 replies
2/3vl: use qemu machine QOM class instead of global machines listinclude/hw/boards.h vl.c+55 -211 reply
3/3hw/boards: converted current_machine to be an instance of MachineCLassdevice-hotplug.c include/hw/boards.h qmp.c +1 more+53 -3615 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchMichael S. Tsirkin
1/3R-b
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [Qemu-devel] [PATCH v3 0/3] qemu-machine as a QOM object

RFC V2 -> V3
Split the series into two parts, because the first part can be submitted as was already accepted (after this review).
- The second part involves the replacement of machine opts queries with QOM queries and I will resend it separately.
Addressed Andreas Färber's comments:
- Dropped the Qemu prefix everywhere
- Coding style issues (I really hope I got them all!)
- machine class:' -machine' sufix instead of 'machine-' prefix
- Regarding replacement of the init order machine_init/type_init:
- I answered on the mail thread that I saw no issues.
- I also stated there that I think that type_init should be before machine_init because the later is using the QOM subsystem.
Addressed Paolo Bonzini's comments:
- Added the current_machine to the QOM tree as '/machine'.
- Passed current_machine->init_args to machine->init.
- I will continue the series following his suggestions (Thanks!).

RFC v1 -> RFC v2
Replaced QemuOpts access by QOM queries. (The main addition)
Addressed Paolo Bonzini's comments:
- Eliminated duplicate fields (of QEMUMachineInitArgs and QemuMachineState) I am not sure about this one, it does mess with the "const" usage. Maybe delay this duplication removal until after QEMUMachineInitArgs disappears completely?
- Added "machine-" prefix to QOM machine type.
- An instance of QEMUMachineInitArgs os is used by QemuMachineState and not a pointer.

The main benefit of QOMifying the qemu machine would be the possibility to have options per machine type and not global.
However, there are other benefits as:
- accessing qemu object properties instead of a global QemuOpts list from different code subsystems.
- improving the machine "initialization" code (compat and stuff)
- getting more close to QOM's vision of single interface for device creation and so on.

Basically the series aims (in the long run) to convert:

    QEMUMachine -> MachineClass
    QEMUMachineInitArgs -> MachineState.

As a first step, in order to make possible an incremental development, both QEMUMachine and QEMUMachineInitArgs are being embedded into the new types.

Marcel Apfelbaum (3):
hw/core: introduced qemu machine as QOM object
vl: use qemu machine QOM class instead of global machines list hw/boards: converted current_machine to be an instance of MachineCLass

 device-hotplug.c      |   4 +-
 hw/core/Makefile.objs |   2 +-
 hw/core/machine.c     |  28 ++++++++++++
 include/hw/boards.h   |  58 +++++++++++++++++++++++-
 qmp.c                 |   7 ++-
 vl.c                  | 121 ++++++++++++++++++++++++++++++++++----------------
 6 files changed, 176 insertions(+), 44 deletions(-)
 create mode 100644 hw/core/machine.c
Signature · 1 line
1.8.3.1