Commit graph

3490 commits

Author SHA1 Message Date
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
Alexandre Courbot
2128b2f2d4 plugin: fix clippy warning
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>
2022-04-12 04:37:47 +00:00
Alexandre Courbot
b32bcc4edc devices: vvu: handler: do not run executor within async method
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>
2022-04-12 02:11:37 +00:00
Keiichi Watanabe
2b85d4d1e5 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>
2022-04-12 01:41:37 +00:00
Daniel Verkamp
772a28edca base: move Windows-only deps into the target section
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>
2022-04-12 00:49:29 +00:00
Daniel Verkamp
f620437e8b virtio_sys: regenerate bindings
BUG=b:218388029
TEST=tools/presubmit --quick

Change-Id: I381dbc4d97e3a0a99dedd4416a347388daf4ccf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339853
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-11 21:14:01 +00:00
Daniel Verkamp
f35f636cc5 Rust 1.60 clippy fixes
BUG=None
TEST=tools/presubmit # with rust-toolchain updated to 1.60.0

Change-Id: I5772e8b0593f8d92003e93aeb2145e87610abe2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3577332
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-11 20:40:36 +00:00
Daniel Verkamp
a795bfff65 base: move descriptor traits and fns out of lib.rs
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>
2022-04-11 20:27:09 +00:00
Daniel Verkamp
3894aa042a base: remove wrap_descriptor
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>
2022-04-11 20:27:07 +00:00
Daniel Verkamp
fa0ffe7e81 base: accept AsRawDescriptor in PollContext/EpollContext/mmap
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>
2022-04-11 20:27:06 +00:00
Peter Fang
63c3a69e21 devices: vfio_pci: implement coordinated PM using PCI config accesses
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>
2022-04-11 19:09:27 +00:00
Peter Fang
87f947a4ff pcie: implement coordinated PM using PCI config accesses
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>
2022-04-11 17:54:51 +00:00
David Stevens
4257919fa7 devices: vvu: poll when opening vvu device
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>
2022-04-11 04:56:18 +00:00
Daniel Verkamp
aebda741ff devices: pci: convert PciAddress::from_string into FromStr impl
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>
2022-04-08 19:42:39 +00:00
Jiyong Park
0914020f0b Add --task-profiles flag for Android
--task-profiles NAME[,...] is used in Android to set the task profiles
[1] for the VM. Task profiles are Android-specific abstraction over
cgroups. Although crosvm already supports --vcpu-cgroup-path, the option
is not desirable in Android, because cgroups are considered
device-specific there. i.e. the existence of a specific cgroup is not
guaranteed across different forks of Android. Moreover, the intended use
of each cgroup may differ in different devices.

--task-profiles internally uses libprocessgroup to set the task
profiles.

[1] https://source.android.com/devices/tech/perf/cgroups

BUG=b:216788146
BUG=b:223790172
TEST=cargo build
TEST=use --task-profiles Dex2oatPerformance in Android and check that
crosvm threads are shown at /sys/kernel/vendor_sched/dump_task

Change-Id: I7a800f1e88e2d7a9c2be152f60bf4affaa1fdd75
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3574427
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Victor Hsieh <victorhsieh@chromium.org>
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>
2022-04-08 16:04:10 +00:00
David Stevens
e123e39433 devices: vvu: use CrOS memory size for BAR size
The size of the BAR limits the size of sibing VMs that can be used with
the vvu proxy device. Since concierge creates VMs with memory size a
little bit smaller than the amount of physical memory it sees, use the
CrOS guest's memory size for the vvu proxy device bar size. Since what
consumes memory is the mapping of sibling memory into the CrOS guest
(not the BAR itself), it's not necessary to strictly limit BAR size.

BUG=None
TEST=vmc start termina

Change-Id: I899e3f126b7ab32665aeabc05f51d3b121dec808
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3574423
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-04-08 12:30:44 +00:00
Woody Chow
91296bdee0 devices: vvu: virtio-iommu support in virtio-vhost-user
Make vvu use devices use VFIO to manage their virt queues. This
alleviates the need to use noiommu mode. However, it is still necessary
to use `vfio_iommu_type1.allow_unsafe_interrupts=1`.

BUG=b:202151642,b:215310597
TEST=launch sibling with vvu + virtio-iommu

Cq-Depend: chromium:3565728, chromium:3565260
Change-Id: If418524598c40a37d41c0ffaa1dcc0f8ee11fcb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3501052
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-04-08 01:39:22 +00:00
Junichi Uekawa
33af75be29 crosvm: Bump version number.
There are two copies of io_uring and cros_async that are slightly
different. Bump the version number of new one.

