mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
windows: add missing balloon and gpu feature checks
Partly fixes the mingw --no-default-features build. The network config code is still broken because net structs are only available when the slirp feature is enabled on Windows, but the uses of the config structs are not protected with the same cfg check. BUG=b:260607247 TEST=cargo build --target x86_64-pc-windows-gnu --no-default-features \ --features=slirp Change-Id: Ia2f6e7baf769245135ef5ff48ee6fb2c4578f319 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4818989 Reviewed-by: Dennis Kempin <denniskempin@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
d56dbed44d
commit
2d5e7d8bef
3 changed files with 22 additions and 12 deletions
|
@ -706,17 +706,18 @@ fn run_internal(mut cfg: Config) -> Result<()> {
|
|||
{
|
||||
let broker_metrics = metrics_tube_pair(&mut metric_tubes)?;
|
||||
metrics::initialize(broker_metrics);
|
||||
let use_vulkan = if cfg!(feature = "gpu") {
|
||||
match &cfg.gpu_parameters {
|
||||
Some(params) => Some(params.use_vulkan),
|
||||
None => {
|
||||
warn!("No GPU parameters set on crosvm config.");
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(feature = "gpu")]
|
||||
let use_vulkan = match &cfg.gpu_parameters {
|
||||
Some(params) => Some(params.use_vulkan),
|
||||
None => {
|
||||
warn!("No GPU parameters set on crosvm config.");
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
#[cfg(not(feature = "gpu"))]
|
||||
let use_vulkan = None;
|
||||
|
||||
anti_tamper::setup_common_metric_invariants(
|
||||
&cfg.product_version,
|
||||
&cfg.product_channel,
|
||||
|
|
|
@ -21,7 +21,6 @@ use std::arch::x86_64::__cpuid;
|
|||
#[cfg(feature = "whpx")]
|
||||
use std::arch::x86_64::__cpuid_count;
|
||||
use std::cmp::Reverse;
|
||||
#[cfg(feature = "gpu")]
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
|
@ -104,6 +103,7 @@ use devices::virtio::vhost::user::device::gpu::sys::windows::GpuVmmConfig;
|
|||
use devices::virtio::vhost::user::gpu::sys::windows::product::GpuBackendConfig as GpuBackendConfigProduct;
|
||||
#[cfg(feature = "audio")]
|
||||
use devices::virtio::vhost::user::snd::sys::windows::product::SndBackendConfig as SndBackendConfigProduct;
|
||||
#[cfg(feature = "balloon")]
|
||||
use devices::virtio::BalloonFeatures;
|
||||
#[cfg(feature = "balloon")]
|
||||
use devices::virtio::BalloonMode;
|
||||
|
@ -180,6 +180,7 @@ use sync::Mutex;
|
|||
use tube_transporter::TubeToken;
|
||||
use tube_transporter::TubeTransporterReader;
|
||||
use vm_control::api::VmMemoryClient;
|
||||
#[cfg(feature = "balloon")]
|
||||
use vm_control::BalloonControlCommand;
|
||||
#[cfg(feature = "balloon")]
|
||||
use vm_control::BalloonTube;
|
||||
|
@ -586,6 +587,7 @@ fn create_virtio_devices(
|
|||
devs.push(create_vhost_user_net_device(cfg, net_vhost_user_tube)?);
|
||||
}
|
||||
|
||||
#[cfg(feature = "balloon")]
|
||||
if let (Some(balloon_device_tube), Some(dynamic_mapping_device_tube)) =
|
||||
(balloon_device_tube, dynamic_mapping_device_tube)
|
||||
{
|
||||
|
@ -1001,6 +1003,7 @@ fn handle_readable_event<V: VmArch + 'static, Vcpu: VcpuArch + 'static>(
|
|||
_ => product::handle_received_token(
|
||||
&event.token,
|
||||
anti_tamper_main_thread_tube,
|
||||
#[cfg(feature = "balloon")]
|
||||
balloon_tube,
|
||||
control_tubes,
|
||||
guest_os,
|
||||
|
|
|
@ -22,6 +22,7 @@ use base::WaitContext;
|
|||
use crosvm_cli::sys::windows::exit::Exit;
|
||||
use crosvm_cli::sys::windows::exit::ExitContext;
|
||||
use devices::virtio;
|
||||
#[cfg(feature = "gpu")]
|
||||
use devices::virtio::gpu::EventDevice;
|
||||
#[cfg(feature = "gpu")]
|
||||
use devices::virtio::vhost::user::gpu::sys::windows::product::GpuBackendConfig as GpuBackendConfigProduct;
|
||||
|
@ -35,12 +36,16 @@ use devices::virtio::vhost::user::snd::sys::windows::product::SndBackendConfig a
|
|||
use devices::virtio::vhost::user::snd::sys::windows::product::SndVmmConfig as SndVmmConfigProduct;
|
||||
#[cfg(feature = "audio")]
|
||||
use devices::virtio::vhost::user::snd::sys::windows::SndVmmConfig;
|
||||
#[cfg(feature = "gpu")]
|
||||
use devices::virtio::DisplayBackend;
|
||||
#[cfg(feature = "gpu")]
|
||||
use devices::virtio::Gpu;
|
||||
#[cfg(feature = "gpu")]
|
||||
use devices::virtio::GpuParameters;
|
||||
pub(crate) use metrics::log_descriptor;
|
||||
pub(crate) use metrics::MetricEventType;
|
||||
use sync::Mutex;
|
||||
#[cfg(feature = "balloon")]
|
||||
use vm_control::BalloonTube;
|
||||
use vm_control::PvClockCommand;
|
||||
|
||||
|
@ -165,7 +170,7 @@ pub(super) fn push_triggers<'a>(
|
|||
pub(super) fn handle_received_token<V: VmArch + 'static, Vcpu: VcpuArch + 'static>(
|
||||
token: &Token,
|
||||
_anti_tamper_main_thread_tube: &Option<ProtoTube>,
|
||||
_balloon_tube: Option<&mut BalloonTube>,
|
||||
#[cfg(feature = "balloon")] _balloon_tube: Option<&mut BalloonTube>,
|
||||
_control_tubes: &BTreeMap<usize, SharedTaggedControlTube>,
|
||||
_guest_os: &mut RunnableLinuxVm<V, Vcpu>,
|
||||
_ipc_main_loop_tube: Option<&Tube>,
|
||||
|
@ -191,6 +196,7 @@ pub(super) fn create_service_vm_state(_memory_size_mb: u64) -> ServiceVmState {
|
|||
ServiceVmState {}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gpu")]
|
||||
pub(super) fn create_gpu(
|
||||
vm_evt_wrtube: &SendTube,
|
||||
resource_bridges: Vec<Tube>,
|
||||
|
@ -273,7 +279,7 @@ pub(crate) fn setup_metrics_reporting() -> Result<()> {
|
|||
|
||||
pub(super) fn push_mouse_device(
|
||||
cfg: &Config,
|
||||
_gpu_vmm_config: &mut GpuVmmConfig,
|
||||
#[cfg(feature = "gpu")] _gpu_vmm_config: &mut GpuVmmConfig,
|
||||
_devs: &mut [VirtioDeviceStub],
|
||||
) -> Result<()> {
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue