Commit graph

2510 commits

Author SHA1 Message Date
Vikram Auradkar
ede68c76ba base: Remove is_packet_ready
BUG=b:184398671
TEST=cargo test

Change-Id: I91770504ef95121246e75e29e9fd64fc32022fc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3002387
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-07-08 16:55:55 +00:00
Dennis Kempin
fa32ced1e0 Crosvm Externalization: Move libvda rust code into crosvm
Long-term libvda will be replaced with an implementation that can
function outside of ChromeOS.

In the meantime thes allows crosvm to be built externally and pass
clippy with all features enabled.

BUG=b:191507399
TEST=Tests in crosvm and cros_sdk both pass:
  $ ./test_all
  $ cros_run_unit_tests --package=crosvm

Cq-Depend: chromium:2989315, chromium:2986403
Change-Id: Ic37bda4426d69d16cb4bc0d7ba6f81052f6f2f59
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983505
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2021-07-08 05:32:04 +00:00
Nicholas Verne
fde29976b1 crosvm: deprecate wayland-dmabuf flag.
The flag sets a config option wayland_dmabuf which is
no longer used. Deprecating the flag first, then
a separate CL will remove it once callers no longer
set it.

BUG=b:192823933
TEST=cros_workon_make --board=nami crosvm --test

Change-Id: Iea0bc6d89ed8991351eecff357b43c8eb74c553b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3008479
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Nicholas Verne <nverne@chromium.org>
Reviewed-by: Fergus Dall <sidereal@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-07-08 02:12:33 +00:00
Dennis Kempin
75eef5f065 Docker: Do not curl | bash
Instead, download the rustup-init binary directly and verify it's sha
before executing.
Also update debian image used in the bundled VM. The previous image
file was no longer available.

TEST=Rebuilt docker images
BUG=b:192355221

Change-Id: I8a2d8091b9cecdf40ecbdd4bb6cef7ca161421d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3011343
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-07-07 23:55:27 +00:00
Chirantan Ekbote
5401edf519 Make vhost-user-devices a workspace member
We don't actually need vhost-user-devices when building crosvm so make
it a workspace member instead.

BUG=b:179755651
TEST=cargo test

Change-Id: Id39e37b3d2e59fd040e1c70a58d1b9b7f8380e36
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2987591
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-07-07 19:00:44 +00:00
Andrew Walbran
fb7c108f15 Add methods to create composite disk image.
This can be used like:
crosvm create_composite composite.img partiton1:partition1.img partition2:partition2.img

BUG=b:190503456
TEST=cargo test

Cq-Depend: chromium:2982777, chromium:3008399
Change-Id: I31a9afe1e5f1e2a850ce1f892122150bcf3441b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2972869
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Andrew Walbran <qwandor@google.com>
2021-07-07 15:59:02 +00:00
Federico 'Morg' Pareschi
da1f83c0b3 vhost_user_devices: Add vhost-user console
Add a new vhost-user device binary implementation.

Example command to launch the device:
vhost-user-console-device --socket test

BUG=b:179755825
TEST=run crosvm with vhost-user-console and the console comes up

Change-Id: I4bb06e058523b73cb01fbe993e0fe7f9e4ee6423
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2951187
Auto-Submit: Morg <morg@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Morg <morg@chromium.org>
2021-07-07 03:55:04 +00:00
Chirantan Ekbote
eff60328c1 Add a From impl for async errors to io::Error
Sometimes users of cros_async need to return an io::Error.  Provide a
conversion function to convert the various async errors into an
io::Error.  This allows callers to access the underlying error without
forcing us to expose these internal implementation details.

BUG=none
TEST=unit tests

Change-Id: Ie0ab00cb80ea58f628a38c173e28babf30b8d5b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3006308
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-07-06 11:35:26 +00:00
Nicholas Verne
b57c124e86 crosvm: Delay RutabagaGralloc creation
RutabagaGralloc::new can cause a thread to be spawned
inside the crosvm process (via libgdm). This is not
allowed before crosvm has forked off its device
process children.

