Commit graph

7885 commits

Author SHA1 Message Date
recipe-roller
7ff3034bd7 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/8765055128461722833

recipe_engine:
165afa5162
  165afa5 (mohrr@google.com)
      [recipe_engine] Handle Exceptions containing StepFailures

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: I11d7d92398246f07ff6f9d20301a280b812ae2ca
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5010880
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-11-07 20:49:28 +00:00
recipe-roller
7371ba26cb 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/8765057016478940129

depot_tools:
a309d29905
  a309d29 (sokcevic@chromium.org)
      Remove .git suffix from git submodules

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: Idcd6ebf57d43249c2786c25b5db3b4c7173d5089
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5009465
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-11-07 20:18:46 +00:00
recipe-roller
a9f93db033 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/8765061418966449105

recipe_engine:
45ce979f73
  45ce979 (mohrr@google.com)
      [recipe_engine] Remove defer_results

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: Ibd890ec281706eb45cb2361799ccf8aebe2653c9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5010084
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-11-07 19:08:41 +00:00
Daniel Verkamp
c1c833ace6 e2e_tests: refactor from_env for clarity and clippy fixes
This fixes "unused return value of `std::result::Result::<T, E>::map_or`
that must be used" warnings with Rust 1.73 and also makes the code
easier to understand.

Change-Id: Id028a0859db6a7b6670e1ed6f9c9cc443a2e7c61
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5007729
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-07 18:39:51 +00:00
Jakob Vukalovic
8b21047281 cros_fdt: Add device tree overlay tests
Add test for the device tree overlay mechanism.

Bug: b/296796644
Test: cd cros_fdt && cargo test
Change-Id: I8e8d129344e1ad4ddf0d7af7b3f21c0c9d9ca038
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4855966
Commit-Queue: Jakob Vukalović <jakobvukalovic@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-07 18:15:21 +00:00
Jakob Vukalovic
6daa3e6f03 cros_fdt: Add device tree overlay support
This change adds support for applying device tree overlays onto existing
Fdt instances. It ensures overlay phandles do not overlap with base
phandles.

The algorithm is roughly:
- Find the maximum phandle node property value used in the base FDT
  (delta)
- Increment all phandle property values in the overlay by delta to avoid
  phandle collisions
- For every property in the overlay where a phandle value pointing to a
  node inside the overlay is used, increment the value by delta so the
  references are once again correct
- For every property in the overlay where a phandle value points to a
  node outside the overlay, update that location with phandle values
  from base, so that the value points to a correct node in base FDT
- Update nodes and properties in base FDT with nodes and properties from
  the overlay

Bug: b/296796644
Test: cd cros_fdt && cargo test
Change-Id: Ibff3c6dc3a9a1201c10da9004b295140d47929cd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4855965
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Jakob Vukalović <jakobvukalovic@google.com>
2023-11-07 18:07:24 +00:00
Pierre-Clément Tosi
1fc2897aa0 vfio: Expect non-null result from CHECK_EXTENSION
Align with the uAPI documentation, which states that

  /**
   * VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32)
   *
   * Check whether an extension is supported.
   * Return: 0 if not supported, 1 (or some other positive integer) if supported.
   * [...]
   */

TEST=tools/run_tests
BUG=b:306110430

Change-Id: Ifab1a55991a725653a8dc06a433f62ac841ec97c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5010356
Auto-Submit: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-07 18:03:52 +00:00
Pierre-Clément Tosi
797de4a579 tools/cl: Add support for SSO Git remote
Some users of *.googlesource.com access the platform through the
internal Single Sign-On authentication mechanism so consider the sso://
remote as valid.

TEST=tools/cl upload

Change-Id: Ie7ebe4c9e165241645fddcdf1884b7e9e7a7d83d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5009550
Auto-Submit: Pierre-Clément Tosi <ptosi@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-07 17:55:30 +00:00
Pierre-Clément Tosi
0be7e9757e dev_container: Only pass /dev/kvm if present
Avoid passing the file to Podman/Docker if it isn't present as that
prevents the container from running:

    Error: stat /dev/kvm: no such file or directory

Even though the script may be used in cases where KVM isn't necessary.

Remove the check for POSIX as non-POSIX OSes are very unlikely to have a
file at that path.

TEST=tools/dev_container tools/run_tests --platform=aarch64

