[PATCH v6 00/39] accel: Preparatory cleanups for split-accel

Philippe Mathieu-Daudé posted 39 patches 5 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250703173248.44995-1-philmd@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Mads Ynddal <mads@ynddal.dk>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Stefano Stabellini <sstabellini@kernel.org>, Anthony PERARD <anthony@xenproject.org>, Paul Durrant <paul@xen.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, "Alex Bennée" <alex.bennee@linaro.org>, "Dr. David Alan Gilbert" <dave@treblig.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, Reinoud Zandijk <reinoud@netbsd.org>, Sunil Muthuswamy <sunilmut@microsoft.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, Alexander Graf <agraf@csgraf.de>, Peter Maydell <peter.maydell@linaro.org>
MAINTAINERS                                   |   4 +-
qapi/machine.json                             |  21 +-
accel/dummy-cpus.h                            |  14 +
accel/kvm/kvm-cpus.h                          |   1 -
accel/tcg/internal-common.h                   |   2 +
accel/tcg/tcg-accel-ops-icount.h              |   2 +-
accel/tcg/tcg-accel-ops.h                     |   2 +-
.../accel-ops.h => accel/accel-cpu-ops.h}     |  34 +-
include/accel/accel-ops.h                     |  50 +++
include/hw/core/cpu.h                         |   3 +-
include/qemu/accel.h                          |  35 +-
include/system/cpus.h                         |   5 -
include/system/hvf.h                          |  38 ---
include/system/hvf_int.h                      |  38 ++-
include/system/hw_accel.h                     |  21 +-
include/system/kvm.h                          |   8 -
include/system/kvm_int.h                      |   1 +
include/system/nvmm.h                         |  23 +-
include/system/runstate.h                     |  10 +
include/system/whpx.h                         |  27 +-
accel/accel-common.c                          |   4 +-
accel/accel-system.c                          |  20 +-
accel/dummy-cpus.c                            |   1 +
accel/hvf/hvf-accel-ops.c                     | 317 +++---------------
accel/hvf/hvf-all.c                           | 279 +++++++++++++--
accel/kvm/kvm-accel-ops.c                     |  10 +-
accel/kvm/kvm-all.c                           |  39 ++-
accel/qtest/qtest.c                           |   7 +-
accel/stubs/kvm-stub.c                        |   9 -
accel/stubs/nvmm-stub.c                       |  12 +
accel/stubs/whpx-stub.c                       |  12 +
accel/tcg/monitor.c                           | 210 +-----------
accel/tcg/tcg-accel-ops-icount.c              |   8 +-
accel/tcg/tcg-accel-ops.c                     |  19 +-
accel/tcg/tcg-all.c                           |  13 +-
accel/tcg/tcg-stats.c                         | 206 ++++++++++++
accel/xen/xen-all.c                           |   9 +-
bsd-user/main.c                               |   3 +-
cpu-target.c                                  |   2 +-
gdbstub/system.c                              |  11 +-
hw/core/machine-hmp-cmds.c                    |   3 +-
hw/core/machine-qmp-cmds.c                    |   1 +
linux-user/main.c                             |   3 +-
system/cpus.c                                 |  28 +-
system/memory.c                               |  12 +-
target/arm/hvf/hvf.c                          |   6 +-
target/i386/hvf/hvf.c                         |   6 +-
target/i386/hvf/x86hvf.c                      |   2 +-
target/i386/nvmm/nvmm-accel-ops.c             |   3 +-
target/i386/nvmm/nvmm-all.c                   |  32 +-
target/i386/whpx/whpx-accel-ops.c             |   3 +-
target/i386/whpx/whpx-all.c                   |  33 +-
tests/qtest/qmp-cmd-test.c                    |   1 -
accel/stubs/meson.build                       |   2 +
accel/tcg/meson.build                         |   1 +
hmp-commands-info.hx                          |  14 -
56 files changed, 876 insertions(+), 804 deletions(-)
create mode 100644 accel/dummy-cpus.h
rename include/{system/accel-ops.h => accel/accel-cpu-ops.h} (70%)
create mode 100644 include/accel/accel-ops.h
create mode 100644 accel/stubs/nvmm-stub.c
create mode 100644 accel/stubs/whpx-stub.c
create mode 100644 accel/tcg/tcg-stats.c
[PATCH v6 00/39] accel: Preparatory cleanups for split-accel
Posted by Philippe Mathieu-Daudé 5 months, 1 week ago
Missing review: 11, 37-39

Since v5:
- Dropped patches with problems
- Moved system/accel-ops.h -> generic accel/ namespace
- Added R-b tags

Few changes needed before being able to add the
split acceleration:

- few method docstring added
- remove pointless stubs
- propagate soon required AccelState argument
- try to reduce current_accel() uses
- move declarations AccelClass <-> AccelOpsClass
- display model name in 'info cpus'
- add 'info accel' command to QMP/HMP
- make accel_create_vcpu_thread() more generic
- introduce hwaccel_enabled()

