[PATCH for-12.0 0/2] hw/i386/microvm: add versioned machine types

Thomas Lamprecht posted 2 patches 6 days, 4 hours ago
docs/system/i386/microvm.rst                  | 21 ++++++++-
hw/i386/microvm.c                             | 47 ++++++++++++++++++-
include/hw/i386/microvm.h                     |  3 ++
.../x86_64/test_cpu_model_versions.py         | 41 ++++++++++++++++
4 files changed, 110 insertions(+), 2 deletions(-)
[PATCH for-12.0 0/2] hw/i386/microvm: add versioned machine types
Posted by Thomas Lamprecht 6 days, 4 hours ago
Proxmox VE wants to use microvm with PCIe and ACPI for long-lived Linux
guests, i.e. like Linux containers but with better isolation. Our
cluster upgrades and host maintenance rely on live migrating guests to
hosts that already run a newer QEMU, which is currently not really
possible with microvm, as it is not versioned.

When microvm was added, versioning was ruled out on purpose [1], as it
targeted short-lived guests. Since then, Paolo noted that microvm could
start having versioned variants [2]. So this series adds microvm-X.Y
machine types, starting with 12.0, as 11.2 is already in freeze.

Noteworthy points that migth be up for discussion:

- Following Paolo preference [2], "microvm" does not become an alias of
  the latest version, rather, it is left as it is. Unversioned machine
  types are meant to be a moving target [2], which includes defaulting
  to the latest version of a CPU model. The versioned types need a fixed
  default and use version 1, like pc and q35 do, and an alias cannot
  differ from the type it refers to.

- The x86 CPU compat properties are part of pc_compat_X_Y in
  hw/i386/pc.c, which is only built with CONFIG_PC. Once microvm-12.0
  needs them, they would have to move, for example to
  hw/i386/x86-common.c (but I'm happy to use another place, just say
  the word).

- With KVM, microvm uses the host's physical address width, so
  migration also needs the same width on both hosts. This is not new,
  the series only documents it for now.

Tested with the x86_64 CPU model and migration functional tests,
bios-tables-test and qom-test, and by live migrating Linux guests on
microvm-12.0 with TCG and KVM.

[1] https://lore.kernel.org/qemu-devel/af3acd26-f114-5889-182a-7dbd025393b9@redhat.com/
[2] https://lore.kernel.org/qemu-devel/004396c0-8370-4015-b746-3c800f45984f@redhat.com/

Thomas Lamprecht (2):
  hw/i386/microvm: make the default CPU model version a class field
  hw/i386/microvm: add versioned machine types

 docs/system/i386/microvm.rst                  | 21 ++++++++-
 hw/i386/microvm.c                             | 47 ++++++++++++++++++-
 include/hw/i386/microvm.h                     |  3 ++
 .../x86_64/test_cpu_model_versions.py         | 41 ++++++++++++++++
 4 files changed, 110 insertions(+), 2 deletions(-)


base-commit: f71afb409a87c4ecd0f9d63a5963eb645dfab780
-- 
2.47.3
Re: [PATCH for-12.0 0/2] hw/i386/microvm: add versioned machine types
Posted by Daniel P. Berrangé 5 days, 11 hours ago
On Tue, Nov 17, 2026 at 12:30:12AM +0100, Thomas Lamprecht wrote:
> Proxmox VE wants to use microvm with PCIe and ACPI for long-lived Linux
> guests, i.e. like Linux containers but with better isolation. Our
> cluster upgrades and host maintenance rely on live migrating guests to
> hosts that already run a newer QEMU, which is currently not really
> possible with microvm, as it is not versioned.
> 
> When microvm was added, versioning was ruled out on purpose [1], as it
> targeted short-lived guests. Since then, Paolo noted that microvm could
> start having versioned variants [2]. So this series adds microvm-X.Y
> machine types, starting with 12.0, as 11.2 is already in freeze.

If you're going to the trouble of enabling PCIe and ACPI for
microvm, and also wanting versioning, then why are you not
picking 'q35' ?

IIRC, since microvm was introduced more pieces of q35 are now
configurable to allow disabling at runtime, further reducing
the difference between a minimal q35 and microvm  w/ PCIe+ACPI.



> Noteworthy points that migth be up for discussion:
> 
> - Following Paolo preference [2], "microvm" does not become an alias of
>   the latest version, rather, it is left as it is. Unversioned machine
>   types are meant to be a moving target [2], which includes defaulting
>   to the latest version of a CPU model. The versioned types need a fixed
>   default and use version 1, like pc and q35 do, and an alias cannot
>   differ from the type it refers to.

I think that would be a bad idea, as it would make 'microvm' work
differently to every other machine type where we have versioning.
The standard pattern is that the unversioned name is always an
alias for the latest version.

Defining an unversioned name as a full machine, separate from the
latest versioned machine esentially gives you two things which are
identical. The burden of versioned machines comes from ensuring the
existing versions get the right compat properties set to keep their
ABI unchanged and from wiring up the boilerplate for new versions
at the start of each release.

> 
> - The x86 CPU compat properties are part of pc_compat_X_Y in
>   hw/i386/pc.c, which is only built with CONFIG_PC. Once microvm-12.0
>   needs them, they would have to move, for example to
>   hw/i386/x86-common.c (but I'm happy to use another place, just say
>   the word).
> 
> - With KVM, microvm uses the host's physical address width, so
>   migration also needs the same width on both hosts. This is not new,
>   the series only documents it for now.
> 
> Tested with the x86_64 CPU model and migration functional tests,
> bios-tables-test and qom-test, and by live migrating Linux guests on
> microvm-12.0 with TCG and KVM.
> 
> [1] https://lore.kernel.org/qemu-devel/af3acd26-f114-5889-182a-7dbd025393b9@redhat.com/
> [2] https://lore.kernel.org/qemu-devel/004396c0-8370-4015-b746-3c800f45984f@redhat.com/
> 
> Thomas Lamprecht (2):
>   hw/i386/microvm: make the default CPU model version a class field
>   hw/i386/microvm: add versioned machine types
> 
>  docs/system/i386/microvm.rst                  | 21 ++++++++-
>  hw/i386/microvm.c                             | 47 ++++++++++++++++++-
>  include/hw/i386/microvm.h                     |  3 ++
>  .../x86_64/test_cpu_model_versions.py         | 41 ++++++++++++++++
>  4 files changed, 110 insertions(+), 2 deletions(-)
> 
> 
> base-commit: f71afb409a87c4ecd0f9d63a5963eb645dfab780
> -- 
> 2.47.3
> 
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|