1[package] 2name = "crosvm" 3version = "0.1.0" 4authors = ["The ChromiumOS Authors"] 5edition = "2021" 6default-run = "crosvm" 7 8[[bin]] 9name = "crosvm" 10path = "src/main.rs" 11 12[profile.release] 13panic = 'abort' 14opt-level = 3 15overflow-checks = true 16 17[profile.release-test] 18inherits = 'release' 19panic = 'unwind' 20 21# Reproduces the options used when building crosvm for ChromeOS. 22[profile.chromeos] 23inherits = "release" 24strip = "symbols" 25 26# Enables LTO to further reduce the size of the binary. 27[profile.lto] 28inherits = "chromeos" 29lto = true 30 31# Set codegen units to 1 to further reduce binary size. 32[profile.largecodegen] 33inherits = "lto" 34codegen-units = 1 35 36[workspace] 37# Explicitly list all crates of crosvm as workspace members since not all of them may be referenced 38# by dependencies. 39members = [ 40 "aarch64", 41 "acpi_tables", 42 "android_audio", 43 "arch", 44 "argh_helpers", 45 "audio_util", 46 "audio_streams_conformance_test", 47 "base", 48 "bit_field", 49 "broker_ipc", 50 "common/audio_streams", 51 "common/balloon_control", 52 "common/data_model", 53 "common/sync", 54 "cros_async", 55 "cros_fdt", 56 "cros_tracing", 57 "crosvm_cli", 58 "crosvm_control", 59 "crosvm_plugin", 60 "devices", 61 "disk", 62 "e2e_tests", 63 "fuse", 64 "fuzz", 65 "gpu_display", 66 "hypervisor", 67 "io_uring", 68 "kernel_cmdline", 69 "kernel_loader", 70 "kvm_sys", 71 "kvm", 72 "libcras_stub", 73 "linux_input_sys", 74 "media/ffmpeg", 75 "metrics", 76 "metrics_events", 77 "net_sys", 78 "net_util", 79 "power_monitor", 80 "prebuilts", 81 "protos", 82 "proto_build_tools", 83 "resources", 84 "rutabaga_gfx", 85 "serde_keyvalue", 86 "swap", 87 "system_api", 88 "third_party/vmm_vhost", 89 "tools/impl/catapult_converter", 90 "usb_sys", 91 "usb_util", 92 "vendor/generic/anti_tamper", 93 "vendor/generic/crash_report", 94 "vendor/generic/crypto", 95 "vfio_sys", 96 "vhost", 97 "virtio_sys", 98 "vm_control", 99 "vm_memory", 100 "x86_64", 101] 102 103# Exclude crates from crosvm builds completely. Avoid using this if possible as crates added here 104# will not be tested in CI and may break at any time. 105exclude = [ 106 "sandbox", 107 "tools/audio_streams_conformance_test", 108 "tools/examples/baremetal", 109 "perfetto", 110 111 # This crate depends on optional features and is compiled via dependencies when enabled. 112 "media/libvda", 113] 114 115[features] 116## Default features of crosvm. This selection is somewhat arbitrary for historical reasons. 117default = ["audio", "balloon", "config-file", "document-features", "gpu", "qcow", "usb", "libvda-stub", "net", "slirp"] 118 119## Enables support for the Android [sparse image format](https://android.googlesource.com/platform/system/core/+/HEAD/libsparse/sparse_format.h) 120## in the block device. 121android-sparse = ["disk/android-sparse"] 122 123## Enables cross-platform audio devices 124audio = ["devices/audio"] 125 126## Enables the virtio-balloon device which allows dynamic scaling of memory via `vm_control` 127## commands. See [Balloon Device](https://crosvm.dev/book/devices/balloon.html) for more 128## information. 129balloon = ["devices/balloon", "vm_control/balloon"] 130 131## Enables the composite-disk format, which adds protobufs as a dependency of the build. This format 132## is intended to speed up crosvm's usage in CI environments that might otherwise have to 133## concatenate large file system images into a single disk image. 134composite-disk = ["protos/composite-disk", "protobuf", "disk/composite-disk"] 135 136## Enables support for JSON configuration files that can be specified using `--cfg`. See 137## [Configuration Files](https://crosvm.dev/book/running_crosvm/options.html#configuration-files) 138## for more information. 139config-file = [] 140 141## Enables using gdb to debug the guest kernel. See 142## [GDB Support](https://crosvm.dev/book/running_crosvm/advanced_usage.html#gdb-support) for more 143## information. 144gdb = [ 145 "aarch64/gdb", 146 "arch/gdb", 147 "gdbstub", 148 "gdbstub_arch", 149 "riscv64/gdb", 150 "vm_control/gdb", 151 "x86_64/gdb", 152] 153 154## Enables virtio-net and vhost-user-net backend. 155net = ["devices/net"] 156 157## Enables PCI hotplug. Only available on Linux, and currently only for x86/x86-64. 158pci-hotplug = ["devices/pci-hotplug", "vm_control/pci-hotplug"] 159 160## Enables virtio-pvclock. Only available on Linux, and currently only for x86/x86-64. 161pvclock = ["devices/pvclock"] 162 163## Enables the use of the qcow format for block devices. 164qcow = ["disk/qcow"] 165 166## Enables the registered_events mechanisms. 167registered_events = ["protos/registered_events", "protobuf", "base/proto_tube", "vm_control/registered_events", "devices/registered_events"] 168 169## Enables vmm-swap of guest memory. This is only available on Linux. 170swap = ["aarch64/swap", "arch/swap", "devices/swap", "vm_control/swap", "x86_64/swap", "swap/enable"] 171 172## Enables collection of VM statistics. 173stats = ["devices/stats"] 174 175## Supports tokio as an asynchronous executor. 176tokio = ["cros_async/tokio"] 177 178## Enables USB host device passthrough via an emulated XHCI controller. 179## USB is supported only on unix/linux. The feature is a no-op on windows. 180usb = ["devices/usb"] 181 182## Enables the non-upstream virtio wayland protocol. This can be used in conjuction with the gpu 183## feature to enable a zero-copy display pipeline. 184wl-dmabuf = ["devices/minigbm"] 185 186## Enables the usage of the X11 protocol for display on the host. 187x = ["devices/x"] 188 189#! ### Graphics features 190 191## Enables basic virtio-gpu support. This includes basic display and input features, but lacks 3D 192## acceleration in the absence of other crosvm features. 193gpu = ["devices/gpu", "gpu_display", "vm_control/gpu"] 194 195## Enables 3D acceleration for guest via the gfxstream protocol over virtio-gpu. This is used for 196## compatibility with the Android Emulator. The protocol provides the best speed and compatibility 197## with GL/vulkan versions by forwarding the guest's calls to the host's graphics libraries and GPU. 198## However, this means the sandbox is not enabled for the virtio-gpu device. 199gfxstream = ["devices/gfxstream"] 200 201## Adds a stub implementation of gfxstream to allow us to compile the gfxstream feature without 202## access to the gfxstream library. 203## Note that this feature only allows compilation of gfxstream and will not be functional at 204## runtime. 205gfxstream_stub = ["rutabaga_gfx/gfxstream_stub"] 206 207## Enables 3D acceleration for the guest via the virglrenderer library over virtio-gpu. 208virgl_renderer = ["devices/virgl_renderer"] 209 210## Enables the usage of Vulkan for display on the host. 211vulkan_display = ["gpu_display/vulkan_display"] 212 213# Enables the highly experimental vulkan graphics buffer allocator. 214# see rutabaga_gfx/Cargo.toml for instructions on building with enabled. 215vulkano = ["rutabaga_gfx/vulkano"] 216 217# Enables the GPU display backend for Android. The backend uses Android surface as the backing 218# store. 219android_display = ["devices/android_display"] 220 221# Stub implementation of the Android display backend. This is only used for building and testing the 222# Android display backend on a non-Android target 223android_display_stub = ["devices/android_display_stub"] 224 225#! ### Video features 226#! 227#! See [Video Device](https://crosvm.dev/book/devices/video.html) for more information. 228 229## Enables the video decoding device 230video-decoder = ["devices/video-decoder"] 231 232## Enables the video encoding device 233video-encoder = ["devices/video-encoder"] 234 235## Enables the ffmpeg backend of video devices. 236ffmpeg = ["devices/ffmpeg"] 237 238# Enables the VAAPI backend of video devices. 239vaapi = ["devices/vaapi"] 240 241#! ### Linux-specific feature flags 242 243## Enables the use of the GenieZone hypervisor 244geniezone = ["devices/geniezone", "hypervisor/geniezone"] 245 246## Enables the use of the Gunyah hypervisor 247gunyah = ["devices/gunyah", "hypervisor/gunyah"] 248 249## Enables the Linux trace_marker backend for cros_tracing. This backend is only 250## supported on Linux systems. It sends all cros_tracing tracepoints to the tracefs 251## filesystem if mounted, for easier debugging with tools like trace-cmd. 252trace_marker = ["cros_tracing/trace_marker"] 253 254## Facilitate tracing all syscalls by sandboxed processes. 255seccomp_trace = ["jail/seccomp_trace","base/seccomp_trace","devices/seccomp_trace"] 256 257## Enables virtio-gpu devices to request a non-coherent memory mapping from the 258## hypervisor. Currently only supported in KVM on x86 and requires kernel 259## patches from: 260## <https://lore.kernel.org/all/20240105091535.24760-1-yan.y.zhao@intel.com/> 261noncoherent-dma = ["devices/noncoherent-dma", "hypervisor/noncoherent-dma"] 262 263#! ### Windows-specific feature flags 264#! 265#! These feature flags are only available on Windows builds of crosvm. 266 267## Enables the use of the HAXM hypervisor 268haxm = ["hypervisor/haxm"] 269 270## Enables the use of the WHPX hypervisor 271whpx = ["devices/whpx", "hypervisor/whpx"] 272 273## Enables a libslirp based network device. Currently only supported on Windows. 274slirp = ["devices/slirp", "net_util/slirp"] 275 276#! ### Non-additive feature flags 277#! 278#! These feature flags change the behavior of crosvm instead of adding functionality. 279#! This is deprecated and will be phased out. 280 281## Run crosvm with `--disable-sandbox` by default. 282default-no-sandbox = [] 283 284#! ### Project specific features 285#! 286#! These features are specific to downstream projects and may not be functional or useful 287#! for standard linux builds of crosvm. 288#! They are however enabled in upstream builds for compile and test coverage in CI. 289 290#! #### ChromeOS 291#! 292#! These features will only be functional in ChromeOS builds running on ChromeOS. 293 294## Enables virtio-fs quota reporting for ARCVM. Requires access to the 295## org.chromium.ArcQuota dbus service. 296arc_quota = ["devices/arc_quota"] 297 298## Enables use of Android AAudio virtio-snd backend. 299audio_aaudio = ["devices/audio_aaudio"] 300 301## Stub implementation of Android AAudio NDK library. This is only used for building and testing the 302## Android audio on a non-Android target 303libaaudio_stub = ["android_audio/libaaudio_stub"] 304 305## Enables use of the ChromeOS audio server. ChromeOS builds will replace libcras_stub with an 306## implementation that talks to the audio server. In upstream builds, using this option will panic. 307audio_cras = ["devices/audio_cras"] 308 309## Enables the VDA backend of the video devices. This feature requires the ChromeOS only 310## libvda library and can be compiled but not linked. See b/244619291. 311libvda = ["devices/libvda"] 312 313## Builds the VDA video backend with a set of no-ops stubs instead of linking with libvda, which is 314## only available on ChromeOS. 315libvda-stub = ["devices/libvda-stub"] 316 317## Enables the crosvm plugin API where functionality is provided via a FFI plugin API. 318## This feature is used to integrate Parallels with crosvm and is not functional upstream. 319plugin = ["protos/plugin", "crosvm_plugin", "kvm", "kvm_sys", "protobuf"] 320 321## Enables battery reporting via the ChromeOS powerd. Requires access to the 322## `org.chromium.PowerManager` dbus service. 323power-monitor-powerd = ["arch/power-monitor-powerd"] 324 325## Enables a virtualized TPM device that uses the `org.chromium.Vtpm` dbus service. 326vtpm = ["devices/vtpm"] 327 328#! #### Windows-future 329#! 330#! These features will only be functional in future builds of windows crosvm. 331 332## Enables reporting of crosvm crashes 333crash-report = ["broker_ipc/crash-report", "crash_report"] 334 335#! ### Platform Feature Sets 336#! 337#! These feature flags enable all features that are supported for a given platform. 338#! Note that these may include project specific features that will not be functional at runtime but 339#! are enabled for compile and test coverage. 340 341## All features that are compiled and tested for aarch64 and x86_64 342all-default = [ 343 "android-sparse", 344 "arc_quota", 345 "audio_cras", 346 "composite-disk", 347 "crash-report", 348 "default", 349 "ffmpeg", 350 "gdb", 351 "geniezone", 352 "gfxstream", 353 "gfxstream_stub", 354 "libvda-stub", 355 "net", 356 "noncoherent-dma", 357 "pci-hotplug", 358 "power-monitor-powerd", 359 "registered_events", 360 "slirp", 361 "swap", 362 "tokio", 363 "trace_marker", 364 "vaapi", 365 "video-decoder", 366 "video-encoder", 367 "virgl_renderer", 368 "vtpm", 369 "wl-dmabuf", 370 "x", 371] 372 373## All features that are compiled and tested for aarch64 374all-aarch64 = [ 375 "audio_aaudio", 376 "all-default", 377 "android_display", 378 "android_display_stub", 379 "gunyah", 380 "libaaudio_stub", 381] 382 383## All features that are compiled and tested for riscv64 384all-riscv64 = [ 385 "gdb", 386] 387 388## All features that are compiled and tested for x86_64 389all-x86_64 = [ 390 "audio_aaudio", 391 "all-default", 392 "android_display", 393 "android_display_stub", 394 "libaaudio_stub", 395 "plugin", 396 "pvclock", 397 "scudo" 398] 399 400## All features that are compiled and tested for armhf 401## Note: This platform is deprecated and will be phased out. 402all-armhf = [ 403 "android-sparse", 404 "composite-disk", 405 "default", 406 "gdb", 407 "libvda-stub", 408 "net", 409] 410 411## All features that are compiled and tested for mingw64 412all-mingw64 = [ 413 "android-sparse", 414 "audio", 415 "balloon", 416 "crash_report", 417 "gpu", 418 "haxm", 419 "net", 420 "slirp", 421 "stats", 422 "vulkan_display", 423] 424 425## All features that are compiled and tested for msvc64 426all-msvc64 = [ "all-mingw64" ] 427 428[dependencies] 429anyhow = "1.0.32" 430arch = { path = "arch" } 431argh = "0.1.10" 432argh_helpers = { path = "argh_helpers" } 433audio_streams = "*" 434base = "*" 435bit_field = { path = "bit_field" } 436broker_ipc = { path = "broker_ipc" } 437cfg-if = "1.0.0" 438crash_report = { path = "vendor/generic/crash_report", optional = true } 439cros_async = { path = "cros_async" } 440cros_tracing = { path = "cros_tracing" } 441crosvm_cli = { path = "crosvm_cli" } 442crosvm_plugin = { path = "crosvm_plugin", optional = true } 443devices = { path = "devices" } 444disk = { path = "disk" } 445document-features = { version = "0.2", optional = true } 446enumn = "0.1.0" 447gdbstub = { version = "0.7.0", optional = true } 448gdbstub_arch = { version = "0.3.0", optional = true } 449rutabaga_gfx = { path = "rutabaga_gfx"} 450hypervisor = { path = "hypervisor" } 451jail = { path = "jail" } 452kernel_cmdline = { path = "kernel_cmdline" } 453kernel_loader = { path = "kernel_loader" } 454kvm = { path = "kvm", optional = true } 455kvm_sys = { path = "kvm_sys", optional = true } 456libc = "0.2.93" 457libcras = "*" 458# Compile out trace statements in release builds 459log = { version = "0", features = ["release_max_level_debug"]} 460merge = "0.1.0" 461metrics = { path = "metrics" } 462net_util = { path = "net_util" } 463once_cell = "1.7" 464protobuf = { version = "3.2", optional = true } 465protos = { path = "protos", optional = true } 466remain = "*" 467resources = { path = "resources" } 468scudo = { version = "0.1", optional = true } 469serde = { version = "*", features = ["rc"] } 470serde_json = "*" 471serde_keyvalue = { path = "serde_keyvalue", features = ["argh_derive"] } 472smallvec = "1.6.1" 473static_assertions = "1.1" 474swap = { path = "swap" } 475sync = { path = "common/sync" } 476tempfile = "3" 477thiserror = { version = "1.0.20" } 478vm_control = { path = "vm_control" } 479acpi_tables = { path = "acpi_tables" } 480vm_memory = { path = "vm_memory" } 481uuid = { version = "1", features = ["v4"] } 482zerocopy = { version = "0.7", features = ["derive"] } 483 484[target.'cfg(target_arch = "riscv64")'.dependencies] 485riscv64 = { path = "riscv64" } 486 487[target.'cfg(target_arch = "x86_64")'.dependencies] 488x86_64 = { path = "x86_64" } 489 490[target.'cfg(any(target_arch = "aarch64", target_arch = "arm"))'.dependencies] 491aarch64 = { path = "aarch64" } 492 493[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies] 494minijail = "*" # provided by ebuild 495p9 = "0.2.3" 496vhost = { path = "vhost" } 497android_audio = { path = "android_audio"} 498 499[target.'cfg(windows)'.dependencies] 500anti_tamper = { path = "vendor/generic/anti_tamper" } 501cros_async = { path = "cros_async" } 502ctrlc = "*" 503futures = "0.3" 504gpu_display = { path = "gpu_display", optional = true } 505rand = "0.8" 506sandbox = { path = "sandbox" } 507cros_tracing = { path = "cros_tracing" } 508tube_transporter = { path = "tube_transporter" } 509winapi = "*" 510win_audio = { path = "win_audio" } 511win_util = { path = "win_util" } 512 513[dev-dependencies] 514base = "*" 515rand = "0.8" 516 517[patch.crates-io] 518audio_streams = { path = "common/audio_streams" } 519base = { path = "base" } 520cros_async = { path = "cros_async" } 521data_model = { path = "common/data_model" } 522libcras = { path = "libcras_stub" } # ignored by ebuild 523sync = { path = "common/sync" } 524minijail = { path = "third_party/minijail/rust/minijail" } # ignored by ebuild 525