Commit graph

3485 commits

Author SHA1 Message Date
Noah Gold
35290a48c0 cros_async: enable tests on Windows.
BUG=b:213147081
TEST=bots

Change-Id: I88ac2eb0c4c9b4f3f77e2b3c0cc994979a14d14c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3585009
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-20 18:56:54 +00:00
Kameron Lutes
1904e141b7 Reland "crosvm_control: Generate C header during build"
This is a reland of commit 06fca32aff

Original change's description:
> crosvm_control: Generate C header during build
>
> Generates a C header for the crosvm_control library during crosvm build.
>
> BUG=b:188858559
> TEST=cq
>
> Cq-Depend: chromium:3553666
> Change-Id: Ic6d57d654f546a4ddf9facad16d29a03c103ebbe
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553761
> Reviewed-by: Dennis Kempin <denniskempin@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Kameron Lutes <kalutes@chromium.org>

Bug: b:188858559
Change-Id: I041cf6452ecec2d3ef9581b07ee0c457ba81cf98
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3593855
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-04-20 18:29:20 +00:00
Richard
2aa0a385f0 tube_transporter: Upstream this Window's specific crate
This IPC crate is used to send boot data across the different CrosVm
processes on Windows.

Test: built presubmit
Bug: b:213154641
Change-Id: I9e8d220e64823fed7c6f887a06ce30795c2bdae5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584244
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-04-20 01:24:35 +00:00
Noah Gold
a81eebfe8e cros_async: move IntoAsync to use AsRawDescriptor
Originally cros_async was not permitted to depend on base, and as such
was precluded from using RawDescriptor/AsRawDescriptor. Now that we can
use base, we are switching over to those types/traits as they allow for
much cleaner cross platform code.

BUG=b:228904576
TEST=builds (also tested applying downstream).

Change-Id: Id5da60b127656568069795707a48beca1a015151
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584139
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-19 22:19:06 +00:00
Noah Gold
68bbe92339 cros_async: upstream Windows support.
Major changes:
* Adds Windows implementations
* Refactors cros_async to use the styleguide for cross platform code.
* Adds platform specific Descriptor impls to Timer & Event (short term;
  this will go away in the next CL in the series).

Minor adjustments:
* The doctests for the Executor were passing the wrong type of seek
  parameter to write_from_vec. It was disabling seeking (None) when it
  should have been  seeking to zero (Some(0)).

BUG=b:213147081
TEST=tested by Windows & Linux bots.

Change-Id: Id7e025ceb9f1be4a165de1e9ba824cf60dd076ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3579735
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-19 22:19:05 +00:00
Dennis Kempin
1def2e61d9 reland: Remove temporarily duplicated code from codebase
This removes sys_util(_core), which moved into base::unix/common, as
well as common/(cros_async,io_uring), which moved into the root
directory.

The only reason the code was still around is that they were still
used in the ChromeOS codebase.
ChromeOS has pinned the version of crosvm it uses for these libraries
so we can go ahead and remove the code.

A few remaining references to sys_util have been updated to base.

BUG=b:227226222,b:229016539
TEST=presubmit

Change-Id: I7a711044de7e067b217287f2bac822d6ac7d3964
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3593852
Reviewed-by: Allen Webb <allenwebb@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-19 21:48:29 +00:00
Dennis Kempin
809b42db2d audio_streams: Remove dependencies on sync and sys_util
sys_util is only used to have a SharedMemory instance to run test.
This commit replaces that with a mock implementation.

BUG=b:229114164
TEST=presubmit

Change-Id: I6268f36dd3d986422090b1d2506ba55896cbca62
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3593851
Reviewed-by: Allen Webb <allenwebb@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-19 21:39:52 +00:00
Dennis Kempin
66be807115 Revert "Remove temporarily duplicated code from codebase"
This reverts commit aac461e25e.

Reason for revert: Breaks audio_streams portage build

