Commit graph

5248 commits

Author SHA1 Message Date
Dennis Kempin
b896b869e4 base: Extract integration tests
The extracted tests rely on access to system devices
or global state that prevent them from being run in parallel
or in restricted environments.

As an integration test they will be executed separately and
single threaded.

Updates the test runner to ensure integration tests are actually
run single threaded as intended.

BUG=b:244623061
TEST=./tools/run_tests base:\* --repeat 100 -p x86_64/mingw64/aarch64

Change-Id: I4267b9f79055208aca86796d902da251816bcada
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3971025
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-10-24 22:49:29 +00:00
recipe-roller
08bd3b167c 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/8799386345334112737

depot_tools:
ff5d25bb10
  ff5d25b (gavinmak@google.com)
      Add canned presubmit checks for corp links

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: I0fbbd3532bc50278464a686ce869dc3edd5b2609
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3975939
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-10-24 22:07:45 +00:00
Pujun Lun
eb3b49f185 gpu_display: better detection for window sizing/moving modal loop.
We do receive WM_ENTERSIZEMOVE when the window is about to be resized or
moved, but it doesn't tell us whether resizing or moving should be
expected. We won't know that until later we receive WM_SIZING or
WM_MOVING. There are also corner cases where we don't receive either
WM_SIZING or WM_MOVING in the modal loop, or receive both of them.

This CL adds an enum SizeMoveLoopState to track this state, so that we
can know whether the window is resizing or moving.

One alternative is to use WM_NCHITTEST to test whether the cursor is on
the window title bar (which implies moving the window) or window
borders/corners (which implies resizing) when WM_ENTERSIZEMOVE is
received. However, the user may also trigger resizing/moving from the
system menu (e.g. by right-clicking on the title bar and selecting it
from the drop down list), so this is not always reliable.

BUG=b:254702853
TEST=Tested in the Windows downstream

Change-Id: I8c8d97a7542b291c57dbddb75d785b324ff2776e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3975933
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-24 20:21:57 +00:00
Bastian Kersting
606bebceaf Bump scudo and enable corresponding feature
This CL bumps to the latest Rust-scudo version and re-enables
the corresponding feature, after it was disabled in crrev/c/3964927.
The fix introduced in https://github.com/google/rust-scudo/pull/6 was
submitted and is part of the 0.1.3 release of scudo.

BUG=None
TEST=health-check

Change-Id: I9c658cde9ea2d4cdf0d03110e2d015c8339e5267
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3973490
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-10-24 17:40:47 +00:00
Alexandre Courbot
d42277f43a resources: reject unknown fields when deserializing AddressRange
We will deserialize AddressRange from RunConfig, so make sure we error
on invalid parameters.

BUG=None
TEST=./tools/health-check

Change-Id: Ia4b5c62e61f3e12e40f400e199fc401773dbbdcc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3970365
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-10-24 02:56:12 +00:00
recipe-roller
0d1d1708f6 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/8799459327196252097

depot_tools:
61ef3d8647
  61ef3d8 (tikuta@chromium.org)
      remove reclient

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: I771520d9a5d5821c41c5ecf373ae204cc3286fcc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3973021
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-10-24 02:47:55 +00:00
Alexandre Courbot
96ebc3b96a crosvm: aerate RunCommand a bit
RunCommand is made of more than 100 (!) command-line parameters, each
with its own derive helper attributes. As we are going to add more of
the latter, add an empty line between each option to improve legibility.

BUG=b:218223240
TEST=./tools/health-check

Change-Id: I2873942e3b492789fa2367341055a5fe5f69b51e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3970361
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-10-22 15:41:43 +00:00
recipe-roller
d0f0fa9848 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/8799663795347091729

depot_tools:
9879712089
  9879712 (bsheedy@chromium.org)
      Run recipe git_cl under Python 3

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: Ie49f387c7f5341b19e03ceb2dee5a97eaf871b0e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3971027
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-10-21 20:37:30 +00:00
Pujun Lun
f8a6c29e60 gpu_display: use the unicode version of WinAPI everywhere.
The Windows official doc suggests that, "New Windows applications
should use Unicode to avoid the inconsistencies of varied code
pages and for ease of localization".

BUG=b:254702853
TEST=Tested in the Windows downstream

