vmm: acpi: provide FADT PM1a event/control blocks for nested Hyper-V

A Windows guest that launches nested Hyper-V (for example to run WSL2)
fails to start its hypervisor on cloud-hypervisor's HW-reduced-ACPI
FADT. hvloader's hypervisor-launch path (0x18000f01c -> 0x180015628 ->
0x180015788) registers every legacy PM register block via 0x1800158dc
and rejects any block whose GAS address is 0 with status 8
(STATUS_INVALID_DEVICE_REQUEST). hvix64 then never launches and
HypervisorPresent stays False. The HW-reduced FADT leaves those blocks
zero.

Emit valid PM1a event/control blocks (I/O ports, lengths and X_GAS) in
the FADT and reserve those ports in the I/O allocator so nothing else
claims them. The HW-reduced guest OS ignores the legacy ports; only
hvloader's ACPI validation reads them.

These blocks are only useful to a guest that itself runs an enlightened
hypervisor, so emit them only when both guest nesting and the Hyper-V
enlightenments are enabled (--cpu nested=on,kvm_hyperv=on).

Signed-off-by: doge <me@crackerben.com>
This commit is contained in:
doge
2026-06-28 21:53:32 +08:00
committed by Rob Bradford
parent 5b3416adf4
commit 3d5f06ff03
2 changed files with 72 additions and 3 deletions

View File

@@ -1089,6 +1089,16 @@ impl CpuManager {
Ok(())
}
#[cfg(target_arch = "x86_64")]
pub fn nested(&self) -> bool {
self.config.nested
}
#[cfg(target_arch = "x86_64")]
pub fn kvm_hyperv(&self) -> bool {
self.config.kvm_hyperv
}
/// Only create new vCPUs if there aren't any inactive ones to reuse
fn create_vcpus(
&mut self,