Commit graph

262 commits

Author SHA1 Message Date
Keiichi Watanabe
6e4190b571 cargo: Remove gdb feature from all-armhf
The gdb feature is supported only on x86_64 and aarch64.
This change removes some compiler warnings.

BUG=b:181763000
TEST=CQ

Change-Id: I22e99574e31147d5ec681bea02c5e0e43c9ca592
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4011922
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-11-08 16:53:48 +00:00
Vikram Auradkar
1b32084a56 crosvm: Enable default features on windows.
The patch makes usb feature no-op on windows as USB pass-through is
not supported on windows.

BUG=b:241251677
BUG=b:213149155
TEST=tools/presubmit

Change-Id: Id82d4c732a86e782695d2af698cc08e8e3fd2d35
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4006819
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-11-07 23:03:25 +00:00
Vikram Auradkar
befb1ccaa9 devices: enable tests for audio on windows
BUG=b:213149155
BUG=b:150630566
BUG=b:236297362
TEST=tools/presubmit

Change-Id: I4619a5c9f1ff8b5ce00b4c7b7c4f5b19cff42471
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4006817
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-11-04 20:52:45 +00:00
Dennis Kempin
b50f6580a2 test_config: Cleanup and enable some video crates
Some of these flags were no longer necessary since we now split
between unit and integration tests.
Others could be enabled by adding some missing dependencies.

BUG=None
TEST=presubmit

Change-Id: Ife5b09a4ee8b27885ee2042d5d93447e8d4deedd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4004345
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-11-03 23:03:54 +00:00
Dennis Kempin
009cb53c76 Rename integration_tests to e2e_tests
Cargo already uses the term 'integration test' for tests living
in the tests/ directory of a crate.

To prevent confusion, rename our 'integration_tests' crate to
'e2e_tests'.

BUG=None
TEST=presubmit

Change-Id: Icfa819eaed08be54ab0f36092f1ba367f3f1ce88
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4004977
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
2022-11-03 22:49:39 +00:00
Daniel Verkamp
be900c3aae build.rs: find compile_seccomp_policy via which
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>
2022-11-02 20:18:42 +00:00
Alexandre Courbot
0bea1ffe17 Cargo.toml: strip symbols with the "chromeos" profile
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>
2022-11-02 00:17:59 +00:00
Vikram Auradkar
2c6e960de3 win_audio: build and test win_audio
BUG=b:253494168
TEST=presubmit

Change-Id: Icb729671a0dcfbc4b6251c69732784de32f6318d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3988069
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-11-01 20:40:09 +00:00
Dennis Kempin
45b5c13047 Make common crates part of the crosvm workspace
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>
2022-10-31 21:33:33 +00:00
Dennis Kempin
7990b9da3c Replace common/assertions with static_assertions
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>
2022-10-31 21:33:33 +00:00
Daniel Almeida
3399026503 video: decoder: vaapi: port the VAAPI backend to cros-codecs
Port the VAAPI backend to the new cros-codecs crate. This crate now
contains all codec related code and is independent from the rest of the
CrosVM code.

BUG=b:214478588
TEST="cargo test --package devices --lib --features video-decoder --features vaapi -- virtio::video::decoder::backend::vaapi::tests::test_get_capabilities --include-ignored"

Change-Id: Id207c53c0c4200e03ce8793d7c37cb5fbe808829
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3875044
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-10-28 03:23:31 +00:00
Daniel Almeida
42bdf1de57 media: cros-codecs: Introduce the cros-codecs crate
Introduce the cros-codecs crate. This crate contains all the
codec-related code and does not depend on CrosVM. The decoders are
decoupled from the backends, which allows for the implementation of new
backends without touching the decoder code.

This crate comes with dummy backends to test the decoder functionality
in isolation, but in order to decode frames, a real backend is needed.
Currently this backend is the VAAPI backend. Using it adds a dependency
on the libva crate.

This change adds support for VP8, H264 and VP9.

