Add ARM64 support for MSHV accelerator
v4 cover Add ARM64 support for MSHV accelerator
This series adds ARM64 guest support to the MSHV (Microsoft Hypervisor) accelerator, enabling QEMU to run aarch64 VMs on Microsoft's hypervisor using the mshv Linux kernel module.
The first few patches refactor the existing x86 MSHV code to separate arch-specific pieces from common infrastructure: moving MSR handling to target/i386, extracting shared register hypercall helpers, provisioning host CPU features, and introducing arch-specific init hooks.
The remaining patches add the ARM64 backend:
- vCPU state get/set using hypervisor register hypercalls
- -cpu host support by querying ID registers from the hypervisor
- vCPU run loop with MMIO emulation via ESR_EL2 syndrome decoding
- In-kernel vGICv3 backed by HVCALL_ASSERT_VIRTUAL_INTERRUPT
- Interrupt control structure adjustments for arm64
With this series, a standard aarch64 virt machine can be launched with:
qemu-system-aarch64 -accel mshv -cpu host -M virt ...
Caveats:
- Live migration is not yet supported.
---
Changes in v2:
- Removed PATCH: "accel/mshv: provision guests with the same features as host".
- Extracted common MMIO emulation logic for hvf, whpx and mshv to a
common place.
- Fixed checkpatch errors/warnings.
- Picked up reviewed-by tags.
- Link to v1: https://lore.kernel.org/qemu-devel/[email protected]
---
Changes in v3:
- Handled GPA Intercept in vCPU run loop to fix EDK2 firmware boot.
- Updated the cover letter: removed caveat about EDK2 firmware boot as
it is now fixed.
- Link to v2: https://lore.kernel.org/qemu-devel/20260402-mshv_accel_arm64_supp-v2-0-754895c15e9e@linux.microsoft.com/
---
Changes in v4:
- Split "target/arm: convert host CPU features ifdef ladder to runtime
checks" out of the -cpu host patch to separate the refactoring.
- Refactored MMIO emulation helper (arm_emulate_mmio) to use callback
ops for per-register access avoiding full CPU state sync for single
register MMIo operations for HVF & WHPX.
- Reordered patches: moved "arch-specific accelerator init hook" earlier
(patch 3), before the arm64 build enablenment.
- Updated cpu_thread_is_idle() comment to be arch-neutral.
- Link to v3: https://lore.kernel.org/qemu-devel/20260421-mshv_accel_arm64_supp-v3-0-469f544778ba@linux.microsoft.com
---
Aastha Rawat (9):
accel/mshv: move msr.c to target/i386
accel/mshv: extract common CPU register helpers
meson, target/arm/mshv: Enable arm64 build & add initial MSHV support target/arm/mshv: implement vcpu state operations for ARM64 target/arm: convert host CPU feature ifdef ladder to runtime checks target/arm/mshv: implement -cpu host for MSHV
accel/mshv: Add access_vp_regs synthetic proc features target/arm: cpu: Mark MSHV supporting PSCI 1.3 target/arm: extract MMIO emulation logic for HVF & WHPX
Anirudh Rayabharam (Microsoft) (5):
accel/mshv: add arch-specific accelerator init hook target/arm/mshv: add vCPU run loop
include/hw/hyperv: adjust hv_interrupt_control structure for arm64 hw/intc,target/arm/mshv: add MSHV vGICv3 implementation
MAINTAINERS: updates for MSHV arm64 code
Magnus Kulke (1):
accel/mshv: implement cpu_thread_is_idle() hook
MAINTAINERS | 8 +
accel/mshv/irq.c | 2 +
accel/mshv/meson.build | 4 +-
accel/mshv/mshv-all.c | 26 +-
accel/mshv/mshv-cpu-common.c | 151 ++++++++++
hw/arm/virt.c | 15 +-
hw/intc/arm_gicv3_common.c | 6 +-
hw/intc/arm_gicv3_mshv.c | 181 ++++++++++++
hw/intc/meson.build | 1 +
include/hw/hyperv/hvgdk_mini.h | 130 +++++++++
include/hw/hyperv/hvhdk.h | 101 ++++++-
include/hw/hyperv/hvhdk_mini.h | 6 +
include/hw/intc/arm_gicv3_common.h | 2 +-
include/system/hw_accel.h | 3 +-
include/system/mshv.h | 2 +
include/system/mshv_int.h | 6 +-
meson.build | 8 +-
target/arm/cpu.c | 8 +-
target/arm/cpu64.c | 27 +-
target/arm/helper.c | 62 ++++
target/arm/helper.h | 16 ++
target/arm/hvf/hvf.c | 57 ++--
target/arm/meson.build | 1 +
target/arm/mshv/meson.build | 7 +
target/arm/mshv/mshv-all.c | 572 +++++++++++++++++++++++++++++++++++++
target/arm/mshv_arm.h | 18 ++
target/arm/syndrome.h | 47 +++
target/arm/whpx/whpx-all.c | 41 ++-
target/i386/mshv/meson.build | 2 +
target/i386/mshv/mshv-all.c | 85 ++++++
target/i386/mshv/mshv-cpu.c | 170 +----------
{accel => target/i386}/mshv/msr.c | 0
32 files changed, 1505 insertions(+), 260 deletions(-)---
base-commit: 554cbfb1cf4601d2762f5315c884319e361b24cb
change-id: 20260311-mshv_accel_arm64_supp-e86b0082aee4
Best regards,
Signature · 1 line
Aastha Rawat <[email protected]>
PATCH v4 1/15 accel/mshv: move msr.c to target/i386
This file has x86 specific implementations. Move this file to i386 folder in preparation for ARM64 MSHV support.
---
accel/mshv/meson.build | 1 -
target/i386/mshv/meson.build | 1 +
{accel => target/i386}/mshv/msr.c | 0
3 files changed, 1 insertion(+), 1 deletion(-)accel/mshv/meson.build +0 -1
@@ -1,6 +1,5 @@ system_ss.add(when: 'CONFIG_MSHV', if_true: files( 'irq.c', 'mem.c', - 'msr.c', 'mshv-all.c' ))
target/i386/mshv/meson.build +1 -0
@@ -2,6 +2,7 @@ i386_mshv_ss = ss.source_set() i386_mshv_ss.add(files( 'mshv-cpu.c', + 'msr.c', )) i386_system_ss.add_all(when: 'CONFIG_MSHV', if_true: i386_mshv_ss)
target/i386/mshv/msr.c renamed from accel/mshv/msr.c +0 -0
Signature · 1 line
2.45.4
PATCH v4 2/15 accel/mshv: extract common CPU register helpers
In reply to Aastha RawatMove arch-independent MSHV CPU register handling functions into accel/mshv/mshv-cpu-common.c. Update x86 MSHV backends to use these shared helpers.
Prefix get_generic_regs() with mshv_ for proper namespacing since it is now public.
--- accel/mshv/meson.build | 3 +- accel/mshv/mshv-cpu-common.c | 151 +++++++++++++++++++++++++++++++++++++++++++ include/system/mshv_int.h | 3 + target/i386/mshv/mshv-cpu.c | 130 +------------------------------------ 4 files changed, 159 insertions(+), 128 deletions(-)
accel/mshv/meson.build +2 -1
@@ -1,5 +1,6 @@ system_ss.add(when: 'CONFIG_MSHV', if_true: files( 'irq.c', 'mem.c', - 'mshv-all.c' + 'mshv-all.c', + 'mshv-cpu-common.c' ))
accel/mshv/mshv-cpu-common.c new file +151 -0
151 lines not on this page · raw message
include/system/mshv_int.h +3 -0
@@ -89,12 +89,15 @@ int mshv_load_regs(CPUState *cpu);int mshv_store_regs (CPUState *cpu);int mshv_set_generic_regs (const CPUState *cpu,const hv_register_assoc *assocs,size_t n_regs); +int mshv_get_generic_regs (CPUState *cpu,hv_register_assoc *assocs, +size_t n_regs);int mshv_arch_put_registers (const CPUState *cpu);void mshv_arch_init_vcpu (CPUState *cpu);void mshv_arch_destroy_vcpu (CPUState *cpu);void mshv_arch_amend_proc_features (union hv_partition_synthetic_processor_features *features);int mshv_arch_post_init_vm (int vm_fd); +void mshv_setup_hvcall_args (AccelCPUState *state);typedef struct mshv_root_hvcall mshv_root_hvcall ;int mshv_hvcall (int fd,const mshv_root_hvcall *args);
target/i386/mshv/mshv-cpu.c +3 -127
166 lines not on this page · raw message
Signature · 1 line
2.45.4
PATCH v4 3/15 accel/mshv: add arch-specific accelerator init hook
In reply to Aastha RawatFrom: "Anirudh Rayabharam (Microsoft)" <[email protected]>
Introduce mshv_arch_accel_init() as an arch-specific hook called early in mshv_init(), before VM creation. This allows each architecture to perform platform-specific initialization at accelerator init time.
For x86, the hook calls mshv_init_mmio_emu() which was previously called directly from the common init path. Also move set_unimplemented_msr_action() and mshv_arch_post_init_vm() from mshv-cpu.c to the new mshv-all.c, as they are not vCPU-specific.
--- accel/mshv/mshv-all.c | 5 ++- include/system/mshv_int.h | 1 + target/i386/mshv/meson.build | 1 + target/i386/mshv/mshv-all.c | 80 ++++++++++++++++++++++++++++++++++++++++++++ target/i386/mshv/mshv-cpu.c | 40 ---------------------- 5 files changed, 86 insertions(+), 41 deletions(-)
accel/mshv/mshv-all.c +4 -1
@@ -448,7 +448,10 @@ static int mshv_init(AccelState *as, MachineState *ms)return -1 ; } -mshv_init_mmio_emu (); + ret =mshv_arch_accel_init (as, ms, mshv_fd); +if (ret <0 ) { +return -1 ; + }mshv_init_msicontrol ();
include/system/mshv_int.h +1 -0
@@ -96,6 +96,7 @@ void mshv_arch_init_vcpu(CPUState *cpu);void mshv_arch_destroy_vcpu (CPUState *cpu);void mshv_arch_amend_proc_features (union hv_partition_synthetic_processor_features *features); +int mshv_arch_accel_init (AccelState *as,MachineState *ms,int mshv_fd);int mshv_arch_post_init_vm (int vm_fd);void mshv_setup_hvcall_args (AccelCPUState *state);
target/i386/mshv/meson.build +1 -0
@@ -1,6 +1,7 @@ i386_mshv_ss = ss.source_set() i386_mshv_ss.add(files( + 'mshv-all.c', 'mshv-cpu.c', 'msr.c', ))
target/i386/mshv/mshv-all.c new file +80 -0
80 lines not on this page · raw message
target/i386/mshv/mshv-cpu.c +0 -40
@@ -1507,43 +1507,3 @@ void mshv_arch_destroy_vcpu(CPUState *cpu) state->hvcall_args = (MshvHvCallArgs ){0 };g_clear_pointer (&env->emu_mmio_buf, g_free); } - -/* -* Default Microsoft Hypervisor behavior for unimplemented MSR is to send a -* fault to the guest if it tries to access it. It is possible to override -* this behavior with a more suitable option i.e., ignore writes from the guest -* and return zero in attempt to read unimplemented. -*/ -static int set_unimplemented_msr_action (int vm_fd) -{ -struct hv_input_set_partition_property in = {0 }; -struct mshv_root_hvcall args = {0 }; - - in.property_code =HV_PARTITION_PROPERTY_UNIMPLEMENTED_MSR_ACTION ; - in.property_value =HV_UNIMPLEMENTED_MSR_ACTION_IGNORE_WRITE_READ_ZERO ; - - args.code =HVCALL_SET_PARTITION_PROPERTY ; - args.in_sz =sizeof (in); - args.in_ptr = (uint64_t )∈ - -trace_mshv_hvcall_args ("unimplemented_msr_action" , args.code, args.in_sz); - -int ret =mshv_hvcall (vm_fd, &args); -if (ret <0 ) { -error_report ("Failed to set unimplemented MSR action" ); -return -1 ; - } -return 0 ; -} - -int mshv_arch_post_init_vm (int vm_fd) -{ -int ret; - - ret =set_unimplemented_msr_action (vm_fd); -if (ret <0 ) { -error_report ("Failed to set unimplemented MSR action" ); - } - -return ret; -}
Signature · 1 line
2.45.4
PATCH v4 4/15 meson, target/arm/mshv: Enable arm64 build & add initial MSHV support
In reply to Aastha RawatEnable the build of the MSHV accelerator for arm64 in the Meson build system. Introduce initial files and stub implementations to support MSHV for the ARM target.
--- meson.build | 8 +++---- target/arm/meson.build | 1 + target/arm/mshv/meson.build | 7 ++++++ target/arm/mshv/mshv-all.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 4 deletions(-)
meson.build +4 -4
@@ -305,7 +305,8 @@ if cpu == 'aarch64' accelerator_targets += { 'CONFIG_HVF': ['aarch64-softmmu'], 'CONFIG_NITRO': ['aarch64-softmmu'], - 'CONFIG_WHPX': ['aarch64-softmmu'] + 'CONFIG_WHPX': ['aarch64-softmmu'], + 'CONFIG_MSHV': ['aarch64-softmmu'], } elif cpu == 'x86_64' accelerator_targets += {
@@ -871,10 +872,9 @@ if get_option('kvm').allowed() and host_os == 'linux' endif if get_option('mshv').allowed() and host_os == 'linux' - if get_option('mshv').enabled() and host_machine.cpu() != 'x86_64' - error('mshv accelerator requires x64_64 host') + if host_machine.cpu() in [ 'x86_64', 'aarch64' ] + accelerators += 'CONFIG_MSHV' endif - accelerators += 'CONFIG_MSHV' endif if get_option('whpx').allowed() and host_os == 'windows'
target/arm/meson.build +1 -0
@@ -58,6 +58,7 @@ arm_common_system_ss.add(files( subdir('hvf') subdir('whpx') +subdir('mshv') if 'CONFIG_TCG' in config_all_accel subdir('tcg')
target/arm/mshv/meson.build new file +7 -0
@@ -0,0 +1,7 @@ +arm_mshv_ss = ss.source_set() + +arm_mshv_ss.add(files( + 'mshv-all.c', +)) + +arm_system_ss.add_all(when: 'CONFIG_MSHV', if_true: arm_mshv_ss)
target/arm/mshv/mshv-all.c new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.45.4
PATCH v4 5/15 target/arm/mshv: implement vcpu state operations for ARM64
In reply to Aastha RawatAdd support for reading and writing ARM64 CPU registers in the MSHV accelerator. This includes functions to set and get registers, initialize and destroy VCPU state, and manage register state synchronization between QEMU and hypervisor.
--- include/hw/hyperv/hvgdk_mini.h | 42 +++++++++++++++ include/system/mshv_int.h | 1 - target/arm/mshv/mshv-all.c | 118 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+), 1 deletion(-)
include/hw/hyperv/hvgdk_mini.h +42 -0
@@ -13,6 +13,46 @@ typedef enum hv_register_name {/* Pending Interruption Register */ HV_REGISTER_PENDING_INTERRUPTION = 0x00010002, +#if defined(__aarch64__) +HV_ARM64_REGISTER_XZR =0x0002FFFE , +HV_ARM64_REGISTER_X0 =0x00020000 , +HV_ARM64_REGISTER_X1 =0x00020001 , +HV_ARM64_REGISTER_X2 =0x00020002 , +HV_ARM64_REGISTER_X3 =0x00020003 , +HV_ARM64_REGISTER_X4 =0x00020004 , +HV_ARM64_REGISTER_X5 =0x00020005 , +HV_ARM64_REGISTER_X6 =0x00020006 , +HV_ARM64_REGISTER_X7 =0x00020007 , +HV_ARM64_REGISTER_X8 =0x00020008 , +HV_ARM64_REGISTER_X9 =0x00020009 , +HV_ARM64_REGISTER_X10 =0x0002000A , +HV_ARM64_REGISTER_X11 =0x0002000B , +HV_ARM64_REGISTER_X12 =0x0002000C , +HV_ARM64_REGISTER_X13 =0x0002000D , +HV_ARM64_REGISTER_X14 =0x0002000E , +HV_ARM64_REGISTER_X15 =0x0002000F , +HV_ARM64_REGISTER_X16 =0x00020010 , +HV_ARM64_REGISTER_X17 =0x00020011 , +HV_ARM64_REGISTER_X18 =0x00020012 , +HV_ARM64_REGISTER_X19 =0x00020013 , +HV_ARM64_REGISTER_X20 =0x00020014 , +HV_ARM64_REGISTER_X21 =0x00020015 , +HV_ARM64_REGISTER_X22 =0x00020016 , +HV_ARM64_REGISTER_X23 =0x00020017 , +HV_ARM64_REGISTER_X24 =0x00020018 , +HV_ARM64_REGISTER_X25 =0x00020019 , +HV_ARM64_REGISTER_X26 =0x0002001A , +HV_ARM64_REGISTER_X27 =0x0002001B , +HV_ARM64_REGISTER_X28 =0x0002001C , +HV_ARM64_REGISTER_FP =0x0002001D , +HV_ARM64_REGISTER_LR =0x0002001E , +HV_ARM64_REGISTER_PC =0x00020022 , + +/* AArch64 System Register Descriptions: General system control registers */ +HV_ARM64_REGISTER_MIDR_EL1 =0x00040051 , +HV_ARM64_REGISTER_MPIDR_EL1 =0x00040001 , + +#elif defined(__x86_64__) /* X64 User-Mode Registers */ HV_X64_REGISTER_RAX = 0x00020000, HV_X64_REGISTER_RCX = 0x00020001,
@@ -157,6 +197,8 @@ typedef enum hv_register_name {/* Other MSRs */ HV_X64_REGISTER_MSR_IA32_MISC_ENABLE =0x000800A0 , +#endif +/* Misc */ HV_REGISTER_GUEST_OS_ID =0x00090002 , HV_REGISTER_REFERENCE_TSC = 0x00090017,
include/system/mshv_int.h +0 -1
@@ -82,7 +82,6 @@ void mshv_init_mmio_emu(void);int mshv_create_vcpu (int vm_fd,uint8_t vp_index,int *cpu_fd);void mshv_remove_vcpu (int vm_fd,int cpu_fd);int mshv_configure_vcpu (const CPUState *cpu,const MshvFPU *fpu,uint64_t xcr0); -int mshv_get_standard_regs (CPUState *cpu);int mshv_get_special_regs (CPUState *cpu);int mshv_run_vcpu (int vm_fd,CPUState *cpu,hv_message *msg,MshvVmExit *exit);int mshv_load_regs (CPUState *cpu);
target/arm/mshv/mshv-all.c +118 -0
147 lines not on this page · raw message
Signature · 1 line
2.45.4
PATCH v4 6/15 target/arm: convert host CPU feature ifdef ladder to runtime checks
In reply to Aastha RawatReplace the compile-time #if/#elif preprocessor ladder in aarch64_host_initfn() with runtime calls and add mshv_enabled() to it. This ensures the correct accelerator is selected at runtime when multiple accelerators are compiled in.
Add CONFIG_MSHV to the aarch64_cpus[] guard so that mshv accelerator can register the "host" CPU type.
--- target/arm/cpu64.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
target/arm/cpu64.c +15 -10
@@ -859,17 +859,21 @@ static void aarch64_host_initfn(Object *obj) }#endif +if (mshv_enabled ()) { +mshv_arm_set_cpu_features_from_host (cpu); + }else if (kvm_enabled ()) {#if defined(CONFIG_KVM ) -kvm_arm_set_cpreg_mig_tolerances (cpu); -kvm_arm_set_cpu_features_from_host (cpu); -aarch64_add_sve_properties (obj); -#elif defined(CONFIG_HVF ) -hvf_arm_set_cpu_features_from_host (cpu); -#elif defined(CONFIG_WHPX ) -whpx_arm_set_cpu_features_from_host (cpu); -#else -g_assert_not_reached (); +kvm_arm_set_cpreg_mig_tolerances (cpu);#endif +kvm_arm_set_cpu_features_from_host (cpu); +aarch64_add_sve_properties (obj); + }else if (hvf_enabled ()) { +hvf_arm_set_cpu_features_from_host (cpu); + }else if (whpx_enabled ()) { +whpx_arm_set_cpu_features_from_host (cpu); + }else { +g_assert_not_reached (); + }if (arm_feature (&cpu->env,ARM_FEATURE_AARCH64 )) {aarch64_add_pauth_properties (obj); }
@@ -897,7 +901,8 @@ static const ARMCPUInfo aarch64_cpus[] = { { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, { .name = "cortex-a53", .initfn = aarch64_a53_initfn }, { .name = "max", .initfn = aarch64_max_initfn }, -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) || defined(CONFIG_WHPX) +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) || \ + defined(CONFIG_WHPX) || defined(CONFIG_MSHV) { .name = "host", .initfn = aarch64_host_initfn }, #endif };
Signature · 1 line
2.45.4
PATCH v4 7/15 target/arm/mshv: implement -cpu host for MSHV
In reply to Aastha RawatThis commit enables support for the -cpu host option with MSHV accelerator on ARM64. The implementation queries the partition's CPU's ID registers and features via hypervisor interface, allowing to pass all CPU capabilities for the host CPU to the guest.
--- accel/mshv/mshv-all.c | 3 +- hw/arm/virt.c | 3 +- include/hw/hyperv/hvgdk_mini.h | 17 ++++ include/hw/hyperv/hvhdk.h | 10 ++ include/system/hw_accel.h | 3 +- target/arm/cpu.c | 6 +- target/arm/cpu64.c | 2 + target/arm/mshv/mshv-all.c | 217 +++++++++++++++++++++++++++++++++++++++++ target/arm/mshv_arm.h | 18 ++++ 9 files changed, 274 insertions(+), 5 deletions(-)
accel/mshv/mshv-all.c +2 -1
@@ -415,13 +415,14 @@ static int mshv_init_vcpu(CPUState *cpu)int ret; cpu->accel =g_new0 (AccelCPUState,1 ); -mshv_arch_init_vcpu (cpu); ret =mshv_create_vcpu (vm_fd, vp_index, &cpu->accel->cpufd);if (ret <0 ) {return -1 ; } +mshv_arch_init_vcpu (cpu); + cpu->accel->dirty = true;return 0 ;
hw/arm/virt.c +2 -1
@@ -49,6 +49,7 @@#include "system/kvm.h" #include "system/hvf.h" #include "system/whpx.h" +#include "system/mshv.h" #include "system/qtest.h" #include "system/system.h" #include "hw/core/loader.h"
@@ -4065,7 +4066,7 @@ static GPtrArray *virt_get_valid_cpu_types(const MachineState *ms)if (target_aarch64 ()) {g_ptr_array_add (vct,g_strdup (ARM_CPU_TYPE_NAME ("cortex-a53" )));g_ptr_array_add (vct,g_strdup (ARM_CPU_TYPE_NAME ("cortex-a57" ))); -if (kvm_enabled () ||hvf_enabled () ||whpx_enabled ()) { +if (kvm_enabled () ||hvf_enabled () ||whpx_enabled () ||mshv_enabled ()) {g_ptr_array_add (vct,g_strdup (ARM_CPU_TYPE_NAME ("host" ))); } }
include/hw/hyperv/hvgdk_mini.h +17 -0
@@ -48,6 +48,20 @@ typedef enum hv_register_name {HV_ARM64_REGISTER_LR =0x0002001E ,HV_ARM64_REGISTER_PC =0x00020022 , +/* AArch64 System Register Descriptions: ID Registers */ +HV_ARM64_REGISTER_ID_MIDR_EL1 =0x00022000 , +HV_ARM64_REGISTER_ID_MPIDR_EL1 =0x00022005 , +HV_ARM64_REGISTER_ID_AA64_PFR0_EL1 =0x00022020 , +HV_ARM64_REGISTER_ID_AA64_PFR1_EL1 =0x00022021 , +HV_ARM64_REGISTER_ID_AA64_ISAR0_EL1 =0x00022030 , +HV_ARM64_REGISTER_ID_AA64_ISAR1_EL1 =0x00022031 , +HV_ARM64_REGISTER_ID_AA64_ISAR2_EL1 =0x00022032 , +HV_ARM64_REGISTER_ID_AA64_MMFR0_EL1 =0x00022038 , +HV_ARM64_REGISTER_ID_AA64_MMFR1_EL1 =0x00022039 , +HV_ARM64_REGISTER_ID_AA64_MMFR2_EL1 =0x0002203a , +HV_ARM64_REGISTER_ID_AA64_DFR0_EL1 =0x00022028 , +HV_ARM64_REGISTER_ID_AA64_DFR1_EL1 =0x00022029 , +/* AArch64 System Register Descriptions: General system control registers */ HV_ARM64_REGISTER_MIDR_EL1 =0x00040051 , HV_ARM64_REGISTER_MPIDR_EL1 = 0x00040001,
@@ -850,6 +864,9 @@ struct hv_cpuid {#define HV_HYP_PAGE_SIZE BIT(HV_HYP_PAGE_SHIFT)#define HV_HYP_PAGE_MASK (~(HV_HYP_PAGE_SIZE - 1)) +#define HV_ANY_VP ((uint32_t)-1) +#define HV_VTL_ALL 0xF +#define HVCALL_GET_PARTITION_PROPERTY 0x0044#define HVCALL_SET_PARTITION_PROPERTY 0x0045#define HVCALL_GET_VP_REGISTERS 0x0050
include/hw/hyperv/hvhdk.h +10 -0
@@ -18,6 +18,16 @@ struct hv_input_set_partition_property {uint64_t property_value; }QEMU_PACKED ; +struct hv_input_get_partition_property { +uint64_t partition_id; +uint32_t property_code;/* enum hv_partition_property_code */ +uint32_t padding; +}; + +struct hv_output_get_partition_property { +uint64_t property_value; +}; +union hv_partition_synthetic_processor_features {uint64_t as_uint64[HV_PARTITION_SYNTHETIC_PROCESSOR_FEATURES_BANKS ];
include/system/hw_accel.h +2 -1
@@ -51,7 +51,8 @@ static inline bool hwaccel_enabled(void)return hvf_enabled () ||kvm_enabled () ||nvmm_enabled () - || whpx_enabled(); + ||whpx_enabled () + || mshv_enabled(); }#endif /* QEMU_HW_ACCEL_H */
target/arm/cpu.c +4 -2
@@ -47,6 +47,7 @@#include "system/tcg.h" #include "system/qtest.h" #include "system/hw_accel.h" +#include "system/mshv.h" #include "kvm_arm.h" #include "disas/capstone.h" #include "fpu/softfloat.h"
@@ -1781,8 +1782,9 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* this is the first point where we can report it. */ if (cpu->host_cpu_probe_failed) { -if (!kvm_enabled () && !hvf_enabled () && !whpx_enabled ()) { -error_setg (errp,"The 'host' CPU type can only be used with KVM, HVF or WHPX" ); +if (!kvm_enabled () && !hvf_enabled () && !whpx_enabled () && !mshv_enabled ()) { +error_setg (errp, +"The 'host' CPU type can only be used with KVM, HVF, WHPX, or MSHV" ); }else {error_setg (errp,"Failed to retrieve host CPU features" ); }
target/arm/cpu64.c +2 -0
@@ -26,12 +26,14 @@#include "qemu/units.h" #include "system/kvm.h" #include "system/hvf.h" +#include "system/mshv.h" #include "system/whpx.h" #include "system/hw_accel.h" #include "system/qtest.h" #include "system/tcg.h" #include "kvm_arm.h" #include "hvf_arm.h" +#include "mshv_arm.h" #include "whpx_arm.h" #include "qapi/visitor.h" #include "hw/core/qdev-properties.h"
target/arm/mshv/mshv-all.c +217 -0
238 lines not on this page · raw message
target/arm/mshv_arm.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* QEMU MSHV support +* +* Copyright Microsoft, Corp. 2026 +* +* Authors: Aastha Rawat <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef QEMU_MSHV_ARM_H +#define QEMU_MSHV_ARM_H + +#include "target/arm/cpu.h" + +void mshv_arm_set_cpu_features_from_host (ARMCPU *cpu); + +#endif
Signature · 1 line
2.45.4
PATCH v4 8/15 accel/mshv: Add access_vp_regs synthetic proc features
In reply to Aastha RawatEnable access_vp_regs feature for regs. In arm64, this feature bit allows the guest to set VP registers using hypercall. This wasn't required for x86 because such registers are set using wrmsr instead of hypercall.
--- accel/mshv/mshv-all.c | 1 + include/hw/hyperv/hvhdk.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 91 insertions(+), 1 deletion(-)
accel/mshv/mshv-all.c +1 -0
@@ -156,6 +156,7 @@ static int set_synthetic_proc_features(int vm_fd) features.tb_flush_hypercalls =1 ; features.synthetic_cluster_ipi =1 ; features.direct_synthetic_timers =1 ; + features.access_vp_regs =1 ;mshv_arch_amend_proc_features (&features);
include/hw/hyperv/hvhdk.h +90 -1
125 lines not on this page · raw message
Signature · 1 line
2.45.4
PATCH v4 9/15 target/arm: cpu: Mark MSHV supporting PSCI 1.3
In reply to Aastha RawatMSHV supports PSCI 1.3. Expose this version to guests.
--- target/arm/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/cpu.c +1 -1
@@ -1247,7 +1247,7 @@ static void arm_cpu_initfn(Object *obj)if (tcg_enabled () ||hvf_enabled ()) {/* TCG and HVF implement PSCI 1.1 */ cpu->psci_version =QEMU_PSCI_VERSION_1_1 ; - }else if (whpx_enabled ()) { + }else if (whpx_enabled () ||mshv_enabled ()) { cpu->psci_version =QEMU_PSCI_VERSION_1_3 ; } }
Signature · 1 line
2.45.4
PATCH v4 10/15 accel/mshv: implement cpu_thread_is_idle() hook
In reply to Aastha RawatFrom: Magnus Kulke <[email protected]>
In MSHV the hypervisor APIC is always used, so we to implement this hook to make sure the AP's vcpu thread is not blocked waiting for an INIT SIPI by the BSP. Without this change soft reboots with -smp cpus>=2 will hang.
--- accel/mshv/mshv-all.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
accel/mshv/mshv-all.c +12 -0
@@ -719,11 +719,23 @@ static const TypeInfo mshv_accel_type = { .instance_size = sizeof(MshvState), }; +/* +* Haulted vCPUs must still enter mshv_cpu_exec() so that MSHV_RUN_VP +* is called and the hypervisor can wake them (via SIPI on x86 or +* PSCI on ARM64). +*/ + +static bool mshv_vcpu_thread_is_idle (CPUState *cpu) +{ +return false; +} +static void mshv_accel_ops_class_init (ObjectClass *oc,const void *data) {AccelOpsClass *ops =ACCEL_OPS_CLASS (oc); ops->create_vcpu_thread = mshv_start_vcpu_thread; + ops->cpu_thread_is_idle = mshv_vcpu_thread_is_idle; ops->synchronize_post_init = mshv_cpu_synchronize_post_init; ops->synchronize_post_reset = mshv_cpu_synchronize_post_reset; ops->synchronize_state = mshv_cpu_synchronize;
Signature · 1 line
2.45.4
Re: [PATCH v4 10/15] accel/mshv: implement cpu_thread_is_idle() hook
Quoted 45 lines · Aastha Rawat
From: Magnus Kulke <[email protected]>
In MSHV the hypervisor APIC is always used, so we to implement this hook to make sure the AP's vcpu thread is not blocked waiting for an INIT SIPI by the BSP. Without this change soft reboots with -smp cpus>=2 will hang.
Signed-off-by Magnus Kulke <[email protected]>Reviewed-by Mohamed Mediouni <[email protected]>Signed-off-by Aastha Rawat <[email protected]>--- accel/mshv/mshv-all.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)accel/mshv/mshv-all.c +12
-0@@ -719,11 +719,23 @@ static const TypeInfo mshv_accel_type = { .instance_size = sizeof(MshvState), }; +/* +* Haulted vCPUs must still enter mshv_cpu_exec() so that MSHV_RUN_VP +* is called and the hypervisor can wake them (via SIPI on x86 or +* PSCI on ARM64). +*/ + +static bool mshv_vcpu_thread_is_idle (CPUState *cpu) +{ +return false; +} +static void mshv_accel_ops_class_init (ObjectClass *oc,const void *data) {AccelOpsClass *ops =ACCEL_OPS_CLASS (oc); ops->create_vcpu_thread = mshv_start_vcpu_thread; + ops->cpu_thread_is_idle = mshv_vcpu_thread_is_idle; ops->synchronize_post_init = mshv_cpu_synchronize_post_init; ops->synchronize_post_reset = mshv_cpu_synchronize_post_reset; ops->synchronize_state = mshv_cpu_synchronize;Signature · 2 lines
-- 2.45.4
this has been merged independently since: dbfb680772d5184544f7c0a8bba96bec229c96e6
best,
magnus
PATCH v4 11/15 target/arm: extract MMIO emulation logic for HVF & WHPX
In reply to Aastha Rawat- Move common MMIO emulation code from HVF and WHPX backend to arm_emulate_mmio() in helper.c.
- Update HVF and WHPX to use the new helper and shared types.
--- target/arm/helper.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++ target/arm/helper.h | 16 ++++++++++++ target/arm/hvf/hvf.c | 57 +++++++++++++++++++----------------------- target/arm/syndrome.h | 47 +++++++++++++++++++++++++++++++++++ target/arm/whpx/whpx-all.c | 41 ++++++++++++------------------ 5 files changed, 167 insertions(+), 56 deletions(-)
target/arm/helper.c +62 -0
@@ -34,6 +34,8 @@#endif #include "cpregs.h" #include "target/arm/gtimer.h" +#include "target/arm/helper.h" +#include "target/arm/syndrome.h" #include "qemu/plugin.h" static void switch_mode (CPUARMState *env,int mode);
@@ -9097,6 +9099,66 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs)take_aarch32_exception (env, new_mode, mask, offset, addr); } +/* +* Emulate a data abort syndrome for MMIO/guest memory access +*/ +int arm_emulate_mmio (CPUState *cpu,EsrEl2 syndrome,uint64_t gpa, +const struct arm_emul_ops *ops) +{ +int ret; +IssDataAbort iss = {0 }; + iss.raw = syndrome.iss; + +if (!(syndrome.ec == data_abort_lower || syndrome.ec == data_abort)) { +error_report ("Unknown exception class 0x%x" , syndrome.ec); +return -1 ; + } + +if (!iss.isv) { +error_report ("Cannot emulate MMIO. ISS not valid." ); +return -1 ; + } + +AddressSpace *as =cpu_get_address_space (cpu, ARMASIdx_NS); +uint64_t len =1ULL << iss.sas; +bool sign_extend = iss.sse; +uint64_t reg_index = iss.srt; + +if (iss.wnr) { +uint8_t data[8 ]; +uint64_t val = reg_index <31 ? ops->get_reg (cpu, reg_index) :0ULL ; + val =cpu_to_le64 (val); +memcpy (data, &val,sizeof (val)); + ret =address_space_write (as, gpa,MEMTXATTRS_UNSPECIFIED , data, len); +if (ret !=MEMTX_OK ) { +error_report ("Failed to write guest memory" ); +return -1 ; + } + }else { +uint8_t data[8 ] = {0 }; + ret =address_space_read (as, gpa,MEMTXATTRS_UNSPECIFIED , data, len); +if (ret !=MEMTX_OK ) { +error_report ("Failed to read guest memory" ); +return -1 ; + } +uint64_t val; +memcpy (&val, data,sizeof (val)); + val =le64_to_cpu (val); +if (sign_extend) { +uint64_t shift =64 - (len *8 ); + val = (((int64_t )val << shift) >> shift); + } +if (!iss.sf) { + val &=0xffffffff ; + } +if (reg_index <31 ) { + ops->set_reg (cpu, reg_index, val); + } + } + +return 0 ; +} +static int aarch64_regnum (CPUARMState *env,int aarch32_reg) {/*
target/arm/helper.h +16 -0
@@ -3,8 +3,24 @@#ifndef HELPER__H #define HELPER__H +#include <stdint.h> +#include <stdbool.h> #include "exec/helper-proto-common.h" #include "exec/helper-gen-common.h" +#include "target/arm/syndrome.h" + +/* +* Callback ops for per-register access during MMIO emulation. +* Each hypervisor backend provides its own implementation to avoid +* syncing the full CPU state for a single-register MMIO access. +*/ +struct arm_emul_ops { +uint64_t (*get_reg)(CPUState *cpu,int reg); +void (*set_reg)(CPUState *cpu,int reg,uint64_t val); +}; + +int arm_emulate_mmio (CPUState *cpu,EsrEl2 syndrome,uint64_t gpa, +const struct arm_emul_ops *ops);#define HELPER_H "tcg/helper-defs.h"#include "exec/helper-proto.h.inc"
target/arm/hvf/hvf.c +26 -31
107 lines not on this page · raw message
target/arm/syndrome.h +47 -0
53 lines not on this page · raw message
target/arm/whpx/whpx-all.c +16 -25
56 lines not on this page · raw message
Signature · 1 line
2.45.4
PATCH v4 12/15 target/arm/mshv: add vCPU run loop
In reply to Aastha RawatFrom: "Anirudh Rayabharam (Microsoft)" <[email protected]>
Add the main vCPU run loop for MSHV using the MSHV_RUN_VP_IOCTL.
Handle MMIO exits by emulating the instruction using the syndrome information from ESR_EL2.
--- include/hw/hyperv/hvgdk_mini.h | 44 +++++++++++++++ target/arm/mshv/mshv-all.c | 120 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+)
include/hw/hyperv/hvgdk_mini.h +44 -0
@@ -759,6 +759,50 @@ struct hv_x64_memory_intercept_message {uint8_t instruction_bytes[16 ]; }QEMU_PACKED ; +union hv_arm64_vp_execution_state { +uint16_t as_uint16; +struct { +uint16_t cpl:2 ; +uint16_t debug_active:1 ; +uint16_t interruption_pending:1 ; +uint16_t vtl:4 ; +uint16_t virtualization_fault_active:1 ; +uint16_t reserved:7 ; + }; +}; + +struct hv_arm64_intercept_message_header { +uint32_t vp_index; +uint8_t instruction_length; +uint8_t intercept_access_type; +union hv_arm64_vp_execution_state execution_state; +uint64_t pc; +uint64_t cpsr; +}; + +union hv_arm64_memory_access_info { +uint8_t as_uint8; +struct { +uint8_t gva_valid:1 ; +uint8_t gva_gpa_valid:1 ; +uint8_t hypercall_output_pending:1 ; +uint8_t reserved:5 ; + }; +}; + +struct hv_arm64_memory_intercept_message { +struct hv_arm64_intercept_message_header header; +uint32_t cache_type;/* enum hv_cache_type */ +uint8_t instruction_byte_count; +union hv_arm64_memory_access_info memory_access_info; +uint16_t reserved1; +uint8_t instruction_bytes[4 ]; +uint32_t reserved2; +uint64_t guest_virtual_address; +uint64_t guest_physical_address; +uint64_t syndrome; +}; +union hv_message_flags {uint8_t asu8;struct {
target/arm/mshv/mshv-all.c +120 -0
134 lines not on this page · raw message
Signature · 1 line
2.45.4
PATCH v4 13/15 include/hw/hyperv: adjust hv_interrupt_control structure for arm64
In reply to Aastha RawatFrom: "Anirudh Rayabharam (Microsoft)" <[email protected]>
Add the arm64 specific fields to the hv_interrupt_control struct and adjust the existing usage accordingly. mshv_request_interrupt is only needed only for x86 so compile it out entirely for arm64.
--- accel/mshv/irq.c | 2 ++ include/hw/hyperv/hvgdk_mini.h | 25 +++++++++++++++++++++++++ include/system/mshv.h | 2 ++ 3 files changed, 29 insertions(+)
accel/mshv/irq.c +2 -0
@@ -310,6 +310,7 @@ int mshv_irqchip_update_msi_route(int virq, MSIMessage msg, PCIDevice *dev)return 0 ; } +#if defined(__x86_64__)int mshv_request_interrupt (MshvState *mshv_state,uint32_t interrupt_type,uint32_t vector,uint32_t vp_index,bool logical_dest_mode,bool level_triggered)
@@ -346,6 +347,7 @@ int mshv_request_interrupt(MshvState *mshv_state, uint32_t interrupt_type, uint3 }return 0 ; } +#endif void mshv_irqchip_commit_routes (void ) {
include/hw/hyperv/hvgdk_mini.h +25 -0
@@ -510,13 +510,38 @@ typedef struct hv_input_set_vp_registers {struct hv_register_assoc elements[]; }QEMU_PACKED hv_input_set_vp_registers; +enum hv_interrupt_type { +#if defined(__x86_64__) +HV_X64_INTERRUPT_TYPE_FIXED =0x0000 , +HV_X64_INTERRUPT_TYPE_LOWESTPRIORITY =0x0001 , +HV_X64_INTERRUPT_TYPE_SMI =0x0002 , +HV_X64_INTERRUPT_TYPE_REMOTEREAD =0x0003 , +HV_X64_INTERRUPT_TYPE_NMI =0x0004 , +HV_X64_INTERRUPT_TYPE_INIT =0x0005 , +HV_X64_INTERRUPT_TYPE_SIPI =0x0006 , +HV_X64_INTERRUPT_TYPE_EXTINT =0x0007 , +HV_X64_INTERRUPT_TYPE_LOCALINT0 =0x0008 , +HV_X64_INTERRUPT_TYPE_LOCALINT1 =0x0009 , +HV_X64_INTERRUPT_TYPE_MAXIMUM =0x000A , +#elif defined(__aarch64__) +HV_ARM64_INTERRUPT_TYPE_FIXED =0x0000 , +HV_ARM64_INTERRUPT_TYPE_MAXIMUM =0x0008 , +#endif +}; +union hv_interrupt_control {uint64_t as_uint64;struct {uint32_t interrupt_type;/* enum hv_interrupt type */ +#if defined(__x86_64__)uint32_t level_triggered:1 ;uint32_t logical_dest_mode:1 ;uint32_t rsvd:30 ; +#elif defined(__aarch64__) +uint32_t rsvd1:2 ; +uint32_t asserted:1 ; +uint32_t rsvd2:29 ; +#endif }; };
include/system/mshv.h +2 -0
@@ -47,10 +47,12 @@ extern bool mshv_allowed;typedef struct MshvState MshvState ;extern MshvState *mshv_state; +#if defined(__x86_64__)/* interrupt */ int mshv_request_interrupt (MshvState *mshv_state,uint32_t interrupt_type,uint32_t vector,uint32_t vp_index,bool logical_destination_mode,bool level_triggered); +#endif int mshv_irqchip_add_msi_route (int vector,PCIDevice *dev);int mshv_irqchip_update_msi_route (int virq,MSIMessage msg,PCIDevice *dev);
Signature · 1 line
2.45.4
PATCH v4 14/15 hw/intc,target/arm/mshv: add MSHV vGICv3 implementation
In reply to Aastha RawatFrom: "Anirudh Rayabharam (Microsoft)" <[email protected]>
Add in-kernel GICv3 support for the MSHV accelerator, following the same approach as the KVM and WHPX vGIC backends. The implementation handles IRQ injection via the HVCALL_ASSERT_VIRTUAL_INTERRUPT hypercall.
Introduce mshv_arch_pre_init_vm(), an arch-specific hook called after VM creation but before VM initialization, used on arm64 to configure GIC partition properties (GICD base, ITS translater base, timer and PMU PPI numbers). The x86 side provides a no-op stub.
Update the virt machine to treat MSHV like WHPX for GIC version selection (GICv3 only) and MSI controller finalization (no ITS support).
--- accel/mshv/mshv-all.c | 5 + hw/arm/virt.c | 12 +-- hw/intc/arm_gicv3_common.c | 6 +- hw/intc/arm_gicv3_mshv.c | 181 +++++++++++++++++++++++++++++++++++++ hw/intc/meson.build | 1 + include/hw/hyperv/hvgdk_mini.h | 2 + include/hw/hyperv/hvhdk_mini.h | 6 ++ include/hw/intc/arm_gicv3_common.h | 2 +- include/system/mshv_int.h | 1 + target/arm/mshv/mshv-all.c | 61 +++++++++++++ target/i386/mshv/mshv-all.c | 5 + 11 files changed, 270 insertions(+), 12 deletions(-)
accel/mshv/mshv-all.c +5 -0
@@ -200,6 +200,11 @@ static int create_vm(int mshv_fd, int *vm_fd)return -1 ; } + ret =mshv_arch_pre_init_vm (*vm_fd); +if (ret <0 ) { +return -1 ; + } + ret =initialize_vm (*vm_fd);if (ret <0 ) {return -1 ;
hw/arm/virt.c +4 -8
@@ -2663,7 +2663,7 @@ static void finalize_gic_version(VirtMachineState *vms)/* KVM w/o kernel irqchip can only deal with GICv2 */ gics_supported |=VIRT_GIC_VERSION_2_MASK ; accel_name ="KVM with kernel-irqchip=off" ; - }else if (whpx_enabled ()) { + }else if (whpx_enabled () ||mshv_enabled ()) { gics_supported |=VIRT_GIC_VERSION_3_MASK ; }else if (hvf_enabled ()) {if (!hvf_irqchip_in_kernel ()) {
@@ -2717,7 +2717,7 @@ static void finalize_msi_controller(VirtMachineState *vms)if (vms->msi_controller ==VIRT_MSI_CTRL_AUTO ) {if (vms->gic_version ==VIRT_GIC_VERSION_2 ) { vms->msi_controller =VIRT_MSI_CTRL_GICV2M ; - }else if (whpx_enabled ()) { + }else if (whpx_enabled () ||mshv_enabled ()) { vms->msi_controller =VIRT_MSI_CTRL_GICV2M ; }else if (hvf_enabled () &&hvf_irqchip_in_kernel ()) { vms->msi_controller =VIRT_MSI_CTRL_GICV2M ;
@@ -2739,12 +2739,8 @@ static void finalize_msi_controller(VirtMachineState *vms)error_report ("GICv2 + ITS is an invalid configuration." );exit (1 ); } -if (vms->gic_version ==VIRT_GIC_VERSION_5 ) { -error_report ("GICv5 + ITS is not yet implemented." ); -exit (1 ); - } -if (whpx_enabled ()) { -error_report ("ITS not supported on WHPX." ); +if (mshv_enabled ()) { +error_report ("ITS not supported on MSHV." );exit (1 ); }if (hvf_enabled () &&hvf_irqchip_in_kernel ()) {
hw/intc/arm_gicv3_common.c +3 -3
@@ -33,7 +33,7 @@#include "hw/arm/linux-boot-if.h" #include "system/kvm.h" #include "system/whpx.h" -#include "system/hvf.h" +#include "system/mshv.h" static void gicv3_gicd_no_migration_shift_bug_post_load (GICv3State *cs)
@@ -660,8 +660,8 @@ const char *gicv3_class_name(void)return "kvm-arm-gicv3" ; }else if (whpx_enabled ()) {return TYPE_WHPX_GICV3 ; - }else if (hvf_enabled () &&hvf_irqchip_in_kernel ()) { -return TYPE_HVF_GICV3 ; + }else if (mshv_enabled ()) { +return TYPE_MSHV_GICV3 ; }else {if (kvm_enabled ()) {error_report ("Userspace GICv3 is not supported with KVM" );
hw/intc/arm_gicv3_mshv.c new file +181 -0
181 lines not on this page · raw message
hw/intc/meson.build +1 -0
@@ -49,6 +49,7 @@ specific_ss.add(when: ['CONFIG_WHPX', 'TARGET_AARCH64'], if_true: files('arm_gic specific_ss.add(when: ['CONFIG_HVF', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_hvf.c')) stub_ss.add(files('arm_gicv3_hvf_stub.c')) specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) +specific_ss.add(when: ['CONFIG_MSHV', 'TARGET_AARCH64'], if_true: files('arm_gicv3_mshv.c')) arm_common_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) specific_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_irqmp.c')) specific_ss.add(when: 'CONFIG_IOAPIC', if_true: files('ioapic.c'))
include/hw/hyperv/hvgdk_mini.h +2 -0
@@ -66,6 +66,8 @@ typedef enum hv_register_name { HV_ARM64_REGISTER_MIDR_EL1 = 0x00040051, HV_ARM64_REGISTER_MPIDR_EL1 = 0x00040001, + HV_ARM64_REGISTER_GICR_BASE_GPA = 0x00063000, + #elif defined(__x86_64__)/* X64 User-Mode Registers */ HV_X64_REGISTER_RAX = 0x00020000,
include/hw/hyperv/hvhdk_mini.h +6 -0
@@ -62,6 +62,12 @@ enum hv_partition_property_code {HV_PARTITION_PROPERTY_ISOLATION_POLICY =0x00050014 ,HV_PARTITION_PROPERTY_UNIMPLEMENTED_MSR_ACTION =0x00050017 ,HV_PARTITION_PROPERTY_SEV_VMGEXIT_OFFLOADS =0x00050022 , +HV_PARTITION_PROPERTY_GICD_BASE_ADDRESS =0x00050028 , +HV_PARTITION_PROPERTY_GITS_TRANSLATER_BASE_ADDRESS =0x00050029 , +HV_PARTITION_PROPERTY_GIC_LPI_INT_ID_BITS =0x0005002A , +HV_PARTITION_PROPERTY_GIC_PPI_OVERFLOW_INTERRUPT_FROM_CNTV =0x0005002B , +HV_PARTITION_PROPERTY_GIC_PPI_OVERFLOW_INTERRUPT_FROM_CNTP =0x0005002C , +HV_PARTITION_PROPERTY_GIC_PPI_PERFORMANCE_MONITORS_INTERRUPT =0x0005002D ,/* Compatibility properties */ HV_PARTITION_PROPERTY_PROCESSOR_VENDOR = 0x00060000,
include/hw/intc/arm_gicv3_common.h +1 -1
@@ -315,7 +315,7 @@ DECLARE_OBJ_CHECKERS(GICv3State, ARMGICv3CommonClass,/* Types for GICv3 kernel-irqchip */ #define TYPE_WHPX_GICV3 "whpx-arm-gicv3" -#define TYPE_HVF_GICV3 "hvf-arm-gicv3" +#define TYPE_MSHV_GICV3 "mshv-arm-gicv3"struct ARMGICv3CommonClass {/*< private >*/
include/system/mshv_int.h +1 -0
@@ -96,6 +96,7 @@ void mshv_arch_destroy_vcpu(CPUState *cpu);void mshv_arch_amend_proc_features (union hv_partition_synthetic_processor_features *features);int mshv_arch_accel_init (AccelState *as,MachineState *ms,int mshv_fd); +int mshv_arch_pre_init_vm (int vm_fd);int mshv_arch_post_init_vm (int vm_fd);void mshv_setup_hvcall_args (AccelCPUState *state);
target/arm/mshv/mshv-all.c +61 -0
67 lines not on this page · raw message
target/i386/mshv/mshv-all.c +5 -0
@@ -39,6 +39,11 @@ int mshv_arch_accel_init(AccelState *as, MachineState *ms, int mshv_fd)return 0 ; } +int mshv_arch_pre_init_vm (int vm_fd) +{ +return 0 ; +} +/* * Default Microsoft Hypervisor behavior for unimplemented MSR is to send a * fault to the guest if it tries to access it. It is possible to override
Signature · 1 line
2.45.4
PATCH v4 15/15 MAINTAINERS: updates for MSHV arm64 code
In reply to Aastha RawatFrom: "Anirudh Rayabharam (Microsoft)" <[email protected]>
Add myself and Aastha Rawat as maintainers.
Add Magnus Kulke as reviewer.
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -611,6 +611,14 @@ R: Doru Blânzeanu <[email protected]> S: Supported F: target/i386/mshv/ +ARM64 MSHV CPUs +M: Anirudh Rayabharam <[email protected]> +M: Aastha Rawat <[email protected]> +R: Magnus Kulke <[email protected]> +S: Supported +F: target/arm/mshv/ +F: hw/intc/arm_gicv3_mshv.c + X86 Instruction Emulator M: Roman Bolshakov <[email protected]> R: Phil Dennis-Jordan <[email protected]>
Signature · 1 line
2.45.4