qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/27] Implementing a MSHV (Microsoft Hypervisor) accelerator
@ 2025-09-16 16:48 Magnus Kulke
  2025-09-16 16:48 ` [PATCH v4 01/27] accel: Add Meson and config support for MSHV accelerator Magnus Kulke
                   ` (28 more replies)
  0 siblings, 29 replies; 62+ messages in thread
From: Magnus Kulke @ 2025-09-16 16:48 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Philippe Mathieu-Daudé, Cameron Esfahani,
	Paolo Bonzini, Thomas Huth, Richard Henderson, Wei Liu,
	Cornelia Huck, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Roman Bolshakov, Phil Dennis-Jordan, Marcel Apfelbaum,
	Daniel P. Berrangé, Zhao Liu, Eduardo Habkost, Magnus Kulke,
	Wei Liu, Eric Blake, Yanan Wang, Marc-André Lureau,
	Alex Bennée

Hello all,

This is the fourth revision of a patch set implementing an accelerator
for the MSHV kernel driver, exposing HyperV to Linux "Dom0" hosts in
various scenarios. Thanks for the feedback to the previous revision, I
tried to incorporate those. The changes in the currenct patchset beyond
the suggested fixes are mostly related to the replacement of retired
ioctl calls that will not part of the upstreamed MSHV kernel driver.

Best regards,

magnus

Changelog:

v3 => v4

- Addressed code review comments
- Extended mention of MSHV accelerator in documentation
- Reworked the QMP `query-mshv` command to work like other accelerator's
  implementations (availability of the accelerator, instead of issueing
  stat() on /dev/mshv)
- Added a HMP `info mshv` command
- Replaced ioctls `MSHV_GET_VP_REGISTERS`, `MSHV_SET_VP_REGISTERS`,
  and `MSHV_TRANSLATE_GVA` with calls to `MSHV_ROOT_HVCALL`
- Allocate static pages in cpu->accel for the HVCALL input/output params
  (to avoid allocations in the MMIO exit path)

v2 => v3

- Addressed code review comments (style)
- Reserve GSI 01-23 for IO-APIC pins (this resolved a problem in which MSI
  routes would be overwritten with interrupts from legacy devices, breaking
  irqfd notification for virtio-blk queues)
- Guard memory slot table with mutex and RCU mechanism (multiple threads
  might access the memory slot table, and in the event of an UNMAPPED_GPA
  exit we need to query the table for an unmapped region covering that GPA)
- Include memory slot manager in MshvState
- Produce mshv.h kernel header with ./scripts/update-linux-headers.sh from
  linux 6.16 (not all UAPI definitions are defined in the upstream kernel,
  hence we ship hw/hyper/hvgdk*.h and hw/hyperv/hvhdk*.h headers)
- Added a QMP command query-mshv (a requirement for integration into
  higher-level tooling)
- Removed handling of HALT vm exit, since this is not a supported HV
  message any more.
- Added 2 maintainers from Microsoft for the respective file hierarchy
- Added mshv as accelerator option in the documentation

RFC (v1) => v2

- Addressed code review comments (style, consilidation).
- Rewrote the logic that handles overlap-in-userspace mappings to use
  a static list of slots, inspired by the HVF accelerator code.
- Fixed a bug that wrote corrupt payload in a MSHV_SET_MSI_ROUTING
  call, preventing vhost=on to work on tap network devices.
- Removed an erronous truncation of guest addresses to 32bit when
  registering ioeventfd's using MSHV_IOEVENTFD. This resulted in
  shadowing of low memory when ioevents were registered with
  addresses beyond the 4gb barrier and thus unexpected "unmapped gpa"
  vm exits in lower mem regions (impacting io performance).
- Fixed problem in which the MSI routing table was committed for KVM
  KVM instead of MSHV in virtio-pci bus initialization.
- Added handler for HLT vm exits.
- The above fixes removed a few limitation present in the previous
  revision:
  - Guest with machine type "pc" are booting (testing is still mostly
    performed with q35)
  - Tap network devices can be used with vhost=on option.
  - Seabios can be used with >2.75G memory and multiple virtio-pci
    devices
  - I/O performance improvement as extranous MMIO vm exits are avoided
    by registering ioevents with a correct address.

Notes:

- A discrete kernel ioctl "set_immediate_exit" (to avoid a race condition
  when handling terminiation signals like ctrl-a x) has been tested and
  proven to mitigate the problem. Since other consumers of /dev/mshv have
  simular requirements as QEMU, we opted to iterate a bit more on the
  respective kernel interface.