BUG=b:214478588
TEST="cd media/cros-codecs && cargo test --release --features vaapi -- --include-ignored"
TEST="emerge-hatch chromeos-base/crosvm" completes successfully.

Change-Id: I596d5db4dabcc96dcfdbce1f41c8092e01b64271
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3875043
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-10-28 03:23:26 +00:00
Dennis Kempin
d5cd2422fe scudo: Drop version to 0.1
This allows ChromeOS/AOSP to keep using their slightly older bugfix
version number, while our Cargo.lock file is updated to the latest
version that includes the build.rs fix to prevent unnecessary re-builds.

BUG=None
TEST=presubmit

Change-Id: Ibe0a46632d9766cad7fb6bc5b6b4042da92313bf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3984415
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-10-27 18:25:05 +00:00
Bastian Kersting
606bebceaf Bump scudo and enable corresponding feature
This CL bumps to the latest Rust-scudo version and re-enables
the corresponding feature, after it was disabled in crrev/c/3964927.
The fix introduced in https://github.com/google/rust-scudo/pull/6 was
submitted and is part of the 0.1.3 release of scudo.

BUG=None
TEST=health-check

Change-Id: I9c658cde9ea2d4cdf0d03110e2d015c8339e5267
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3973490
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-10-24 17:40:47 +00:00
Alexandre Courbot
839577a796 media: libvda: allow to build without linking to libvda
libvda is only available on ChromeOS, and being unable to link to it
with regular builds reduces our build coverage.

Add a "libvda-stub" feature that, if enabled, results in dummy C stubs
being build for all the exported libvda functions. This allows builds
with the "libvda" feature to pass, although of course the resulting
video device would immediately crash and thus should not be used.

BUG=b:244619291
TEST=`cargo build --features="video-decoder,video-encoder,libvda-stub"`
completes.
TEST=`cargo build --features="video-decoder,video-encoder,libvda"`
reports link errors against libvda.
TEST=`cargo build --features all-x86_64` builds libvda and completes
without error.

Change-Id: I9bb60f6caf670081d67c91275727f3888272d64b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3947844
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-10-21 13:57:31 +00:00
Dennis Kempin
89f0a34eff Disable scudo feature
The feature will trigger rebuilds on every cargo build invocation.
A fix is submitted: https://github.com/google/rust-scudo/pull/6
Until then, let's disable it.

BUG=None
TEST=health-check

Change-Id: Id328bd976b65674b50f9845490eb5083008781e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3964927
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 23:11:58 +00:00
Noah Gold
adc5e6fd3f src: move exit module to new crosvm_cli crate.
Since we have "main" like functions in the devices crate for vhost-user
devices, we need to use ExitContext & Exit there. This wasn't possible
with the existing location in the crosvm/main crate because crosvm ->
devices so we can't have devices -> crosvm. This CL moves exit to a new
crate, crosvm_cli, where it can be used by all interested consumers.

BUG=b:253348635
TEST=builds

Change-Id: Ia06d9dee2cd5826ea20a7fb3a0c2a53c58e2ff1d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960854
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 20:27:58 +00:00
Dennis Kempin
6d0d597b5f gfxstream: Enable the feature upstream via stub backend
This won't be functional at runtime, but does allow us to at
least compile with gfxstream enabled.

BUG=b:244618506
TEST=presubmit

Change-Id: I72a63976310e635964645a1265a22518fc6cb694
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3967431
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 20:22:23 +00:00
Daniel Verkamp
474d2eea17 arch: split fdt code into its own crate
This will let the hypervisor crate use types and functions from the new
cros_fdt crate (it could not depend on arch, since that would cause a
circular dependency).

No functional change, just code movement.

BUG=b:253416076
TEST=cargo build
TEST=cargo build --target=aarch64-unknown-linux-gnu

Change-Id: I62d906941867c45f1b77ff1db6923d915ce2123e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965088
Reviewed-by: Steven Moreland <smoreland@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-10-19 17:43:19 +00:00
Pujun Lun
1289167d24 crosvm: enable the "gpu" feature by default on Windows.
BUG=b:213149288
TEST=presubmit

