accel/mshv: disable la57 (5lvl paging)
This change disable la57 paging on the mshv hypervisor on both the mshv processor feature bitmap and mask the cpuid feature leaf to the guest. Since the removal of hypervisor-assisted gva=>gpa translation in 1c85a4a3d7 we have seen MMIO errors in guests on la57-enabled hw. We will have to investigate and test this further. Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com> Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> Reviewed-by: Wei Liu <wei.liu@kernel.org> Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com> Link: https://lore.kernel.org/r/20260416121116.527927-10-magnuskulke@linux.microsoft.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Magnus Kulke committed
Apr 16, 2026 at 14:11 UTC
e7c9532d8940f3abfe2a989c2357b2373d314b2b
3 files changed
+24
accel/mshv/mshv-all.c
+7
@@ -142,6 +142,8 @@ static int create_partition(int mshv_fd, int *vm_fd)
142
int ret;
143
uint64_t pt_flags, host_proc_features;
144
union hv_partition_processor_xsave_features disabled_xsave_features;
145
+ union hv_partition_processor_features disabled_partition_features = {0};
146
+
147
struct mshv_create_partition_v2 args = {0};
148
149
QEMU_BUILD_BUG_ON(MSHV_NUM_CPU_FEATURES_BANKS != 2);
@@ -177,6 +179,11 @@ static int create_partition(int mshv_fd, int *vm_fd)
179
}
180
args.pt_cpu_fbanks[1] = ~host_proc_features;
181
182
+ /* arch-specific features we disable regardless of host support */
183
+ mshv_arch_disable_partition_proc_features(&disabled_partition_features);
184
+ args.pt_cpu_fbanks[0] |= disabled_partition_features.as_uint64[0];
185
+ args.pt_cpu_fbanks[1] |= disabled_partition_features.as_uint64[1];
186
+
187
/* populate args structure */
188
args.pt_flags = pt_flags;
189
args.pt_isolation = MSHV_PT_ISOLATION_NONE;
include/system/mshv_int.h
+2
@@ -94,6 +94,8 @@ void mshv_arch_init_vcpu(CPUState *cpu);
94
void mshv_arch_destroy_vcpu(CPUState *cpu);
95
void mshv_arch_amend_proc_features(
96
union hv_partition_synthetic_processor_features *features);
97
+void mshv_arch_disable_partition_proc_features(
98
+ union hv_partition_processor_features *disabled_features);
99
int mshv_arch_post_init_vm(int vm_fd);
100
101
typedef struct mshv_root_hvcall mshv_root_hvcall;
target/i386/mshv/mshv-cpu.c
+15
@@ -1129,6 +1129,12 @@ void mshv_arch_amend_proc_features(
1129
features->access_guest_idle_reg = 1;
1130
}
1131
1132
+void mshv_arch_disable_partition_proc_features(
1133
+ union hv_partition_processor_features *disabled_features)
1134
+{
1135
+ disabled_features->la57_support = 1;
1136
+}
1137
+
1138
static int set_memory_info(const struct hyperv_message *msg,
1139
struct hv_x64_memory_intercept_message *info)
1140
{
@@ -1707,6 +1713,15 @@ uint32_t mshv_get_supported_cpuid(uint32_t func, uint32_t idx, int reg)
1713
ret &= ~CPUID_EXT_VMX;
1714
}
1715
1716
+ if (func == 0x07 && idx == 0 && reg == R_ECX) {
1717
+ /*
1718
+ * LA57 (5-level paging) causes incorrect GVA=>GPA translations
1719
+ * in the instruction decoder/emulator. Disable until page table
1720
+ * walk in x86_mmu.c works w/ 5-level paging.
1721
+ */
1722
+ ret &= ~CPUID_7_0_ECX_LA57;
1723
+ }
1724
+
1725
return ret;
1726
}
1727