Commit graph

5537 commits

Author SHA1 Message Date
recipe-roller
98c490e098 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8792965915657022497

depot_tools:
7a81ebf111
  7a81ebf (brucedawson@chromium.org)
      Add .rs to list of presubmit source file patterns

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I87eeaa86b4b0ee66af2d1699fb296a997191ec82
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4131129
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2023-01-03 18:59:29 +00:00
Vikram Auradkar
b375cbf575 crosvm: reduce kiwi feature flag usage
BUG=b:260601120
TEST=NONE

Change-Id: I7b0de67b21d981fd446c32abc0380f0a50e2cfeb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4126246
Reviewed-by: Richard Zhang <rizhang@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-01-03 17:31:31 +00:00
recipe-roller
504899212d Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8793081047555935185

recipe_engine:
46fb59926a
  46fb599 (chromium-autoroll@skia-public.iam.gserviceaccount.com)
      Roll CAS Client from 02ae470ec2d1 to 89298485414b

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I86af0013417392317f73fe58673690f5a3f6fb2e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4130671
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2023-01-02 12:32:47 +00:00
Jorge E. Moreira
3a3c1fb03b Add statx to vios audio device policy
BUG=b/254212930
TEST=run cuttlefish locally

Change-Id: I76fce661eb93c19afc8aa95c47eb2a8861161ddc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4126253
Auto-Submit: Jorge Moreira Broche <jemoreira@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
2022-12-29 20:31:45 +00:00
Daniel Verkamp
000e65339e e2e_tests: fix direct feature check
Two small tweaks:
- The original check had a typo ('features' vs. 'feature').
- Use the cfg! macro to simplify the code (cfg_if! is not needed here).

BUG=None
TEST=tools/presubmit --all
TEST=crosvm CQ

Change-Id: Icf84c24cb7f34bf4629e99ee1d7d33676e7ae8c1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4126555
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-12-28 01:47:49 +00:00
recipe-roller
5f1c21430b Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8793596315644092785

depot_tools:
03af44a516
  03af44a (brucedawson@chromium.org)
      Fix roll-dep commit message on Windows and add suggestions

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I22b7331c109f63fd9e8483866db32c285a48b4f0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4126715
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-12-27 19:55:50 +00:00
Federico 'Morg' Pareschi
912b70b741 cros_trace: Add initial trace_marker backend
This CL adds a new backend for the cros_tracing crate. This backend can
be enabled by building crosvm with the trace_marker feature enabled.
When the feature is not enabled, no extra overhead incurs as the default
NOOP cros_tracing crate will be compiled in instead.

BUG=b:259501910
TEST=compiled and ran crosvm with and without `--features trace_marker`

Change-Id: Ia4b929b042712a458b7d54c0362d6fda90db9e9f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4075413
Reviewed-by: Christian Blichmann <cblichmann@google.com>
Auto-Submit: Morg <morg@chromium.org>
Commit-Queue: Morg <morg@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-12-23 06:21:24 +00:00
recipe-roller
d7c0c57500 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8794046784645416993

depot_tools:
0b96058844
  0b96058 (orrb@google.com)
      Add an option to 'git cl web' to print the issue URL instead of...

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: Ib7bf5141a16f52c29ce529070c3c549117513a98
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4122800
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-12-22 20:38:57 +00:00
Richard Otap
86cfe470b2 broker: Actually pass ui_exceptions to sandbox
We were always passing a `0` for `ui_exceptions` for the sandbox
policy's job object, where we should have been passing the value
specified in the policy. This meant we were stricter than we specified
in the policy, but also that we could not be as strict with our job
object as we wanted to be, as we couldn't make use of exceptions.

BUG: b:262445398
TEST: Built and ran windows crosvm downstream.
Change-Id: I7df0282dbfadb33550956c2461b7dc084116617f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4103909
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Richard Otap <rotap@google.com>
2022-12-22 03:52:51 +00:00
Alexandre Courbot
1a2d0fb8f1 media: libva: remove udev dependency and make DRM device opening more flexible
Currently the only way to open a DRM device for libva is to scan the
list of DRM render nodes using udev. This works nicely for the general
case, but requires a few extra ioctls that are not currently added in
the video device process seccomp allowlist so we would like to get rid
of it.

One can also argue that how to detect the DRM device should be left to
the application, so this CL allows users to explicitly specify which DRM
device they want to open. As a helper, it also adds an iterator over
standard DRM render nodes locations to provide similar functionality
without requiring extra ioctls.

BUG=b:262824148
TEST=ARCVM can start and create a VAAPI-backed video device without
triggering seccomp policy failures.

Change-Id: I241c4834361ec1e8455a4307093850a7b3cef276
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4112728
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.corp-partner.google.com>
2022-12-22 03:07:55 +00:00
Elie Kheirallah
7607ae7b4a devices: cmos: Add sleep/wake/snapshot/restore to Cmos.
Add implementations to functions sleep, wake, snapshot, restore.
Sleep and wake only modify the device state to avoid reading/writing in
sleep.

Bug=b:232437513
Test=tools/dev_container tools/presubmit --all

Change-Id: I68e293a227471dc6b70fc5e78397c4745d48735e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4096009
Auto-Submit: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Steven Moreland <smoreland@google.com>
2022-12-21 23:55:23 +00:00
Idan Raiter
54a1f43c2e rutabaga_gfx: Make Vulkano gralloc initialization non-fatal
When the Vulkano feature is enabled, we create a vulkano-gralloc. But,
some users can be running the host-ANGLE stack, never using Vulkan.
Potentially, they have no Vulkan devices, which would fail
vulkano-gralloc.

The simplest change to avoid this is to make a vulkano-gralloc error
acceptable, by issuing a stern error! and continuing. Then, it is
safe to enable the Vulkano feature without worrying about breaking
existing users.

BUG=b:243061269
TEST=Manually error'd in vulkano-gralloc but still launched emulator

Change-Id: Ic39e1c6c43b208e41aed3ecc86b4876aaf47d729
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4119065
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2022-12-21 19:35:57 +00:00
Daniel Verkamp
01b1fd11ce devices: fs: avoid Arc::clone when incrementing refcount
The increase_inode_refcount() function just needs a temporary reference
(&InodeData), not a full Arc<InodeData>. Removing the Arc::clone() gets
rid of a few extra atomic operations, since the Arc would be cloned and
then dropped immediately after calling increase_inode_refcount(), even
before leaving the calling function.

BUG=b:261922849
TEST=boot arcvm on brya

Change-Id: I285f0a31150695fb8ebeebc2c9d4c33a71702833
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4116248
Reviewed-by: Morg <morg@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-12-21 19:22:30 +00:00
Daniel Verkamp
122991293c devices: fs: hold inodes lock throughout add_entry()
There seems to be no downside to holding self.inodes.lock() for the
whole PassthroughFs::add_entry() function. We don't do any siginificant
amount of work while the lock is held; either the inode already exists,
in which case we increment its refcount, or the inode is added to the
map. Note that we already opened the file before entering this function,
so the lock is not held across open().

This also prevents the possible race between threads opening the same
inode simultaneously, so remove the related comment.

BUG=b:261922849
TEST=boot arcvm on brya

Change-Id: I036ebaed179f7ac43d071a26cb68ba9a131521a0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4116247
Reviewed-by: Morg <morg@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-12-21 19:21:08 +00:00
Alexandre Courbot
8b22c63a7f crosvm: allow video process to open DRI device with VAAPI
The VAAPI decoder backend needs to open the DRI render node in order to
function. Add the necessary code to allow this to happen in a jailed
environment.

BUG=b:262824148
TEST=ARCVM can start and create a VAAPI-backed video device.

Change-Id: I130963ab9c2d1d0a008b674f0f606fa2dbba8dd9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4112727
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-12-21 13:37:01 +00:00
recipe-roller
06c7884557 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8794214768937239729