BUG=None
TEST=cargo build

Change-Id: I7f82d3c5f01633bef7d0ce14ab777bbb50d4fbd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3565625
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-04-08 01:04:50 +00:00
Anton Romanov
79b3a811ca Reland "crosvm: Remove CLOEXEC from fds passed into non-jailed plugin"
This is a reland of commit 7afcfa00e7

remove rlib as it doesn't play nicely with cros-rust.eclass' lto
BUG=none
TEST=cargo test

Original change's description:
> crosvm: Remove CLOEXEC from fds passed into non-jailed plugin
>
> Otherwise we'll lose them
>
> BUT=none
> TEST=kokoro/luci
>
> Change-Id: I6b48b802be7c985efb05a4e9ffb326c63117e677
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3570179
> Tested-by: kokoro <noreply+kokoro@google.com>
> Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
> Commit-Queue: Anton Romanov <romanton@google.com>

Change-Id: I74bfc2311e4892cdcf7f517d25234409176bc9dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3575286
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-04-07 23:12:16 +00:00
Long Cheng
3491bdfc56 Revert "Apply usb configuration even configuration is not changed."
This reverts commit 7ea795dc56.

Reason for revert: This cl cause some Android devices in debug mode fail to connect to crostini 

Original change's description:
> Apply usb configuration even configuration is not changed.
>
> Apply usb configuration even when configuration is not changed. When
> Android sets usb configuration, it expects the device connection gets reset.
> This change will pass CTS verifer  USB devices tests which try to
> observe device connection and reconnection after set unchanged usb
> configuration.
>
> BUG=b:123374026
> TEST= Run cts verifer USB device tests in ARCVM.
> TEST=lsusb in crostini. device shows.
>
> Change-Id: I5856d1173a3ea1a65c6fa205cb9facd407706a6c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3413815
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Auto-Submit: Long Cheng <lgcheng@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Long Cheng <lgcheng@google.com>

Bug: b:123374026
Change-Id: Ie5a91a3af5083f2174a329add53763ccc4d1e82b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3575287
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Long Cheng <lgcheng@google.com>
2022-04-07 20:21:44 +00:00
Daniel Verkamp
ceb5ef155a aarch64: fdt: add PSCI compatible string tests
Move the PSCI version to compatible code to a function so it can be more
easily tested and add a few basic unit tests.

BUG=b:227142928
TEST=tools/dev_container tools/run_tests --target=vm:aarch64

Change-Id: I383b6e9df76f26995adab6fe980fd29fe1fcdf0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3573362
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-07 18:08:55 +00:00
Daniel Verkamp
1d1372f742 aarch64: fdt: fix PSCI v0.1 case
This was accidentally creating a new `compatible` variable that shadowed
the other one rather than updating its value.

BUG=b:227142928
TEST=tools/presubmit

Change-Id: I11ec4f89501315d9946a5641493673ab6e938b76
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3573361
Reviewed-by: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Andrew Walbran <qwandor@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-07 18:08:54 +00:00
Daniel Verkamp
1060d852d6 media/libvda: fix bindgen path after move
BUG=None
TEST=media/libvda/bindgen.sh

Change-Id: Icef4201663543abe7f52a595c72fd6321d5a8968
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3574975
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-04-07 13:28:37 +00:00
Dmytro Maluka
0ac97979b6 direct_irq: Add support for host wakeup capable IRQs
Add userspace counterpart to host kernel change CL:3571844 to support
physical wakeup of the machine from suspend via forwarded interrupts
from wakeup-capable devices owned by CrOS (touchpad, keyboard etc).

Add --direct-wake-irq param for marking forwarded IRQs as wakeup
capable.

BUG=b:227735609
TEST=put DUT in s2idle and wakeup by keyboard and LID open

Change-Id: I28fe26a06ca88920e55caf1121c5774711db2160
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3572121
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
2022-04-07 10:40:41 +00:00
David Stevens
91e5125853 Revert "crosvm: Remove CLOEXEC from fds passed into non-jailed plugin"
This reverts commit 7afcfa00e7.

Reason for revert: breaks emerge crosvm

