Commit graph

3894 commits

Author SHA1 Message Date
Alexandre Courbot
9defdd860c devices: vhost-user: cras: fix build with audio_cras feature
http://crrev.com/c/3592633 make `run_with_listener` generic, but did not
update the cras vhost-user device to use this new version.

BUG=None
TEST=Chrome OS build succeeds.

Change-Id: I82342e3a2505dc97e5cdaa1749b9091fb986fa35
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3694880
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-08 09:09:56 +00:00
Keiichi Watanabe
19d2fd9c47 integration_tests: Remove debug field
Remove `TestVm`'s `debug` field and print guest outputs unconditionally.
This won't make the test log messy because the output is hidden unless
the test case fails.

BUG=none
TEST=./integration_tests/run

Change-Id: Ica77492229b547f2e244f2751992869b00b78f7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686716
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-08 07:19:40 +00:00
Keiichi Watanabe
52d56f1d37 integration_tests: Print guest logs only when a test failed
Forward crosvm command processes' stdout/stderr to the test process's
stdout so that the messages will be hidden by `cargo test` unless the
test case fails.

BUG=none
TEST=./integration_tests/run with/without additional panic!() in a test

Change-Id: Ife290fb5333fd792cabdad35acea54732f864610
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686715
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-08 07:19:38 +00:00
Alexandre Courbot
1cbf6665b1 virtio: video: encoder: remove never-read fields
These fields were reported as never read by the compiler.

BUG=None
TEST=cargo clippy --features "video-decoder,video-encoder,libvda"

Change-Id: I7580fa9161ba8239398bb7a5b547d67c0c2591e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3685675
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-08 03:24:04 +00:00
Alexandre Courbot
e67e969534 virtio: video: fix wrong_self_convention clippy lints
Since `Self` implements Copy, these methods can and should take their
parameter by value.

BUG=None
TEST=cargo clippy --features "video-decoder,video-encoder,libvda"

Change-Id: I13c4ed627e4cddc1873cf8fa6e3d5c9ac89eccd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3685676
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-08 03:24:03 +00:00
Alexandre Courbot
da0025851c devices: vhost-user: handler: make run_with_listener() generic
The run_with_listener() method can now be made generic and be used for
both the socket and VVU handlers.

BUG=b:229554679
TEST=vhost-user console device works.
TEST=vvu console device works.

Change-Id: Ic1ae286e573383d6b66c8a406227d6cf51cbd578
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3592633
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-06-08 02:29:21 +00:00
Alexandre Courbot
d60bf43903 devices: vhost-user: handler: stop spawning a thread for the socket listener
The async methods of the socket VVU handler were calling the non-async
accept() on a dedicated thread so the async method does not get blocked
awaiting for a connection. This socket-specific behavior forces us to
have dedicated code for the socket and VVU handlers.

Fix this by adding a poll_descriptor() method to vmm_vhost's Listener
trait that returns a descriptor that callers can poll on if a call to
accept() can block. This way we can wait for the connection
asynchronously and avoid using a thread for that. It also opens the way
towards factorizing the socket and VVU specific code.

BUG=b:229554679
TEST=vhost-user console device works.

Change-Id: I3fbc96d3904f777c6165b04564f577c553ce55d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3592632
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-06-08 02:29:20 +00:00
Alexandre Courbot
a5c1b2ff7f cros_async: add async_from_local()
Add an async_from_local() method, which does the same thing as
async_from() (create an IoSourceExt for asynchronous I/O), but without
the requirement that the passed argument implements Send. Async I/O
sources created that way can only be used in thread-local executors.

BUG=b:229554679
TEST=cargo build

Change-Id: Id4cd0cb177e5fed4b72fab12a6f82f964b9bac28
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3670773
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-08 02:29:19 +00:00
Vikram Auradkar
3cd90a401e crosvm: enable windows tests for vhost crate
BUG=b:213149155
TEST=presubmit

Change-Id: I980e6a6883345768db59064287f836ef66fdbd2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691962
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-06-07 20:46:28 +00:00
Anton Romanov
9ac4427d7b crosvm: vm_control: make handle_request generic over AsRef<Path>
All the Path::new(string var) are very repeptitive and completely
unnecessary

Change-Id: I05e86bcf9ad35519cd74ed8de78c4ddabd88abe0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3680296
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-06-07 20:19:34 +00:00
Anton Romanov
d19b575fd1 crosvm: argh-ify vfio command
Usage: crosvm vfio <command> [<args>]