Change-Id: I726324893d78b8cc0303d1bb4d8132e48889a5bc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960861
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2022-10-18 18:18:38 +00:00
Noah Gold
cb55cd0394 tracing: rename tracing to cros_tracing.
`tracing` conflicts with a crates.io crate. Since we may support tokio
tracing in the future, and want to submit some benchmarks against it
right now, we should rename our crate.

BUG=b:253517247
TEST=presubmit

Change-Id: I32bf64a7ce1830e881bd582e4606932782df65c6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3957598
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-10-17 20:49:16 +00:00
Dennis Kempin
849f1558cf Enable the video-encoder feature upstream
This feature can be enabled now that we have ffmpeg enabled.

BUG=b:244618273
TEST=presubmit

Change-Id: Ic1c36ffa46729fcbdc408135f4167c49042ea56a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3953083
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-10-14 20:31:19 +00:00
Dennis Kempin
5a32a2d198 Enable vaapi feature upstream
The feature can be built but not tested without access to an intel
GPU.
To enable the build, the testvm and dev container are updated to
include libva.

BUG=b:244619376
TEST=presubmit

Change-Id: Ia8c4dc46ccbcd244bf57441f2c550a6b73c67b1c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3946027
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-10-14 20:31:19 +00:00
Dennis Kempin
f91a9f673a Remove plugin-render-server feature
This feature was used for experiments and is no longer needed.

BUG=b:253086623
TEST=presubmit

Change-Id: Id8ece0e1e8588a5716794961c359482bc60dc729
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3946029
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-10-14 20:31:19 +00:00
Dennis Kempin
bb9a3a5572 Document feature flags and introduce new feature sets
The feature flags are documented using the document_features
crate.
Each platform gets one feature set that enables the features that
are built and tested for that platform.

The only functional difference is that the plugin feature is now
enabled in clippy. Otherwise this should be a no-op.

BUG=b:243894033
TEST=presubmit && cargo doc

Change-Id: Ia910bc2670696172daedcc503f7ad5844a844964
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3946024
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-14 20:31:19 +00:00
Dennis Kempin
e8842561c6 Enable a couple of trivial features in upstream
Also fixes health-check to recognize that the proto optional
crate is referred to by other features.

Change-Id: Ie0e8f9ee8960ccb31539eeb2604e8c9654798de4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3943594
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-10-13 17:24:22 +00:00
Vikram Auradkar
44a07970cb sandbox: upstream sandbox
The crate depends on a prebuilt library.

BUG=b:213170185
TEST=presubmit

Change-Id: I810baa14afa53e88f6b2a739481a6d3656efc2e5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784338
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-12 21:05:39 +00:00
Jason Macnak
1e077db461 devices: gpu: Support display hotplug
Adds `crosvm gpu <>` commands which allows for interactively
adding/listing/removing virtio-gpu displays/scanouts.

Also updates the virtio gpu device to use a Map<u32, Scanout>
instead of a Vec<Scanout> and always report the maximum number
of displays (16) with enabled/disabled. This helps handle the
case of removing a display that is not the last display number.

BUG=b:163864461
TEST=cargo build
TEST=cargo build (with gpu feature disabled)
TEST=Android build
TEST=launch Cuttlefish
TEST=crosvm gpu list-displays <socket>
TEST=crosvm gpu add-displays
     --gpu-display=width=900,height=600
     --gpu-display=width=600,height=480
     <socket>
TEST=crosvm gpu list-displays <socket>
TEST=crosvm gpu remove-displays
     --display-id=1
     <socket>

Change-Id: I7530498897eb4e84199eaeb3d66df006df62817f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911102
Commit-Queue: Jason Macnak <natsu@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-11 16:20:31 +00:00
Vikram Auradkar
c4a4dc9b23 net_util: Add windows slirp support
BUG=b:237011316
TEST=presubmit and tested in wine

Change-Id: I1b6160142b8161d4b09d3fd98dfacde354e238b4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3934818
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-10-11 15:25:38 +00:00
Vikram Auradkar
1acc0a28d9 prebuilts: move prebuilts tests under tests
BUG=b:246987526
TEST=presubmit