Original change's description:
> Remove temporarily duplicated code from codebase
>
> This removes sys_util(_core), which moved into base::unix/common, as
> well as common/(cros_async,io_uring), which moved into the root
> directory.
>
> The only reason the code was still around is that they were still
> used in the ChromeOS codebase.
> ChromeOS has pinned the version of crosvm it uses for these libraries
> so we can go ahead and remove the code.
>
> A few remaining references to sys_util have been updated to base.
>
> BUG=b:227226222,b:229016539
> TEST=presubmit
>
> Change-Id: I35a3d1f0ea28182b77abf9b423fcab4cad525981
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3580118
> Reviewed-by: Allen Webb <allenwebb@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Dennis Kempin <denniskempin@google.com>

Bug: b:227226222,b:229016539
Change-Id: I907279ab47718355cd57915830580929dc157f84
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3593846
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Maciek Swiech <drmasquatch@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-19 18:24:13 +00:00
Noah Gold
9da4030ab0 cros_async: use portable enum for fallocate modes
fallocate modes were previously unix specific constants, which won't work after
we add support for Winodws. Here, we've put a generic abstraction in place so
that each platform can implement the details as appropriate.

Thanks to acourbot@ for suggesting the splits in this series.

BUG=b:213147081
TEST=see final CL in series.

Change-Id: I822ad6c4a26eea716482029e8a6c0489aa72c595
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3583613
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-19 05:37:42 +00:00
Noah Gold
78ef113617 cros_async: make AsyncTimer use base::Timer
TimerFd is the sys_util era Unix-specific timer, which doesn't support Windows.
This CL moves us to base::Timer, which is the cross platform equivalent.

Thanks to acourbot@ for suggesting the splits in this series.

BUG=b:213147081
TEST=see final CL in series.

Change-Id: I41c8ad88da77c48397ed466ff11aecd703c470a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3583612
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-19 05:37:41 +00:00
Noah Gold
084aa95af1 cros_async: make AsyncEvent use base::Event
EventFd is the original sys_util era Unix-specific Event. We need to use
base::Event, which is the cross platform event that works on Windows.

Thanks to acourbot@ for suggesting the splits in this series.

BUG=b:213147081
TEST=see final CL in series.

Change-Id: I174313cb544c5fc3768810365a42e6eaac1ca91a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3583611
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-19 05:37:40 +00:00
Risan
ab11843e86 fs: Support setting project inheritance flag
This CL allows passthrough to set project inheritance flag through
cryptohome since setting project inheritance flag cannot be done in
user namespace.

BUG=b:226908517
TEST=atest android.appsecurity.cts.StorageHostTest

Change-Id: Icdde5164e2e6f8655fff28748f6bc18449ad36c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3585215
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Risan <risan@chromium.org>
2022-04-19 00:18:41 +00:00
Vikram Auradkar
29818542a4 move unix/win under sys/
This brings the dir structure *somewhat* similar to that the style
guide recommends.

BUG=b:213153157
TEST=presubmit

Change-Id: Iff7c7af1cfb64be45b07e57a9929d9f2fd1fa47e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3585020
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-04-19 00:17:04 +00:00
Dennis Kempin
970b00fa4d Add documentation for ChromeOS workflows
This change consolidates some of the spread out information about
what ChromeOS developers need to know about crosvms differences to
other ChromeOS projects.

I created a new directory since I would expect a similar guide for
AOSP eventually.

This also adds more documentation on some of the process changes
suggested in go/crosvm-merge-improvements to improve the
stability of the merge process.

BUG=b:227475914
TEST=None

Change-Id: I08111ecd5a937fde22c7d97f342c1cf02f49b02e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3561886
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-18 19:05:49 +00:00
Dennis Kempin
aac461e25e Remove temporarily duplicated code from codebase
This removes sys_util(_core), which moved into base::unix/common, as
well as common/(cros_async,io_uring), which moved into the root
directory.

