BUG=b:257124165
TEST=build with virgl_renderer but without virgl_renderer_next
Change-Id: I8dda5ad35619920fa0414e6aa6f7d217de8e7a09
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3999177
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Update mentions to the deprecated `--disk`, `--rwdisk`, `--root`,
`--rwroot` to use the new `--disk`, and to the obsolete network
parameters to use the new `--net` argument.
BUG=b:218223240
BUG=b:246224081
TEST=`mdbook build` in `docs/book` passes.
Change-Id: I942a9e03980a3477d4b87332f5b4cfdfebba814f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3996046
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
For linux based systems, clippy continues to run in health_check
BUG=b:257249038
TEST=CQ
Change-Id: I39d3d45a0db72c61e79fd2c51b195b82c067a244
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3993934
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Currently an error message while parsing arguments goes to only stderr.
It's useful to send it to both syslog and stderr via error! so that
it's evident via crosvm failed (if syslog is present).
BUG=b:251305451
TEST=Send rubbish arguments to crosvm and observe stdout.
Change-Id: Iccbd0a637391f72ddadae447019cf6957635a63b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4000482
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Abhishek Bhardwaj <abhishekbh@chromium.org>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
Since we will be allowing for multiple audio streams soon (1 playback and 1 capture), we will need a unique completion event name for each stream. Otherwise, if multiple streams are created around the same time, they would be listening for the same event, which would result in bugs where some streams would be notified when they shouldn't have.
This also prepares us for having >1 playback and >1 capture streams as well, if we ever want to have that.
Bug: 253509368
Test: ran emulator and verified sound still works
Change-Id: Id53a4c233579c0ffba750b6663111e6c02f02dfd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3997600
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
The future DeviceCapturer object will use a lot of the functionality for DeviceRenderer. This CL will refactor these methods so that they can be shareable.
TEST=In downstream branch, ran emulator, verified sound still works
BUG=b:253509368
Change-Id: I468eafeab0a9741332a360638b267366c06fe944
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3994883
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
In non-privileged containers, comparing a file descriptor may not
work. So the test will not work in every runtime environment.
BUG=b:244623061
TEST=dev_container --podman --unprivileged tools/run_tests base:base
Change-Id: Ifa67e11db9694c36b47cd5ae88de9247284e1cdf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3999711
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Use the off64_t versions of libc file functions.
There is no Rust libc crate equivalent of the C _FILE_OFFSET_BITS and
related defines, so we have to use the Linux-specific *64 variants
explicitly.
This extends the size of file offsets to 64 bits instead of 32 on
platforms with 32-bit userspace.
(It also fixes the recently introduced check for non-LFS functions in
ChromeOS - see b/201531268 for details.)
BUG=b:201531268
TEST=emerge-kevin crosvm
TEST=start Crostini on kevin
Change-Id: Ife42917c8896d4fa1ccd78051c2a0b7dd565b2b3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3979975
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The most notable changes are:
* Playback Async support
* Audio Client flags to hide app from SndVol when audio session has
expired
* Updates to audio_streams and cros_async crates for playback async
support
BUG=b:256655413
TEST=Verified to work downstream
Change-Id: Ifbe9a15791feaa41d6e1d5eaf2c5824b2c7c25b8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3994882
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
The seccomp policy files are no longer needed at runtime since they are
embedded in the crosvm binary.
BUG=b:235858187
TEST=mdbook build docs/book
Change-Id: Ib8220bce01a21bd3b4a1ef749468e12b18377a62
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3999176
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Now that seccomp policies are always embedded in the crosvm binary, the
default /usr/share/policy/crosvm path that was used when embedded
policies were not present can be removed.
BUG=b:235858187
TEST=tools/presubmit --all
TEST=emerge-kevin crosvm
Change-Id: I10f3380297e2629f404db8a264c82e2c6c844316
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3999175
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
--try: set CQ+1
--autosubmit: Set Auto-Submit and CQ+1
--submit: set CQ+2
--reviewer: Set a username as reviewer
BUG=None
TEST=This CL was uploaded with:
tools/cl upload --autosubmit -r dverkamp
Change-Id: I1ec9834d2f5d365eaa500e8e5915c77a4f066c6b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3997873
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
If a copy of the compile_seccomp_policy program that is used to generate
BPF versions of the seccomp policies is available in the $PATH, use it
in preference to the one in the submodule.
This makes the ChromeOS ebuild able to embed seccomp policies, since it
has compile_secomp_policy installed as part of the cros_sdk, so the
special case for CROSVM_BUILD_VARIANT is removed.
BUG=b:235858187
TEST=emerge-kevin crosvm # with submodules deinitialized
Change-Id: I30f23a507ee444bc3fe5d78af394fbe651191be0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3998113
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The code from configure_vcpu_early() is split into two parts:
1. vcpu_features() returns the `VcpuFeature`s required for vcpu.init()
2. vcpu_init() returns the general register state
This makes use of the new generic vcpu_init code path and moves the
general purpose register initialization into configure_vcpu() rather
than the ARM-specific confgiure_vcpu_early() to be consistent with other
architectures. Only the vcpu.init() call needs to happen before irqchip
is finalized on ARM, not other register setup.
BUG=b:237095693
TEST=tools/presubmit --all
TEST=Boot Crostini on trogdor
Change-Id: Ib3eab946ba9f1e407f339c2119d36d280655066f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3786979
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
A search/replace broke the toml file. Fuzz builds are currently
not included in upstream builds.
BUG=None
TEST= USE=fuzzer emerge-amd64-generic dev-rust/p9
Change-Id: I9a42d8a18bc60d137f50fb44581e2e47db259f87
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3999265
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
tmux can be used to run presubmit checks in parallel:
$ tools/presubmit --tmux
And mold is a faster linker that will be used for experiments.
BUG=None
TEST=None
Change-Id: Ie332d7285aa94d9072e201a3cac825337ae825cb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3997872
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
ChromeOS binaries are stripped, so let's reflect this on the equivalent
profile.
BUG=None
TEST=`cargo build --profile chromeos` yields a stripped binary.
Change-Id: I0491e422f1ea6121aaeb6d08edaf9a9e42a9ee14
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3995886
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The constants.json file is generated for compiling seccomp polices,
but is only ever added to in newer versions of linux.
Generating them in build.rs will cause the seccomp compiler to only
understand constants and syscalls available on the build machine
and fail if policy files try to allow syscalls not available.
Putting the constants in version control will allow us to compile
the policies regardless of how old the kernel headers on the build
machine are.
BUG=b:235858187
TEST=presubmit
Change-Id: I1cfbb38f4687eb68b141f62c1c5fe6104b3f6456
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3988899
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
This will allow them to be build via
cargo build --bin simple
cargo build --bin simple_open
It will also include them in CI builds to ensure the
code will not rot.
BUG=None
TEST=CQ
Change-Id: Id6e73f3d5535141f5b1df0edc07c0f84cd03305b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3997601
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Refactor the Windows PlatformEvent wait and wait_timeout functions to
use an internal wrapper function that correctly handles waiting forever
by passing the INFINITE value to WaitForSingleObject.
Previously, the wait function used a Duration value of i64::MAX seconds,
which becomes 0xfffffc18 when converted to milliseconds and truncated to
a DWORD. This does not correspond to the INFINITE value (-1, 0xffffffff)
that the Win32 Wait* functions expect, so theoretically a wait() call
could have returned without the event being signaled.
BUG=b:231344063
TEST=tools/presubmit --all
Change-Id: If68c4b2518926c12e8caf6746ef4b0bb152be00d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966485
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
We should use the public Event API wherever possible, even within the
base crate.
BUG=b:231344063
TEST=tools/presubmit --all
Change-Id: Ie4c8b2b82cf16299666998acb7b9b174c2bedc3b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966484
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Use the cross-platform AsRawDescriptor rather than the unix-specific
AsRawFd. FileFlags and PlatformEvent are migrated simultaneously since
the FileFlags unit tests use PlatformEvent.
BUG=b:231344063
TEST=tools/presubmit --all
TEST=cargo test -p base -- --test-threads=1
Change-Id: I3653f7d50524bf459c6fb944b00dce90e9d4e659
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966483
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Adding a block device is a very common operation, and some of the
deprecated disk options already had shortcuts, so assign one to it.
BUG=None
TEST=Substitute `--block` with `-b` on a command-line invocation, block
device is visible in the guest.
Change-Id: I87303957fbf359e6d2e760bccdee68f2ddccc586
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3996047
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Use backticks around comments that use array syntax with [] to avoid
interpreting those as Markdown links.
Additionally, convert a few file headers to //! so they show up in the
generated docs.
BUG=None
TEST=tools/cargo-doc
Change-Id: I34799ff8e0e48b799f31255ae1ed84a0c18e8601
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3993931
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Fix, extend, and reformat the documentation of libva to be closer to the
style of the standard library.
BUG=b:214478588
TEST=`cargo doc --document-private-items` in `media/libva` does not
generate any error.
Change-Id: Iee18f3471ddf8f2e65b5111f40fad3a020eafe41
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3932442
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.corp-partner.google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Previously, several tests used the same hard-coded filename for test
files ("/tmp/write_from_vec"), which could cause flaky tests when
running in parallel. Replace these with a tempfile invocation so the
tests can run simultaneously.
BUG=None
TEST=cargo test -p cros_async
Change-Id: I2b32d998583f9a44359345628d803b2397af33b1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3993927
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
We no longer need to selectively disable features or set the
CARGO_DOC env var to successfully build crosvm.
BUG=None
TEST=None
Change-Id: Ib997533c79340e3330a80633c4e8a81cbfb22ab6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3988653
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This greatly simplifies and speeds up compilation
and clippy times.
This ChromeOS-side building these crates has been
updated to copy the source out of the source tree
so that they will compile as a separate workspace.
BUG=b:256020427
TEST=presubmit
Change-Id: I2e0f1f6724924d6bdd70ea28d7777df7966cf724
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3988324
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
The crates do the same thing, but static_assertions is
proven and stable, with no added dependencies.
Note: While this won't require changes to chromeos ebuild files
it will require the removal of dev-rust/assertions when crosvm-base
is upreved.
BUG=b:255989923
TEST=presbumit
Change-Id: I1420447ebdaa1a3649b30e6a6ec57f8dee858b98
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3988328
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Using the same CARGO_TARGET_DIR for all builds prevents us from
building for platforms in parallel, since cargo will lock the
directory to only run one build at a time.
Use the same directory for clippy as well, and ensure that
clippy won't invalidate caches created by run_tests.
This reduces the build time for tools/presubmit by about 50%.
Another advantage is that rust_analyzer and run_tests will no longer
block each other or invalidate the cache when run with different
feature flags.
Note: This introduces two subtle changes to the build that required nit
fixes:
- build.rs files are now run through clippy as well
- common/* crates are now also built for the target architecture instead
the host.
BUG=None
TEST=tools/presubmit
Change-Id: I8da9ef53418c0b15827d512a04e77828621aef88
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3984416
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Add cfg checks to types that are only available when the gpu feature is
enabled. This fixes the `tools/presubmit --all` build.
BUG=None
TEST=cargo build --no-default-features
TEST=cargo build --no-default-features --features=gpu
Change-Id: Ibb6adb73f196dc798ba114cbae5e06e989a6e96d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3993687
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Idan Raiter <idanr@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Makes the async vhost-user backend cross-platform. The next change will
add the plumbing to turn it on. The plan is to create GpuBackendConfig
and GpuVmmConfig in the broker and pass to the relevant processes.
This way, we can also pass GpuBackendConfig to the main process if we
want to use the original non-vhost-user worker. The config changes will
be included with the plumbing CL that follows.
- Split into a sys module.
- Introduce 'platform_workers' that tracks platform-dependent futures.
Reasoning: Windows will need to be able to launch more futures at
runtime due to our input handling, it's useful to have a vector of
workers to append to. This way the specific worker function doesn't
need to leak into the shared file. We can also put the resource
bridge workers here following the same logic.
- Introduce backend and VMM config structures to pass around.
BUG=b:243061269
TEST=downstream / presubmit
Change-Id: I53458c4dd2cf74b9e6bf5d10819533206e47a683
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3963645
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
https://crrev.com/c/3977111 factored out the integration tests for all
irqchip implementations, except for whpx.
Factor out the tests. Add `#[allow(unused)]` attribute for certain
helper functions that are not used in whpx. Make `interrupt_requested`
and `get_external_interrupt` public methods for tests to call into.
Test: Verified tests on windows. Using following command:
Test: `cargo test --tests -p devices --features="whpx,slirp" whpx -- --nocapture --test-threads 1`
Change-Id: I1863d509357193fdbc309e90cd0631fe5849a3bc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3993814
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>