depot_tools:
cf31045b34
  cf31045 (martiniss@google.com)
      Remove martiniss from OWNERS

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I99eb7711a03a084ce9d0b09f827e54fc483607a0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4119504
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-12-21 00:07:26 +00:00
Daniel Verkamp
4a57d13173 windows: make gpu_vmm_config optional
This allows `crosvm run` to work without requiring a `--gpu` option,
which matches the behavior on Linux. The VM is fully functional and can
boot a Debian guest to a working login prompt and shell on the serial
port.

BUG=b:243061269
TEST=tools/dev_container tools/run_tests --platform=mingw64
TEST=boot x86-64 Linux bzImage on Windows

Change-Id: I828893cb6349c39b971aca0fccaa67c3238a7f3d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4108050
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Idan Raiter <idanr@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
2022-12-20 21:44:38 +00:00
Daniel Verkamp
d5e5741946 windows: refactor GPU and input creation into a fn
No functional change, just reorganizing the code that requires a
GpuVmmConfig into a separate function.

BUG=b:243061269
TEST=tools/dev_container tools/run_tests --platform=mingw64

Change-Id: I172579fa26ccdbc1c6cb1b8c1c6ac90d8bf37635
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4108049
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Idan Raiter <idanr@google.com>
2022-12-20 21:44:38 +00:00
recipe-roller
e0e3c4cd16 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8794253146416300017

recipe_engine:
aed2176f4d
  aed2176 (yiwzhang@google.com)
      add USE_PYTHON3 = True to PRESUBMIT.py

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I422f27f733238161fff3308d467bd6d0c40bfef5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4118095
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-12-20 14:03:51 +00:00
Federico 'Morg' Pareschi
03c2eaeff9 Reland "fs: Reduce number of open() calls in passthroughfs"
This is a reland of commit 55a9bccead

The fix is to make sure we drop to the lock guard acquired by the
inodes mutex, so we don't end up in a deadlock. By splitting the if
statement and separating the else block, the guard is dropped
automatically.

Original change's description:
> fs: Reduce number of open() calls in passthroughfs
>
> Instead of always opening a new file every time we do an entry lookup,
> check first if the entry already exists in our inode map.
>
> I ran a trace test while loading a game on arcvm with and without this
> patch.
>
> Without patch:
> System-wide trace:
> newfstatat calls = 19211
> openat calls = 13189
> ~68% ratio of all newstat() calls vs openat() call
>
> virtiofs trace:
> newfstatat calls = 11958
> openat calls = 9899
> 82% ratio of virtiofs newstat() calls vs openat() call
>
> With patch:
> System-wide trace:
> newfstatat calls = 20242
> openat calls = 12954
> 64% ratio of all newstat() calls vs openat() call
>
> virtiofs trace:
> newfstatat calls = 2223
> openat = 273
> ~12% ratio of virtiofs newstat() calls vs openat() call
>
> This is a significant reduction of unnecessary syscalls in virtiofs
> (82% -> 12%)
>
> BUG=b:261922849
> TEST=loaded a game in arcvm and compared syscall % count
>
> Change-Id: I28acbae05900d9735ba3730ee106368ddc792476
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4091563
> Auto-Submit: Morg <morg@chromium.org>
> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>

Bug: b:261922849
Change-Id: Ib885cb5f2b3f725405df2eecc641228042ea2093
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4105201
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Morg <morg@chromium.org>
2022-12-20 06:42:18 +00:00
Takaya Saeki
a85d391fbb Revert "devices: virtio: create the Executor for the block before jail"
This reverts commit ca90b4d1bd.

Reason for revert: This causes issues for Cattlefish

Original change's description:
> devices: virtio: create the Executor for the block before jail
>
> To utilize the io_uring-based Executor with the sandbox, each device
> must create any `Executor`s before jailing.
>
> This commit has the virtio-blk device make its `Executor` in `new`
> method, which is called in the main process before jailing. This change
> allows the virtio-block device to run in the sandbox with io_uring.
>
> BUG=b:251039942
> BUG=b:262341514
> TEST=`crosvm run --rwdisk path=blkdisk.img,async_executor=uring` runs
> with and without the sandbox
> TEST=`crosvm run --rwdisk path=blkdisk.img,async_executor=epoll` runs
> with and without the sandbox
>
> Change-Id: Iadb002d436a9d45f63220528273f9d2e283fbd88
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4098933
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>

