mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
x86_64: fix e820 computation
Exclude pci mmio region below 4gb from the e820 table. This is a followup to CL:3696671. BUG=None TEST=arc.Boot.vm Change-Id: I07c2b9a9e2e4e27682c4b60406625b019eea195f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3708390 Reviewed-by: Junichi Uekawa <uekawa@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: David Stevens <stevensd@chromium.org>
This commit is contained in:
parent
89479b41db
commit
a4a46df15e
1 changed files with 9 additions and 5 deletions
|
@ -369,13 +369,17 @@ fn configure_system(
|
|||
E820Type::Ram,
|
||||
)?;
|
||||
|
||||
let ram_region = AddressRange {
|
||||
// GuestMemory::end_addr() returns the first address past the end, so subtract 1 to get the
|
||||
// inclusive end.
|
||||
let guest_mem_end = guest_mem.end_addr().offset() - 1;
|
||||
let ram_below_4g = AddressRange {
|
||||
start: kernel_addr.offset(),
|
||||
// GuestMemory::end_addr() returns the first address past the end, so subtract 1 to get the
|
||||
// inclusive end.
|
||||
end: guest_mem.end_addr().offset() - 1,
|
||||
end: guest_mem_end.min(read_pci_mmio_before_32bit().start - 1),
|
||||
};
|
||||
let ram_above_4g = AddressRange {
|
||||
start: FIRST_ADDR_PAST_32BITS,
|
||||
end: guest_mem_end,
|
||||
};
|
||||
let (ram_below_4g, ram_above_4g) = ram_region.split_at(FIRST_ADDR_PAST_32BITS);
|
||||
add_e820_entry(&mut params, ram_below_4g, E820Type::Ram)?;
|
||||
if !ram_above_4g.is_empty() {
|
||||
add_e820_entry(&mut params, ram_above_4g, E820Type::Ram)?
|
||||
|
|
Loading…
Reference in a new issue