add/remove host vfio pci device into guest

Options:
  --help            display usage information

Commands: add               ADD
  remove            REMOVE

Change-Id: I79d0b5205b1ae8d880b26cf12d61a2f70bb73756
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3680295
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-07 20:19:33 +00:00
Anton Romanov
9140f8d41c crosvm: argh-ify disk command
Usage: crosvm disk resize <DISK_INDEX> <NEW_SIZE> <VM_SOCKET>

resize disk

Positional Arguments:
  DISK_INDEX        disk index
  NEW_SIZE          new disk size
  VM_SOCKET         VM Socket path

Options: --help            display usage information

Change-Id: I416aae6bc898bef39870a9b3252405b1cdd9bc88
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3680294
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-06-07 20:19:32 +00:00
Anton Romanov
7c01401750 crosvm: argh-ify create_qcow2 command
Usage: crosvm create_qcow2 <PATH> [<SIZE>] [--backing-file <backing-file>]

Create Qcow2 image given path and size Either SIZE or --backing-file need to be specified

Positional Arguments:
  PATH
  SIZE

Options: --backing-file    path to backing file
  --help            display usage information

Change-Id: If8e82836cec7edca1b6f8a7173cc2200a7308455
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3675076
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-07 20:19:31 +00:00
Anton Romanov
e747a1b969 crosvm: argh-ify create_composite command
Usage: crosvm create_composite <PATH> [<LABEL:PARTITION...>]

Create a new composite disk image file

Positional Arguments:
  PATH              image path
  LABEL:PARTITION   partitions

Options: --help            display usage information

Change-Id: If485b85ac2c1c054e1366ad8ea00442e0f0f9fe1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3673608
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-06-07 20:19:31 +00:00
Anton Romanov
8c5bf1a048 crosvm: arghify battery command
Usage: crosvm battery <BATTERY_TYPE> <property> <target> <VM_SOCKET>

Modify battery

Positional Arguments:
  BATTERY_TYPE      battery type
  property          battery property status | present | health | capacity |
                    aconline
  target            battery property target STATUS | PRESENT | HEALTH | CAPACITY
                    | ACONLINE
  VM_SOCKET         VM Socket path

Options: --help            display usage information

Change-Id: I4af34511faaa0ecbec7fe1f91a28261596283442
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3673607
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-07 20:19:30 +00:00
Anton Romanov
bf41a525c8 crosvm: argh-ify balloon_stats command
Change-Id: I7b1f1a55663cdf96578e3bfb728e7ee35d5771dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3674536
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-07 20:19:29 +00:00
Anton Romanov
a73c4b4cc2 crosvm: argh-ify balloon command
TEST=cq, crosvm balloon --help
BUG=none

Change-Id: Id3b857b76dda8745ef9284e00b4f7a155d2a5f8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3674007
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-07 20:19:28 +00:00
Anton Romanov
72c9c20be8 crosvm: argh-ify usb command
Change-Id: Ifd4f5a252f363277c551c1c2efadeedaacbbc011
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3674005
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-07 20:19:27 +00:00
Daniel Verkamp
3eef0ed379 book: linkify the rustup.rs URL
BUG=None
TEST=mdbook build # test that rustup ref becomes a clickable link

Change-Id: Ieea42a363130ca42cea6db9133e2a8de94a1d275
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691970
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-06-07 17:37:15 +00:00
Daniel Verkamp
9315d0a741 Use 4-space indent in cfg_if treewide
A few of the cfg_if blocks got misaligned somewhere along the line, and
cargo fmt won't rewrite code inside macro invocations, so we have to fix
them manually.

BUG=None
TEST=stare at whitespace

Change-Id: I1ccf7aff7c7827a2687ab5fa50cc192c79d6400b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691968
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-07 17:36:51 +00:00
Vikram Auradkar
e18cfbfbe8 crosvm: enable windows tests for hypervisor and vmm_vhost crates
BUG=b:213149155
TEST=presubmit

Change-Id: I5b958e299426ef72fc7d73a514000bdb2472c7d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691964
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-07 16:31:39 +00:00
Vikram Auradkar
326337b5d3 crosvm: Enable vm_memory tests on windows
BUG=b:213149155
TEST=presubmit

Change-Id: I5b09c6a4b1d83765dc1313c5d28a100ebb50987b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691963
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-06-07 16:31:38 +00:00
Vikram Auradkar
77a8e62e5d crosvm: Enable windows tests for a few crates
BUG=b:213149155
TEST=presubmit