BUG=b:192823933
TEST=Build and deploy on nami, no problems detected with
Crostini graphics.

Change-Id: I9d86e299923c7c4ca3cdd6c54ad03c13e3011564
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3005196
Auto-Submit: Nicholas Verne <nverne@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Nicholas Verne <nverne@chromium.org>
2021-07-05 23:07:39 +00:00
Andrew Walbran
4cad30a560 Handle /proc/self/fd/N specially for kernel, bios and initrd.
This was already done for block device images, so reuse the same logic.

BUG=b:192256642
TEST=cargo test

Change-Id: Ifa69c0170ac39fc13eab61024d31e6ee5b2dd97c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3000986
Auto-Submit: Andrew Walbran <qwandor@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Andrew Walbran <qwandor@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-07-05 11:58:50 +00:00
Federico 'Morg' Pareschi
70fc7deb09 devices: virtio: Add vhost-user-console to the vmm
This adds a vhost-user console to the vmm, which will be enabled by
`--vhost-user-console <socket path>` option.

BUG=b:179755825
TEST=launch crosvm with --vhost-user-console and connection happens

Change-Id: I6339c6cde3a221fd3e6a1652474e17344c73d6d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2814058
Auto-Submit: Morg <morg@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Morg <morg@chromium.org>
2021-07-05 02:26:54 +00:00
Jason Macnak
64f1e3ac99 gpu_display: Fix up display destruction
Ensures that GpuDisplayImport and GpuDisplaySurfaces
are dropped before DisplayT (changed in crrev.com/c/2852523).

Also, call destroy on the new wayland surface metadata object
on drop.

BUG=b:189933900
TEST=launch Cuttlefish and `adb reboot`

Change-Id: I6718b03dc01e29c9b6e68189cf540a5a5cf93617
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3002149
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
2021-07-02 19:28:45 +00:00
Alexandre Courbot
ab6c4822a6 virtio: video: decoder: pass output format along with number of buffers
The output buffers must all have the same pixel format, therefore it
doesn't make sense to pass it with each buffer we import. Instead, pass
it alongside the number of output buffers (before any buffer is
imported) and let the backend remember it.

BUG=b:161774071
BUG=b:169295147
TEST=arc.VideoDecodeAccel.h264_vm passes on hatch
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch

Change-Id: I1890ad24f9874ed3c674a7bdf7d4be303ba24e92
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983094
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-07-02 14:43:36 +00:00
Alexandre Courbot
93d7a12cf9 virtio: video: decoder: use mutable references for state-changing methods
Methods that mutate the backend should take a mutable reference to self.
This problem was not apparent with the VDA backend since libvda's
methods themselves are not mutable, but this will cause issues with
backends that include more of their own data.

BUG=b:161774071
BUG=b:169295147
TEST=arc.VideoDecodeAccel.h264_vm passes on hatch
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch

Change-Id: I61cc64b6cbb9f4d1633c6a0acc188bbfc8dd0c54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983093
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-07-02 14:43:35 +00:00
Alexandre Courbot
ce6515a1c4 virtio: video: make Rect struct comparable
This is useful for e.g. unit tests.

BUG=b:161774071
TEST=arc.VideoDecodeAccel.h264_vm passes on hatch
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch

Change-Id: Ica409926c9da6c788a60134fa3f609db97f4aaa4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983092
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: David Staessens <dstaessens@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-07-02 14:43:34 +00:00
Alexandre Courbot
ed3c374b29 virtio: video: merge similar frame plane structs
We are using similar structures for describing the planes of a frame in
the decoder and encoder. Consolidate them into a single structure
accessible from the shared format module.

BUG=b:161774071
TEST=arc.VideoDecodeAccel.h264_vm passes on hatch
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch

Change-Id: I289c896e022cbb0952a1f2be626b3f8a6caaf13e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983091
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: David Staessens <dstaessens@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-07-02 14:43:33 +00:00
Alexandre Courbot
7704e3e196 virtio: video: use Descriptor to return the event pipe
The interface to return the event pipe for a backend currently requires
a &File to be returned, which is not very appropriate since the file
only serves as a proxy to the pipe's file descriptor.