Change-Id: If46bb42076c79adfeab4baceb01913a9179ac00d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5010772
Auto-Submit: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-07 17:48:21 +00:00
Daniel Verkamp
1c930717d6 swap: provide full context if monitor thread fails
monitor_process() returns anyhow::Result, so print it with the alternate
format specifier to get the full chain of context messages in the panic
handler if it fails.

BUG=b:309463106
TEST=cargo build --features=swap

Change-Id: Id50b35dad980fc6e1d3c02ba4a85a598cc34ba8c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5006707
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Shin Kawamura <kawasin@google.com>
2023-11-07 17:45:55 +00:00
Vikram Auradkar
8dacb2ed64 config: force lf as line endings
this allows sharing repo on windows running a linux container

BUG=b:308883445
TEST=on windows ran
       py .\tools\dev_container tools/presubmit line_endings

Change-Id: Ief73f1ad2da201dac0337711d0c4f706a936f7a6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5008193
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2023-11-07 17:38:58 +00:00
Keiichi Watanabe
01065a8286 tools: contrib: Explain memstats tool's graph
Add a section to explain what memstats shows in the graph.

BUG=none
TEST=read the doc

Change-Id: If7990c844a63e381adab403af00f02a40ef35bb7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4942210
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2023-11-07 12:33:50 +00:00
recipe-roller
1e42e43550 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/8765127475989284913

recipe_engine:
351d79bca5
  351d79b (jwata@google.com)
      [cas] Change the default log level to info

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: Iab1d9975e05d781471afd1e68eca90b381122887
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5009194
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-11-07 01:39:22 +00:00
Daniel Verkamp
673a730638 Tweaks to placate clippy single_range_in_vec_init
<https://rust-lang.github.io/rust-clippy/master/index.html#single_range_in_vec_init>

Change-Id: I97cfe03c602630bcdb6c8b270f553c7c62e794d5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5007727
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-06 23:36:11 +00:00
Daniel Verkamp
173abe43a6 devices: virtio-scsi: fix clippy unnecessary return warning
Change-Id: I2580edbf97159f13e122f8c3825b0bb506c3075a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5008191
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-06 23:02:28 +00:00
Daniel Verkamp
c54a59e75b data_model: use vec! to initialize zero-filled vector
<https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization>

Change-Id: I525a01d49420ddbb1707bc33e27d2c50bee94fa2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005520
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-06 22:42:31 +00:00
Daniel Verkamp
7666fbc7eb argh_helpers: use fold() to build String from iterator
Rather than constructing a bunch of String objects with format!() and
then concatenating them all with collect() at the end, use fold() and
write!() to append onto a single String instance.

This is suggested by a new Rust 1.73 clippy lint.

<https://rust-lang.github.io/rust-clippy/master/index.html#/format_collect>

Change-Id: If9bcc9fa579228618a7cb6f3602793f2287d97c4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005519
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-06 22:22:50 +00:00
Daniel Verkamp
8d890f6acb x86_64: gdb: print an error for CR4.LA57 case
We can't currently walk the page tables used when 5-level paging is
enabled. Previously, this was just an empty block, which causes a clippy
warning now. Add a log statement so the user can tell it won't work.

Change-Id: If7a3b635af8b5c95280cd23c142d764c6b6656a7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005518
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-06 22:01:21 +00:00
Daniel Verkamp
2ca1a16b3f audio_streams: drop wait_fd_readable in test executor
Use the default AudioStreamsExecutor::wait_fd_readable implementation
instead, which just returns Ok(()).

Fixes a build error when trying to run clippy with Rust 1.72, which
seems to be related to the async_trait usage.

BUG=None
TEST=cd common/audio_streams; cargo test

Change-Id: I415cff6e7dbd2fdfee43693a04f8ce74da3eeb7a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005516
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-06 21:31:40 +00:00
Daniel Verkamp
3c1d96ac07 Fix unnecessary vec![]
Change-Id: I8df666fbd1df47c0ca3231091aff0aab2c663106
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005515
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-06 21:08:56 +00:00
Daniel Verkamp
8f85a4ad58 Fix clippy warning for unnecessary raw string quoting
Change-Id: I6c205da55c6e6cd5ec87a7a9e694adbf58d89681
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005514
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-06 20:50:05 +00:00
Daniel Verkamp
3e1c271449 Fix clippy useless_conversion into_iter() warnings
Change-Id: Ie526b343dea32598565e56156afe33455a70a744
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005513
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-06 19:43:56 +00:00
Daniel Verkamp
d362e2ea56 Fix new clippy 1.72 unnecessary_cast warnings
Remove pointer casts where the target type is the same as the original.