Change-Id: I159263d21ff5e9900c4bb79fe17bd0aa3aedae0d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3971022
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2022-10-21 18:01:48 +00:00
Alexandre Courbot
839577a796 media: libvda: allow to build without linking to libvda
libvda is only available on ChromeOS, and being unable to link to it
with regular builds reduces our build coverage.

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

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

Change-Id: I9bb60f6caf670081d67c91275727f3888272d64b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3947844
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-10-21 13:57:31 +00:00
recipe-roller
52b5462ba8 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/8799700287580809569

depot_tools:
8e2da91cbb
  8e2da91 (vadimsh@chromium.org)
      Fix UnboundLocalError in CheckLicense.

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: Ia792f116e179caf1bcb8cc634c4a519f5d09b450
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3971377
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-10-21 11:31:29 +00:00
David Stevens
60aa43629a devices: vhost-user: add protocol flag for shmem
Add a vhost protocol feature flag for shared memory region support. This
is necessary to avoid sending the GET_SHARED_MEMORY_REGIONS message to
backends which don't support it.

BUG=b:252901073
TEST=crosvm device wl

Change-Id: I044926e982526c3c76063b5386cab0db72524707
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3951472
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-10-21 01:09:07 +00:00
Dennis Kempin
89f0a34eff Disable scudo feature
The feature will trigger rebuilds on every cargo build invocation.
A fix is submitted: https://github.com/google/rust-scudo/pull/6
Until then, let's disable it.

BUG=None
TEST=health-check

Change-Id: Id328bd976b65674b50f9845490eb5083008781e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3964927
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 23:11:58 +00:00
Dennis Kempin
ca2049f982 Use previous bindgen version
The latest version is breaking minijail bindings and needs changes
to accomodate, which we cannot do until ChromeOS is updating it's
bindgen version as well.

BUG=None
TEST=make -C tools/impl/dev_container crosvm_dev &&
./tools/dev_container cargo build

Change-Id: I86476e4260154caf2aaf1b210490d466961b827f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3964923
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
2022-10-20 22:08:37 +00:00
Pujun Lun
4331e432c5 gpu_display: add F1-F12 and numpad equal key to keycode translator.
BUG=b:254702853
TEST=Tested in the Windows downstream

Change-Id: I932bac772acee48179b3d793be0f129c9bfed79e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3969223
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 21:25:37 +00:00
Daniel Verkamp
c433c9e796 base: remove Windows EventExt::new_with_manual_reset()
Replace the single new_with_manual_reset() call, which passed false to
create an auto-reset event, with a call to the more descriptive
new_auto_reset() function.

This allows the new_with_manual_reset() API to be removed.

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

Change-Id: I51d1fcbab161d10539c44689b31e2d86ad9e1527
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966482
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 21:15:41 +00:00
Daniel Verkamp
a364040b4b base: fix WaitContext doc tests
BUG=b:231344063
TEST=cargo test -p base -- --test-threads=1

Change-Id: Icf4dc6228eadb41aacbb49844089b1cadb6c5b5e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966481
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-10-20 21:10:14 +00:00
Daniel Verkamp
28d0f67858 base: event: add Event::reset() API
This allows resetting an Event without waiting on it. Windows already
had this functionality in its EventExt, and we can provide an equivalent
implementation for eventfd on Linux, so promote this function to the
cross-platform Event type.

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

Change-Id: I6dba3cb2e0b2d702e8a3f0dacf5c25c1dd044a13
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966480
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-10-20 21:04:14 +00:00
recipe-roller
129f66ec51 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/8799754395249021009

depot_tools:
3b9552584d
  3b95525 (brucedawson@chromium.org)
      Fix year comparison

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: I4d1ac6d94c0bb57046bc4de20b1efa9c48460c38
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3969222
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-10-20 20:37:40 +00:00
Daniel Verkamp
5f1f82469e crosvm: only enable --x-display option on unix
This command line option does not make sense on Windows, so enable it in
the RunCommand struct on unix platforms only.

BUG=None
TEST=cargo run run --help # on Windows, no --x-display option

Change-Id: Id091d1ae65dae6b897d59adc09f28f719f4e0a76
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3961531
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 20:30:55 +00:00
Noah Gold
81549b21d9 devices: add err code for disk image open failed.
Adds a new error code for when we fail to open a disk image. Also adds
an exit code we were missing upstream.

BUG=b:253348635
TEST=intentionally messed up the disk image path and verified we get
this error.

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

BUG=b:253348635
TEST=builds

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

BUG=b:244618506
TEST=presubmit

