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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Clippy warns us that this block can be collapsed.
BUG=None
TEST=cargo clippy --features plugin
Change-Id: Ie094f85a79ffca210e42744237e8f2f0067045d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3581830
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
run_vvu() was running the request handling loop on the executor passed
as argument, even though it is an async function that is being run on
the very same executor.
BUG=b:194137301
TEST=VVU console device is working.
Change-Id: I8c79f9285329c07b3411b2d4121c94d0e5c88a49
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578142
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
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>
chrono, rand, and regex are only needed in the Windows parts of base for
now; remove them from the common dependencies so we don't need to
compile them for Linux builds.
BUG=None
TEST=cargo build --timings
Change-Id: Ib62d8e9c71860a4e924a05c8453c6bd54ba7ecf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3579725
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Common descriptor code can be moved into the appropriate descriptor.rs
and platform-specific files instead of living in the top-level base
lib.rs file.
BUG=None
TEST=tools/presubmit
TEST=kokoro ci
Change-Id: I07b8d822c40b563cffd12c7726a5c126bc1a0e10
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3573363
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
After the preceding patch series, it is now unused.
BUG=None
TEST=tools/presubmit
Change-Id: I8639357db101517de830ef4e3e33bc40980391b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3572771
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This lets us remove the wrap_descriptor() calls.
A few other places around the tree need to be updated to use Descriptor
instead of RawFd to match the new API.
BUG=None
TEST=tools/presubmit
Change-Id: Ie290f082b50bcf6ae8f77ce6a8b7615fad1be480
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3572770
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Perform coordinated PM in the hypervisor for vfio-pci devices using
several sysfs interfaces added to the hypervisor kernel.
The interfaces used and the PCI header hacks are identical to the ones
previously added to pcie.
This is only a temporary solution. A proper communication channel should
be implemented in the future.
BUG=b:189182339
TEST=boot manatee and verify the sysfs interfaces are used correctly in
the hypervisor
Change-Id: I8022ed17e4bf898065b5ebcf8fe09f5c8e3c3fa4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578021
Reviewed-by: Dmytro Maluka <dmy@semihalf.com>
Reviewed-by: Tomasz Nowicki <tnowicki@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Perform coordinated PM in the hypervisor using several sysfs interfaces
added to the hypervisor kernel.
- /sys/bus/pci/devices/X/power/coordinated
Writing "enter" to this file will cause the device to enter PCI
coordinated PM
Writing "exit" to this file will cause the device to exit PCI
coordinated PM
- /sys/bus/pci/devices/X/power/op_call
A write to this file will cause the device to perform a PCI PM
operation
- /sys/bus/pci/devices/X/power_state
A read from this file returns a snapshot of the device's current power
state, including PCI_D3cold
The guest makes use of these interfaces through a couple of
quick-and-dirty hacks in the PCI header in the guest.
- Byte writes to the "Revision ID" register are interpreted as PM op
calls
- Reads from the "BIST" register are interpreted as device PCI power
state
The PCI spec defines the "Revision ID" register as read-only. The "BIST"
register is mostly considered legacy and its use has not been observed
in recent Chromebooks.
The rest of the PCI config accesses remain the same.
This is only a temporary solution. A proper communication channel should
be implemented in the future.
BUG=b:189182339
TEST=boot manatee and verify the sysfs interfaces are used correctly in
the hypervisor
Change-Id: I7570728257300435d0fc77076d1e3f6bea6af5e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3455125
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmytro Maluka <dmy@semihalf.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Launching a VVU device requires access to /dev/vfio/$vfio_group. The
permissions on those files can't be set by upstart, since the files
don't exist until a vvu device process binds its vvu pci device to
vfio-pci. Instead, the permissions are set via udev rules.
Unfortunately, there is no good way to wait for udev to modify the
permissions, so the device process just needs to poll until it is
successfully able to open its device.
BUG=b:222424090
TEST=vmc start termina
Change-Id: Id8668c66ff7ddaa7bb43061979ead51d12cde8f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3574422
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Implement the standard FromStr trait, since it has the same prototype as
our existing from_string function.
BUG=None
TEST=cargo test -p devices pci_address
Change-Id: I41bb77638891bfcc39f9fb555b3463f2f92c029f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3576956
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>