Change-Id: Ibb7bda2e4afcb5df2cd7c0bd9a075d0288b69f67
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005512
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-06 19:16:18 +00:00
Daniel Verkamp
344316b6b5 rutabaga_gfx: fix clippy 1.72, 1.73 warnings
Remove unnecessary type casts and unnecessary .into_iter() for something
that is already an Iterator.

Also remove `let x = x;` local variable initializations where x is a
parameter with the same type.

BUG=None
TEST=tools/clippy # with rust-toolchain 1.73.0

Change-Id: Id18380b1cb617cc384e9944c2a48344dcafc6519
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005511
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-06 18:29:46 +00:00
recipe-roller
e516505dfb 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/8765165229362673569

recipe_engine:
94e9b251b5
  94e9b25 (jonahhooper@google.com)
      [swarming] [recipe] Updated swarming cli to more recent version

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: Ie269ad577685924fdb07c3b551f7bd49c22428d8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5006705
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-11-06 15:40:07 +00:00
Keiichi Watanabe
316783a88b cros_tracing_analyser: Fix unused Result warning
BUG=none
TEST=cargo build

Change-Id: I144eec11637f3bb9a7bfa741a72a61d58b0f5f37
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5000826
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Morg <morg@google.com>
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
2023-11-06 12:52:51 +00:00
Keiichi Watanabe
64aa6d408f cros_trace_analyser: Use libtracecmd-rs v0.2.1
With a fix in libtracemd-rs v0.2.1 [1], we no longer need to rebuild
libtracecmd-rs every time.
[1]: https://github.com/google/libtracecmd-rs/pull/6

BUG=none
TEST=cargo build

Change-Id: Ica1342c9b23ed778fff2c0677717e3953b42dbd9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5000825
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Morg <morg@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2023-11-06 12:52:51 +00:00
Joe Hattori
3f944b0c9d devices: virtio: scsi: clean up check_lba_range
This commit modifies `check_lba_range` to return Result<(),
ExecuteError> instead of bool, which is more idiomatic. Also the
`max_lba` field in LogicalUnit is currently the size of the disk, so
this commit also changes the field to hold the lba.

TEST=tools/presubmit
BUG=b:300042376

Change-Id: I6c55fabbae9cbf53047d52435f16f1c3510f2d38
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4995951
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Commit-Queue: Joe Hattori <hattorij@google.com>
2023-11-06 01:27:43 +00:00
Joe Hattori
c892748785 devices: virtio: scsi: Support multiple SCSI devices
Currently crosvm allows only one SCSI device. This commit enables crosvm
to handle multiple SCSI devices. Each LogicalUnit contains a disk image,
and each controller contains all the LogicalUnits.

BUG=b:300042376
TEST=guest with multiple SCSI devices boots and FIO works on all
devices
TEST=./tools/run_tests2 --dut=vm -E 'test(test_scsi)'

Change-Id: I67653e9b7656e867277afbea24987cdefa9da0fb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4964673
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
2023-11-06 01:27:43 +00:00
Daniel Verkamp
b23277d86c base: linux: drop "get" from get_max_open_files()
Rust API style usually omits the "get" from getters. Rename
get_max_open_files() to max_open_files() for consistency.

BUG=None
TEST=tools/dev_container tools/presubmit

Change-Id: Id272d56b6eb3d40d740644ec5e509ab85d00624a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005638
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-03 23:52:41 +00:00
Daniel Verkamp
61bb3e326c base: drop unused chown, fchown, and fchmod wrappers
These were only present on Linux and not used anywhere in the current
crosvm source code.

BUG=None
TEST=tools/dev_container tools/presubmit

Change-Id: I21a3211c7d678f093fc75e9fe8329c9365ed767a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005637
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-03 23:43:00 +00:00
A. Cody Schuffelen
1a9aff6f5a Add stubs so that cargo test -p base compiles on MacOS
Bug: b/309011910
Change-Id: Id6a9bf86885e16a271453c46fd2351dbb53c032d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4997937
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
2023-11-03 23:35:45 +00:00
Daniel Verkamp
0622061108 base: move round_up_to_page_size() to lib.rs
This function can be implemented the same way on all platforms, so move
it out of the sys/ files.