Change-Id: I72a63976310e635964645a1265a22518fc6cb694
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3967431
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 20:22:23 +00:00
Dennis Kempin
ad45660d22 Enable mingw64 builders on CQ, disable coverage.
This is awkward. The previous .star config had the builder only
on postsubmit, but the actual .cfg files were outdated and enabled
it on the CQ already. Luckily it's been green, we just need to
disable coverage collection for postsubmit to pass as well.

This should be prevented by a presubmit check, unfortunately we
cannot do so in a reliable way since we need to authenticate
with luci in order to validate configs, which won't work
in the docker container.

BUG=b:254316054
TEST=None

Change-Id: Ie46b91bc691c7d033ff882a976dc0462ecf57c70
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3967433
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2022-10-20 20:04:38 +00:00
recipe-roller
5774432b45 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/8799759429729631969

recipe_engine:
2d0544260e
  2d05442 (chromium-autoroll@skia-public.iam.gserviceaccount.com)
      Roll CAS Client from e1eba7cdc7fd to 50ab33853a8b

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: Ic09b9890eb9f6c6f35fa594e036b3be37b11c1e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3964925
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-10-20 19:14:30 +00:00
David Stevens
e72be7b593 devices: vhost-user: wl: fix shared memory
Fix shared memory support for vhost-user wl implementation. Handle
set_slave_req_fd being called before get_shared_memory_regions and make
sure the wl device only tries to get its shared memory mapper once.

BUG=None
TEST=crosvm device wl

Change-Id: I724712399bd6a9ffbffb22dd69d431f54df58282
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965812
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-10-20 09:22:29 +00:00
recipe-roller
cf303afa83 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/8799824843376671505

depot_tools:
a7949c2545
  a7949c2 (brucedawson@chromium.org)
      Fix license checks

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: I56cc42d9717f6f1f0ce8c8881210a077d9bc265a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3967439
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-10-20 01:55:52 +00:00
Sreenad Menon
877b350c4b devices: virtio: Determine block queue size and number of queues at runtime
Qualcomm has developed a wrapper program which uses CrosVM's libdevices
crate. Some Qualcomm products use 128 as virtio block queue size and
some of them use 256 depending on the memory constraints.
Number of virtqueues per device may also vary on different products.

This change lets virtio block new() function accept arguments that
specifies virt queue size and number of virt queues.
Qualcomm's wrapper program calls new() method with required number of
queues and queue size at runtime.

When they are not provided at runtime, they get their default values.

Change-Id: I71d8340e9a97009ae855cc0403d45f8c5c1cb55f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965432
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 01:25:48 +00:00
Sreenad Menon
5ad8b5afc5 devices: virtio: Always inject interrupts if hypervisor can handle
Gunyah hypervisor supports virtio-mmio transport only in some
products on which CrosVM is also used. Qualcomm has developed
a wrapper program which uses CrosVM's libdevices crate.

Gunyah hypervisor has some optimizations for how virtio-mmio
register access are handled. Normally they are synchronous access -
meaning any access of virtio-mmio register by a guest will cause
a fault, which requires blocking the guest VCPU until the access
can be served by CrosVM running in a different VM. Since that could
induce long delays for guest (esp since the OS in which CrosVM is
hosted is considered untrusted), Gunyah hypervisor caches all
virtio-mmio registers in its address space.
Any read access is handled without requiring intervention from CrosVM.
Write access is handled asynchronously - i,e a write will cause
hypervisor to updates its copy of the register, unblock the guest vcpu
and simultaneously notify CrosVM about the update.
By the time CrosVM gets to notice the update, guest could have
progressed lot more.

This works reasonably well for many devices and registers.
One problem case is writes to VIRTIO_MMIO_INTERRUPT_ACK, which signals
the guest having seen an interrupt. CrosVM seems to rely on synchronous
handling of this register write. Any attempts to kick guest via signal
method of 'struct Interrupt' (devices/src/virtio/interrupt.rs) skips
sending a kick if prior kick is "not yet" acknowledged, which fails
if writes to VIRTIO_MMIO_INTERRUPT_ACK is asynchronous.

This patch introduces a 'async_intr_status' flag in signal method which allows
the kick to be always delivered to guest independent of the status of
acknowledgement of prior kicks. Hypervisor will queue kick requests and
deliver another kick after current kick is processed.

Its expected that only the Qualcomm wrapper program will initialize the
interrupt object with 'async_intr_status' flag set and hence the upstream
CrosVM should not be affected because of this change.

