Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH 00/23] kvm: introduce KVMCPUOps
@ 2026-10-20 10:42 Alex Bennée
  2026-10-20 10:42 ` [PATCH 01/23] accel: introduce KVMAccelClass and KVMCPUOps Alex Bennée
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: Alex Bennée @ 2026-10-20 10:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Bibo Mao, Christian Borntraeger, Ilya Leoshkevich,
	Alistair Francis, Richard Henderson, Daniel Henrique Barboza,
	Paolo Bonzini, Eric Farman, Song Gao, Harsh Prateek Bora,
	David Hildenbrand, Bernhard Beschow, Halil Pasic, Nicholas Piggin,
	Paul Durrant, Björn Walk, Jiaxun Yang,
	Philippe Mathieu-Daudé, Palmer Dabbelt, qemu-s390x,
	David Woodhouse, Liu Zhiwei, qemu-ppc, Marcelo Tosatti, kvm,
	qemu-arm, linux-edac, Glenn Miles, Chao Liu, Cornelia Huck,
	Gautam Menghani, Xianglai Li, Pierrick Bouvier, Chinmay Rath,
	Michael S. Tsirkin, Matthew Rosato, Amit Machhiwal, Zhao Liu,
	Weiwei Li, Peter Maydell, Mauro Carvalho Chehab, qemu-riscv,
	Alex Bennée

There is a world coming where we can have a KVM interface which
supports multiple architectures. The old style approach of using
linking to resolve per arch kvm_arch_foo handlers won't scale and is
also slightly antithetical to the flexible not-quite object orientated
way we do things in QEMU.

Taking TCGCpuOps as a reference this implements KVMCpuOps as the
shared function dispatcher for CPU specific KVM operations.

A couple of open questions:

  - should we consider some sort of shared AccelInfo region for
  CPUState instead of a bunch of mutually unused bits
  - how can we improve coverage of KVM testing?

The main driver for writing:

  Message-ID: <20261019192704.3220373-1-alex.bennee@linaro.org>
  Date: Mon, 19 Oct 2026 20:26:45 +0100
  Subject: [PATCH v3 00/19] testing/next: functional testing updates for gdb (pre-PR)
  From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>

was so I could be sure the KVMCpuOps where properly working. I don't
think we have that much that exercises KVM in our CI system anyway
because most runners don't give access to HW virtualisation. I have
tested this on:

  - x86_64 (on my dev box)
  - aarch64 (on my personal dev box and the aarch64 ci machine)
  - s390x (on devcloud instance, same as the s390x runner)

Notably I wasn't able to test the riscv64, loongarch64 or ppc64
behaviour. I do have access to the OSUL ppc runner but it doesn't
support nested virt and testing on that machine needs some love anyway
(see #3207).

Anyway I await your discussion ;-)

Alex.

Alex Bennée (23):
  accel: introduce KVMAccelClass and KVMCPUOps
  target/i386: wire up empty KVMAccelCPUClass
  target/ppc: wire up empty KVMAccelCPUClass
  target/riscv: wire up empty KVMAccelCPUClass
  target/arm: wire up empty KVMAccelCPUClass
  target/s390x: wire up empty KVMAccelCPUClass
  target/loongarch: wire up empty KVMAccelCPUClass
  accel/kvm: port kvm_arch_pre_run to KVMCPUOps
  accel/kvm: port kvm_arch_post_run to KVMCPUOps
  accel/kvm: port kvm_arch_handle_exit to KVMCPUOps
  accel/kvm: port kvm_arch_process_async_events to KVMCPUOps
  accel/kvm: port kvm_arch_[put|get]_registers to KVMCPUOps
  accel/kvm: port kvm_arch_pre_create_vcpu to KVMCPUOps
  accel/kvm: port kvm_arch_init_vcpu to KVMCPUOps
  accel/kvm: port kvm_arch_destroy_vcpu to KVMCPUOps
  accel/kvm: port kvm_arch_vpcu_id to KVMCPUOps
  accel/kvm: port kvm_arch_update_guest_debug to KVMCPUOps
  accel/kvm: port kvm_arch_[insert|remove]_hw_breakpoints to KVMCPUOps
  accel/kvm: remove TARGET_KVM_HAVE_GUEST_DEBUG
  accel/kvm: port kvm_arch_stop_on_emulation_error to KVMCPUOps
  accel/kvm: port kvm_arch_on_sigbus_vcpu to KVMCPUOps
  accel/kvm: cache KVMCPUOps
  accel/kvm: remove redundant ops checks for kvm_get_cpu_ops

 docs/specs/acpi_hest_ghes.rst           |   3 +-
 configs/targets/aarch64-softmmu.mak     |   1 -
 configs/targets/i386-softmmu.mak        |   1 -
 configs/targets/loongarch64-softmmu.mak |   1 -
 configs/targets/ppc-softmmu.mak         |   1 -
 configs/targets/ppc64-softmmu.mak       |   1 -
 configs/targets/riscv64-softmmu.mak     |   1 -
 configs/targets/s390x-softmmu.mak       |   1 -
 configs/targets/x86_64-softmmu.mak      |   1 -
 include/accel/kvm/cpu-ops.h             | 171 ++++++++++++++++++++++
 include/hw/core/cpu.h                   |   3 +
 include/system/kvm.h                    |  42 +-----
 include/system/kvm_int.h                |   2 -
 target/i386/kvm/kvm_i386.h              |  20 +++
 accel/kvm/kvm-accel-ops.c               |  13 +-
 accel/kvm/kvm-all.c                     | 183 +++++++++++++++++-------
 accel/tcg/cpu-exec.c                    |   2 +-
 hw/i386/kvm/xen_evtchn.c                |   6 +-
 hw/intc/openpic_kvm.c                   |   4 +-
 hw/intc/spapr_xive_kvm.c                |  10 +-
 hw/intc/xics_kvm.c                      |   6 +-
 target/arm/kvm.c                        |  96 +++++++------
 target/i386/kvm/kvm-cpu.c               |  26 +++-
 target/i386/kvm/kvm.c                   |  42 +++---
 target/loongarch/cpu.c                  |   8 +-
 target/loongarch/kvm/kvm.c              |  96 ++++++-------
 target/ppc/kvm.c                        |  75 +++++-----
 target/riscv/kvm/kvm-cpu.c              |  95 +++++-------
 target/s390x/kvm/kvm.c                  |  89 +++++++-----
 29 files changed, 628 insertions(+), 372 deletions(-)
 create mode 100644 include/accel/kvm/cpu-ops.h

-- 
2.47.3


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2026-10-20 11:21 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20 10:42 [PATCH 00/23] kvm: introduce KVMCPUOps Alex Bennée
2026-10-20 10:42 ` [PATCH 01/23] accel: introduce KVMAccelClass and KVMCPUOps Alex Bennée
2026-10-20 10:42 ` [PATCH 02/23] target/i386: wire up empty KVMAccelCPUClass Alex Bennée
2026-10-20 10:42 ` [PATCH 03/23] target/ppc: " Alex Bennée
2026-10-20 10:42 ` [PATCH 04/23] target/riscv: " Alex Bennée
2026-10-20 10:42 ` [PATCH 05/23] target/arm: " Alex Bennée
2026-10-20 10:43 ` [PATCH 06/23] target/s390x: " Alex Bennée
2026-10-20 10:43 ` [PATCH 07/23] target/loongarch: " Alex Bennée
2026-10-20 10:43 ` [PATCH 08/23] accel/kvm: port kvm_arch_pre_run to KVMCPUOps Alex Bennée
2026-10-20 10:43 ` [PATCH 09/23] accel/kvm: port kvm_arch_post_run " Alex Bennée
2026-10-20 10:43 ` [PATCH 10/23] accel/kvm: port kvm_arch_handle_exit " Alex Bennée
2026-10-20 10:43 ` [PATCH 11/23] accel/kvm: port kvm_arch_process_async_events " Alex Bennée
2026-10-20 10:43 ` [PATCH 12/23] accel/kvm: port kvm_arch_[put|get]_registers " Alex Bennée
2026-10-20 10:43 ` [PATCH 13/23] accel/kvm: port kvm_arch_pre_create_vcpu " Alex Bennée
2026-10-20 10:43 ` [PATCH 14/23] accel/kvm: port kvm_arch_init_vcpu " Alex Bennée
2026-10-20 10:43 ` [PATCH 15/23] accel/kvm: port kvm_arch_destroy_vcpu " Alex Bennée
2026-10-20 10:43 ` [PATCH 16/23] accel/kvm: port kvm_arch_vpcu_id " Alex Bennée
2026-10-20 10:43 ` [PATCH 17/23] accel/kvm: port kvm_arch_update_guest_debug " Alex Bennée
2026-10-20 10:43 ` [PATCH 18/23] accel/kvm: port kvm_arch_[insert|remove]_hw_breakpoints " Alex Bennée
2026-10-20 10:43 ` [PATCH 19/23] accel/kvm: remove TARGET_KVM_HAVE_GUEST_DEBUG Alex Bennée
2026-10-20 10:43 ` [PATCH 20/23] accel/kvm: port kvm_arch_stop_on_emulation_error to KVMCPUOps Alex Bennée
2026-10-20 10:43 ` [PATCH 21/23] accel/kvm: port kvm_arch_on_sigbus_vcpu " Alex Bennée
2026-10-20 10:43 ` [PATCH 22/23] accel/kvm: cache KVMCPUOps Alex Bennée
2026-10-20 10:43 ` [PATCH 23/23] accel/kvm: remove redundant ops checks for kvm_get_cpu_ops Alex Bennée
2026-10-20 11:21 ` [PATCH 00/23] kvm: introduce KVMCPUOps Alex Bennée

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox