vmm: Place SGX EPC region between RAM and device area

Increase the start of the device area to accomodate the SGX EPC area.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-10-29 09:56:18 +01:00
parent e20be3e147
commit b8fee11822

View File

@ -1622,15 +1622,12 @@ impl MemoryManager {
epc_region_size += epc_section.size; epc_region_size += epc_section.size;
} }
// Now that we know about the total size for the EPC region, we can // Place the SGX EPC region on a 4k boundary between the RAM and the device area
// proceed with the allocation of the entire range. The EPC region let epc_region_start =
// must be 4kiB aligned. GuestAddress(((self.start_of_device_area.0 + 0xfff) / 0x1000) * 0x1000);
let epc_region_start = self self.start_of_device_area = epc_region_start
.allocator .checked_add(epc_region_size)
.lock() .ok_or(Error::GuestAddressOverFlow)?;
.unwrap()
.allocate_mmio_addresses(None, epc_region_size as GuestUsize, Some(0x1000))
.ok_or(Error::SgxEpcRangeAllocation)?;
let mut sgx_epc_region = SgxEpcRegion::new(epc_region_start, epc_region_size as GuestUsize); let mut sgx_epc_region = SgxEpcRegion::new(epc_region_start, epc_region_size as GuestUsize);