Bug: b:251039942
Bug: b:262341514
Change-Id: I23097d929a0e9f680e3aaa02f4d83d8f7e1ddb26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4114052
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Takaya Saeki <takayas@chromium.org>
2022-12-20 02:16:17 +00:00
Seungjae Yoo
1cc3ba1473 Force calling interrupt when msix is not supported
BUG=b:261814790, b:244541299, b:258160075
TEST=maunally test by running aosp_cf_arm64_phone-userdebug

Change-Id: I7169354dd28e09049de1410d04d953203b3001d4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4112726
Reviewed-by: Jeongik Cha <jeongik@google.com>
Commit-Queue: Seungjae Yoo <seungjaeyoo@google.com>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-12-19 23:20:16 +00:00
Daniel Verkamp
c11f01fbbb devices: vhost-user device: remove per-backend max_vring_len()
There is no mechanism in the vhost-user protocol for the VMM side to
ask the backend device for its max queue size, so the only way to ensure
compatibility with arbitrary VMM frontends is for the backend to support
the maximum valid size. The maximum queue size for both packed and split
virtqueues is 32768 (2**15), so we can use that as the max queue size
for all device types. The VMM frontend can still choose a smaller queue
size when it sends the VHOST_USER_SET_VRING_NUM request.

BUG=b:262291811
TEST=tools/presubmit --all
TEST=Boot x86-64 Linux from a vhost-user block device attached to crosvm

Change-Id: Ie685ea7718f738ef19c1bc27132bbe5fc0466607
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4098493
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-12-19 22:10:28 +00:00
Elie Kheirallah
a5dec24be2 devices: change serializing to have a better format
Change format of serialize, reduce nesting.

BUG=b:232437513
Test=tools/presubmit --all

Change-Id: I9afaf5a714cd3fca8927caa0e092770015f1d466
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4113014
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Elie Kheirallah <khei@google.com>
2022-12-19 20:59:05 +00:00
Changyuan Lyu
da9ba09030 cmdline: let tap from fd and name support vhost
Previously flag `--vhost-net` had no effects if a tap device is
provided by `--tap-fd` or `--tap-name`. `--net` did not support
`vhost-net=true` for the two cases neither.

This commit adds vhost-net support to those two cases.

TEST=tools/presubmit
TEST=cargo test -p devices
BUG=None

Change-Id: I38d149d76512e5b56e5b86e129bf44afe12a1d9a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4081878
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Changyuan Lyu <changyuanl@google.com>
2022-12-19 17:59:33 +00:00
Alexandre Courbot
b03dbe84ad devices: vhost: user: fix parsing of --serial parameter for devices command
The VhostUserParams struct uses a fake flattening technique to allow the
addition of the `vhost` parameter, but it relies on FromArgValue, not
Deserialize. Make sure to call the right method and add a TODO item so I
don't forget to revisit before enabling configuration files for the
`devices` command.

BUG=b:262345003
TEST=crosvm devices --serial vhost=/tmp/vu-console,type=stdout,hardware=virtio-console,console=true

Change-Id: I4948ca8185a475d41ab0e9c547628455de71188d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4105302
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
2022-12-19 15:36:37 +00:00
Takaya Saeki
529b67e202 devices: virtio: vhost-user: move executor creation before jail.
This commit has  vhost-user devices implemented by `VhostUserDevice`
trait call `Executor::new()` before jailing, not after jailing . The
context is the jail for io_uring. For the effective io_uring jail, an
`Executor` must be created before jailing.

Currently, the virtio-block and the virtio-console are implemented by
`VhostUserDevice` trait. Thus, this change enables vhost-user block
and console to work with io_uring in the sandbox.

This change also updates the doc comment of `VhostUserDevice`.
`Executor` can be actually kept during jailing as this change does, so
the current doc comment is obsoleted. However, `VhostUserDevice` is
still powerful to ensure that every initialization for
`VhostUserBackend` is done in the jailed process.