Change-Id: I86eed7c84f7e21eb7155695489ee9446f999dc1d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3936733
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-10-07 15:54:37 +00:00
Dennis Kempin
8a38e8f36e Re-enable video-decoder feature
This was disabled in https://crrev.com/c/3835500 due to the lack
of ffmgeg 5.0 in our dev containers.
The container has since been upgraded in https://crrev.com/c/3892621

BUG=b:244619658
TEST=presubmit

Change-Id: Ia2bd41fbd780bad7d7706e0ffe7554e202ec0eb1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3907377
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-06 18:28:56 +00:00
Dennis Kempin
4c211a4d41 Extract vtpm out of the chromeos feature
And enable it in upstream all-linux builds.
The feature is enabled for chromeos by default, so should
be a no-op for chromeos builds.

We can probably simplify the cfg() attributes further by
only enabling the feature for x86, so we do not need the
extra check each time. But that'll require ebuild changes.

BUG=b:244618505
TEST=presubmit
TEST=cargo build --no-default-features --features=vtpm

Change-Id: Ibb33c04ab5e6486969fefc6f3e57503be4eccdf3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3924741
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-04 21:11:30 +00:00
Vikram Auradkar
eb52905d36 prebuilts: Add helper crate to download prebuilts
BUG=b:246987526
TEST=presubmit

Change-Id: I1e54cf4a176d48c30340d6e7925733d6a1f4ce93
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784337
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-10-04 20:22:47 +00:00
Dennis Kempin
d6cd312571 Split arc_quota out of the chromeos feature
This allows us to enable the feature in upstream builds.

The feature is automatically enabled for the chromeos feature,
so it should be a noop for ChromeOS builds.

BUG=b:244618505
TEST=presubmit / build_packages implicit-system crosvm

Change-Id: I2ea2d668a0f8c2faa92aad5452df0bf660d85e0e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3919815
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-28 18:13:00 +00:00
Dennis Kempin
891455563b system_api: Add copy of ChromeOS's system_api
Adds a script that copies the bindings we need upstream. We cannot
use the original repository, as it's part of the large platform2 git
repository, and the original build.rs depends on ChromeOS tooling to
generate these bindings.

So instead, this change adds a script that can be called from a
chromiumos checkout of crosvm to update the upstream bindings.

This allows us to enable certain features that talk to ChromeOS
dbus services. They won't be functional upstream, but at least we
can compile and test the code.

To make things more consistent, we no longer replace the crate
with the ChromeOS version when building for ChromeOS.

BUG=b:244618505
TEST=presubmit

Change-Id: I504cbf6d12b0cb50d9935f5e49b7fa72b692d45c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3919814
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-28 18:13:00 +00:00
Vikram Auradkar
21d2a616f0 crosvm: enable building with crash-report and slirp on linux
BUG: b:244619302
BUG: b:244618109
TEST: presubmit
Change-Id: Iaa7d5ac866e76da0a53ac86f65320a00694b00e7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3916695
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-09-28 14:47:24 +00:00
Vikram Auradkar
e493edd79e crash-report: Build with feature crash-report
BUG: b:244618109
TEST: Presubmit and built with the feature on windows and linux.

Change-Id: Idf9ae87243eb0a7c7b9a6ff525406f1430b49c20
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3916339
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-09-28 14:45:00 +00:00
Pierre-Clément Tosi
7737c533db gdb: Add basic support for AArch64
Enable the "gdb" feature on AArch64 (KVM) builds and add support for:

 - reading & writing guest memory (only guest IPAs, for now)
 - getting & setting core registers
 - getting & setting the few system registers from kvm_regs
 - setting hardware breakpoints (no software breakpoints, for now)
 - enabling single-step mode

BUG=b:222222882
BUG=b:240711627
BUG=chromium:1141812
TEST=tools/dev_container ./tools/run_tests

