]> git.proxmox.com Git - qemu-server.git/commit - PVE/QemuServer/Memory.pm
memory hotplug: rework max memory handling, make phys-bits dependent
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 17 Nov 2022 14:55:40 +0000 (15:55 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 17 Nov 2022 15:54:49 +0000 (16:54 +0100)
commit33b0d3b7bee12c49f3d0b7d53699b5874ab8eb73
tree74d5f56c4c6f993f00f17ec2fabb82489fba6f2c
parentd1901fe2cee8e4802e3c3e3d0c730ee8f31d2f62
memory hotplug: rework max memory handling, make phys-bits dependent

QEMU 7.1 introduced some actual checks for the max memory value in
1caab5cf86bd ("i386/pc: bounds check phys-bits against max used GPA")
and while correct it breaks our by-luck working hard coded max mem of
4 TB for cases with smaller phys bit address sizes, like some older
CPUs or most CPU types have per default if not 'host' or 'max'.

QEMU uses 40 bits per default if the CPU isn't set to host or
phys-bits is not set explicitly.

For 40 bit it seems that depending on machine type one has a max
possible mem of: i440 -> 752, q35 -> 722 GiB, but instead of reducing
it to 704 GiB (512+1128+64) in a hard coded way we acutally check for
the bit size that will probably be used and use that to determine the
max memory size useable.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer/Memory.pm