BUG=b:243368499

Change-Id: I76568d9d8bc3be00c75c52d4a51d39410c5c35b3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965686
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 01:25:48 +00:00
David Stevens
aad6a554dc tools/cl: add confirmation for multi-cl uploads
Add a confirmation if multiple changes are being uploaded. This can help
catch errors such as being based on the wrong branch.

BUG=None
TEST=manual testing

Change-Id: Ia7ea75564628e25b09eda894bf45bd2a3f9e4f26
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960214
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-10-20 00:54:27 +00:00
Elie Kheirallah
eb27c46876 devices: adding Suspendable trait to BusDevice and PciDevice
Add supertrait Suspednable to BusDevice and PciDevice

Bug=b:232437513
Test=WIP

Change-Id: I74162399091fc4bc5fdef4bbeefb2639148bd283
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3924745
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Auto-Submit: Elie Kheirallah <khei@google.com>
2022-10-20 00:47:45 +00:00
recipe-roller
2cfd0293af 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/8799836183334245681

recipe_engine:
2302a33d68
  2302a33 (fmil@google.com)
      [misc] Fixes fake_bbagent.sh to work with non-chromium setups

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: Ic13fc53232cd0e62c59fe92aacc63cc31861a6dd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3967370
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-10-19 22:57:22 +00:00
recipe-roller
560601ccad 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/8799837441173500385

recipe_engine:
e9ec41a478
  e9ec41a (chromium-autoroll@skia-public.iam.gserviceaccount.com)
      Roll CAS Client from 0a7cca567fdd to 2673c9d7d4a3

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: Iad73036bf21de0f308fe2a5cf6875ec8877c99c7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966927
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-10-19 22:35:32 +00:00
Frederick Mayle
3d4b4809ba base: cross platform Event API
Trying to reconcile the difference between the linux and windows
implementations.

Code relying on the eventfd count must now use the linux specific
`EventExt` interface.

BUG=b:231344063
TEST=presubmits

Change-Id: I14eb50f7a02d766a00f27aca388823309633e193
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3864030
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-10-19 20:17:42 +00:00
Daniel Verkamp
fecddd7737 main: print --help usage to stdout
Make the --help output go to stdout rather than stderr and return 0 in
this case, as is convention for programs printing usage information.

BUG=None
TEST=crosvm run --help | grep disk
TEST=crosvm run --help; echo $?
TEST=cargo test

Change-Id: Ie3ab673e02ff07a0a2949147ed53a65aa116b3d7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960855
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
2022-10-19 19:11:37 +00:00
recipe-roller
15ced5f977 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/8799854426462414593

depot_tools:
0e9f668e4d
  0e9f668 (dcheng@chromium.org)
      Only add a CC if it is not already present in the list of CCs.

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: Ifc061a20b5da0803c365779d900b5bc7a60d51f7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965687
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-10-19 18:06:47 +00:00
Alexandre Courbot
5286194102 virtio: video: allow dead code in the utils module
The utils module contains code commonly used by backends, but not
necessarily used by all. This can lead to compiler warnings about unused
code depending on which backends are compiled in. Silence them by
allowing dead code in that module only.

BUG=None
TEST=`cargo build --features "video-decoder,video-encoder,libvda"` does
not emit any warning.

Change-Id: Ia5cb28f84a2367f450c69eb505347cc4a0d95ba1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960215
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-10-19 17:50:20 +00:00
Daniel Verkamp
474d2eea17 arch: split fdt code into its own crate
This will let the hypervisor crate use types and functions from the new
cros_fdt crate (it could not depend on arch, since that would cause a
circular dependency).

No functional change, just code movement.

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

Change-Id: I62d906941867c45f1b77ff1db6923d915ce2123e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965088
Reviewed-by: Steven Moreland <smoreland@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-10-19 17:43:19 +00:00
recipe-roller
564fa5f84c 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/8799856317928981121

recipe_engine:
bec48a30d6
  bec48a3 (chromium-autoroll@skia-public.iam.gserviceaccount.com)
      Roll CAS Client from 2da06f172d53 to 22cdcc8941f1

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: Ida726f7e1fcbd0d0dfc7968fc402543dcbadef76
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965685
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-10-19 17:37:04 +00:00
Idan Raiter
cbf1e0c61b devices: stop resetting ReadNotifiers in vhost user
Upstreaming a fix from nkgold@ for the following issue:

