On Thu, Aug 07, 2025 at 04:39:51PM +0200, Magnus Kulke wrote:
> From: Praveen K Paladugu <[email protected]>
>
> Allow to query mshv capabilities via query-mshv QMP command.
>
> Signed-off-by: Praveen K Paladugu <[email protected]>
> Signed-off-by: Magnus Kulke <[email protected]>
> ---
> hw/core/machine-qmp-cmds.c | 14 ++++++++++++++
> qapi/accelerator.json | 29 +++++++++++++++++++++++++++++
> 2 files changed, 43 insertions(+)
>
> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
> index 6aca1a626e..024ddb8d2d 100644
> --- a/hw/core/machine-qmp-cmds.c
> +++ b/hw/core/machine-qmp-cmds.c
> @@ -28,6 +28,20 @@
> #include "system/runstate.h"
> #include "system/system.h"
> #include "hw/s390x/storage-keys.h"
> +#include <sys/stat.h>
> +
> +/*
> + * QMP query for MSHV
> + */
> +MshvInfo *qmp_query_mshv(Error **errp)
> +{
> + MshvInfo *info = g_malloc0(sizeof(*info));
> + struct stat st;
> +
> + info->present = accel_find("mshv");
> + info->enabled = (stat("/dev/mshv", &st) == 0);
This does't have the right semantics
$ sudo touch /dev/mshv
$ ./scripts/qmp/qmp-shell-wrap ./build/qemu-system-x86_64 -display none -accel
tcg
(QEMU) query-mshv
{"return": {"enabled": true, "present": true}}
It cannot be enabled, since I asked for 'tcg' as the accelerator
IIUC, it should be
info->enabled = mshv_enabled();
to match what KVM does.
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 :|