diff options
author | Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com> | 2019-04-23 17:15:24 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-06 08:47:29 +0000 |
commit | 85abeff27f6256725621c4db749d4401078236d8 (patch) | |
tree | f0e911c1b8dcd3348d1b80ae4f04bf262a6a21b2 /src/linux.rs | |
parent | c0385a09161fc2570354a071af4a945d81528c08 (diff) | |
download | crosvm-85abeff27f6256725621c4db749d4401078236d8.tar crosvm-85abeff27f6256725621c4db749d4401078236d8.tar.gz crosvm-85abeff27f6256725621c4db749d4401078236d8.tar.bz2 crosvm-85abeff27f6256725621c4db749d4401078236d8.tar.lz crosvm-85abeff27f6256725621c4db749d4401078236d8.tar.xz crosvm-85abeff27f6256725621c4db749d4401078236d8.tar.zst crosvm-85abeff27f6256725621c4db749d4401078236d8.zip |
vfio: Implement bar mappable
if device bar is mappable, map bar's gpa to hpa in EPT, guest vcpu could access this bar directly through EPT without trapping. This could improve performance. vm.add_mmio_memory could help do this, here vfio_pci send RegisterMmapMemory request through vm_control socket to do this. BUG=chromium:992270 TEST=none Change-Id: I3b4274372f7dcd32e18084d55f037b6fe45ed422 Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1581147 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'src/linux.rs')
-rw-r--r-- | src/linux.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/linux.rs b/src/linux.rs index 9b984d1..7257520 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -1084,10 +1084,18 @@ fn create_devices( msg_socket::pair::<VmIrqResponse, VmIrqRequest>().map_err(Error::CreateSocket)?; control_sockets.push(TaggedControlSocket::VmIrq(vfio_host_socket_irq)); + let (vfio_host_socket_mem, vfio_device_socket_mem) = + msg_socket::pair::<VmMemoryResponse, VmMemoryRequest>().map_err(Error::CreateSocket)?; + control_sockets.push(TaggedControlSocket::VmMemory(vfio_host_socket_mem)); + let vfio_path = cfg.vfio.as_ref().unwrap().as_path(); let vfiodevice = VfioDevice::new(vfio_path, vm, mem.clone()).map_err(Error::CreateVfioDevice)?; - let vfiopcidevice = Box::new(VfioPciDevice::new(vfiodevice, vfio_device_socket_irq)); + let vfiopcidevice = Box::new(VfioPciDevice::new( + vfiodevice, + vfio_device_socket_irq, + vfio_device_socket_mem, + )); pci_devices.push((vfiopcidevice, simple_jail(&cfg, "vfio_device.policy")?)); } |