Original change's description:
> crosvm: Remove CLOEXEC from fds passed into non-jailed plugin
>
> Otherwise we'll lose them
>
> BUT=none
> TEST=kokoro/luci
>
> Change-Id: I6b48b802be7c985efb05a4e9ffb326c63117e677
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3570179
> Tested-by: kokoro <noreply+kokoro@google.com>
> Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
> Commit-Queue: Anton Romanov <romanton@google.com>

Change-Id: Ied2f67efce1f746cbcc7ee342eb86e37ca5cf212
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3575953
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-04-07 06:44:03 +00:00
Alexandre Courbot
93aefc512c devices: block: merge device and vhost-user handle_queue functions into one
Both the regular asynchronous block device and the vhost-user one had
their own handle_queue() method which are almost identical ; they can be
merged into one function if we tune the arguments of the original to
make those of the vhost-user version, and implement SignalableInterrupt
for interrupts behind a Rc<RefCell<>>, similarly to what is already done
for Arc<Mutex<>>.

BUG=b:228385297
TEST=block device works with both regular VM and using virtio-vhost-user.

Change-Id: I657bd8331275d3c3827b2f799562bcd8a272d07b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3565302
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-04-07 01:53:38 +00:00
Dmitry Torokhov
a4a3b1dd6c devices: irq_event: implement as_raw_descriptors() and use them
This implements AsRawDescriptors trait for IrqEdgeEvent and
IrqLevelEvent and updates the users.

BUG=None
TEST=./tools/presubmit

Change-Id: I879531e98396f1eb8e99db73cb00d7b3330101a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3552317
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-07 01:41:56 +00:00
Dmitry Torokhov
7997f0c28f devices: vfio_platform: add specialized assign_{edge|level}_platform_irq()
The new specialized functions take IrqEdgeEvent and IrqLevelEvent
arguments, so that callers can use them directly.

BUG=None
TEST=./tools/presubmit

Change-Id: I2e5c5d92a6c292f31ad6cfb8652f0c46f0a7a958
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548067
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-07 01:41:53 +00:00
Dmitry Torokhov
f021a62130 devices: irqchip: add specialized register_{edge|level}_irq_event()
The new specialized functions take IrqEdgeEvent and IrqLevelEvent
arguments, so that callers can use them directly.

BUG=None
TEST=./tools/presubmit

Change-Id: I2c1272e31f6b20eb22743b003bd23b9c1105cda6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548066
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-07 01:41:52 +00:00
Dmitry Torokhov
c11a18b713 devices: vfio_platform: change assign_platfrom_irq() to accept events refs
This is in preparation for callers to use IrqEdgeEvent and IrqLevelEvent
and follows general principle in crosvm that if entity needs to hold on
to an event, the entity is responsible for cloning it.

BUG=None
TEST=./tools/presubmit

Change-Id: I9da9a5156108355449b290a2a848257816370fb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548064
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-07 01:41:51 +00:00
Dmitry Torokhov
99067756fb devices: vfio_platform: make assign_platform_irq() return errors
This allows to make the code more concise and gives callers a chance
to act upon errors.

BUG=None
TEST=./tools/presubmit

Change-Id: Ibd9d53270bc21f90fcb44c673d2c7f3763a44c3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548063
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-07 01:41:50 +00:00
Noah Gold
44306221c1 devices: Upstream Windows vhost-user net device.
Splits the vhost-user device into unix & Windows components, and
upstreams the Windows side. Note that we can't build devices on Windows
yet in crosvm because we have to upstream a fair bit more first
(net_util, cros_async, the vmm side of the vhost-user device).

Since net_util isn't upstreamed yet, we've made some very minor changes
to keep things consistent & building on Linux.

TEST=unix is tested by bots upstream & downstream; windows is tested by
bots downstream only.

BUG=b:226233737

Change-Id: Ie3f9818ff93c9e0085a5434055f9dc71c6f6851c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3549854
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-07 01:19:21 +00:00
Kameron Lutes
cd0e7edcc7 Docs: Fix kernel config build steps
ChromeOS moved to using split config, so update the build steps for a
custom kernel to reflect the new procedure.

BUG=b:228107412
TEST=Follow the custom kernel rootfs steps with the new config steps

Change-Id: Ib8f7d8748897fb6b907d0da4c25e2cccba1c5954
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3570172
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-04-06 23:58:34 +00:00
Dmitry Torokhov
7b7a20620f devices: direct_irq: switch to using IrqEdgeEvent and IrqLevelEvent
With users of IRQ code switching to dedicated objects to represent IRQ
signalling, let's introduce DirectIrq::new_edge() and
DirectIrq::new_level() methods accepting appropriate event types.

