mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-01-12 16:45:31 +00:00
x86_64: Don't allocate addrs in the 32 bit gap
Device allocations have to skip the gap so they don't collide with things like the APIC. BUG=863490 TEST=Resize a gedit window on APL for a minute and make sure there isn't a crash. Change-Id: Ia8185bcdbb6c18e13d02be317ae4d48c73288661 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1168400 Reviewed-by: Sonny Rao <sonnyrao@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
ebd56813e1
commit
2dd78797d7
1 changed files with 3 additions and 2 deletions
|
@ -305,10 +305,11 @@ impl arch::LinuxArch for X8664arch {
|
|||
///
|
||||
/// * `mem_size` - the size in bytes of physical ram for the guest
|
||||
fn get_base_dev_pfn(mem_size: u64) -> u64 {
|
||||
// Put device memory at nearest 2MB boundary after physical memory
|
||||
// Put device memory at a 2MB boundary after physical memory or 4gb, whichever is greater.
|
||||
const MB: u64 = 1024 * 1024;
|
||||
const GB: u64 = 1024 * MB;
|
||||
let mem_size_round_2mb = (mem_size + 2*MB - 1) / (2*MB) * (2*MB);
|
||||
mem_size_round_2mb / sys_util::pagesize() as u64
|
||||
std::cmp::max(mem_size_round_2mb, 4 * GB) / sys_util::pagesize() as u64
|
||||
}
|
||||
|
||||
/// This returns a minimal kernel command for this architecture
|
||||
|
|
Loading…
Reference in a new issue