Default phys-bits on Qemu is TCG_PHYS_BITS (40) which is enough to address 1Tb (0xff ffff ffff). On AMD platforms, if a ram-above-4g relocation happens and the CPU wasn't configured with a big enough phys-bits, warn the user. There isn't a catastrophic failure exactly, the guest will still boot, but most likely won't be able to use more than ~4G of RAM.
Signed-off-by: Joao Martins <joao.m.mart...@oracle.com> --- hw/i386/pc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6e4f5c87a2e5..11598a0a39e4 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -888,6 +888,7 @@ void pc_memory_init(PCMachineState *pcms, MachineClass *mc = MACHINE_GET_CLASS(machine); PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); X86MachineState *x86ms = X86_MACHINE(pcms); + hwaddr maxphysaddr, maxusedaddr; assert(machine->ram_size == x86ms->below_4g_mem_size + x86ms->above_4g_mem_size); @@ -896,6 +897,15 @@ void pc_memory_init(PCMachineState *pcms, x86_update_above_4g_mem_start(pcms, pci_hole64_size); + maxphysaddr = ((hwaddr)1 << X86_CPU(first_cpu)->phys_bits) - 1; + maxusedaddr = x86_max_phys_addr(pcms, pci_hole64_size); + if (maxphysaddr < maxusedaddr) { + warn_report("Address space above 4G at %"PRIx64"-%"PRIx64 + " phys-bits too low (%u)", + x86ms->above_4g_mem_start, maxusedaddr, + X86_CPU(first_cpu)->phys_bits); + } + /* * Split single memory region and use aliases to address portions of it, * done for backwards compatibility with older qemus. -- 2.17.2