The only reason the code was still around is that they were still
used in the ChromeOS codebase.
ChromeOS has pinned the version of crosvm it uses for these libraries
so we can go ahead and remove the code.

A few remaining references to sys_util have been updated to base.

BUG=b:227226222,b:229016539
TEST=presubmit

Change-Id: I35a3d1f0ea28182b77abf9b423fcab4cad525981
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3580118
Reviewed-by: Allen Webb <allenwebb@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-04-18 18:35:07 +00:00
Elliot Berman
c903a58f86 aarch64: Abstract KVM register read/writes
Remove KVM-specific code from the generic aarch64 module by providing a
generic enum for hypervisor-specific vCpus to use instead:
VCpuRegAArch64.

Change-Id: Idd7379ad35943622c534b5e0d954ec15f9d15b41
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3586723
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Steven Moreland <smoreland@google.com>
2022-04-18 17:58:06 +00:00
Elliot Berman
d28ce639c6 linux: Prepare to run with multiple hypervisors
Move KVM-specific code to "run_kvm" function in preparation for
supporting different hypervisors.

Change-Id: I02b81478ded893a0ee67e132f12d637912491fea
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3586011
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Steven Moreland <smoreland@google.com>
2022-04-15 22:23:33 +00:00
Elliot Berman
53d9530f36 linux: Drop kvm_ prefix from vcpu_ids
Simple rename to emphasize that vcpu_ids are not KVM-specific.

Change-Id: Icaf8a5f15a83021cf48467b0b8d0042ab0ab4a92
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3586010
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Steven Moreland <smoreland@google.com>
2022-04-15 22:23:32 +00:00
Dennis Kempin
af594fe6a6 Merge bot: A few minor tweaks
- Don't try to download gcompute tools multiple times
- Fix off-by-one error in merge log calculation.
- Fail if gerrit upload fails repeatedly

BUG=None
TEST=./tools/chromeos/merge-bot update-dry-runs

Change-Id: I9e845455f8c5209c38aee1bcd6bb1b2b81a3d99a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3585019
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-04-15 20:40:00 +00:00
Dennis Kempin
77569908de Merge bot: Always set up username on gce
Sligthly changes the logic. If we are on GCE, always use the authdaemon
and set up the git user info for the service account.

Outside of GCE just check if a cookie is available.

BUG=None
TEST=Faked out is_gce_instance and ran locally

Change-Id: Icf4c521b650b5d47f395a59695d1f1470621f661
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3585016
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-04-15 19:59:57 +00:00
Dennis Kempin
fe433eb18f Add version pin warning to common/
Could be added to README.md, but who reads those...

BUG=b:229016539
TEST=None

Change-Id: I3cc0f3672999926018fae572d8966dd971dcf80f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3586142
Reviewed-by: Allen Webb <allenwebb@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-15 19:51:35 +00:00
Dennis Kempin
a3249a7fef Merge bot: Actually execute clone of gcompute-tools
BUG=None
TEST=Ran locally, but cannot test actually running the tool outside of
GCE.

Change-Id: I4483d8ea75fceb3d289a38d2aa3b8c6f85985dfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3588403
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-04-15 19:31:18 +00:00
Dennis Kempin
ba4adc0efb Add python presubmit checks
This change adds python type and formatting checks and
consolidates code health checks in ./tools/health-check.

Dealing with relative imports in python is tricky, so
we are making ./tools/impl a proper package with no
directly executable files.

Some of the bash shorthands in ./tools had to be converted
to python for this.

To make the new checks pass, we run the formatter and fix
some mypy type checks.

TEST=./tools/health-check
BUG=b:218559722,b:219965702

Change-Id: Ie18d3d6dd2f5a033141e167a6e1aa762791941d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3558592
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-04-15 19:22:53 +00:00
Dennis Kempin
335aaf6ad2 common.py allow absolute paths to programs
This would previously trigger a program not found error.

BUG=None
TEST=Added doctest