Change-Id: I0ae38c1065002d55a569b1575b1637110694e6db
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3785467
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
2022-09-28 11:25:50 +00:00
Pujun Lun
698d2dcc3a devices: add feature flags to render_server_fd.
We want to hide this variable from platforms that don't use it.

BUG=b:213149288
TEST=presubmit

Change-Id: I0d44d2bc50843b86d82b4084f95c8d1a1f750aa6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3895401
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
2022-09-22 20:21:59 +00:00
Vineeth Pillai
aea39132e8 libcras_stub: Stub implementation
Stub the required parts of libcras so that upstream builds with
audio_cras feature

BUG=b:244618503
TEST=cargo build --features audio_cras

Change-Id: I21eb3bcb9a61990740b1419f124401878619481e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911099
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vineeth Pillai <vineethrp@google.com>
2022-09-21 23:36:06 +00:00
Dennis Kempin
3164f92428 power_monitor: Enable feature in all-linux
To enable this feature, we copy the required proto file from
ChromeOS. Not a great solution, but better than leaving the
code uncompiled in upstream.

We could consider downloading the file from gitilies with
a fixed sha that is manually upreved. But unfortunately
downloading things in build.rs is not trivial without adding
a ton of dependencies for the reqwest crate.

BUG=b:244619797
TEST=presubmit

Change-Id: I401917134471909be80a281454bc64dd27799afe
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3907373
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-20 21:06:47 +00:00
Daniel Verkamp
38d39953c7 Cargo.toml: enable wl-dmabuf feature for all-linux
Now that the libdrm linker issues are fixed, we can enable wl-dmabuf
testing in CI.

BUG=b:244618790
TEST=tools/dev_container tools/presubmit --all

Change-Id: Id4d3e979ab357518ad8804fde373345bb5a38c37
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3905093
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-09-20 20:30:43 +00:00
Pujun Lun
b97f10ef0f gpu_display: upstream Windows implementation
On Windows, we have to create a GUI thread that creates the window and
retrieves window messages from the thread-specific message queue created
by the system. All host events, such as window resizing and mouse and
keyboard events, are sent in the form of window messages. Hence, we
created these structs/traits to model it:

- `Window`: Owns the handle of one window, and provides helper functions
  for operating on this window.
- `HandleWindowMessage`: A trait implemented by the struct that
  processes host events. In our case, that is the surface.
- `WindowMessageProcessor`: Holds one `Window` object and one
  `HandleWindowMessage` trait object. We only support one window for
  now. Once we support multi-windowing, there will be multiple
  processors.
- `WindowMessageDispatcher`: A singleton, responsible for dispatching
  messages retrieved from the message queue to the targeted processor.
- `WindowProcedureThread`: Wraps the GUI thread, retrieves messages from
  the message queue and forwards them to the dispatcher. It also
  provides helper functions for other threads to talk to the GUI thread.
- `MessageRelayThread`: Relays service messages to the GUI thread.

Main difference from other platforms: event devices are imported to the
GUI thread, since all host events are processed there.

BUG=b:213150276
TEST=presubmit

Change-Id: I0aabf6adf8a9ff4b24375e9c7df7625b6f761c7a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3834009
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2022-09-16 17:36:57 +00:00
Daniel Verkamp
e27dde0caa crosvm: unix: install memfd panic hook
Add a call to the install_memfd_handler() function so that panics
produce a specially named memfd to store the panic information for
retrieval by the crash reporter.

A new panic-memfd feature (enabled by default with --features=chromeos)
is added to control this functionality.

BUG=b:234093439
TEST=emerge-hatch crosvm

Change-Id: Ibc92b3970609d097371b0019d6f1c8d00a3e5f15
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892142
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Paramjit Oberoi <psoberoi@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-09-13 20:01:55 +00:00
Daniel Verkamp
bd13bdbfc8 windows: fix build without --features=stats
Add a top-level stats feature that selects devices/stats and guard the
uses of stats-related types with a cfg check. Fixes the Windows build
when the stats feature is not enabled. No change in behavior when
building with the win64 feature, as that selected the stats feature
already.

