qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Magnus Kulke <magnuskulke@linux.microsoft.com>
Cc: qemu-devel@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Cameron Esfahani" <dirty@apple.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Wei Liu" <liuwe@microsoft.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Dr. David Alan Gilbert" <dave@treblig.org>,
	"Roman Bolshakov" <rbolshakov@ddn.com>,
	"Phil Dennis-Jordan" <phil@philjordan.eu>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Magnus Kulke" <magnuskulke@microsoft.com>,
	"Wei Liu" <wei.liu@kernel.org>, "Eric Blake" <eblake@redhat.com>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH v4 24/27] qapi/accel: Allow to query mshv capabilities
Date: Fri, 10 Oct 2025 16:02:32 +0200	[thread overview]
Message-ID: <871pnahn2f.fsf@pond.sub.org> (raw)
In-Reply-To: <20250916164847.77883-25-magnuskulke@linux.microsoft.com> (Magnus Kulke's message of "Tue, 16 Sep 2025 18:48:44 +0200")

Magnus Kulke <magnuskulke@linux.microsoft.com> writes:

> From: Praveen K Paladugu <prapal@microsoft.com>
>
> Allow to query mshv capabilities via query-mshv QMP and info mshv HMP commands.
>
> Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
> ---
>  hmp-commands-info.hx       | 13 +++++++++++++
>  hw/core/machine-hmp-cmds.c | 15 +++++++++++++++
>  hw/core/machine-qmp-cmds.c | 14 ++++++++++++++
>  include/monitor/hmp.h      |  1 +
>  include/system/hw_accel.h  |  1 +
>  qapi/accelerator.json      | 29 +++++++++++++++++++++++++++++
>  6 files changed, 73 insertions(+)
>
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index 6142f60e7b..eaaa880c1b 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -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
> +

Mirrors the entry for "kvm".

>      {
>          .name       = "numa",
>          .args_type  = "",
> diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
> index 3a612e2232..682ed9f49b 100644
> --- a/hw/core/machine-hmp-cmds.c
> +++ b/hw/core/machine-hmp-cmds.c
> @@ -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);
> +}
> +

Mirrors hmp_info_kvm().

>  void hmp_info_uuid(Monitor *mon, const QDict *qdict)
>  {
>      UuidInfo *info;
> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
> index 6aca1a626e..e24bf0d97b 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));
> +
> +    info->enabled = mshv_enabled();
> +    info->present = accel_find("mshv");
> +
> +    return info;
> +}

Mirrors qmp_query_kvm().

Note that accel_find() works for any accelerator.  It returns the
AccelClass.  As far as I can tell, AccelClass member @allowed points to
the variable _enabled() returns.  So, this function could be made
generic.  More on that below.

>  
>  /*
>   * fast means: we NEVER interrupt vCPU threads to retrieve
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index ae116d9804..31bd812e5f 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -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);
> diff --git a/include/system/hw_accel.h b/include/system/hw_accel.h
> index fa9228d5d2..55497edc29 100644
> --- a/include/system/hw_accel.h
> +++ b/include/system/hw_accel.h
> @@ -14,6 +14,7 @@
>  #include "hw/core/cpu.h"
>  #include "system/kvm.h"
>  #include "system/hvf.h"
> +#include "system/mshv.h"

Why?

>  #include "system/whpx.h"
>  #include "system/nvmm.h"
>  
> diff --git a/qapi/accelerator.json b/qapi/accelerator.json
> index fb28c8d920..c2bfbc507f 100644
> --- a/qapi/accelerator.json
> +++ b/qapi/accelerator.json
> @@ -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.0.92
> +##
> +{ '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' }

Mirrors query-kvm.  Okay apart from the Since: issues Daniel pointed
out.

Should we have a generic query-accelerator instead of one query-FOO for
every accelerator FOO?



  parent reply	other threads:[~2025-10-10 14:05 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 16:48 [PATCH v4 00/27] Implementing a MSHV (Microsoft Hypervisor) accelerator Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 01/27] accel: Add Meson and config support for MSHV accelerator Magnus Kulke
2025-10-01 10:55   ` Daniel P. Berrangé
2025-10-02  8:23   ` Philippe Mathieu-Daudé
2025-09-16 16:48 ` [PATCH v4 02/27] target/i386/emulate: Allow instruction decoding from stream Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 03/27] target/i386/mshv: Add x86 decoder/emu implementation Magnus Kulke
2025-09-16 17:40   ` Dr. David Alan Gilbert
2025-09-16 22:48     ` Mohamed Mediouni
2025-09-16 23:47       ` [CRM114spam]: " Dr. David Alan Gilbert
2025-09-17  9:11         ` Magnus Kulke
2025-09-17  9:36         ` Magnus Kulke
2025-10-01 10:59   ` Daniel P. Berrangé
2025-10-01 12:49     ` Paolo Bonzini
2025-09-16 16:48 ` [PATCH v4 04/27] hw/intc: Generalize APIC helper names from kvm_* to accel_* Magnus Kulke
2025-10-01 12:24   ` Paolo Bonzini
2025-09-16 16:48 ` [PATCH v4 05/27] include/hw/hyperv: Add MSHV ABI header definitions Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 06/27] linux-headers/linux: Add mshv.h headers Magnus Kulke
2025-10-01 11:09   ` Daniel P. Berrangé
2025-09-16 16:48 ` [PATCH v4 07/27] accel/mshv: Add accelerator skeleton Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 08/27] accel/mshv: Register memory region listeners Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 09/27] accel/mshv: Initialize VM partition Magnus Kulke
2025-10-01 12:27   ` Paolo Bonzini
2025-09-16 16:48 ` [PATCH v4 10/27] accel/mshv: Add vCPU creation and execution loop Magnus Kulke
2025-10-01 11:36   ` Daniel P. Berrangé
2025-09-16 16:48 ` [PATCH v4 11/27] accel/mshv: Add vCPU signal handling Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 12/27] target/i386/mshv: Add CPU create and remove logic Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 13/27] target/i386/mshv: Implement mshv_store_regs() Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 14/27] target/i386/mshv: Implement mshv_get_standard_regs() Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 15/27] target/i386/mshv: Implement mshv_get_special_regs() Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 16/27] target/i386/mshv: Implement mshv_arch_put_registers() Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 17/27] target/i386/mshv: Set local interrupt controller state Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 18/27] target/i386/mshv: Register CPUID entries with MSHV Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 19/27] target/i386/mshv: Register MSRs " Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 20/27] target/i386/mshv: Integrate x86 instruction decoder/emulator Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 21/27] target/i386/mshv: Write MSRs to the hypervisor Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 22/27] target/i386/mshv: Implement mshv_vcpu_run() Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 23/27] accel/mshv: Handle overlapping mem mappings Magnus Kulke
2025-09-16 16:48 ` [PATCH v4 24/27] qapi/accel: Allow to query mshv capabilities Magnus Kulke
2025-09-16 17:52   ` Dr. David Alan Gilbert
2025-10-01  9:43   ` Daniel P. Berrangé
2025-10-01 12:14   ` Daniel P. Berrangé
2025-10-10 14:02   ` Markus Armbruster [this message]
2025-10-10 14:10     ` Paolo Bonzini
     [not found]       ` <20251010163312.GA2896568@liuwe-devbox-debian-v2.local>
2025-10-10 16:44         ` Daniel P. Berrangé
2025-09-16 16:48 ` [PATCH v4 25/27] target/i386/mshv: Use preallocated page for hvcall Magnus Kulke
2025-10-01 12:17   ` Daniel P. Berrangé
2025-10-02  8:05     ` Magnus Kulke
2025-10-02  8:11       ` Daniel P. Berrangé
2025-09-16 16:48 ` [PATCH v4 26/27] docs: Add mshv to documentation Magnus Kulke
2025-10-01 12:20   ` Daniel P. Berrangé
2025-09-16 16:48 ` [PATCH v4 27/27] MAINTAINERS: Add maintainers for mshv accelerator Magnus Kulke
2025-10-01 12:23   ` Daniel P. Berrangé
2025-10-02  7:40     ` Magnus Kulke
2025-10-02  7:56       ` Daniel P. Berrangé
2025-09-30 20:59 ` [PATCH v4 00/27] Implementing a MSHV (Microsoft Hypervisor) accelerator Wei Liu
2025-10-02  8:30 ` Philippe Mathieu-Daudé
2025-10-02  8:41   ` Daniel P. Berrangé
2025-10-02  8:48     ` Philippe Mathieu-Daudé
2025-10-02  9:10   ` Magnus Kulke
2025-10-02 14:07     ` Mohamed Mediouni
2025-10-02 15:36       ` Magnus Kulke
2025-10-02 16:10         ` Mohamed Mediouni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871pnahn2f.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=dave@treblig.org \
    --cc=dirty@apple.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=liuwe@microsoft.com \
    --cc=magnuskulke@linux.microsoft.com \
    --cc=magnuskulke@microsoft.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=phil@philjordan.eu \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rbolshakov@ddn.com \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=wangyanan55@huawei.com \
    --cc=wei.liu@kernel.org \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).