Change-Id: I357c44d2b9ce7b2a3240958c5c88008a29164baa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3587885
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-04-15 18:42:27 +00:00
Dennis Kempin
0506ac6549 Curl with headers to get GCE metadata
Metadata-Flavor is a header and not part of the body.

BUG=None
TEST=Has to be tested in GCE.

Change-Id: I92711a86502d19601a5f2d63e6a653743b5b2614
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3579815
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-04-14 23:33:54 +00:00
Dennis Kempin
cc6642deff Do not use curl --fail-with-body
The curl version of Kokoro is too old and does not know it.

BUG=None
TEST=testing in prod.

Change-Id: I8e1fe856dcd893944da06f6a9097497a9c320c43
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584319
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-04-14 22:51:29 +00:00
Dennis Kempin
f334e19ffc merge bot: Do not check result of git config
If the value is not set, treat it as empty.

BUG=None
TEST=Tested by removing the config setting locally.

Change-Id: Ia160285c03bffcf7a332f3891587e7ada2228623
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3585860
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-04-14 22:43:59 +00:00
Dennis Kempin
45df242c01 merge bot: Skip installing python version if it exists already
If the version is installed, but not the default selected, pyenv
can fail.

BUG=None
TEST=Testing in prod..

Change-Id: I5063051dd300f9dbbb057e429a84062341b3324c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3585859
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-04-14 22:23:43 +00:00
Dennis Kempin
9740b944eb merge buildes: Fix formatting of version check
The script broke after the formatter wrapped the string.

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

Change-Id: Id6e972d786d5a58f6cbb43f80d02f0aa26483967
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3585858
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-04-14 22:06:34 +00:00
Dennis Kempin
b193738186 New merge bot
The new merge bot is written in python to allow us to improve the
merge process.

The new process is as follows:
- The merge bot will only create a new merge when the previous
  ones have been submitted.
- When the bot creates a new merge, it'll split the merge commits
  into smaller changes to make bisection easier.

This allows us to only ever deal with one set of merge commits
instead of piling on new merges day after day.

For dry runs, the new process is:
- The bot will check existing dry runs and abandon them if the CQ
  is done.
- The bot will vote Verified+-1 to indicate if the dry run passed.
- If no more dry runs are active, it'll create a new one.

This ensures we always have a dry run in the CQ and can easily see
in gerrit which ones have passed.

The python script will also allow us to add convenience features
for oncall for retrying bratches, etc.

BUG=b:227347397
TEST=The script can be run locally:
./tools/chromeos/merge_bot update-merges
./tools/chromeos/merge_bot update-dry-runs

Change-Id: I51fc0741f5032868ad07f5e926e570e29cc461fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3583254
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-14 21:38:07 +00:00
Dennis Kempin
a7d91e5f66 p9: Remove dependency on sys_util
The read_dir utility was only used by p9. Other code uses fs::read_dir,
so we can move it from base::unix into p9.

BUG=b:229114164
TEST=presubmit

Change-Id: I9bd12b11233582245db8251aeb3d4480170a2d48
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584628
Reviewed-by: Allen Webb <allenwebb@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-04-14 20:32:59 +00:00
Dennis Kempin
d1440454f5 Remove *_stub crates from workspace
These were erronously added by https://crrev.com/c/3530503

BUG=b:228384796
TEST=None

Change-Id: Id13fd1568e897025cc917c7af4f0bd711185bf1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3575715
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-04-14 19:13:30 +00:00
Junichi Uekawa
835bfc3cfa Revert "crosvm_control: Generate C header during build"
This reverts commit 06fca32aff.

Reason for revert: cros side dependency is not there yet

Original change's description:
> crosvm_control: Generate C header during build
>
> Generates a C header for the crosvm_control library during crosvm build.
>
> BUG=b:188858559
> TEST=cq
>
> Cq-Depend: chromium:3553666
> Change-Id: Ic6d57d654f546a4ddf9facad16d29a03c103ebbe
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553761
> Reviewed-by: Dennis Kempin <denniskempin@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Kameron Lutes <kalutes@chromium.org>