Change-Id: I73e5bfab4f3bc1fbda24a840a6c94c983cdddb0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691961
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-06-07 14:37:43 +00:00
Alexandre Courbot
00da200d2b virtio: video: fix clippy upper-case-acronyms warning
BUG=None
TEST=cargo clippy --features "video-decoder,video-encoder,libvda"

Change-Id: Ie7292fbb85453873c93d8250aba7e910ba9895e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3685674
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-06-07 11:44:23 +00:00
Alexandre Courbot
fc891cea82 virtio: video: decoder: add ffmpeg-based software decoder backend
The virtio video decoder device is currently only available under very
drastic conditions: a build linked against libvda (a ChromeOS-only
library that needs the cros chroot to be built and linked against), and
a ChromeOS-flavored Chrome instance running alongside crosvm, so the
browser can provide the video decoding service through Mojo.

This makes the decoder device very difficult to develop on for
non-Chromies, and also for Chromies actually since they will always need
a DUT to test it on.

This patch introduces an alternative decoder backend based on
ffmpeg's libraries that performs decoding on the host's CPU. It supports both
guest pages and virtio objects as target, and can be considered a
reliable and predictable way to test the decoder in any environment.

We introduce our own ffmpeg bindings after a quick state of the art
revealed that the existing ones were all unsuitable, either for
technical or licensing reasons. Doing so is also not a big effort and
does not add any new external crate dependency to crosvm.

BUG=b:169295147
TEST=cargo test --features "video-decoder,ffmpeg" -p devices ffmpeg
TEST=v4l2r's simple_decoder example decodes test-25fps.h264 properly with the
     following command:
     ./simple_decoder test-25fps.h264 /dev/video0 --input_format h264 --save test-25fps.nv12
TEST=ARCVM Android youtube plays videos correctly when the ffmpeg
     backend is used.

Change-Id: Ic9c586193f7939f2a3fe59d009c3666585a8bbc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026355
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-07 11:44:21 +00:00
Alexandre Courbot
d036e9f225 tools: install-deps: add ffmpeg libraries as dependencies
Add the ffmpeg libraries needed by the ffmpeg decoder device backend and
bump the dev_container and testvm to include them.

BUG=b:169295147
TEST=./tools/install-deps
TEST=./tools/dev_container

Change-Id: Ifc07b9599403aa1ed18a96067ada1fa2efa6e13c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3685682
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-06-07 11:44:20 +00:00
Junichi Uekawa
c1b467f17a Revert "Add rseq to the seccomp policy file on aarch64."
This reverts commit 637402a827.

Reason for revert: break CrOS build

Original change's description:
> Add rseq to the seccomp policy file on aarch64.
>
> Some newer versions of glibc use this syscall.
>
> Change-Id: I553db954b019fa5fc738074b28dbba78392c3ede
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3690467
> Tested-by: kokoro <noreply+kokoro@google.com>
> Auto-Submit: Peter Collingbourne <pcc@chromium.org>
> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>

Change-Id: If2ff928964bb2184e473a4b15cacb92367d594b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3688025
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Junichi Uekawa <uekawa@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-06-07 04:30:15 +00:00
Noah Gold
157bd6f04d x86_64: reset msrs when using bios
Our BIOS doesn't set the TSC MSR to 0 on boot, but our hypervisors need
this to be set so they can correctly sync their TSC offsets. This
introduces a generic "reset_msrs" function where we currently reset the
TSC msr, but where we could also reset if we need to in the future.

Cherrypick from downstream branch.
Actual author: Colin Downs-Razouk <colindr@google.com>.

BUG=191981229
TEST=tested downstream

Change-Id: I17b5709411394ae48fb5d7310636636295ebfaad
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3690370
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-06-07 02:19:06 +00:00
Federico 'Morg' Pareschi
8839e1c368 devices: virtio: Use mmap for vvu doorbell
This change enables memory mapping of the vfio device doorbell regions so
we can access the vfio bar more efficiently by limiting the scope of the vvu
device interactions with the guest kernel.

BUG=b:231938067
TEST=built and run, verified vvu communication happens as expected

Change-Id: I16925d99a467d44ce7f74316770f1c665de75433
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3670459
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Morg <morg@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Morg <morg@chromium.org>
2022-06-07 01:41:49 +00:00
Daniel Verkamp
8579daefae devices: virtio: fs: fix warning about extra parens
The outer set of parentheses is redundant.