BUG=b:309011910
TEST=tools/dev_container tools/presubmit
TEST=cargo build --target=aarch64-apple-darwin -p base

Change-Id: Ia894e3719c9ccc1c31f86d80e0c822bad81cd418
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005633
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-03 23:35:40 +00:00
A. Cody Schuffelen
c2896a059f Move descriptor.rs back from linux to unix
`descriptor.rs` for `unix` loses the `PartialEq` implementation for
SafeDescriptor because the implementation for it relies on
linux-specific features, i.e. `kcmp`. It would be possible to
implement this differently using something based on `fstat` in the
future for other platforms like MacOS.

Bug: b/309020556
Test: cd base && cargo build --target=aarch64-apple-darwin
Test: tools/presubmit
Change-Id: I09560874d8876decfc4a492da206d42a4768a2c7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4834121
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
2023-11-03 22:11:46 +00:00
recipe-roller
58c81d1c6e 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/8765414998724250897

recipe_engine:
bc82350667~..d9994e3522dc0700ceb13f2e0ed260892107770a
  bc82350 (iannucci@chromium.org)
      [recipe_engine] Switch recipes to execute with python3.11.
  d9994e3 (chromium-autoroll@skia-public.iam.gserviceaccount.com)
      Roll CAS Client from dfbae63f58ac to 540222a3d0b1

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: Id65b152c5e83e81e26434fbbcd10056842383a10
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005724
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-11-03 21:35:28 +00:00
Dennis Kempin
6a9a779d9b presubmit: Remove infra checks from presubmit tooling
We should be using the builder-provided vpython to be able to
reliably testing recipes in the right environment.

Let's remove these to unblock the recipe roller, then add them
as a seprate step in the health check build recipe.

BUG=None
TEST=CQ

Change-Id: I14fa4d744ab83c01c54f9618854e5e5f657d9f60
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005627
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-03 21:17:36 +00:00
A. Cody Schuffelen
6e8a64dea7 Replace base sys.rs cfg_if with multiple use statements
This allows defining `platform` out of a composite of symbols from
different platforms, which is relevant for multi-platform pieces like
`unix`.

Bug: b/309011910
Change-Id: Iccdc7927dba6ecf4dd45c58ae0f6caa698b94c86
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4997936
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-03 21:14:36 +00:00
Daniel Verkamp
227f871e58 virtio_sys: move vhost ioctls to a Linux-only file
The vhost kernel interface is specific to Linux; factor it out to a
separate file so it can be more easily controlled with a cfg check.

The rest of the virtio_sys bindings are generated from Linux uapi
headers, but they are valid for all platforms, so update the file-level
doc comment to match.

BUG=None
TEST=tools/dev_container tools/presubmit
TEST=cargo build --target=aarch64-apple-darwin -p virtio_sys

Change-Id: I1c7e1b6816993499ebf4431095e9308f7611a4d4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005276
Reviewed-by: Cody Schuffelen <schuffelen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-03 20:49:19 +00:00
Daniel Verkamp
870a4e036a gpu_display: only build Wayland code on Linux
Refactor the build.rs platform detection to explicitly select the
Wayland support code when building for Linux (instead of skipping it
only for Windows).

BUG=None
TEST=tools/dev_container tools/presubmit
TEST=cargo build -p gpu_display --target=aarch64-apple-darwin

Change-Id: I9437acdc2e2439d0da094887a5a8f520f3279399
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5005295
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Cody Schuffelen <schuffelen@google.com>
2023-11-03 20:20:08 +00:00
A. Cody Schuffelen
9cd31f1669 Stub out bare minimum to compile base on MacOS
Also add compilation scripts

Bug: b/309011910
Test: tools/install-mac-deps && tools/mac-build
Change-Id: I5aa200238fb83c94115ca2f3624ca84a34d9555a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4997935
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
2023-11-03 19:09:27 +00:00
A. Cody Schuffelen
a97ada3cdd Restore unix on audio_streams
Test: cargo build -p audio_streams --target=aarch64-apple-darwin
Change-Id: I50666bedc333d6ed0906da629b80b559e49584c9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4997934
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
2023-11-02 20:08:01 +00:00
A. Cody Schuffelen
8db9bdc247 Restore data_model's linux to unix.
Test: cargo build -p data_model --target aarch64-apple-darwin
Change-Id: Ifeca4b24cbca549c8033d9c4768fb63a79b1ef57
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4997933
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
2023-11-02 19:51:40 +00:00
Vikram Auradkar
39f462aad8 tools: script to install podman on windows
the script may need a few other changes as my dev box already had
podman and potentially other dependencies. I uninstalled podman to test.