BUG=None
TEST=./tools/presubmit

Change-Id: I18d9373c8cf5ed9db7c33227ca8b67e0a9136f6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548062
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-06 23:46:08 +00:00
Anton Romanov
f87295a8ce crosvm: skip creating tap device in plugins tests if not enough capabilities
BUG=none
TEST=presubmit

Change-Id: Icf3948941103b535ec138e68a05298c18d469485
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3574989
Auto-Submit: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-06 23:26:09 +00:00
Junichi Uekawa
b3a094e820 crosvm: Support for RDMSR in userspace.
Add basic support so that it is possible to pass through some MSR from
the host, like the temperature and C state counters.

BUG=b:215297064
TEST=iotools rdmsr 0 0x1a2

Change-Id: Ie7bfdc00dfaac1e097a29f3a8fe58efc84510a62
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3499759
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-04-06 23:26:00 +00:00
Dmitry Torokhov
d77eab2921 devices: acpi: convert to using IrqLevelEvent
Now that we have enough infrastructure in place, we can convert
ACPIPMResource to use IrqLevelEvent for both the host (direct) and guest
SCI handling, which makes the code cleaner.

BUG=None
TEST=./tools/presubmit

Change-Id: Ia3c522a9b143b852bf9c34f62a975b670530a82f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548065
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-06 23:21:19 +00:00
Anton Romanov
24a226169d Run some win64 tests with wine as part of presubmit
docker container size increases to ~4.7-8 Gb

TEST=./dev_container --hermetic ./tools/presubmit
BUG=none

Change-Id: I49dc03182f6ac5c29e0174618cc3864e073a2eb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3499264
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
2022-04-06 19:45:49 +00:00
Daniel Verkamp
c30abefc07 vfio_sys: regenerate bindings
BUG=b:218388029
TEST=tools/presubmit --quick

Change-Id: Ia1dc0daeb8d642ca94336c671639691930a246f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339852
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-06 19:20:35 +00:00
Daniel Verkamp
ac0b33ad9f net_sys: regenerate bindgen bindings
This replaces the bindgen-based bindings with Rust libc crate types and
constants where possible, so our custom bindings are significantly
reduced.

BUG=b:218388029
TEST=tools/presubmit --quick

Change-Id: I7f20ecf5ccd651456f9a23ce7964fdbd0e8064ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339851
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-06 19:20:34 +00:00
Dmitry Torokhov
dd21595173 devices: pci: change assign_irq() to accept IrqLevelEvent
This continues conversion from a pair of Event objects to single
IrqLevelEvent.

BUG=None
TEST=./tools/presubmit

Change-Id: Iec7e94f4c40cc29fa612cc3ae364cc6f8b0d0177
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548061
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-06 18:54:49 +00:00
Dmitry Torokhov
be3bbc0f37 devices: pl030: convert to using IrqEdgeEvent
This converts pl030 code to use IrqEdgeEvent.

BUG=None
TEST=./tools/presubmit

Change-Id: Ibc216d1989d90880176e70821f3d98ccc41302f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3572999
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-06 18:54:48 +00:00
Dmitry Torokhov
ccb9e902d0 devices: ac97: convert to using IrqLevelEvent
This converts AC97 code to use IrqLevelEvent.

BUG=None
TEST=./tools/presubmit

Change-Id: If388b724db808891a5bcb5ad040a7dfc4a4dff9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548060
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-06 18:54:47 +00:00
Dmitry Torokhov
e1196921a7 devices: xhci: convert to using IrqLevelEvent
This converts XHCI code to use IrqLevelEvent.

BUG=None
TEST=./tools/presubmit

Change-Id: I503ab76e162c4175c0be62a6d9ddf8da18f8617b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548059
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-06 18:54:46 +00:00
Dmitry Torokhov
3d159f8e50 devices: pcie: convert to using IrqLevelEvent
This converts PciBridge to use IrqLevelEvent.

BUG=None
TEST=./tools/presubmit

Change-Id: I01b8da5a6bc843a1b065c0e19e026aa5ddaff71e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548058
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-06 18:54:45 +00:00
Dmitry Torokhov
f6f5789f51 devices: vfio_pci: convert to using IrqLevelEvent
This converts VfioPciDevice to use IrqLevelEvent.

BUG=None
TEST=./tools/presubmit

Change-Id: Idc3dd32ec92936e771f0d418aa4c0dfb6eb9d3ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548057
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-04-06 18:54:43 +00:00