BUG=None
TEST=emerge-kevin crosvm

Change-Id: I482e04601b0f7a3ef22221a77c00ef746bbd288a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691969
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-06 23:52:21 +00:00
Peter Collingbourne
e44dbaa6ad Fix running the tests natively on aarch64.
Change-Id: Icdeacc8247fbd44cd62445e610306ce0c67d70e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3689858
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-06 19:49:03 +00:00
Dennis Kempin
301da40bc5 Kokoro: Fix dry-run merge target
Using HEAD for both calls will cause update-dry-runs to use the
merge branch as a target to do the merge, creating the dry run on top
of the merge.

BUG=None
TEST=./ci/kokoro/simulate.py ./ci/kokoro/build-merge-into-chromeos.sh
Change-Id: Ib466272d3acce30888e1e3c5db853be9ded46106

Change-Id: Ifc40ffb81a61a75326b296419a4337c49a8fd7db
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3688803
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-06 19:42:57 +00:00
Richard
e7a35d8f9c devices: descriptor_utils: split out tests that don't run correctly on
Windows

BUG=b:213149162
TEST=built and presubmits

Change-Id: I3b88ea3032458c39b78f6059ecf06e830887a424
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3669691
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Richard Zhang <rizhang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-06 18:38:29 +00:00
Daniel Verkamp
62636c5b2f data_model: use fully qualified name in flexible_array_impl! macro
The flexible_array_impl! macro should not rely on the caller to import
FlexibleArray; use $crate::FlexibleArray to refer to it instead.

BUG=None
TEST=tools/presubmit

Change-Id: I9743a4cbc01deb6cdfadd98e63f4803a5572421c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687064
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-06-06 18:17:03 +00:00
Peter Collingbourne
637402a827 Add rseq to the seccomp policy file on aarch64.
Some newer versions of glibc use this syscall.

Change-Id: I553db954b019fa5fc738074b28dbba78392c3ede
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3690467
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Peter Collingbourne <pcc@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-06 18:08:15 +00:00
Vikram Auradkar
76188090d9 Adding Vikram to crosvm OWNERS
BUG=None
TEST=None

Change-Id: I96027017e37740108d95acfae62b0fdd917fa0c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3641319
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-06-06 17:20:10 +00:00
Daniel Verkamp
4c0de58cbf base: unix: rename PollContext to EventContext
We already exported PollContext as EventContext for use in the portable
WaitContext wrapper, so this makes no difference to callers.

A few remaining references to PollContext in documentation and errors
are fixed up as well to avoid confusion.

BUG=None
TEST=cargo build

Change-Id: I89943d4d9e135a0da7dd0fbff470b6a14efd669a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687059
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-06-06 17:07:35 +00:00
Daniel Verkamp
25f08902ff base: unix: remove unused IntoRawDescriptor for PollContext
PollContext is wrapped by the platform-agnostic WaitContext, which does
not support IntoRawDescriptor, so nobody should be using this.

BUG=None
TEST=cargo build

Change-Id: I5d931d20cb3d0a8f42cc1e625d35df4047e45c7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687058
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-06-06 17:07:34 +00:00
Daniel Verkamp
f0f10c4209 base: remove WatchingEvents in favor of EventType
Migrate the last few users of WatchingEvents to the equivalent EventType
values so we can remove the unix-specific WatchingEvents type.

BUG=b:213153157
TEST=cargo build

Change-Id: I215127309591125c4c64ff2963e7d2b8e1914cf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687057
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-06-06 17:07:33 +00:00
Daniel Verkamp
e3d9206dc9 io_uring: expand poll_events to 32 bits
The original poll_events field in io_uring_sqe was 16 bits wide, but it
was later extended to 32 bits to allow the use of all epoll flags.

Technically, we should check for the IORING_FEAT_POLL_32BITS feature,
but the new poll32_events union member was added in Linux commit
5769a351b89c ("io_uring: change the poll type to be 32-bits"), which was
included in Linux 5.9, so we can assume this is available for all
io_uring-enabled kernels due to our baseline version of 5.10.

BUG=None
TEST=cargo test -p io_uring

