arch: Add a Reserved memory region to the memory hole

We add a Reserved region type at the end of the memory hole to prevent
32-bit devices allocations to overlap with architectural address ranges
like IOAPIC, TSS or APIC ones.

Eventually we should remove that reserved range by allocating all the
architectural ranges before letting 32-bit devices use the memory hole.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-07-25 11:05:28 +02:00
committed by Rob Bradford
parent 299d887856
commit fa41ddd94f
2 changed files with 28 additions and 36 deletions

View File

@@ -1237,11 +1237,6 @@ impl<'a> Vm<'a> {
.filter(|r| r.2 == RegionType::SubRegion)
.map(|r| (r.0, r.1))
.collect();
let _reserved_regions: Vec<(GuestAddress, usize)> = arch_mem_regions
.iter()
.filter(|r| r.2 == RegionType::Reserved)
.map(|r| (r.0, r.1))
.collect();
// Check the number of reserved regions, and only take the first one
// that's acrtually a 32-bit hole.
@@ -1380,25 +1375,6 @@ impl<'a> Vm<'a> {
.ok_or(Error::MemoryRangeAllocation)?;
}
// Allocate IOAPIC address in the memory hole if necessary.
if IOAPIC_RANGE_ADDR >= mem_hole.0.raw_value() && IOAPIC_RANGE_SIZE < mem_hole.1 as u64 {
allocator
.allocate_mmio_hole_addresses(
Some(GuestAddress(IOAPIC_RANGE_ADDR)),
IOAPIC_RANGE_SIZE as GuestUsize,
None,
)
.ok_or(Error::IoapicRangeAllocation)?;
} else {
allocator
.allocate_mmio_addresses(
Some(GuestAddress(IOAPIC_RANGE_ADDR)),
IOAPIC_RANGE_SIZE as GuestUsize,
None,
)
.ok_or(Error::IoapicRangeAllocation)?;
}
let device_manager = DeviceManager::new(
guest_memory.clone(),
&mut allocator,