On Tue, May 20, 2025 at 01:29:54PM +0200, Magnus Kulke wrote:
> Introduce a Meson feature option and default-config entry to allow
> building QEMU with MSHV (Microsoft Hypervisor) acceleration support.
>
> This is the first step toward implementing an MSHV backend in QEMU.
>
> Signed-off-by: Magnus Kulke <[email protected]>
> ---
> accel/Kconfig | 3 +++
> meson.build | 16 ++++++++++++++++
> meson_options.txt | 2 ++
> scripts/meson-buildoptions.sh | 3 +++
> 4 files changed, 24 insertions(+)
>
> diff --git a/accel/Kconfig b/accel/Kconfig
> index 4263cab722..a60f114923 100644
> --- a/accel/Kconfig
> +++ b/accel/Kconfig
> @@ -13,6 +13,9 @@ config TCG
> config KVM
> bool
>
> +config MSHV
> + bool
> +
> config XEN
> bool
> select FSDEV_9P if VIRTFS
> diff --git a/meson.build b/meson.build
> index e819a7084c..a4269b816b 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -322,6 +322,13 @@ else
> endif
> accelerator_targets += { 'CONFIG_XEN': xen_targets }
>
> +if cpu == 'x86_64'
> + mshv_targets = ['x86_64-softmmu']
> +else
> + mshv_targets = []
> +endif
> +accelerator_targets += { 'CONFIG_MSHV': mshv_targets }
> +
> if cpu == 'aarch64'
> accelerator_targets += {
> 'CONFIG_HVF': ['aarch64-softmmu']
> @@ -877,6 +884,14 @@ accelerators = []
> if get_option('kvm').allowed() and host_os == 'linux'
> accelerators += 'CONFIG_KVM'
> endif
> +
> +if get_option('mshv').allowed() and host_os == 'linux'
> + if get_option('mshv').enabled() and host_machine.cpu() != 'x86_64'
> + error('mshv accelerator requires x64_64 host')
> + endif
> + accelerators += 'CONFIG_MSHV'
This enables MSHV for non-x86 when the option is left on 'auto'.
You would need something more like this:
if host_machine.cpu() != 'x86_64'
if get_option('mshv').enabled()
error('mshv accelerator requires x64_64 host')
endif
else
accelerators += 'CONFIG_MSHV'
endif
> +endif
> +
> if get_option('whpx').allowed() and host_os == 'windows'
> if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64'
> error('WHPX requires 64-bit host')
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|