Change-Id: I5a6266f24ba53a1826b40c91c281527481e99c8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687056
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-06 17:07:32 +00:00
Peter Collingbourne
4f7d84e5b9 Fix some clippy warnings on aarch64.
Change-Id: Iac9a9540c585a08374c966a1014c6746fbba0554
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687061
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Peter Collingbourne <pcc@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-06-06 16:58:32 +00:00
Noah Gold
eac74eb836 broker_ipc: add crate
Adds the broker_ipc crate, which is used for communication & setup tasks
shared between the broker (Windows orchestrator for crosvm & vhost-user
devices) and all other crosvm processes.

BUG=b:232318124
TEST=builds

Change-Id: I17d529305dd348a50574e6c3c082808e97ffff45
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3648474
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-06-03 22:00:11 +00:00
Noah Gold
b803f10fa2 base: add unix no op impl of enable_high_res_timers.
This is needed by broker_ipc (next crate in the chain).

BUG=232318124
TEST=builds

Change-Id: I7d71b9208123dd055b7150fd3ae6703cdc21bf6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3685809
Commit-Queue: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
2022-06-03 22:00:10 +00:00
Dennis Kempin
59cfdaaff0 tools: Add tools/cl script as a helper for uploading to gerrit
See USAGE for documentation.

This tool will be needed to upload to the upstream repository, as
we will no longer be able to use repo.

Currently, for testing it still points to the chromiumos repository.

BUG=b:221088786
TEST=Follow USAGE

Change-Id: I4a8d88a8354942f0ddfb7f9420ef1cf7f5885867
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687419
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-03 21:35:31 +00:00
Dennis Kempin
9cf56a869e infra: Add merge_into_chromeos builder
This builder re-creates ci/build_merge_into_chromeos and just calls
the merge_bot script.

Eventually this could be better integrated with Luci UI. For now,
this is feature parity with Kokoro.

BUG=b:233913643
TEST=recipe.py run merge_into_chromeos

Change-Id: Ia5de775cad943687be654c3a054f1150ba9adbb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3673786
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-03 19:18:06 +00:00
Dennis Kempin
47e25297d5 merge_bot: Handle merge conflicts
The bot cannot resolve those automatically. To ease the process, we
will upload the merge anyway, so the oncall can download and resolve
the conflict.

Dry runs are not created when there are conflicts, they are bound
to fail and there is nothing the oncall can do about conflicts
until the actual merge is generated.

BUG=b:234847583
TEST=MERGE_BOT_TEST=1 ./tools/chromeos/merge_bot update-merges / update-dry-runs

Change-Id: I409e6b99284ff8a98b504b390c35329875d6a8b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3689544
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-03 19:12:04 +00:00
Dennis Kempin
ca66addad0 Update merge_bot to support merging across repos
We will be merging from the upstream repo into the cros repo. The
script can be run from both an upstream and a cros checkout, it
will setup the required remotes.

The CLI changes a little. We now require a revision to merge from
needs to be specified, since the script is not setting up the
upstream remote.

CI jobs will simply use HEAD, as the version to merge is already
checked out by the CI system.

BUG=b:233913643
TEST=
./merge_bot update-merges HEAD
./merge_bot update-merges origin/main
./merge_bot update-dry-runs HEAD

Change-Id: I247e1edc3ad951becf5d59b63efd74914bb2205f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687222
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-03 19:12:04 +00:00
Dennis Kempin
bebb69843a infra: Add a little documentation about testing recipes
Recipes can be tested with unit tests, run locally or run on a build
bot. The documentation shows how to do this.

BUG=None
TEST=None

Change-Id: Iec139de5c38d45765c9da0d95e8ac076c5df1dfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3682200
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-03 18:36:40 +00:00
Kaiyi Li
26e0aeb03b crosvm: move gpu display parameter parser into one struct
BUG=b:233676779
TEST=presubmit

Change-Id: Ib30bab79fbe1e593a10e8807f4217d19b1ac24d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3668928
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Auto-Submit: Kaiyi Li <kaiyili@google.com>
Commit-Queue: Kaiyi Li <kaiyili@google.com>
2022-06-03 17:12:54 +00:00
Keiichi Watanabe
5fffb39355 devices: vvu-proxy: Introduce an enum to manage device lifecycle
Introduce `State` enum to handle vvu-proxy's lifecycle.
This state will be used to support recovery from sibling disconnection in the follow-up CL.

BUG=b:216407443
TEST=run VVU

Change-Id: I47f9c69abb9d08520ec90a4a9a87fc4d230c96a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3591105
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-03 15:28:42 +00:00