crosvm/x86_64
Xiong Zhang fd75d90c76 x86_64: Correct guest ram memory region layout
When guest boot with -m 4096, guest e820 is:
BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
BIOS-e820: [mem 0x0000000000200000-0x00000000cfffffff] usable
so guest usable ram is 3.25G which is smaller than specified 4G.

3.25G~4G is assigned to pci device as mmio, this range should be
relocated to 4G above like 4G to 4.75G. So guest could see the full 4G
usable ram.

With this patch, guest e820 is:
BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
BIOS-e820: [mem 0x0000000000200000-0x00000000cfffffff] usable
BIOS-e820: [mem 0x0000000100000000-0x000000012fffffff] usable
The guest could use 4G ram equal to specified 4G.

Then mmio hole exists in guest ram's regions, GuestMemory's end_addr
is larger than the memsize. end_addr couldn't be used to judge an
address in a guest memory or not We should iterate all the regions
to avoid the address in the hole; end_addr couldn't be used for
checked_offset() also, it may faill into mmio hole.

BUG=none
TEST=build_test; Boot vm with different guest memory size, and check
vm's e820 table

Change-Id: I2cd7c3223173ab635041875b9d8b49c2800c8dab
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1895231
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2019-11-04 10:38:58 +00:00
..
src x86_64: Correct guest ram memory region layout 2019-11-04 10:38:58 +00:00
build.rs edition: Remove extern crate lines 2019-04-15 02:06:08 -07:00
Cargo.toml x86_64: replace byteorder with {to,from}_le_bytes() 2019-08-26 23:41:51 +00:00
host_cpuid.c x86_64: fill cache info in cpuid, stop spoofing CPU vendor id 2018-07-09 12:42:42 -07:00