BUG=b:308883445
TEST=used script install on a dev box.

Change-Id: Ieb44587cc79b22952bc0c8154c9001f608e51769
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4998699
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
2023-11-02 18:33:16 +00:00
Vikram Auradkar
92e8988fd4 tools: windows support for dev_container
Won't allow running e2e or integration tests.

BUG=b:308883445
TEST=py .\tools\dev_container tools/presubmit clippy

Change-Id: Ib97eb6640ce25ebfa71b3edce734a1de3ddf9409
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4996643
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-02 18:33:16 +00:00
Jakob Vukalovic
c963fbc5a4 cros_fdt: Implement node paths API
To make querying device tree node paths in device tree easier, implement
a `Path` struct. Node paths are used extensively in overlay "metadata"
which makes it possible to find phandle references stored as plain u32
property values.

Furthermore, node paths exported by an overlay will be used to resolve
device tree symbols (node labels) once overlay filtering is implemented.

Bug: b/296796644
Test: cd cros_fdt && cargo test
Change-Id: I9bae0a5643c054731c9d3b4cd92bb69de2b807d4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4855962
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Jakob Vukalović <jakobvukalovic@google.com>
2023-11-02 16:44:15 +00:00
Jakob Vukalovic
6ba5fab07a cros_fdt: Implement FdtNode properties API
Implement additional property APIs on FdtNodes. Beside the generic
property getter method, implement special getter and setter for phandle
values with an offset parameter. These will be used for updating phandle
references stored inside larger property values. Also, each FDT property type
now implements a new `AsFdtPropval` trait for parsing a binary property
value into a supported type.

Bug: b/296796644
Test: cd cros_fdt && cargo test
Change-Id: I2d9e2259e49f8a88e99d67b25672b1add7c0b6b5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4855961
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Jakob Vukalović <jakobvukalovic@google.com>
2023-11-02 16:44:15 +00:00
recipe-roller
134acc4516 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/8765577319341830177

depot_tools:
17debef507
  17debef (philwo@google.com)
      autoninja.py: Enable offline mode for Siso when use_remoteexec...

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: I90a47b4cbef99bb2a55c8837d3a9a494c7844871
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4996641
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-11-02 02:35:09 +00:00
Federico 'Morg' Pareschi
4d38fff52d devices: usb: Refactor backend + endpoint behavior
This is yet another refactoring to the USB backend code to support
future virtual USB devices. It replaces the dyn trait implementation
with a backend device enum type. This enum type will support different
backends in later CLs but here we start with a just host device
backend.

The backend device state is also split among DeviceState and
ControlTransferState which each holds stateful operations like endpoint
allocation and control transfer packet protocol handling. This in turns
also gives us more fine-grained locking control for read/write
operations on them individually.

BUG=b:297957754
TEST=presubmit and tested USB behavior on a DUT

Change-Id: Id500d158b68a584c4b71c0e044a22cae1909e8ed
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4938324
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Commit-Queue: Ryuichiro Chiba <chibar@chromium.org>
Auto-Submit: Morg <morg@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-02 02:09:24 +00:00
Noah Gold
67a814074f docs: add unsafe comment style guidance.
We've been following most of these practices already, but it seems worth
writing them down especially for new contributors. Something new
here is `unsafe_op_in_unsafe_fn` which I saw in one of kawasin@'s swap
CLs. It seems like a really useful tool to help us convey more subtle
safety situations.

BUG=none
TEST=build mdbook & verified the page looks reasonable.

Change-Id: I4151d0cff9969900abbbe5832bb61c9a04327d8b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4996510
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Shin Kawamura <kawasin@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2023-11-01 23:34:15 +00:00
recipe-roller
ace02c8c9f 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/8765591790392243681

depot_tools:
a413ee7249
  a413ee7 (aravindvasudev@google.com)
      [gsutil.py] Skip luci-auth wrapper on unsupported platforms

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: I44f9645ed3677687ab94f6905b2ff25eb3152698
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4996638
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-11-01 22:40:22 +00:00