BUG=b:251039942
BUG=b:262341514
TEST=`crosvm devices --async_executor uring --block ...` works with the frontend.
TEST=`crosvm devices --async-executor uring --jail --block ...` works with the frontend.
TEST=`crosvm devices --async_executor uring --serial ...` works with the frontend.
TEST=`crosvm devices --async-executor uring --jail --serial ...` works with the frontend.

Change-Id: I1365ef96c2f2f27cd63bdeb3d0ca327100a5dcdc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4098934
Commit-Queue: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-12-19 09:54:51 +00:00
Takaya Saeki
1a7d55d42e devices: virtio: fix missing deduplication of keep_rds
Minijail requires the `keep_rds` list to be unique, so you need to
deduplicate it before passing it to Minijail. This commit fixes missing
deduplication for the vhost-user devices.

This commit also fixes the wrong usage of `Vector::dedup()` of the
vhost-user fs device.

BUG=b:262339813
TEST=./tools/presubmit passes

Change-Id: Id8d8a5fb327a75a938315601ba67a91a698972c6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4112720
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Takaya Saeki <takayas@chromium.org>
2022-12-19 08:09:27 +00:00
Takaya Saeki
ca90b4d1bd devices: virtio: create the Executor for the block before jail
To utilize the io_uring-based Executor with the sandbox, each device
must create any `Executor`s before jailing.

This commit has the virtio-blk device make its `Executor` in `new`
method, which is called in the main process before jailing. This change
allows the virtio-block device to run in the sandbox with io_uring.

BUG=b:251039942
BUG=b:262341514
TEST=`crosvm run --rwdisk path=blkdisk.img,async_executor=uring` runs
with and without the sandbox
TEST=`crosvm run --rwdisk path=blkdisk.img,async_executor=epoll` runs
with and without the sandbox

Change-Id: Iadb002d436a9d45f63220528273f9d2e283fbd88
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4098933
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-12-19 08:09:27 +00:00
Elie Kheirallah
9ec59a22ec devices: bus: add info when device is missing from snapshot
add info when a device being restored doesn't have data in the snapshot.
No action would be taken on the device.

BUG=b:232437513
TEST=tools/presubmit --all

Change-Id: I67b5450f63aae693b44cb8cddda6d41aa88e6c9d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4114640
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Elie Kheirallah <khei@google.com>
Auto-Submit: Elie Kheirallah <khei@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
2022-12-17 00:56:45 +00:00
Gurchetan Singh
e76be0a8b7 rutabaga_gfx: rutabaga_gralloc: nuke Cargo.toml
No need for separate module.

BUG=b:173630595
TEST=compile

Change-Id: Ia88d64a9546322a9502fcd5bb24a0b6b9607a5d4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4114022
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-12-16 19:22:45 +00:00
recipe-roller
79857fe409 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8794665865110618465

depot_tools:
5decb17543
  5decb17 (vapier@chromium.org)
      cros: start warning for python 3.6/3.7 usage

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I3f95d43adccba0b70262235ad0633e27f513f6d9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4113006
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-12-16 00:40:27 +00:00
Frederick Mayle
c0672fd0f1 crosvm: treat unexpected child exit as error
If a child process exited, crosvm would exit with a status indicating a
success, as if the guest had requested a shutdown.

That behavior seems generally undesirable, but it has an added side
effect in Android, where some of the debug utilities (e.g. debuggerd)
work by forking the debug target (i.e. crosvm in this case), then, when
the debug fork exits, crosvm immediately exits itself. This CL doesn't
fix that, but at least makes it more obvious that something bad
happened.

BUG=b:238324526

Change-Id: I8fd86488f9401217100b82d433ea3d4f107ac526
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4108770
Reviewed-by: Steven Moreland <smoreland@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-12-15 21:01:21 +00:00
recipe-roller
af8855f85a Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8794741362463369825