Bug: b:188858559
Change-Id: I34a2d970415f95f559678520901340c1d8e6297a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3581450
Auto-Submit: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-04-14 12:48:22 +00:00
Junichi Uekawa
e8d38a6a8f crosvm: Logic for newline for help message.
Now we know the exact line size of the leading part of the help message
we can do a better logic for inserting a newline.

BUG=None
TEST=unit

Change-Id: Ia29ea9876199cfcef4cb97dd64eecbc71c6bcd60
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3581829
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-04-14 07:33:14 +00:00
Lepton Wu
90f58ccc27 Add help message for host-cpu-topology flag.
BUG=b:220638871
TEST=emerge-$BOARD crosvm

Change-Id: Ib9d825ebe64e8edfdb46f58100e6417b90eacfc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584833
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Lepton Wu <lepton@chromium.org>
2022-04-14 02:13:49 +00:00
Kameron Lutes
06fca32aff crosvm_control: Generate C header during build
Generates a C header for the crosvm_control library during crosvm build.

BUG=b:188858559
TEST=cq

Cq-Depend: chromium:3553666
Change-Id: Ic6d57d654f546a4ddf9facad16d29a03c103ebbe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553761
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-04-13 23:37:32 +00:00
Shao-Chuan Lee
105d68747b Revert "rutabaga_gfx: remove fence polling and enable async callback"
This reverts commit a999284da2.

This also introduces two extra `use` statements to fix the corresponding
errors in the LUCI build, which did not occur in local builds.

Reason for revert: caused deadlock in virglrenderer

Original change's description:
> rutabaga_gfx: remove fence polling and enable async callback
>
> Now that rutabaga users can provide a callback for fence
> completion, fences no longer need to be polled on the main thread.
>
> Optional polling still occurs for Rutabaga Components that still
> rely on it for other purposes (e.g. virglrenderer for GL query
> checking).
>
> Also, use a BTreeMap rather a HashMap since we only expect a dozen
> or so entries at most.  In such cases, a BTreeMap is faster.
>
> * v1 (lfrb@collabora.com): remove all polling + add async_cb
> * v2 (ryanneph@google.com): re-introduce optional polling to fix
>       virglrenderer that relies on it for GL query checking.
> * v3 (ryanneph@google.com): replace timer-based polling with
>       eventfd-based poll() signaling for components that want to
>       use it.
>
> BUG=b:175527587
> TEST=glxgears and vkcube in a crosvm guest VM.
>
> Cq-Depend: chromium:3555854, chromium:3563893
> Change-Id: I8e0181317e954cd15e2b8dc04c9b1329b0a6e182
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2860746
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Ryan Neph <ryanneph@google.com>

BUG=b:175527587,b:228782431,b:228521246
TEST=arc.Notification.vm on kukui-arc-r
TEST=dEQP-VK.wsi.android.swapchain.create#image_usage on dedede/kukui-arc-r

Change-Id: I616e3f283a60fe6a260f796cddce67c548b5e304
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584076
Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
2022-04-13 17:46:41 +00:00
Shao-Chuan Lee
a1fac454ed Revert "gfxstream: support async fence cb"
This reverts commit 3c2d5cefa2.

Reason for revert: depends on crrev.com/c/2860746

Original change's description:
> gfxstream: support async fence cb
>
> This adds the asynchronous interrupts in crosvm-gpu for gfxstream.
> This will allow gfxstream to alternate between the main signalling
> method (ASG [1]) and the more traditional interrupts when it
> makes sense performance-wise.
>
> gfxstream also requires new write fence callbacks that take into
> account the ring_idx and ctx_id where the fence is on.
>
> [1] goto.google.com/address-space-graphics
>
> BUG=b:192614792
> TEST=Tested locally with Vulkan cereal
>
> Change-Id: I010d9ebfc71594b393fee062b984a4c6d69404d8
> Reviewed-on:
> https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3027489
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>

