From 96beafc1c1813b010cbf5964fb9cb27279c50d56 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Wed, 15 May 2019 09:46:52 -0700 Subject: linux.rs: create a socket between gpu device and host The GPU process needs to access KVM from host coherent memory. BUG=chromium:924405 TEST=compile Change-Id: I3db9dce044e2a5cc816f48f28d943024dad7e7eb Reviewed-on: https://chromium-review.googlesource.com/1626792 Commit-Ready: ChromeOS CL Exonerator Bot Tested-by: kokoro Legacy-Commit-Queue: Commit Bot Reviewed-by: Zach Reizner --- src/linux.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/linux.rs') diff --git a/src/linux.rs b/src/linux.rs index 58a0667..b5235d1 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -535,6 +535,7 @@ fn create_net_device( fn create_gpu_device( cfg: &Config, exit_evt: &EventFd, + _gpu_device_socket: VmMemoryControlRequestSocket, gpu_socket: virtio::resource_bridge::ResourceResponseSocket, wayland_socket_path: &Path, ) -> DeviceResult { @@ -693,6 +694,7 @@ fn create_virtio_devices( mem: &GuestMemory, _exit_evt: &EventFd, wayland_device_socket: VmMemoryControlRequestSocket, + gpu_device_socket: VmMemoryControlRequestSocket, balloon_device_socket: BalloonControlResponseSocket, disk_device_sockets: &mut Vec, ) -> DeviceResult> { @@ -759,6 +761,7 @@ fn create_virtio_devices( devs.push(create_gpu_device( cfg, _exit_evt, + gpu_device_socket, gpu_socket, wayland_socket_path, )?); @@ -793,6 +796,7 @@ fn create_devices( mem: &GuestMemory, exit_evt: &EventFd, wayland_device_socket: VmMemoryControlRequestSocket, + gpu_device_socket: VmMemoryControlRequestSocket, balloon_device_socket: BalloonControlResponseSocket, disk_device_sockets: &mut Vec, usb_provider: HostBackendDeviceProvider, @@ -802,6 +806,7 @@ fn create_devices( mem, exit_evt, wayland_device_socket, + gpu_device_socket, balloon_device_socket, disk_device_sockets, )?; @@ -1179,6 +1184,10 @@ pub fn run_config(cfg: Config) -> Result<()> { disk_device_sockets.push(disk_device_socket); } + let (gpu_host_socket, gpu_device_socket) = + msg_socket::pair::().map_err(Error::CreateSocket)?; + control_sockets.push(TaggedControlSocket::VmMemory(gpu_host_socket)); + let sandbox = cfg.sandbox; let linux = Arch::build_vm( components, @@ -1190,6 +1199,7 @@ pub fn run_config(cfg: Config) -> Result<()> { m, e, wayland_device_socket, + gpu_device_socket, balloon_device_socket, &mut disk_device_sockets, usb_provider, -- cgit 1.4.1