hypervisor: vmm: mshv: Enable SMT for guests with threads_per_core > 1

Set HV_PARTITION_CREATION_FLAG_SMT_ENABLED_GUEST when the guest
topology has more than one thread per core. This allows the
hypervisor to schedule guest VPs correctly on SMT-enabled hosts.

Without this flag, the hypervisor schedules guest VPs incorrectly,
causing SMT unusable.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-01-19 19:15:12 +01:00
committed by Rob Bradford
parent e3a2bf0870
commit a00189cf72
3 changed files with 10 additions and 0 deletions

View File

@@ -171,6 +171,7 @@ pub struct HypervisorVmConfig {
#[cfg(feature = "sev_snp")]
pub mem_size: u64,
pub nested: bool,
pub smt_enabled: bool,
}
#[derive(Copy, Clone)]

View File

@@ -307,6 +307,10 @@ impl hypervisor::Hypervisor for MshvHypervisor {
.__bindgen_anon_1
.set_nested_virt_support(1u64);
}
if _config.smt_enabled {
create_args.pt_flags |= 1 << MSHV_PT_BIT_SMT_ENABLED_GUEST;
}
}
// Modified feature bit fields are written back to create_args
for i in 0..create_args.pt_num_cpu_fbanks {