mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
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>
This commit is contained in:
parent
bb30b2f7cf
commit
84be74727c
6 changed files with 1 additions and 128 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -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",
|
||||
|
@ -454,13 +453,6 @@ dependencies = [
|
|||
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "render_node_forward"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"sys_util 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "resources"
|
||||
version = "0.1.0"
|
||||
|
|
|
@ -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 = "*"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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" }
|
|
@ -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 }
|
||||
}
|
||||
}
|
46
src/linux.rs
46
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.
|
||||
|
|
Loading…
Reference in a new issue