Although libvda uses this structure to return its event pipe, this won't
be the case for all backends, so change the interface to return a
non-owned Descriptor, which is more generic and suitable to the task.

BUG=b:161774071
TEST=arc.VideoDecodeAccel.h264_vm passes on hatch
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch

Change-Id: I73dc66ba59e023a77d7b8e0efe533ec7805cf441
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983090
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: David Staessens <dstaessens@chromium.org>
2021-07-02 14:43:32 +00:00
Alexandre Courbot
520ec1bb2f virtio: video: use thiserror in the command module
This reduces the code a little bit.

BUG=b:161774071
TEST=arc.VideoDecodeAccel.h264_vm passes on hatch
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch

Change-Id: I547d0d26a1a69bc50af4df9b6bb2b4016ff760c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983089
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: David Staessens <dstaessens@chromium.org>
2021-07-02 14:43:31 +00:00
Woody Chow
1e3022c922 cros_async: Add Send to async_from
This allows struct using IoSourceExt to be Send

BUG=None
TEST=cargo test

Change-Id: I7541977151537387da59b0ada5592a77a0382998
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3002823
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Woody Chow <woodychow@google.com>
2021-07-02 13:11:46 +00:00
Hikaru Nishida
584e52c287 crosvm: Remove balloon sizing logic
This CL removes balloon sizing logic from crosvm. The logic will be
moved into concierge.

BUG=b:181267848
TEST=emerge-$BOARD chromeos-base/crosvm
TEST=crosvm balloon <balloon size here> /run/vm/*/arcvm.sock
TEST=confirmed that the balloon size is changed only by manually

Disallow-Recycled-Builds: test-failures
Change-Id: I5a8b64cb5966a568b507eba233f647961c179dfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2853172
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Hikaru Nishida <hikalium@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-07-02 09:31:36 +00:00
John Bates
ef085de490 allow libglvnd to be used for rendering
BUG=b:177358466
TEST=vmc start --enable-gpu

Change-Id: I79bd74d69d78b9b0c4e120b318b58cef5401cb08
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2848282
Auto-Submit: John Bates <jbates@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: David Riley <davidriley@chromium.org>
Commit-Queue: John Bates <jbates@chromium.org>
2021-07-02 02:00:38 +00:00
Zach Reizner
9c9fd5fcf5 book: add features chapter
TEST=mdbook docs/book
BUG=None

Change-Id: I1a9c0553e801c293b42fd3f2f4c7b03357cb6f29
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2991093
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-07-01 16:28:33 +00:00
Zach Reizner
7a96510dcd book: add mermaid-js support
TEST=mdbook docs/book
BUG=None

Change-Id: I63c487e3718ed47f7084b211fa398422b8b571fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2991090
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-07-01 16:28:32 +00:00
Zach Reizner
81f717b152 book: add sandboxing chapters
BUG=None
TEST=mdbook docs/book

Change-Id: Idadd7c807ea37a27cfdc90cb1280762e98253ea2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2991089
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-07-01 16:28:31 +00:00
Zach Reizner
c663173cae book: add initial book using mdbook
This change adds a document that was already written, but never
published before. Also, the summary includes a skeleton of chapters to
be filled in by future changes.

TEST=mdbook build docs/book
BUG=None

Change-Id: If1d6e295b6d5a639f728f5de0df73de094399166
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2982861
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-07-01 16:28:29 +00:00
Xiong Zhang
10f15050d0 Linux: Extract vfio device creation code for vfio runtime add/remove
Vfio device could be created at vm creation or vm running through hotplug,
extract the create_vfio_device() code, it could be called by both.

While Only one VfioContainer exists in a vm, it could be created at vm
creation or vm running also, so a global VfioContainer variable is used.

BUG=b:185084350
TEST=Boot a guest with passthrough device

Change-Id: I87b6a32975279280d6ee51c2451b0c8451b37906
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2954670
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-07-01 06:03:20 +00:00
Jorge E. Moreira
7cbfbb599f Fixes typo and adds missing fd to keep_fd list in vios_client
BUG=b:191297702

Change-Id: I677a35ce961a35d68a39b1ee9e6aa6180b010afe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983387
Auto-Submit: Jorge Moreira Broche <jemoreira@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Jorge Moreira Broche <jemoreira@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-06-30 21:02:50 +00:00
Pi-Hsun Shih
f78b278d0f Revert "sync: Add wait_while variants to condvar wrapper"
This reverts commit 01743e49eb.

Reason for revert: break snapshot builders: https://ci.chromium.org/ui/p/chromeos/builders/postsubmit/atlas-snapshot/39409/overview

Original change's description:
> sync: Add wait_while variants to condvar wrapper
>
> wait_while and wait_timeout_while are similar to wait and wait_timeout,
> but they implicitly wrap the wait in a while loop to handle spurious
> wakeups.
>
> BUG=b:192243046
> TEST=cargo test
>
> Change-Id: I2b4c2b6784df9128872772880e7045a09d1d8c22
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2992161
> Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Benjamin Gordon <bmgordon@chromium.org>

Bug: b:192243046
Change-Id: I64794afd5b1df9d513da01944017affbba479d90
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2995507
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-06-30 04:23:47 +00:00
Chia-I Wu
d8921baae1 seccomp: gpu: allow getcwd
The Vulkan validation layer wants to search the current working
directory for vk_layer_settings.txt.

BUG=b:191082452
TEST=run vulkan apps in the guest and observe validation errors being
     logged in the host

Change-Id: Iece467f72162efc730b74a8dd6075c7b624aa0bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2959464
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-06-30 03:10:55 +00:00
Benjamin Gordon
01743e49eb sync: Add wait_while variants to condvar wrapper
wait_while and wait_timeout_while are similar to wait and wait_timeout,
but they implicitly wrap the wait in a while loop to handle spurious
wakeups.

BUG=b:192243046
TEST=cargo test

Change-Id: I2b4c2b6784df9128872772880e7045a09d1d8c22
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2992161
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Benjamin Gordon <bmgordon@chromium.org>
2021-06-30 02:38:43 +00:00
Jason Macnak
114d7d7ccd gpu_display: Add opt wayland ext for sending scanout id
Cuttlefish's streaming server, which acts as a Wayland compositor
in order to receive display framebuffers from Crosvm, needs some
mechanism to tell which Wayland surface corresponds to which display
(a "display" is a "scanout" in virtio-gpu terminology).

Wayland object ids can not be directly used for this as all Wayland
objects share a single global id space (so the first created Wayland
wl_surface surface object may have id = 15).

Previously, the case of unchanging displays was handled by enforcing
the creation order of surfaces within Crosvm so that Cuttlefish's
streaming server (which is a Wayland compositor) could assume the
creation order corresponded to the display order. However, this still
experienced issues (b:186580833) when surfaces were destroyed and
later recreated when handling `set_scanout(..., resource_id = 0)`
commands.

There is also an ongoing effort to support adding and removing
displays at runtime in (see aosp/1671968) which experiences the
same issue. When surfaces are arbitrarily created and destroyed,
Cuttlefish's streaming server has no way to determine which Wayland
surface corresponds to which display.

To solve all of this, this change introduces an extension to allow
Wayland clients (Crosvm) to attach additional metadata (scanout_id)
to Wayland objects (surfaces) so that Wayland compositors (Cuttlefish's
streaming server) can exactly determine which surfaces correspond
to which displays. I will attempt to upstream this protocol (tracked
in b:191901112).

BUG=b:188904670
BUG=b:187351899
BUG=b:191901112
TEST=launch Cuttlefish with single display
TEST=launch Cuttlefish with multiple displays
TEST=launch Cuttlefish and hotplug some displays

Change-Id: I2aa4b714a49e4d85b6a3c705ba0d5bc1720b838e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2909903
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
2021-06-30 02:22:14 +00:00
Chirantan Ekbote
b7cc9f2084 Condvar: Add wait_while and wait_timeout_while
Also use a single &'static str for the panic message.

BUG=b:179755651
TEST=cargo test

Change-Id: I48172ebf0b59ca9c021c1f451badbe7090743f23
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2987584
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-06-29 15:20:59 +00:00
Chirantan Ekbote
79bcb99530 cros_async: Make block_on a top-level function
This doesn't really have anything to do with synchronization so move it
into its own module and export it as a top-level function.

BUG=b:179755651
TEST=cargo test

Change-Id: Icb733c36ee1d4cebcb445e47289c92b9b77a278b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2987583
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-06-29 15:20:58 +00:00
Woody Chow
1dbffd13c6 devices: vios: Move functions to handle enums to common.rs
The new cras_backend to be implemented will use these functions

BUG=b:179757101
TEST=cargo test

Change-Id: Ie1777d79a16303e562740b2e02f6b509fab4ef92
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2993704
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Woody Chow <woodychow@google.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-06-29 10:38:47 +00:00
Zide Chen
25e61a71e8 vm_memory: implement get_host_address_range() for GuestMemory
This new API converts a GuestAddress to a host pointer and verify that
the provided size define a valid range within a single memory region.

BUG=b:181736020
TEST=cargo test and bin/clippy

Change-Id: Ie9f6c674a2b414837dae5c4e496bdc32ed606e73
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2757274
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-06-29 05:16:54 +00:00
Jason Macnak
d659a0db2f devices: gpu: Support multiple displays
Updates virtio-gpu frontend to track multiple
scanouts and the resources set for those scanouts.

Adds a --gpu-display command line arg to avoid having
to create a very complicated --gpu string.

BUG=b:173523402
TEST=launch Cuttlefish w/ multiple displays
TEST=(see change series at aosp/1652814)

Change-Id: I73174c11f35f865b8b67ae77d8169d6812f85535
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2836265
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
2021-06-29 04:18:37 +00:00
Dennis Kempin
b1bffc9845 OWNERS: Remove zachr, change denniskempin to google.com
Change-Id: I10d37554c171e224510b7877f2f1634a4b573227
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2993289
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-06-28 22:33:11 +00:00
Keiichi Watanabe
36c91c733e vhost_user_devices: net: Remove obsolete comments
BUG=none
TEST=CQ

Change-Id: I50d04cf9d7b526a3dfcd1d70640f00fe5dfc78c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2977149
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2021-06-28 21:34:07 +00:00
Keiichi Watanabe
b128645dc5 vhost_user_devices: net: Support ctrl queue
BUG=b:182430355
TEST=run `ethtool -K eth0 lro on` in guest

Change-Id: I56538c341d1967e75eb461a656fa0162b2f614be
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2964521
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-06-28 21:34:05 +00:00
Keiichi Watanabe
4032487443 devices: virtio: vhost-user: Allow using legacy PCI IRQ as call fd
If a guest driver doesn't enable MSI-X vector, vhost-user device will
use a legacy PCI IRQ as call fd instead.

BUG=none
TEST=crrev.com/c/2964521

Change-Id: I92715687f7bd85743d9668f668835c01eac8a551
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2977143
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2021-06-28 21:34:04 +00:00
Keiichi Watanabe
2fedf5fd84 vhost_user_devices: Fix tests for DeviceRequestHandler
Fix bugs in tests for DeviceRequestHandler.

BUG=none
TEST=cargo test

Change-Id: I2f41e5ab6dca8abf31ab597fa5b4d59aa35348fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2984015
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2021-06-28 20:40:40 +00:00
hscham
a7fd914538 crosvm: add memfd_create to seccomp policy files
To enable SupportsChannelUpgrade in libchrome (upstream r850346,
crrev.com/c/2670092).

BUG=b:189403036
TEST=tast run $hatch-DUT
         arc.Notification.vm
         arc.CheckAndroidVersion.vm
         arc.RemovableMedia.vm
         arc.Gamepad.vm
         arc.IMEBlockingVK.vm
         security.SELinuxFilesDataDir.vm
         arc.StartStop.vm
         arc.CPUSet.vm
         arc.Optin.vm
         arc.IntentForward.vm
         arc.MIDIClient.vm
         arc.IMESwitchShortcut.vm
         arc.ChromeCrash.vm_logged_in
         arc.Boot.vm
         arc.BuildProperties.vm
         arc.ConciergeCrash
         arc.VMPstoreDump
         security.SELinuxProcessesARC.vm
         security.NetworkListenersARC.vm
     with disable patch removed in libchrome

Change-Id: I1a924c60ebe9707627fdd064b2233a7452d5cc57
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2984719
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Qijiang Fan <fqj@google.com>
Commit-Queue: Grace Cham <hscham@chromium.org>
2021-06-28 04:40:43 +00:00
Alexandre Courbot
e2a61d3289 virtio: video: encoder: vda: increase buffer ID on success
use_output_buffer() can fail, in which case we won't have processed any
buffer. Increase our ID counter only if we are confident a buffer with
the assigned ID will eventually be delivered.

BUG=b:161774071
TEST=arc.VideoDecodeAccel.h264_vm passes on hatch
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch

Change-Id: I37ad68059854182795ff631b3816614058444900
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983088
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: David Staessens <dstaessens@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2021-06-26 03:20:13 +00:00
Dylan Reid
60efe11939 OWNERS: Remove dgreid
denniskempin will inherit fuzzing or find someone to.

Change-Id: Icb4dc76949726c0d958dab41228ba848ec292c94
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2988148
Auto-Submit: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2021-06-25 19:42:12 +00:00
Stephen Barber
a7da32ddd4 OWNERS: remove smbarber
meme/5825845511061504

BUG=none
TEST=none

Change-Id: I23a2e87c745dc806ff046d545c902f6ef6565304
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2988147
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
2021-06-25 19:08:26 +00:00
paulhsia
0647350018 Add paulhsia@ to owners
To approve audio patches.

TEST=None
BUG=None

Change-Id: Iad841b764dcd691bdb2a015bf9556156a51161e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2987719
Auto-Submit: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-06-25 14:17:31 +00:00
Allen Webb
113ae363f9 vcpu: Fix import for later protobuf releases.
Unblock the rust toolchain upgrade by unblocking the protobuf upgrade.

Later versions of dev-rust/protobuf do not export CodedOutputStream from
protobuf::stream anymore.

BUG=b:191365098
TEST=cargo build

Change-Id: I21c76605eb16a3b456f3608afbb0a7c507306d78
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2978853
Auto-Submit: Allen Webb <allenwebb@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-06-24 13:31:48 +00:00
Ryo Hashimoto
c54cf6c8e9 power_monitor: Upgrade dbus to 0.8
To be consistent with other Chromium OS rust code.

BUG=b:190791826
TEST=cat $(find /sys -name voltage_now 2>/dev/null)

Change-Id: I578bddc14259b32ffed709a8d4b490cabb6a435d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2970820
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
2021-06-22 05:44:42 +00:00
Louis-Francis Ratté-Boulianne
09954ae8fd virtio: gpu: add QueueReader trait to consume a queue
There are two implementations:

 * SharedQueueReader: Thread-safe (protected with a mutex)
 * LocalQueueReader: Not thread-safe

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Change-Id: I9ac746660e666fde81f3b5e2909422fd8922c43e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2845983
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-06-22 01:12:59 +00:00
Louis-Francis Ratté-Boulianne
7bc4251f27 rutabaga_gfx: add support for fence completion callback
It allows Rutabaga library users to set a fence callback on the
component builder or while creating a context. The handler is
called when a fence is signaled as completed and could
be executed from another thread.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Change-Id: Ia9176bf2f0822a0076bed6a7a09e709b426aa620
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2845982
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2021-06-22 01:12:58 +00:00