Magnus Kulke (26):
  accel: Add Meson and config support for MSHV accelerator
  target/i386/emulate: Allow instruction decoding from stream
  target/i386/mshv: Add x86 decoder/emu implementation
  hw/intc: Generalize APIC helper names from kvm_* to accel_*
  include/hw/hyperv: Add MSHV ABI header definitions
  linux-headers/linux: Add mshv.h headers
  accel/mshv: Add accelerator skeleton
  accel/mshv: Register memory region listeners
  accel/mshv: Initialize VM partition
  accel/mshv: Add vCPU creation and execution loop
  accel/mshv: Add vCPU signal handling
  target/i386/mshv: Add CPU create and remove logic
  target/i386/mshv: Implement mshv_store_regs()
  target/i386/mshv: Implement mshv_get_standard_regs()
  target/i386/mshv: Implement mshv_get_special_regs()
  target/i386/mshv: Implement mshv_arch_put_registers()
  target/i386/mshv: Set local interrupt controller state
  target/i386/mshv: Register CPUID entries with MSHV
  target/i386/mshv: Register MSRs with MSHV
  target/i386/mshv: Integrate x86 instruction decoder/emulator
  target/i386/mshv: Write MSRs to the hypervisor
  target/i386/mshv: Implement mshv_vcpu_run()
  accel/mshv: Handle overlapping mem mappings
  target/i386/mshv: Use preallocated page for hvcall
  docs: Add mshv to documentation
  MAINTAINERS: Add maintainers for mshv accelerator

Praveen K Paladugu (1):
  qapi/accel: Allow to query mshv capabilities

 MAINTAINERS                      |   15 +
 accel/Kconfig                    |    3 +
 accel/accel-irq.c                |  106 ++
 accel/meson.build                |    3 +-
 accel/mshv/irq.c                 |  397 +++++++
 accel/mshv/mem.c                 |  562 ++++++++++
 accel/mshv/meson.build           |    9 +
 accel/mshv/mshv-all.c            |  728 ++++++++++++
 accel/mshv/msr.c                 |  374 +++++++
 accel/mshv/trace-events          |   33 +
 accel/mshv/trace.h               |   14 +
 docs/about/build-platforms.rst   |    2 +-
 docs/devel/codebase.rst          |    2 +-
 docs/glossary.rst                |    6 +-
 docs/system/introduction.rst     |    3 +
 hmp-commands-info.hx             |   13 +
 hw/core/machine-hmp-cmds.c       |   15 +
 hw/core/machine-qmp-cmds.c       |   14 +
 hw/intc/apic.c                   |    8 +
 hw/intc/ioapic.c                 |   20 +-
 hw/virtio/virtio-pci.c           |   21 +-
 include/hw/hyperv/hvgdk.h        |   20 +
 include/hw/hyperv/hvgdk_mini.h   |  817 ++++++++++++++
 include/hw/hyperv/hvhdk.h        |  249 +++++
 include/hw/hyperv/hvhdk_mini.h   |  102 ++
 include/monitor/hmp.h            |    1 +
 include/system/accel-irq.h       |   37 +
 include/system/hw_accel.h        |    1 +
 include/system/mshv.h            |  196 ++++
 linux-headers/linux/mshv.h       |  291 +++++
 meson.build                      |   11 +
 meson_options.txt                |    2 +
 qapi/accelerator.json            |   29 +
 qemu-options.hx                  |   16 +-
 scripts/meson-buildoptions.sh    |    3 +
 scripts/update-linux-headers.sh  |    2 +-
 target/i386/cpu.h                |    4 +-
 target/i386/emulate/meson.build  |    7 +-
 target/i386/emulate/x86_decode.c |   27 +-
 target/i386/emulate/x86_decode.h |    9 +
 target/i386/emulate/x86_emu.c    |    3 +-
 target/i386/emulate/x86_emu.h    |    2 +
 target/i386/meson.build          |    2 +
 target/i386/mshv/meson.build     |    8 +
 target/i386/mshv/mshv-cpu.c      | 1764 ++++++++++++++++++++++++++++++
 target/i386/mshv/x86.c           |  297 +++++
 46 files changed, 6208 insertions(+), 40 deletions(-)
 create mode 100644 accel/accel-irq.c
 create mode 100644 accel/mshv/irq.c
 create mode 100644 accel/mshv/mem.c
 create mode 100644 accel/mshv/meson.build
 create mode 100644 accel/mshv/mshv-all.c
 create mode 100644 accel/mshv/msr.c
 create mode 100644 accel/mshv/trace-events
 create mode 100644 accel/mshv/trace.h
 create mode 100644 include/hw/hyperv/hvgdk.h
 create mode 100644 include/hw/hyperv/hvgdk_mini.h
 create mode 100644 include/hw/hyperv/hvhdk.h
 create mode 100644 include/hw/hyperv/hvhdk_mini.h
 create mode 100644 include/system/accel-irq.h
 create mode 100644 include/system/mshv.h
 create mode 100644 linux-headers/linux/mshv.h
 create mode 100644 target/i386/mshv/meson.build
 create mode 100644 target/i386/mshv/mshv-cpu.c
 create mode 100644 target/i386/mshv/x86.c

-- 
2.34.1



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

end of thread, other threads:[~2025-10-10 16:46 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).