mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
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 <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
53edb817da
commit
96beafc1c1
1 changed files with 10 additions and 0 deletions
10
src/linux.rs
10
src/linux.rs
|
@ -535,6 +535,7 @@ fn create_net_device(
|
||||||
fn create_gpu_device(
|
fn create_gpu_device(
|
||||||
cfg: &Config,
|
cfg: &Config,
|
||||||
exit_evt: &EventFd,
|
exit_evt: &EventFd,
|
||||||
|
_gpu_device_socket: VmMemoryControlRequestSocket,
|
||||||
gpu_socket: virtio::resource_bridge::ResourceResponseSocket,
|
gpu_socket: virtio::resource_bridge::ResourceResponseSocket,
|
||||||
wayland_socket_path: &Path,
|
wayland_socket_path: &Path,
|
||||||
) -> DeviceResult {
|
) -> DeviceResult {
|
||||||
|
@ -693,6 +694,7 @@ fn create_virtio_devices(
|
||||||
mem: &GuestMemory,
|
mem: &GuestMemory,
|
||||||
_exit_evt: &EventFd,
|
_exit_evt: &EventFd,
|
||||||
wayland_device_socket: VmMemoryControlRequestSocket,
|
wayland_device_socket: VmMemoryControlRequestSocket,
|
||||||
|
gpu_device_socket: VmMemoryControlRequestSocket,
|
||||||
balloon_device_socket: BalloonControlResponseSocket,
|
balloon_device_socket: BalloonControlResponseSocket,
|
||||||
disk_device_sockets: &mut Vec<DiskControlResponseSocket>,
|
disk_device_sockets: &mut Vec<DiskControlResponseSocket>,
|
||||||
) -> DeviceResult<Vec<VirtioDeviceStub>> {
|
) -> DeviceResult<Vec<VirtioDeviceStub>> {
|
||||||
|
@ -759,6 +761,7 @@ fn create_virtio_devices(
|
||||||
devs.push(create_gpu_device(
|
devs.push(create_gpu_device(
|
||||||
cfg,
|
cfg,
|
||||||
_exit_evt,
|
_exit_evt,
|
||||||
|
gpu_device_socket,
|
||||||
gpu_socket,
|
gpu_socket,
|
||||||
wayland_socket_path,
|
wayland_socket_path,
|
||||||
)?);
|
)?);
|
||||||
|
@ -793,6 +796,7 @@ fn create_devices(
|
||||||
mem: &GuestMemory,
|
mem: &GuestMemory,
|
||||||
exit_evt: &EventFd,
|
exit_evt: &EventFd,
|
||||||
wayland_device_socket: VmMemoryControlRequestSocket,
|
wayland_device_socket: VmMemoryControlRequestSocket,
|
||||||
|
gpu_device_socket: VmMemoryControlRequestSocket,
|
||||||
balloon_device_socket: BalloonControlResponseSocket,
|
balloon_device_socket: BalloonControlResponseSocket,
|
||||||
disk_device_sockets: &mut Vec<DiskControlResponseSocket>,
|
disk_device_sockets: &mut Vec<DiskControlResponseSocket>,
|
||||||
usb_provider: HostBackendDeviceProvider,
|
usb_provider: HostBackendDeviceProvider,
|
||||||
|
@ -802,6 +806,7 @@ fn create_devices(
|
||||||
mem,
|
mem,
|
||||||
exit_evt,
|
exit_evt,
|
||||||
wayland_device_socket,
|
wayland_device_socket,
|
||||||
|
gpu_device_socket,
|
||||||
balloon_device_socket,
|
balloon_device_socket,
|
||||||
disk_device_sockets,
|
disk_device_sockets,
|
||||||
)?;
|
)?;
|
||||||
|
@ -1179,6 +1184,10 @@ pub fn run_config(cfg: Config) -> Result<()> {
|
||||||
disk_device_sockets.push(disk_device_socket);
|
disk_device_sockets.push(disk_device_socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let (gpu_host_socket, gpu_device_socket) =
|
||||||
|
msg_socket::pair::<VmMemoryResponse, VmMemoryRequest>().map_err(Error::CreateSocket)?;
|
||||||
|
control_sockets.push(TaggedControlSocket::VmMemory(gpu_host_socket));
|
||||||
|
|
||||||
let sandbox = cfg.sandbox;
|
let sandbox = cfg.sandbox;
|
||||||
let linux = Arch::build_vm(
|
let linux = Arch::build_vm(
|
||||||
components,
|
components,
|
||||||
|
@ -1190,6 +1199,7 @@ pub fn run_config(cfg: Config) -> Result<()> {
|
||||||
m,
|
m,
|
||||||
e,
|
e,
|
||||||
wayland_device_socket,
|
wayland_device_socket,
|
||||||
|
gpu_device_socket,
|
||||||
balloon_device_socket,
|
balloon_device_socket,
|
||||||
&mut disk_device_sockets,
|
&mut disk_device_sockets,
|
||||||
usb_provider,
|
usb_provider,
|
||||||
|
|
Loading…
Reference in a new issue