recipe_engine:
dc46b6c283
  dc46b6c (weiweilin@google.com)
      [resultdb] support configuring -inv-properties(-file) via resul...

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: If5237e3afc171037314bdefba437d7bd4ae789fb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4110110
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-12-15 04:37:51 +00:00
Victor Ding
4112ba84ed devices: pcie: Allow RP to trigger PME for any of its children
PCIe root ports can raise PME for any of its children, and hence should
not be limited to raise PME for the port itself.

BUG=b:241526471
TEST=builds and boots borealis

Change-Id: I784e579c97424f0baa7190cd73b69d7a1d6f88b8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4105337
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Victor Ding <victording@chromium.org>
Auto-Submit: Victor Ding <victording@chromium.org>
2022-12-15 03:48:21 +00:00
recipe-roller
7ad1ecdfda Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8794748284753720529

depot_tools:
9ace9b4dc4
  9ace9b4 (weiweilin@google.com)
      [depot_tools] roll rdb

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I39f79a5a276cce7c5ffbf1cf0bf215a20a2868e1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4109597
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-12-15 02:47:49 +00:00
Shintaro Kawamura
9311c538c7 devices: virtio: net: refactor Net fields to be private
Visibility should be as minimum as possible in general.

The fields of Net was `pub(super)` so that windows support can create
the Net instance from `new_slirp()`.

Introducing `Net::new_internal()` enables to make the fields private and
also move the duplicated logic (e.g. creating kill_evt) into
`new_internal()`.

BUG=b:237342367
TEST=cargo build

Change-Id: Ieff79bbdc5cd8efa88caa00155d9c80cb51cc47f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4105332
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
2022-12-15 02:24:50 +00:00
Daniel Verkamp
8538b70759 cmdline: fix crosvm run help string
The ///-style docstring at the top of RunCommand was included in the argh
help output (`crosvm --help` and `crosvm run --help`), but the bulk of
the comment is intended for developers, not for users of crosvm.

Move the run subcommand's help to an explicit #[argh(description = "")]
so the docstring is not used as the help text.

BUG=None
TEST=crosvm --help

Change-Id: Iccb702203f376c304fc2825eec42471a3b48efd9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4109471
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-12-15 01:00:58 +00:00
Victor Ding
16741a7924 x86_64: Enable PME bit in _OSC
CrosVM supports PME and hence the PME bit in _OSC should be set.

BUG=b:241526471
TEST=Dump DSDT and verify

Change-Id: Ibc2cbec7096f7025724176834a9ae84c2ab18f04
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4105336
Auto-Submit: Victor Ding <victording@chromium.org>
Commit-Queue: Victor Ding <victording@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-12-14 23:57:32 +00:00
recipe-roller
fed24fbce1 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8794774708663436897

depot_tools:
18359bb9a1
  18359bb (yuanjunh@google.com)
      [depot_tools] roll lucicfg

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I188b098e40413c3b7452e07d9fc816b35db0eb40
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4108329
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-12-14 19:49:00 +00:00
Daniel Verkamp
20aff052cc devices: virtio: enable all vhost-user VMM frontends on all platforms
The vhost-user VMM code does not depend on the corresponding backend
being enabled (or even implemented) on the current platform. Enable all
devices unconditionally to simplify the vmm/mod.rs code and ensure that
the vmm code does not grow any new dependencies on platform-specific
imports.

The resulting Windows binary should not be any different, since it will
not call any of the newly-added device creation functions, but this
allows the cleanup of some unnecessarily platform-specific code.

Additionally, remove the unnecessary wildcard exports of each device
module, since the devices are just extra functions added to the
VhostUserVirtioDevice impl.

BUG=b:262291811
TEST=tools/presubmit --all

Change-Id: I0b7d6ee1ab75e5ca5e97216aef0b39018192bbd6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4098575
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-12-14 18:40:21 +00:00
Victor Ding
4fe595b67f devices: pci: pm: Rename PMC to PM to match the Specs
PCI and PCIe Specs describe the whole concept as PCI Power Management
Interface, and these registers as, for example, Power Management
Capabilities, Power Management Control/Status, etc. Therefore, PM (Power
Management) is a more accurate acronym than PMC (Power Management
Capabilities).

Linux also uses `pm` (`pci_pm`) instead of `pmc`.

No functional changes.

BUG=b:241526471
TEST=builds and boots borealis

Change-Id: Icab1a3fb3708b4e1fa65eeef918ecc8c047d177a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4105335
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Victor Ding <victording@chromium.org>
2022-12-14 18:18:30 +00:00
Daniel Verkamp
61dda97d91 devices: virtio: wl: move consts to device_constants
BUG=b:262291811
TEST=tools/presubmit --all

Change-Id: Iff78dca845aa26fdc4a2ceb6efbb3cac885fff23
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4098574
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-12-14 18:17:26 +00:00
Daniel Verkamp
748f807d7b devices: virtio: fs: move consts to device_constants
BUG=b:262291811
TEST=tools/presubmit --all

Change-Id: Ic4cf15274f0f5abc7fa7da9f32be746a623a5473
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4098573
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-12-14 18:09:51 +00:00
Daniel Verkamp
bb54c5e169 virtio_sys: add virtio_fs bindings
Replace the hand-written bindings in the virtio-fs device with
automatically generated bindings from bindgen.

BUG=None
TEST=./virtio_sys/bindgen.sh

Change-Id: Ia11a2d97f3546515196a41764107e7aaece8ad82
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4103907
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-12-14 18:07:51 +00:00
Alexandre Courbot
dde912b8d1 devices: serial: use kebab-case for serial parameters
Serial parameters fields should use kebab-case. Enforce it and add
aliases for fields using underscores for backward-compatibility.

BUG=b:255223604
TEST=cargo test -p devices

Change-Id: I2adf7f4161a83d32bca389fc413311b7f02216ce
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4105301
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-12-14 17:52:30 +00:00
Changyuan Lyu
011f538978 devices: virtio: net device creation code cleanup
For both virtio-net and virtio-vhost-net devices, clean up creation
code by providing a single new() function accepting a tap device.
Move tap device creation code to device_helpers.rs.

Booted VM with `--net tap-name=crosvm_tap` and
`--net host-ip=192.168.1.1,netmask=255.255.255.0,mac=\
  42:70:eb:61:1a:81,vhost-net=<false|false>`. Guests can ping
the host.

Tested that `cargo test -p devices` passes.

TEST=tools/presubmit
BUG=None

Change-Id: I75a3d47ba8750486abaa8ab70deea1805a7fc055
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4096607
Commit-Queue: Changyuan Lyu <changyuanl@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-12-14 17:38:47 +00:00
Vikram Auradkar
13f8029329 e2e_tests: Add windows tests
The windows code is build only for now because
- crosvm upstream windows code needs some changes to be runnable
- LUCI windows infra is not ready for nested vm

BUG=b:253498690
TEST=ran `cargo t --features all-msvc64 -p e2e_tests` downstream

Change-Id: I318f6f17fc91bc76cfd28741a526193362ab4e50
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4096606
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-12-14 14:21:51 +00:00
Alexandre Courbot
1db7f39cff video: decoder: vaapi: use generic H.264 decoder test
This test ensures that the decoder backend is working as expected from
crosvm's perspective, so add it.

We only add the guestmem to guestmem test as virtio object import
required actual DMABUFs with VAAPI, which our current dummy object
building code does not allow to create.

BUG=b:214478588
TEST=cargo test --features "video-decoder,vaapi" -p devices vaapi -- --ignored

Change-Id: I1e2a03262ef30d4dacbd9ae4314e158b6bcae428
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4096401
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-12-14 08:12:11 +00:00
Alexandre Courbot
bf1d3c1293 video: decoder: ffmpeg: move H.264 decoder test to the common backend code
Now that the H.264 decoder test function is generic, move it to the
parent module so other backends can also use it.

BUG=b:214478588
TEST=cargo test --features "video-decoder,ffmpeg" -p devices ffmpeg

Change-Id: I2ecc9fe09dd85c6d85a77f9e8e19005f55447a73
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4096400
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-12-14 08:06:41 +00:00