BUG=b:192614792,b:228782431,b:228521246
TEST=arc.Notification.vm on kukui-arc-r
TEST=dEQP-VK.wsi.android.swapchain.create#image_usage on
dedede/kukui-arc-r

Change-Id: I4d2c43320880e38e8396cee3b96ce8c32addf39b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584075
Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
2022-04-13 17:46:40 +00:00
Shao-Chuan Lee
c6d01ebdbc Revert "rutabaga_gfx: enable per-context/per-ring fencing for virgl_renderer"
This reverts commit 8452832b97.

Reason for revert: depends on crrev.com/c/2860746

Original change's description:
> rutabaga_gfx: enable per-context/per-ring fencing for virgl_renderer
>
> Permits virglrenderer contexts to make use of per-context/per-ring
> fencing.
>
> BUG=b:193892617
> TEST=Run glxgears and vkcube in a crosvm guest VM.
>
> Change-Id: I9800d3fbab788602a25f2a118619910300126d4b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3453115
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Ryan Neph <ryanneph@google.com>

BUG=b:193892617,b:228782431,b:228521246
TEST=arc.Notification.vm on kukui-arc-r
TEST=dEQP-VK.wsi.android.swapchain.create#image_usage on dedede/kukui-arc-r

Change-Id: I96be478ed4b994c3ccffa5b3cbc2de00a06332f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584074
Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
2022-04-13 17:46:39 +00:00
Vikram Auradkar
413ec71451 base: fix doc test
Without this change `cargo test --doc` from `/base/` directory
would fail

BUG=b:213153157
TEST=cd base; cargo test --doc

Change-Id: I3a23a33b96237a663c0f6887c18bffdf2d25881e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584831
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-04-13 16:42:04 +00:00
Vikram Auradkar
a0c4acaf80 book: Add style guide
BUG=b:227345067
TEST=mdbook build

Change-Id: I689b8f92512ed8b97872c67b6bf31833a7fa78a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3557813
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-04-13 13:49:50 +00:00
David LeGare
740c824fe8 Update to gdbstub 0.6.1
Update the GDB stub implementation to the 0.6 version of the gdbstub
crate API, attempting to preserve the current behavior as much as
possible. Hardware breakpoints and single stepping still work, but some
existing issues with software breakpoints are still present.

BUG=None
TEST=Manual

Cq-Depend: chromium:3578400
Change-Id: I522242a1a2055ecdf47b2010a615dc9e0136ebd0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578025
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: David LeGare <legare@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-04-13 12:52:24 +00:00
Keiichi Watanabe
c59db48131 devices: vvu: Unbind driver first regardless of driver type
When a VVU driver starts, the current implementation tries to unbind
virtio-pci driver unconditionally, but this can fail when no driver is
bounded or another driver is bounded.

Instead of assuming virtio-pci driver is bounded, we should unbind the
bounded driver regardless of its type by writing to
"/sys/bus/pci/devices/${ADDR}/driver/unbind", which is a symlink to the
unbind file of the currently bounded driver.

This change will allow the vvu driver to open a vvu device after a previous
driver exists. (Note that our vvu device hasn't supported
reinitialization yet.)

BUG=b:216407443
TEST=run vvu on workstation

Change-Id: Ib6c3ac1cd51a8018573596eef9fe0fd759450c07
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3581833
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-04-13 02:27:28 +00:00
Keiichi Watanabe
98dd4c211a docs: Generate API docs only for first-party crates
Pass `--workspace` and `--no-deps` as cargo-doc's arguements.
As a result:
* it won't generate API docs for third-party crates
* it'll generate API docs for our first crates that are not used by the
  minimal crosvm build. (e.g. qcow_utils, libvda, etc)

BUG=none
TEST=test on personal GitHub

