summary refs log tree commit diff
diff options
context:
space:
mode:
authorLepton Wu <lepton@chromium.org>2019-12-09 10:19:54 -0800
committerCommit Bot <commit-bot@chromium.org>2019-12-10 19:14:40 +0000
commit84be74727c7510d48d516de89c88374db78e71b3 (patch)
tree8b42a753f1b12b666f62454ec42db12054ace41b
parentbb30b2f7cf2721b32da71adfa7f7482bfce7b915 (diff)
downloadcrosvm-84be74727c7510d48d516de89c88374db78e71b3.tar
crosvm-84be74727c7510d48d516de89c88374db78e71b3.tar.gz
crosvm-84be74727c7510d48d516de89c88374db78e71b3.tar.bz2
crosvm-84be74727c7510d48d516de89c88374db78e71b3.tar.lz
crosvm-84be74727c7510d48d516de89c88374db78e71b3.tar.xz
crosvm-84be74727c7510d48d516de89c88374db78e71b3.tar.zst
crosvm-84be74727c7510d48d516de89c88374db78e71b3.zip
Remove render node forward code
We don't use it for ARCVM now.
BUG=None
TEST=`emerge-eve crosvm`
Change-Id: I14343a2eb24c24a0216950b7c4eeb56ac482973e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1958569
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Lepton Wu <lepton@chromium.org>
Auto-Submit: Lepton Wu <lepton@chromium.org>
-rw-r--r--Cargo.lock8
-rw-r--r--Cargo.toml2
-rwxr-xr-xbin/smoke_test2
-rw-r--r--render_node_forward/Cargo.toml11
-rw-r--r--render_node_forward/lib.rs60
-rw-r--r--src/linux.rs46
6 files changed, 1 insertions, 128 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 2029906..e525db3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -109,7 +109,6 @@ dependencies = [
  "qcow 0.1.0",
  "rand_ish 0.1.0",
  "remain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "render_node_forward 0.1.0",
  "resources 0.1.0",
  "sync 0.1.0",
  "sys_util 0.1.0",
@@ -455,13 +454,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "render_node_forward"
-version = "0.1.0"
-dependencies = [
- "sys_util 0.1.0",
-]
-
-[[package]]
 name = "resources"
 version = "0.1.0"
 dependencies = [
diff --git a/Cargo.toml b/Cargo.toml
index f4ec195..69d1a42 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,7 +30,6 @@ exclude = [
 [features]
 default-no-sandbox = []
 gpu = ["devices/gpu"]
-gpu-forward = ["render_node_forward"]
 plugin = ["protos/plugin", "crosvm_plugin", "protobuf"]
 tpm = ["devices/tpm"]
 wl-dmabuf = ["devices/wl-dmabuf", "gpu_buffer", "resources/wl-dmabuf"]
@@ -65,7 +64,6 @@ protos = { path = "protos", optional = true }
 qcow = { path = "qcow" }
 rand_ish = { path = "rand_ish" }
 remain = "*"
-render_node_forward = { path = "render_node_forward", optional = true }
 resources = { path = "resources" }
 sync = { path = "sync" }
 sys_util = "*"
diff --git a/bin/smoke_test b/bin/smoke_test
index e488e0e..b2d71f3 100755
--- a/bin/smoke_test
+++ b/bin/smoke_test
@@ -12,7 +12,7 @@ rustup default "$(cat rust-toolchain)"
 rustup component add rustfmt-preview
 cargo --version && rustc --version && rustfmt --version
 echo "Running cargo test"
-cargo test --no-fail-fast --features plugin,default-no-sandbox,wl-dmabuf,gpu,tpm,gpu-forward \
+cargo test --no-fail-fast --features plugin,default-no-sandbox,wl-dmabuf,gpu,tpm \
     --all --exclude aarch64 $TEST_FLAGS -- \
     --test-threads=1 $TEST_RUNNER_FLAGS
 echo "Running cargo fmt"
diff --git a/render_node_forward/Cargo.toml b/render_node_forward/Cargo.toml
deleted file mode 100644
index d23b46a..0000000
--- a/render_node_forward/Cargo.toml
+++ /dev/null
@@ -1,11 +0,0 @@
-[package]
-name = "render_node_forward"
-version = "0.1.0"
-authors = ["The Chromium OS Authors"]
-edition = "2018"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-sys_util = { path = "../sys_util" }
diff --git a/render_node_forward/lib.rs b/render_node_forward/lib.rs
deleted file mode 100644
index f96fdd1..0000000
--- a/render_node_forward/lib.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2019 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-use sys_util::{GuestAddress, GuestMemory, MemoryMapping};
-
-#[link(name = "rendernodehost")]
-extern "C" {
-    fn start_render_node_host(
-        gpu_host_mem: *mut u8,
-        gpu_guest_mem_start: u64,
-        gpu_guest_mem_size: u64,
-        host_start: *const u8,
-        host_4g_start: *const u8,
-    );
-}
-
-/// The number of bytes in 4 GiB.
-pub const FOUR_GB: u64 = (1 << 32);
-/// The size required for the render node host in host and guest address space.
-pub const RENDER_NODE_HOST_SIZE: u64 = FOUR_GB;
-
-/// A render node host device that interfaces with the guest render node forwarder.
-pub struct RenderNodeHost {
-    #[allow(dead_code)]
-    guest_mem: GuestMemory,
-}
-
-impl RenderNodeHost {
-    /// Starts the render node host forwarding service over the given guest and host address ranges.
-    pub fn start(
-        mmap: &MemoryMapping,
-        gpu_guest_address: u64,
-        guest_mem: GuestMemory,
-    ) -> RenderNodeHost {
-        // Render node forward library need to do address translation between host user space
-        // address and guest physical address. We could call Rust function from C library. But
-        // since it's actually a linear mapping now, we just pass the host start address to
-        // render node forward library. We need two start address here since there would be a
-        // hole below 4G if guest memory size is bigger than 4G.
-
-        let host_start_addr = guest_mem.get_host_address(GuestAddress(0)).unwrap();
-        let host_4g_addr = if guest_mem.memory_size() > FOUR_GB {
-            guest_mem.get_host_address(GuestAddress(FOUR_GB)).unwrap()
-        } else {
-            host_start_addr
-        };
-        // Safe because only valid addresses are given.
-        unsafe {
-            start_render_node_host(
-                mmap.as_ptr(),
-                gpu_guest_address,
-                mmap.size() as u64,
-                host_start_addr,
-                host_4g_addr,
-            )
-        }
-        RenderNodeHost { guest_mem }
-    }
-}
diff --git a/src/linux.rs b/src/linux.rs
index f692ea0..006af42 100644
--- a/src/linux.rs
+++ b/src/linux.rs
@@ -69,11 +69,6 @@ use aarch64::AArch64 as Arch;
 #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
 use x86_64::X8664arch as Arch;
 
-#[cfg(feature = "gpu-forward")]
-use render_node_forward::*;
-#[cfg(not(feature = "gpu-forward"))]
-type RenderNodeHost = ();
-
 #[sorted]
 #[derive(Debug)]
 pub enum Error {
@@ -1493,45 +1488,6 @@ pub fn run_config(cfg: Config) -> Result<()> {
     )
     .map_err(Error::BuildVm)?;
 
-    let _render_node_host = ();
-    #[cfg(feature = "gpu-forward")]
-    let (_render_node_host, linux) = {
-        // Rebinds linux as mutable.
-        let mut linux = linux;
-
-        // Reserve memory range for GPU buffer allocation in advance to bypass region count
-        // limitation. We use mremap/MAP_FIXED later to make sure GPU buffers fall into this range.
-        let gpu_mmap =
-            MemoryMapping::new_protection(RENDER_NODE_HOST_SIZE as usize, Protection::none())
-                .map_err(Error::ReserveGpuMemory)?;
-
-        // Put the non-accessible memory map into high mmio so that no other devices use that
-        // guest address space.
-        let gpu_addr = linux
-            .resources
-            .mmio_allocator(MmioType::High)
-            .allocate(
-                RENDER_NODE_HOST_SIZE,
-                Alloc::GpuRenderNode,
-                "gpu_render_node".to_string(),
-            )
-            .map_err(|_| Error::AllocateGpuDeviceAddress)?;
-
-        let host = RenderNodeHost::start(&gpu_mmap, gpu_addr, linux.vm.get_memory().clone());
-
-        // Makes the gpu memory accessible at allocated address.
-        linux
-            .vm
-            .add_mmio_memory(
-                GuestAddress(gpu_addr),
-                gpu_mmap,
-                /* read_only = */ false,
-                /* log_dirty_pages = */ false,
-            )
-            .map_err(Error::AddGpuDeviceMemory)?;
-        (host, linux)
-    };
-
     run_control(
         linux,
         control_server_socket,
@@ -1540,7 +1496,6 @@ pub fn run_config(cfg: Config) -> Result<()> {
         &disk_host_sockets,
         usb_control_socket,
         sigchld_fd,
-        _render_node_host,
         sandbox,
     )
 }
@@ -1553,7 +1508,6 @@ fn run_control(
     disk_host_sockets: &[DiskControlRequestSocket],
     usb_control_socket: UsbControlSocket,
     sigchld_fd: SignalFd,
-    _render_node_host: RenderNodeHost,
     sandbox: bool,
 ) -> Result<()> {
     // Paths to get the currently available memory and the low memory threshold.