i386/pc: bounds check phys-bits against max used GPA
commit1caab5cf86bdf02fa71079c4ca4a3c0748f39eb5
authorJoao Martins <joao.m.martins@oracle.com>
Tue, 19 Jul 2022 17:00:12 +0000 (19 18:00 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 26 Jul 2022 14:40:58 +0000 (26 10:40 -0400)
tree12c1ede82ceca535f04952db9c984b947e29b571
parent8288a8286d00e074b765f1d47ee61159ed5291fd
i386/pc: bounds check phys-bits against max used GPA

Calculate max *used* GPA against the CPU maximum possible address
and error out if the former surprasses the latter. This ensures
max used GPA is reacheable by configured phys-bits. Default phys-bits
on Qemu is TCG_PHYS_ADDR_BITS (40) which is enough for the CPU to
address 1Tb (0xff ffff ffff) or 1010G (0xfc ffff ffff) in AMD hosts
with IOMMU.

This is preparation for AMD guests with >1010G, where it will want relocate
ram-above-4g to be after 1Tb instead of 4G.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220719170014.27028-10-joao.m.martins@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/i386/pc.c