summary refs log tree commit diff
path: root/src/linux.rs
diff options
context:
space:
mode:
authorXiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>2019-10-29 17:32:44 +0800
committerCommit Bot <commit-bot@chromium.org>2019-11-10 06:39:31 +0000
commit87a3b44d9e6caa82ab521a5dd9bafdb56e8b6ed1 (patch)
tree29bc942019a2cdb32d292c4650eccb5cf0deaddf /src/linux.rs
parent279248255f9f65c6baf044f1fbff0011bcd9938a (diff)
downloadcrosvm-87a3b44d9e6caa82ab521a5dd9bafdb56e8b6ed1.tar
crosvm-87a3b44d9e6caa82ab521a5dd9bafdb56e8b6ed1.tar.gz
crosvm-87a3b44d9e6caa82ab521a5dd9bafdb56e8b6ed1.tar.bz2
crosvm-87a3b44d9e6caa82ab521a5dd9bafdb56e8b6ed1.tar.lz
crosvm-87a3b44d9e6caa82ab521a5dd9bafdb56e8b6ed1.tar.xz
crosvm-87a3b44d9e6caa82ab521a5dd9bafdb56e8b6ed1.tar.zst
crosvm-87a3b44d9e6caa82ab521a5dd9bafdb56e8b6ed1.zip
Resource: Unify mmio allocator
Current mmio and device two allocators exist, the purpose to define
two allocator is:
Accessing to gpa from mmio allocator cause vm exit, while gpa from
device allocator doesn't cause vm exit.

Whether vm exits exist or not, dependency on whether
vm->add_device_memory() is called with gpa from allocator or not.Even
if gpa is from mmio alloator, and vm->add_device_memory() is called
with this gpa, accessing this gpa won't cause vm exit. So mmio allocator
and device allocator couldn't guarantee the original purpose.

This patch unify mmio allocator and device allocator into one mmio
allocator.

BUG=chromium:992270
TEST=this patch doesn't change function, so just run build_test

Change-Id: If87d5c2838eb122ef627fa45c394b1b3ccfafeb0
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1895233
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'src/linux.rs')
-rw-r--r--src/linux.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/linux.rs b/src/linux.rs
index 0a3860e..2816d55 100644
--- a/src/linux.rs
+++ b/src/linux.rs
@@ -38,7 +38,7 @@ use msg_socket::{MsgError, MsgReceiver, MsgSender, MsgSocket};
 use net_util::{Error as NetError, MacAddress, Tap};
 use rand_ish::SimpleRng;
 use remain::sorted;
-use resources::{Alloc, SystemAllocator};
+use resources::{Alloc, MmioType, SystemAllocator};
 use sync::{Condvar, Mutex};
 use sys_util::net::{UnixSeqpacket, UnixSeqpacketListener, UnlinkUnixSeqpacketListener};
 
@@ -784,7 +784,7 @@ fn create_pmem_device(
     };
 
     let mapping_address = resources
-        .device_allocator()
+        .mmio_allocator(MmioType::Device)
         .allocate_with_align(
             image_size,
             Alloc::PmemDevice(index),
@@ -1424,7 +1424,7 @@ pub fn run_config(cfg: Config) -> Result<()> {
         // guest address space.
         let gpu_addr = linux
             .resources
-            .device_allocator()
+            .mmio_allocator(MmioType::Device)
             .allocate(
                 RENDER_NODE_HOST_SIZE,
                 Alloc::GpuRenderNode,