ReadNotifiers shouldn't ever be reset as their state is managed by the
type that exposed the notifier (e.g. StreamChannel). Resetting it can
lead to lose notifications. idanr@ discovered that EventAsync::clone_raw
was creating a regular EventAsync (e.g. with reset), and it was being
used with read notifiers. This CL replaces clone_raw with a new factory
that produces `without_reset` EventAsyncs.

BUG=b:253255209
TEST=presubmit, downstream

Change-Id: I0b9de2f12cc3597ba05a8ac108f4cd0a8e726b3f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960857
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2022-10-19 17:13:15 +00:00
Keiichi Watanabe
bbe8a60f46 CONTRIBUTING: Add a section about commit messages' format
Document what a good commit message should look like in CONTRIBUTING.md.

BUG=none
TEST=./tools/fmt

Change-Id: I5097efa9650c9659f090553b1ba4171790cc51fd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3945521
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-10-19 06:22:42 +00:00
Koki Ryu
16da55f236 Add --net option to the crosvm run command
Currently, --tap-name, --tap-name, --host-ip...etc commands are all used
to create a vhost-user net device. This CL unifies the command line arguments.

BUG=b:246224081
TEST=run the following tests:
- `cargo test -p devices virtio::net::tests`
- `cargo test -p net_util`

Change-Id: Ie1342f23f0951e5a81e54547bf725c0d9be19f97
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3893869
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Koki Ryu <kokiryu@chromium.org>
2022-10-19 02:18:27 +00:00
recipe-roller
43edde25d8 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/8799919231068078929

recipe_engine:
0f888193b8
  0f88819 (sidereal@google.com)
      [recipe-py] buildbucket: Expose "bb builders" in the API

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: Iabac48cf2b378f2f2210cd36498b6407bf36e2b5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965668
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-10-19 00:55:38 +00:00
recipe-roller
2c50cc424f 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/8799920490053070497

recipe_engine:
763aebeb5b
  763aebe (chromium-autoroll@skia-public.iam.gserviceaccount.com)
      Roll CAS Client from 9f32e02d53ad to 0b4ca8594812

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: If59a8563b7a9b752abe564499a76b668afd6ed11
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965283
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-10-19 00:37:38 +00:00
recipe-roller
f3a9280040 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/8799928668461771985

depot_tools:
1b48a2184a
  1b48a21 (qyearsley@google.com)
      Deploy lucicfg version 1.33.4 enabling location_filters

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: I460853dd06ed4ed5a32853e551e3e68b7de6f9ed
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965274
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-10-18 22:27:02 +00:00
recipe-roller
f940ece70c 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/8799931178579205025

recipe_engine:
e3c4498ea5
  e3c4498 (randymaldonado@google.com)
      [buildbucket] adding step tags to streams

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: I97e3cb3a872c01dd4087171eda607bf42804235a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3965272
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-10-18 21:48:45 +00:00
Dennis Kempin
1c66b6cf7e Add mingw64 builder to postsubmit
Mingw64 builds are used frequently by linux developers to check
windows portions of crosvm and part of ./tools/presubmit.

Test in postsubmit and once the builder is green it can be enabled
in the CQ as well.

BUG=b:254316054
TEST=recipes.py tests run

Change-Id: I8495446772a54d63644e73d07423892e28cedd1a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3964541
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-10-18 21:12:14 +00:00
Eval EXEC
b951ca684f fix bindgen installation instruction
The bindgen cli tool has changed to a workspace member of rust-bindegen
repo: https://github.com/rust-lang/rust-bindgen/commits/master/bindgen-cli

Change-Id: Ie3248d61919fdb742e49f57a10f5db827cd8230d
Signed-off-by: Eval EXEC <execvy@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3964808
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-10-18 19:50:46 +00:00
Pujun Lun
1289167d24 crosvm: enable the "gpu" feature by default on Windows.
BUG=b:213149288
TEST=presubmit

Change-Id: I726324893d78b8cc0303d1bb4d8132e48889a5bc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960861
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2022-10-18 18:18:38 +00:00
David Stevens
c11683b07f seccomp: add lseek to all devices
The panic hook calls read_to_string, which relies on lseek internally.
Most devices already allow lseek, but add it to the common policy files
to ensure that devices can properly panic.

BUG=None
TEST=compiles

Change-Id: I99d6d1d258706874cc04ce550108991631d71706
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960213
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-10-18 06:39:41 +00:00