mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-10-23 20:59:45 +00:00
Allocate pVM firmware memory consistently.
Allocate the same way as the rest of RAM, whether in unprotected-with-firmware mode or actually protected mode. TEST=tools/dev_container tools/run_tests --target=vm:aarch64 Change-Id: Ic0ebc0d90e91bd450af55f3252039ddab8d26443 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3827215 Commit-Queue: Andrew Walbran <qwandor@google.com> Tested-by: Andrew Walbran <qwandor@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
3fcf6e68eb
commit
379dd2dfec
2 changed files with 5 additions and 6 deletions
|
@ -251,7 +251,10 @@ impl arch::LinuxArch for AArch64 {
|
|||
vec![(GuestAddress(AARCH64_PHYS_MEM_START), components.memory_size)];
|
||||
|
||||
// Allocate memory for the pVM firmware.
|
||||
if components.protected_vm == ProtectionType::UnprotectedWithFirmware {
|
||||
if matches!(
|
||||
components.protected_vm,
|
||||
ProtectionType::Protected | ProtectionType::UnprotectedWithFirmware
|
||||
) {
|
||||
memory_regions.push((
|
||||
GuestAddress(AARCH64_PROTECTED_VM_FW_START),
|
||||
AARCH64_PROTECTED_VM_FW_MAX_SIZE,
|
||||
|
@ -373,7 +376,7 @@ impl arch::LinuxArch for AArch64 {
|
|||
|
||||
match components.protected_vm {
|
||||
ProtectionType::Protected => {
|
||||
// Allocate memory for the pVM firmware and tell the hypervisor to load it.
|
||||
// Tell the hypervisor to load the pVM firmware.
|
||||
vm.load_protected_vm_firmware(
|
||||
GuestAddress(AARCH64_PROTECTED_VM_FW_START),
|
||||
AARCH64_PROTECTED_VM_FW_MAX_SIZE,
|
||||
|
|
|
@ -197,10 +197,6 @@ impl VmAArch64 for KvmVm {
|
|||
if info.firmware_size > fw_max_size {
|
||||
return Err(Error::new(ENOMEM));
|
||||
}
|
||||
let mem = MemoryMappingBuilder::new(info.firmware_size as usize)
|
||||
.build()
|
||||
.map_err(|_| Error::new(EINVAL))?;
|
||||
self.add_memory_region(fw_addr, Box::new(mem), false, false)?;
|
||||
self.set_protected_vm_firmware_ipa(fw_addr)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue