qapi/accel: Allow to query mshv capabilities
Allow to query mshv capabilities via query-mshv QMP and info mshv HMP commands. Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com> Acked-by: Dr. David Alan Gilbert <dave@treblig.org> Link: https://lore.kernel.org/r/20250916164847.77883-25-magnuskulke@linux.microsoft.com [Fix "since" version. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
efc4093358
commit
e7b08dfb90
6 changed files with 73 additions and 0 deletions
|
|
@ -307,6 +307,19 @@ SRST
|
|||
Show KVM information.
|
||||
ERST
|
||||
|
||||
{
|
||||
.name = "mshv",
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show MSHV information",
|
||||
.cmd = hmp_info_mshv,
|
||||
},
|
||||
|
||||
SRST
|
||||
``info mshv``
|
||||
Show MSHV information.
|
||||
ERST
|
||||
|
||||
{
|
||||
.name = "numa",
|
||||
.args_type = "",
|
||||
|
|
|
|||
|
|
@ -163,6 +163,21 @@ void hmp_info_kvm(Monitor *mon, const QDict *qdict)
|
|||
qapi_free_KvmInfo(info);
|
||||
}
|
||||
|
||||
void hmp_info_mshv(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
MshvInfo *info;
|
||||
|
||||
info = qmp_query_mshv(NULL);
|
||||
monitor_printf(mon, "mshv support: ");
|
||||
if (info->present) {
|
||||
monitor_printf(mon, "%s\n", info->enabled ? "enabled" : "disabled");
|
||||
} else {
|
||||
monitor_printf(mon, "not compiled\n");
|
||||
}
|
||||
|
||||
qapi_free_MshvInfo(info);
|
||||
}
|
||||
|
||||
void hmp_info_uuid(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
UuidInfo *info;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
info->enabled = mshv_enabled();
|
||||
info->present = accel_find("mshv");
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/*
|
||||
* fast means: we NEVER interrupt vCPU threads to retrieve
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ strList *hmp_split_at_comma(const char *str);
|
|||
void hmp_info_name(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_version(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_kvm(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_mshv(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_status(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_uuid(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_chardev(Monitor *mon, const QDict *qdict);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "hw/core/cpu.h"
|
||||
#include "system/kvm.h"
|
||||
#include "system/hvf.h"
|
||||
#include "system/mshv.h"
|
||||
#include "system/whpx.h"
|
||||
#include "system/nvmm.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -54,3 +54,32 @@
|
|||
{ 'command': 'x-accel-stats',
|
||||
'returns': 'HumanReadableText',
|
||||
'features': [ 'unstable' ] }
|
||||
|
||||
##
|
||||
# @MshvInfo:
|
||||
#
|
||||
# Information about support for MSHV acceleration
|
||||
#
|
||||
# @enabled: true if MSHV acceleration is active
|
||||
#
|
||||
# @present: true if MSHV acceleration is built into this executable
|
||||
#
|
||||
# Since: 10.2.0
|
||||
##
|
||||
{ 'struct': 'MshvInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
|
||||
|
||||
##
|
||||
# @query-mshv:
|
||||
#
|
||||
# Return information about MSHV acceleration
|
||||
#
|
||||
# Returns: @MshvInfo
|
||||
#
|
||||
# Since: 10.0.92
|
||||
#
|
||||
# .. qmp-example::
|
||||
#
|
||||
# -> { "execute": "query-mshv" }
|
||||
# <- { "return": { "enabled": true, "present": true } }
|
||||
##
|
||||
{ 'command': 'query-mshv', 'returns': 'MshvInfo' }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue