All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"John Snow" <jsnow@redhat.com>
Subject: Re: [PATCH v4 22/65] qapi: Move definitions related to accelerators in their own file
Date: Thu, 03 Jul 2025 10:31:20 +0200	[thread overview]
Message-ID: <87cyah65gn.fsf@pond.sub.org> (raw)
In-Reply-To: <20250702185332.43650-23-philmd@linaro.org> ("Philippe Mathieu-Daudé"'s message of "Wed, 2 Jul 2025 20:52:44 +0200")

Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> Extract TCG and KVM definitions from machine.json to accelerator.json.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  MAINTAINERS                |  1 +
>  qapi/accelerator.json      | 75 ++++++++++++++++++++++++++++++++++++++
>  qapi/machine.json          | 65 ---------------------------------
>  qapi/qapi-schema.json      |  1 +
>  accel/tcg/monitor.c        |  2 +-
>  hw/core/machine-hmp-cmds.c |  1 +
>  hw/core/machine-qmp-cmds.c |  1 +
>  qapi/meson.build           |  1 +
>  8 files changed, 81 insertions(+), 66 deletions(-)
>  create mode 100644 qapi/accelerator.json
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7128e0bc98e..5d6b337cef6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -507,6 +507,7 @@ F: accel/Makefile.objs
>  F: accel/stubs/Makefile.objs
>  F: cpu-common.c
>  F: cpu-target.c
> +F: qapi/accelerator.json
>  F: system/cpus.c
>  
>  Apple Silicon HVF CPUs
> diff --git a/qapi/accelerator.json b/qapi/accelerator.json
> new file mode 100644
> index 00000000000..1d2a83f1b22
> --- /dev/null
> +++ b/qapi/accelerator.json
> @@ -0,0 +1,75 @@
> +# -*- Mode: Python -*-
> +# vim: filetype=python
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +##
> +# = Accelerators
> +##

Going to conflict with John Snow's "[PATCH v3 4/5] docs/sphinx: remove
special parsing for freeform sections".  Don't worry about it.

> +
> +{ 'include': 'common.json' }
> +
> +##
> +# @KvmInfo:
> +#
> +# Information about support for KVM acceleration
> +#
> +# @enabled: true if KVM acceleration is active
> +#
> +# @present: true if KVM acceleration is built into this executable
> +#
> +# Since: 0.14
> +##
> +{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
> +
> +##
> +# @query-kvm:
> +#
> +# Return information about KVM acceleration
> +#
> +# Returns: @KvmInfo
> +#
> +# Since: 0.14
> +#
> +# .. qmp-example::
> +#
> +#     -> { "execute": "query-kvm" }
> +#     <- { "return": { "enabled": true, "present": true } }
> +##
> +{ 'command': 'query-kvm', 'returns': 'KvmInfo' }
> +
> +##
> +# @x-query-jit:
> +#
> +# Query TCG compiler statistics
> +#
> +# Features:
> +#
> +# @unstable: This command is meant for debugging.
> +#
> +# Returns: TCG compiler statistics
> +#
> +# Since: 6.2
> +##
> +{ 'command': 'x-query-jit',
> +  'returns': 'HumanReadableText',
> +  'if': 'CONFIG_TCG',
> +  'features': [ 'unstable' ] }
> +
> +##
> +# @x-query-opcount:
> +#
> +# Query TCG opcode counters
> +#
> +# Features:
> +#
> +# @unstable: This command is meant for debugging.
> +#
> +# Returns: TCG opcode counters
> +#
> +# Since: 6.2
> +##
> +{ 'command': 'x-query-opcount',
> +  'returns': 'HumanReadableText',
> +  'if': 'CONFIG_TCG',
> +  'features': [ 'unstable' ] }
> diff --git a/qapi/machine.json b/qapi/machine.json
> index d5bbb5e367e..e4713c405e8 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -454,35 +454,6 @@
>  ##
>  { 'command': 'inject-nmi' }
>  
> -##
> -# @KvmInfo:
> -#
> -# Information about support for KVM acceleration
> -#
> -# @enabled: true if KVM acceleration is active
> -#
> -# @present: true if KVM acceleration is built into this executable
> -#
> -# Since: 0.14
> -##
> -{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
> -
> -##
> -# @query-kvm:
> -#
> -# Return information about KVM acceleration
> -#
> -# Returns: @KvmInfo
> -#
> -# Since: 0.14
> -#
> -# .. qmp-example::
> -#
> -#     -> { "execute": "query-kvm" }
> -#     <- { "return": { "enabled": true, "present": true } }
> -##
> -{ 'command': 'query-kvm', 'returns': 'KvmInfo' }
> -
>  ##
>  # @NumaOptionsType:
>  #
> @@ -1729,24 +1700,6 @@
>    'returns': 'HumanReadableText',
>    'features': [ 'unstable' ] }
>  
> -##
> -# @x-query-jit:
> -#
> -# Query TCG compiler statistics
> -#
> -# Features:
> -#
> -# @unstable: This command is meant for debugging.
> -#
> -# Returns: TCG compiler statistics
> -#
> -# Since: 6.2
> -##
> -{ 'command': 'x-query-jit',
> -  'returns': 'HumanReadableText',
> -  'if': 'CONFIG_TCG',
> -  'features': [ 'unstable' ] }
> -
>  ##
>  # @x-query-numa:
>  #
> @@ -1764,24 +1717,6 @@
>    'returns': 'HumanReadableText',
>    'features': [ 'unstable' ] }
>  
> -##
> -# @x-query-opcount:
> -#
> -# Query TCG opcode counters
> -#
> -# Features:
> -#
> -# @unstable: This command is meant for debugging.
> -#
> -# Returns: TCG opcode counters
> -#
> -# Since: 6.2
> -##
> -{ 'command': 'x-query-opcount',
> -  'returns': 'HumanReadableText',
> -  'if': 'CONFIG_TCG',
> -  'features': [ 'unstable' ] }
> -
>  ##
>  # @x-query-ramblock:
>  #
> diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
> index a8f66163cb7..0477696ff02 100644
> --- a/qapi/qapi-schema.json
> +++ b/qapi/qapi-schema.json
> @@ -37,6 +37,7 @@
>  { 'include': 'run-state.json' }
>  { 'include': 'crypto.json' }
>  { 'include': 'job.json' }
> +{ 'include': 'accelerator.json' }
>  { 'include': 'block.json' }
>  { 'include': 'block-export.json' }
>  { 'include': 'char.json' }

This puts the new section "Accelerators" between "Background jobs" and
"Block devices".  Feels arbitrary.  Much of the existing order does.
Would it fit better next to "Machines"?

> diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
> index 1c182b6bfb5..5bdd837006c 100644
> --- a/accel/tcg/monitor.c
> +++ b/accel/tcg/monitor.c
> @@ -11,7 +11,7 @@
>  #include "qemu/qht.h"
>  #include "qapi/error.h"
>  #include "qapi/type-helpers.h"
> -#include "qapi/qapi-commands-machine.h"
> +#include "qapi/qapi-commands-accelerator.h"
>  #include "monitor/monitor.h"
>  #include "system/cpu-timers.h"
>  #include "exec/icount.h"
> diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
> index 65eeb5e9cc2..15ae5864d16 100644
> --- a/hw/core/machine-hmp-cmds.c
> +++ b/hw/core/machine-hmp-cmds.c
> @@ -18,6 +18,7 @@
>  #include "monitor/monitor.h"
>  #include "qapi/error.h"
>  #include "qapi/qapi-builtin-visit.h"
> +#include "qapi/qapi-commands-accelerator.h"
>  #include "qapi/qapi-commands-machine.h"
>  #include "qobject/qdict.h"
>  #include "qapi/string-output-visitor.h"
> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
> index ab4fd1ec08a..f37fd220c2d 100644
> --- a/hw/core/machine-qmp-cmds.c
> +++ b/hw/core/machine-qmp-cmds.c
> @@ -14,6 +14,7 @@
>  #include "hw/mem/memory-device.h"
>  #include "qapi/error.h"
>  #include "qapi/qapi-builtin-visit.h"
> +#include "qapi/qapi-commands-accelerator.h"
>  #include "qapi/qapi-commands-machine.h"
>  #include "qobject/qobject.h"
>  #include "qapi/qobject-input-visitor.h"

Have you considered extracting the accelerator command code to
accel/accel-qmp-cmds.c and accel/accel-hmp-cmds.c?

> diff --git a/qapi/meson.build b/qapi/meson.build
> index 3b035aea339..ca6b61a608d 100644
> --- a/qapi/meson.build
> +++ b/qapi/meson.build
> @@ -57,6 +57,7 @@ qapi_all_modules = [
>  ]
>  if have_system
>    qapi_all_modules += [
> +    'accelerator',
>      'acpi',
>      'audio',
>      'cryptodev',



  parent reply	other threads:[~2025-07-03  8:32 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02 18:52 [PATCH v4 00/65] accel: Preparatory cleanups for split-accel Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 01/65] system/runstate: Document qemu_add_vm_change_state_handler() Philippe Mathieu-Daudé
2025-07-03  7:03   ` Alex Bennée
2025-07-02 18:52 ` [PATCH v4 02/65] system/cpus: Defer memory layout changes until vCPUs are realized Philippe Mathieu-Daudé
2025-07-03 16:37   ` Alex Bennée
2025-07-03 16:55     ` Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 03/65] system/cpus: Assert interrupt handling is done with BQL locked Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 04/65] accel: Keep reference to AccelOpsClass in AccelClass Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 05/65] accel: Introduce AccelOpsClass::cpu_target_realize() hook Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 06/65] accel/hvf: Add hvf_arch_cpu_realize() stubs Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 07/65] accel/kvm: Remove kvm_init_cpu_signals() stub Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 08/65] accel/kvm: Reduce kvm_create_vcpu() declaration scope Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 09/65] accel: Propagate AccelState to AccelClass::init_machine() Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 10/65] accel/kvm: Prefer local AccelState over global MachineState::accel Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 11/65] accel/hvf: Re-use QOM allocated state Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 12/65] accel/tcg: Prefer local AccelState over global current_accel() Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 13/65] accel: Directly pass AccelState argument to AccelClass::has_memory() Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 14/65] accel/kvm: Directly pass KVMState argument to do_kvm_create_vm() Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 15/65] accel: Remove unused MachineState argument of AccelClass::setup_post() Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 16/65] accel: Pass AccelState argument to gdbstub_supported_sstep_flags() Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 17/65] accel: Move supports_guest_debug() declaration to AccelClass Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 18/65] accel: Move cpus_are_resettable() " Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 19/65] accel: Move cpu_common_[un]realize() declarations to AccelOpsClass Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 20/65] accel/system: Convert pre_resume() from AccelOpsClass to AccelClass Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 21/65] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
2025-07-03  7:23   ` Zhao Liu
2025-07-02 18:52 ` [PATCH v4 22/65] qapi: Move definitions related to accelerators in their own file Philippe Mathieu-Daudé
2025-07-02 20:26   ` Pierrick Bouvier
2025-07-03  7:26   ` Zhao Liu
2025-07-03  8:31   ` Markus Armbruster [this message]
2025-07-02 18:52 ` [PATCH v4 23/65] accel/system: Introduce @x-accel-stats QMP command Philippe Mathieu-Daudé
2025-07-02 20:27   ` Pierrick Bouvier
2025-07-03  8:35   ` Markus Armbruster
2025-07-03  8:42   ` Zhao Liu
2025-07-02 18:52 ` [PATCH v4 24/65] accel/system: Add 'info accel' on human monitor Philippe Mathieu-Daudé
2025-07-02 20:27   ` Pierrick Bouvier
2025-07-02 18:52 ` [PATCH v4 25/65] accel/tcg: Factor tcg_dump_flush_info() out Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 26/65] accel/tcg: Implement get_[vcpu]_stats() Philippe Mathieu-Daudé
2025-07-03  8:40   ` Zhao Liu
2025-07-03 16:55   ` Alex Bennée
2025-07-03 16:57     ` Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 27/65] accel/hvf: Implement get_vcpu_stats() Philippe Mathieu-Daudé
2025-07-04 12:05   ` Mads Ynddal
2025-07-04 12:45     ` Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 28/65] accel/hvf: Report missing com.apple.security.hypervisor entitlement Philippe Mathieu-Daudé
2025-07-02 21:06   ` Pierrick Bouvier
2025-07-04  9:20   ` Mads Ynddal
2025-07-02 18:52 ` [PATCH v4 29/65] accel/hvf: Restrict internal declarations Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 30/65] accel/hvf: Move per-cpu method declarations to hvf-accel-ops.c Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 31/65] accel/hvf: Move generic method declarations to hvf-all.c Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 32/65] cpus: Document CPUState::vcpu_dirty field Philippe Mathieu-Daudé
2025-07-03  7:29   ` Zhao Liu
2025-07-02 18:52 ` [PATCH v4 33/65] accel/hvf: Replace @dirty field by generic " Philippe Mathieu-Daudé
2025-07-04 10:40   ` Mads Ynddal
2025-07-02 18:52 ` [PATCH v4 34/65] accel/nvmm: " Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 35/65] accel/whpx: " Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 36/65] accel/kvm: Remove kvm_cpu_synchronize_state() stub Philippe Mathieu-Daudé
2025-07-02 18:52 ` [PATCH v4 37/65] accel/system: Document cpu_synchronize_state() Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 38/65] accel/system: Document cpu_synchronize_state_post_init/reset() Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 39/65] accel/nvmm: Expose nvmm_enabled() to common code Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 40/65] accel/whpx: Expose whpx_enabled() " Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 41/65] accel/system: Introduce hwaccel_enabled() helper Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 42/65] target/arm: Use generic hwaccel_enabled() to check 'host' cpu type Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 43/65] accel/dummy: Extract 'dummy-cpus.h' header from 'system/cpus.h' Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 44/65] accel/dummy: Factor dummy_thread_precreate() out Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 45/65] accel/tcg: Factor tcg_vcpu_thread_precreate() out Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 46/65] accel: Factor accel_create_vcpu_thread() out Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 47/65] accel: Introduce AccelOpsClass::cpu_thread_routine handler Philippe Mathieu-Daudé
2025-07-04  9:12   ` Mads Ynddal
2025-07-02 18:53 ` [PATCH v4 48/65] accel/dummy: Convert to AccelOpsClass::cpu_thread_routine Philippe Mathieu-Daudé
2025-07-02 20:09   ` Fabiano Rosas
2025-07-02 18:53 ` [PATCH v4 49/65] accel/tcg: " Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 50/65] accel/hvf: " Philippe Mathieu-Daudé
2025-07-04  9:12   ` Mads Ynddal
2025-07-02 18:53 ` [PATCH v4 51/65] accel/kvm: " Philippe Mathieu-Daudé
2025-07-04  9:15   ` Mads Ynddal
2025-07-02 18:53 ` [PATCH v4 52/65] accel/nvmm: " Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 53/65] accel/whpx: " Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 54/65] accel: Factor accel_cpu_realize() out Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 55/65] accel: Pass old/new interrupt mask to handle_interrupt() handler Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 56/65] accel: Expose and register generic_handle_interrupt() Philippe Mathieu-Daudé
2025-07-02 21:19   ` Pierrick Bouvier
2025-07-03  8:53   ` Zhao Liu
2025-07-04 10:30   ` Mads Ynddal
2025-07-02 18:53 ` [PATCH v4 57/65] accel: Always register AccelOpsClass::kick_vcpu_thread() handler Philippe Mathieu-Daudé
2025-07-02 21:26   ` Pierrick Bouvier
2025-07-03 10:45     ` Philippe Mathieu-Daudé
2025-07-03  8:46   ` Zhao Liu
2025-07-02 18:53 ` [PATCH v4 58/65] accel: Always register AccelOpsClass::get_elapsed_ticks() handler Philippe Mathieu-Daudé
2025-07-02 21:29   ` Pierrick Bouvier
2025-07-03  8:48   ` Zhao Liu
2025-07-04  9:34   ` Mads Ynddal
2025-07-02 18:53 ` [PATCH v4 59/65] accel: Always register AccelOpsClass::get_virtual_clock() handler Philippe Mathieu-Daudé
2025-07-02 21:30   ` Pierrick Bouvier
2025-07-02 21:35   ` Pierrick Bouvier
2025-07-03  8:49   ` Zhao Liu
2025-07-04  9:31   ` Mads Ynddal
2025-07-02 18:53 ` [PATCH v4 60/65] system/memory: Restrict eventfd dispatch_write() to emulators Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 61/65] accel/tcg: Factor tcg_vcpu_init() out for re-use Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 62/65] accel/tcg: Factor mttcg_cpu_exec() " Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 63/65] accel/tcg: Factor rr_cpu_exec() out Philippe Mathieu-Daudé
2025-07-02 21:07   ` Pierrick Bouvier
2025-07-03  8:50   ` Zhao Liu
2025-07-02 18:53 ` [PATCH v4 64/65] accel/tcg: Clear exit_request once in tcg_cpu_exec() Philippe Mathieu-Daudé
2025-07-02 18:53 ` [PATCH v4 65/65] accel/tcg: Unregister the RCU before exiting RR thread Philippe Mathieu-Daudé
2025-07-02 21:09   ` Pierrick Bouvier
2025-07-03  8:51   ` Zhao Liu
2025-07-02 19:08 ` [PATCH v4 00/65] accel: Preparatory cleanups for split-accel Philippe Mathieu-Daudé

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=87cyah65gn.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=jsnow@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=wangyanan55@huawei.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.