I plan to send a PR once fully reviewed.

Regards,

Phil.

Philippe Mathieu-Daudé (39):
  hw/core/machine: Display CPU model name in 'info cpus' command
  system/memory: Restrict eventfd dispatch_write() to emulators
  system/runstate: Document qemu_add_vm_change_state_handler()
  system/cpus: Assert interrupt handling is done with BQL locked
  accel/kvm: Remove kvm_init_cpu_signals() stub
  accel/kvm: Reduce kvm_create_vcpu() declaration scope
  accel/tcg: Remove 'info opcount' and @x-query-opcount
  accel/tcg: Remove profiler leftover
  accel/tcg: Factor tcg_dump_flush_info() out
  accel/tcg: Factor tcg_dump_stats() out for re-use
  accel/tcg: Extract statistic related code to tcg-stats.c
  accel: Move supports_guest_debug() declaration to AccelClass
  accel: Move cpus_are_resettable() declaration to AccelClass
  accel/hvf: Restrict internal declarations
  accel/hvf: Move per-cpu method declarations to hvf-accel-ops.c
  accel/hvf: Move generic method declarations to hvf-all.c
  cpus: Document CPUState::vcpu_dirty field
  accel/hvf: Replace @dirty field by generic CPUState::vcpu_dirty field
  accel/nvmm: Replace @dirty field by generic CPUState::vcpu_dirty field
  accel/whpx: Replace @dirty field by generic CPUState::vcpu_dirty field
  accel/kvm: Remove kvm_cpu_synchronize_state() stub
  accel/system: Document cpu_synchronize_state()
  accel/system: Document cpu_synchronize_state_post_init/reset()
  accel/nvmm: Expose nvmm_enabled() to common code
  accel/whpx: Expose whpx_enabled() to common code
  accel/dummy: Extract 'dummy-cpus.h' header from 'system/cpus.h'
  accel: Pass old/new interrupt mask to handle_interrupt() handler
  accel: Expose and register generic_handle_interrupt()
  accel: Keep reference to AccelOpsClass in AccelClass
  accel: Propagate AccelState to AccelClass::init_machine()
  accel/kvm: Prefer local AccelState over global MachineState::accel
  accel/tcg: Prefer local AccelState over global current_accel()
  accel: Directly pass AccelState argument to AccelClass::has_memory()
  accel/kvm: Directly pass KVMState argument to do_kvm_create_vm()
  accel: Remove unused MachineState argument of AccelClass::setup_post()
  accel: Pass AccelState argument to gdbstub_supported_sstep_flags()
  accel: Rename 'system/accel-ops.h' -> 'accel/accel-cpu-ops.h'
  accel: Extract AccelClass definition to 'accel/accel-ops.h'
  MAINTAINERS: Add me as reviewer of overall accelerators section

 MAINTAINERS                                   |   4 +-
 qapi/machine.json                             |  21 +-
 accel/dummy-cpus.h                            |  14 +
 accel/kvm/kvm-cpus.h                          |   1 -
 accel/tcg/internal-common.h                   |   2 +
 accel/tcg/tcg-accel-ops-icount.h              |   2 +-
 accel/tcg/tcg-accel-ops.h                     |   2 +-
 .../accel-ops.h => accel/accel-cpu-ops.h}     |  34 +-
 include/accel/accel-ops.h                     |  50 +++
 include/hw/core/cpu.h                         |   3 +-
 include/qemu/accel.h                          |  35 +-
 include/system/cpus.h                         |   5 -
 include/system/hvf.h                          |  38 ---
 include/system/hvf_int.h                      |  38 ++-
 include/system/hw_accel.h                     |  21 +-
 include/system/kvm.h                          |   8 -
 include/system/kvm_int.h                      |   1 +
 include/system/nvmm.h                         |  23 +-
 include/system/runstate.h                     |  10 +
 include/system/whpx.h                         |  27 +-
 accel/accel-common.c                          |   4 +-
 accel/accel-system.c                          |  20 +-
 accel/dummy-cpus.c                            |   1 +
 accel/hvf/hvf-accel-ops.c                     | 317 +++---------------
 accel/hvf/hvf-all.c                           | 279 +++++++++++++--
 accel/kvm/kvm-accel-ops.c                     |  10 +-
 accel/kvm/kvm-all.c                           |  39 ++-
 accel/qtest/qtest.c                           |   7 +-
 accel/stubs/kvm-stub.c                        |   9 -
 accel/stubs/nvmm-stub.c                       |  12 +
 accel/stubs/whpx-stub.c                       |  12 +
 accel/tcg/monitor.c                           | 210 +-----------
 accel/tcg/tcg-accel-ops-icount.c              |   8 +-
 accel/tcg/tcg-accel-ops.c                     |  19 +-
 accel/tcg/tcg-all.c                           |  13 +-
 accel/tcg/tcg-stats.c                         | 206 ++++++++++++
 accel/xen/xen-all.c                           |   9 +-
 bsd-user/main.c                               |   3 +-
 cpu-target.c                                  |   2 +-
 gdbstub/system.c                              |  11 +-
 hw/core/machine-hmp-cmds.c                    |   3 +-
 hw/core/machine-qmp-cmds.c                    |   1 +
 linux-user/main.c                             |   3 +-
 system/cpus.c                                 |  28 +-
 system/memory.c                               |  12 +-
 target/arm/hvf/hvf.c                          |   6 +-
 target/i386/hvf/hvf.c                         |   6 +-
 target/i386/hvf/x86hvf.c                      |   2 +-
 target/i386/nvmm/nvmm-accel-ops.c             |   3 +-
 target/i386/nvmm/nvmm-all.c                   |  32 +-
 target/i386/whpx/whpx-accel-ops.c             |   3 +-
 target/i386/whpx/whpx-all.c                   |  33 +-
 tests/qtest/qmp-cmd-test.c                    |   1 -
 accel/stubs/meson.build                       |   2 +
 accel/tcg/meson.build                         |   1 +
 hmp-commands-info.hx                          |  14 -
 56 files changed, 876 insertions(+), 804 deletions(-)
 create mode 100644 accel/dummy-cpus.h
 rename include/{system/accel-ops.h => accel/accel-cpu-ops.h} (70%)
 create mode 100644 include/accel/accel-ops.h
 create mode 100644 accel/stubs/nvmm-stub.c
 create mode 100644 accel/stubs/whpx-stub.c
 create mode 100644 accel/tcg/tcg-stats.c

