mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
When generating guest CPUID, we set PhysAddrSize (EAX bits 7:0) based on the host's physical address bits. On AMD hosts with SME, get_host_cpu_phys_bits() subtracts the c-bit reduction from this value, but the code here only writes the result to bits 7:0 and leaves GuestPhysAddrSize (bits 23:16) at the unmodified host value. This creates a gap: e.g. PhysAddrSize=43 but GuestPhysAddrSize=48. Guest firmware that reads GuestPhysAddrSize will see a larger address space than the VMM provides, and may place PCI BARs beyond the MMIO bus range. However, Cloud-hypervisor sizes its MMIO bus to phys_bits. Fix by setting both PhysAddrSize (bits 7:0) and GuestPhysAddrSize (bits 23:16) to phys_bits, using mask 0xff00_ff00 instead of 0xffff_ff00. Signed-off-by: Ruben Hakobyan <hruben@meta.com>