BUG=None
TEST=cargo build --no-default-features

Change-Id: I468f6c34509753d640ea002199da74e1729d25f7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3885496
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-09-09 22:47:16 +00:00
Zihan Chen
b233d7d60a crosvm: Embed seccomp filters into binary
Seccomp policy files will now pre-compile to bpf bytecode for
target architecture and embedded in the crosvm binary when not
built for chrome os.
When minijail is not checked out in crosvm tree as a submodule,
MINIJAIL_DIR environment variable needs to be specified for the
policy compiler to run.
Integration tests are now sandbox enabled for better coverage.

TEST=all tests passed, vm runs fine with sandbox on and no separate
policy files present. cros deploy & crostini still works.
BUG=b:235858187
FIXED=b:226975168

Change-Id: Ieaba4b3d7160ccb342a297ebc374894d19a8dc4d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3824062
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2022-09-08 21:12:55 +00:00
Keita Suzuki
7d1c18ac69 devices: vhost-user: block: add control server to devices command
Add an in-process control server-like mechanism which runs in the
devices command to enable controlling vhost-user devices with control
commands such as DiskControlCommands. Like the in-process version,
the vhost-user control server waits for connection on the specified
socket, processes the recevied command, and forwards it to the
corresponding device via established tubes. Currently, DiskCommands are
the only commands supported by the control server, as block devices are
the only devices which need this mechanism.

This patch also adds the mechanism to process forwarded commands in
the vhost-user block backend device, similar to the command processing
mechanism in the worker provided in the in-process block device.

BUG=b:191845881
TEST=cargo run devices -s /path/to/socket.sock --block ..., then run
cargo run disk resize 0 $SIZE /path/to/socket.sock

Change-Id: I7b96e6c4bb7371424ca220da5f95be88e82c1fc0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3841001
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Keita Suzuki <suzukikeita@google.com>
Reviewed-by: Morg <morg@chromium.org>
Commit-Queue: Keita Suzuki <suzukikeita@google.com>
2022-09-02 07:47:30 +00:00
Pierre-Clément Tosi
4a11ffc891 gdb: Upgrade gdbstub & gdbstub_arch dependencies
Bump the versions of these crates as we're about to require support for
unavailable register values and AArch64. Do it in a separate commit to
ease future bisects.

BUG=b:222222882
BUG=chromium:1141812
TEST=tools/dev_container ./tools/run_tests

Change-Id: I0bfa3559d172faf2df6bcffdc77714830f442051
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3785466
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Pierre-Clément Tosi <ptosi@google.com>
Tested-by: Pierre-Clément Tosi <ptosi@google.com>
Commit-Queue: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
2022-09-01 16:24:00 +00:00
Christian Blichmann
8847de2725 qcow: Turn QCOW support into a feature
This change allows to turn off support for QCOW. This is useful for
projects that do not need/want it.

A follow-up change (if this one is merged) will do the same for Android
sparse disk images.

BUG=none
TEST=./tools/presubmit

Change-Id: I69083c4c2e21d504db89eff47f4c86c6f61d67e9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3864926
Tested-by: Christian Blichmann <cblichmann@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Christian Blichmann <cblichmann@google.com>
2022-09-01 08:13:29 +00:00
Alexandre Courbot
d19ae375b5 crosvm: disable ffmpeg decoder from default builds
We are about to require ffmpeg >= 5.0 in the ffmpeg decoder backend, but
the version on Debian Bullseye (used in our container and VM images) is
still 4.3. Temporarily disable building the ffmpeg crate and video
decoder by default until we use a system image that includes ffmpeg >=
5.0.

BUG=None
TEST=./tools/dev_container ./tools/run_tests
TEST=./tools/dev_container ./tools/run_tests --target=vm:aarch64
TEST=./tools/dev_container ./tools/run_tests --target=vm:aarch64 --build-target armhf

Change-Id: Idf96862d3ea9bea597701fdee8145e12a0753a3e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3835500
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-08-23 01:47:48 +00:00