-- 
2.49.0


Re: [PATCH v6 00/39] accel: Preparatory cleanups for split-accel
Posted by Philippe Mathieu-Daudé 5 months, 1 week ago
On 3/7/25 19:32, Philippe Mathieu-Daudé wrote:

> Philippe Mathieu-Daudé (39):
>    hw/core/machine: Display CPU model name in 'info cpus' command
>    system/memory: Restrict eventfd dispatch_write() to emulators
>    system/runstate: Document qemu_add_vm_change_state_handler()
>    system/cpus: Assert interrupt handling is done with BQL locked
>    accel/kvm: Remove kvm_init_cpu_signals() stub
>    accel/kvm: Reduce kvm_create_vcpu() declaration scope
>    accel/tcg: Remove 'info opcount' and @x-query-opcount
>    accel/tcg: Remove profiler leftover
>    accel/tcg: Factor tcg_dump_flush_info() out
>    accel/tcg: Factor tcg_dump_stats() out for re-use
>    accel/tcg: Extract statistic related code to tcg-stats.c
>    accel: Move supports_guest_debug() declaration to AccelClass
>    accel: Move cpus_are_resettable() declaration to AccelClass
>    accel/hvf: Restrict internal declarations
>    accel/hvf: Move per-cpu method declarations to hvf-accel-ops.c
>    accel/hvf: Move generic method declarations to hvf-all.c
>    cpus: Document CPUState::vcpu_dirty field
>    accel/hvf: Replace @dirty field by generic CPUState::vcpu_dirty field
>    accel/nvmm: Replace @dirty field by generic CPUState::vcpu_dirty field
>    accel/whpx: Replace @dirty field by generic CPUState::vcpu_dirty field
>    accel/kvm: Remove kvm_cpu_synchronize_state() stub
>    accel/system: Document cpu_synchronize_state()
>    accel/system: Document cpu_synchronize_state_post_init/reset()
>    accel/nvmm: Expose nvmm_enabled() to common code
>    accel/whpx: Expose whpx_enabled() to common code
>    accel/dummy: Extract 'dummy-cpus.h' header from 'system/cpus.h'
>    accel: Pass old/new interrupt mask to handle_interrupt() handler
>    accel: Expose and register generic_handle_interrupt()
>    accel: Keep reference to AccelOpsClass in AccelClass
>    accel: Propagate AccelState to AccelClass::init_machine()
>    accel/kvm: Prefer local AccelState over global MachineState::accel
>    accel/tcg: Prefer local AccelState over global current_accel()
>    accel: Directly pass AccelState argument to AccelClass::has_memory()
>    accel/kvm: Directly pass KVMState argument to do_kvm_create_vm()
>    accel: Remove unused MachineState argument of AccelClass::setup_post()
>    accel: Pass AccelState argument to gdbstub_supported_sstep_flags()
>    accel: Rename 'system/accel-ops.h' -> 'accel/accel-cpu-ops.h'
>    accel: Extract AccelClass definition to 'accel/accel-ops.h'
>    MAINTAINERS: Add me as reviewer of overall accelerators section

Non-controversial patches queued to accel-next, thanks.