Change-Id: I8911eb7d830f1cda77d264c1dc19ff948cfa4768
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578146
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-04-12 22:59:34 +00:00
Keiichi Watanabe
c1ae5cdc49 docs: Generate API docs for non-public items
BUG=b:222030094
TEST=test on my personal GitHub account

Change-Id: I45bc1a3d365bfa170890cee93fef7788d684bbf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578145
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-04-12 22:59:33 +00:00
Keiichi Watanabe
901cd7df7f Reland "github: Minimize dependencies for document generation"
This is a reland of commit 2b85d4d1e5

Diff from the original CL:
* Changed the return value of `main()` in power_monitor/build.rs
* Ran cargo-check with all features enabled

Original change's description:
> github: Minimize dependencies for document generation
>
> Instead of install full dependencies with `install-deps` in GitHub
> action, minimize dependencies because we use GitHub only for document
> generation.
>
> - Passed `CARGO_DOC` environment when running cargo-doc command so we
>   can skip unnecessary build flow when we just want to generate API docs.
> - Added a new script `install-docs-deps` to install only doc-related
>   dependencies.
>
> BUG=none
> TEST=test on GitHub Action at my personal repository
>
> Change-Id: Ibe988ab43215e285d946812bdd6c1536ae87b50e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578144
> Tested-by: kokoro <noreply+kokoro@google.com>
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Reviewed-by: Anton Romanov <romanton@google.com>
> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>

Bug=none
TEST=cargo check --all-features

Change-Id: I77ee6543910e3fe7f69be48f8f965eda3433d4e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3584063
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-04-12 22:30:10 +00:00
Lepton Wu
d33666bbd7 x86: Advertise hwp related features.
intel pstate cpufreq driver requires these to work.

BUG=b:220638871
TEST=manual - check cpuinfo_max_freq under sysfs

Change-Id: Ia5ee0aa700520f7ae19f3cb3da3ecfaa2641eceb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3583066
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Lepton Wu <lepton@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Lepton Wu <lepton@chromium.org>
2022-04-12 17:23:31 +00:00
Junichi Uekawa
7af06dfc70 Revert "github: Minimize dependencies for document generation"
This reverts commit 2b85d4d1e5.

Reason for revert: breaks powerd compile

Original change's description:
> github: Minimize dependencies for document generation
>
> Instead of install full dependencies with `install-deps` in GitHub
> action, minimize dependencies because we use GitHub only for document
> generation.
>
> - Passed `CARGO_DOC` environment when running cargo-doc command so we
>   can skip unnecessary build flow when we just want to generate API docs.
> - Added a new script `install-docs-deps` to install only doc-related
>   dependencies.
>
> BUG=none
> TEST=test on GitHub Action at my personal repository
>
> Change-Id: Ibe988ab43215e285d946812bdd6c1536ae87b50e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578144
> Tested-by: kokoro <noreply+kokoro@google.com>
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Reviewed-by: Anton Romanov <romanton@google.com>
> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>

Bug: none
Change-Id: Ie16b65235490071ac4e69bf3f09af3ba0c766eab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3581836
Auto-Submit: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-04-12 13:15:16 +00:00
Junichi Uekawa
3c9351b446 argument: Use terminal_size crate for getting terminal size.
BUG=None
TEST=crosvm help  # reflows at width even in my emacs shell.

Change-Id: I18afb7e359f369d1a0f5291bb7386f84769efe81
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3556929
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-04-12 10:42:12 +00:00
Junichi Uekawa
5b414d97ec argument: Automatically reflow help messages.
Long help messages are not really easy to display, and they had to be
manually indented 30 spaces to be consistent. Let the machine do that
computation. Just use a space to delimit and assume ASCII.

BUG=None
TEST=crosvm run --help looks reasonable.

Change-Id: If846d7ec21be14941049b50d25a1401ed6dd8af0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3524465
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-04-12 08:58:05 +00:00