Commit graph

4082 commits

Author SHA1 Message Date
Alexandre Courbot
98bdae6557 virtio: vhost: user: remove associated constants from VhostUserBackend
Replace the associated constants by methods. On top of the fact that the
number of queues and their maximum size might be instance-dependent,
this also prevented us from creating VhostUserBackend trait objects.

BUG=b:217480043
TEST=cargo build

Change-Id: I82a9f6d6e1397af467096458f8797d1089eed1fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3702778
Reviewed-by: Morg <morg@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-15 16:50:10 +00:00
Alexandre Courbot
cf7904a0a0 virtio: vhost: user: remove Sized constraint on VhostUserBackend trait
This constraint seems to be unneeded and prevents us from creating
VhostUserBackend trait objects.

BUG=b:217480043
TEST=cargo build

Change-Id: I79c1015d3a45902bc18cd22e52de78b2639354aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3702777
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-15 16:50:09 +00:00
Alexandre Courbot
2ac78210ef virtio: vhost: user: remove Error type parameter for VhostUserBackend
This type is never set to anything else than `anyhow::Error` and makes
it harder to work with VhostUserBackends as trait objects.

BUG=b:217480043
TEST=cargo build

Change-Id: Iae0be59f9b2bcec1e3fe9b22cbec2f9b99a59020
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3702776
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Morg <morg@chromium.org>
2022-06-15 16:50:08 +00:00
David Stevens
c12ea3dc0b crosvm: fix some direct only argument parsing
Fix a couple of compilation errors around direct-only argument parsing.
This is a followup to CL:3684144.

BUG=None
TEST=emerge-brya-manatee crosvm, boot brya-manatee w/new crosvm-direct

Change-Id: Iff45f5dd2240f183f303056e7855078fa891e058
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3706477
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-15 16:49:02 +00:00
Alexandre Courbot
9b8ef9d65b crosvm: config: re-enable ffmpeg feature
The ffmpeg feature flag handling code has been inadvertedly removed by
http://crrev.com/c/3684144. Restore it.

BUG=b:169295147
BUG=b:179756087
TEST=`cargo build --features "video-decoder,ffmpeg"` and decode a video
     from a guest.

Change-Id: Id0d0f8c380353648e53602c6fa56ae9a0115cb8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3706480
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-06-15 16:46:57 +00:00
Masami Hiramatsu
eb83ee79b6 aarch64: Add Goldfish battery to aarch64 crosvm
Add Goldfish battery to aarch64 crosvm. The guest kernel will
see the goldfish battery node on the FDT.
This copies the seccomp policy for the battery from x86-64.

BUG=b:214124318
TEST=create VM with parameter "--battery" or "--battery=type=goldfish"
TEST=android-sh -c 'dumpsys battery'
TEST=tast run ${DUT} arc.PerfBoot.vm

Change-Id: I8212e760db5ffbc5d01442cfa7930baa5962ef6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686713
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Masami Hiramatsu <mhiramat@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Masami Hiramatsu <mhiramat@google.com>
2022-06-15 02:46:45 +00:00
Federico 'Morg' Pareschi
44b5dccc2c devices: virtio: Use mmap for vvu QueueNotifier
Just like with the doorbell notification system, this patch makes use of
mmap for the queue notification mechanism. It also refactors some of the
code to make the QueueNotifier struct more standalone and changes the
signature of the notify() method.

BUG=b:231938067
TEST=built and run, verified vvu communication happens as expected

Change-Id: I2d51432a38ac0048a2bd3aae7c5c31d7ab45d65f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686712
Auto-Submit: Morg <morg@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Morg <morg@chromium.org>
2022-06-15 00:56:50 +00:00
Peter Fang
cc4d016445 devices: vfio: fix mmap offset in VFIO_REGION_INFO_CAP_MSIX_MAPPABLE
vfio_region_info.offset refers to the region offset from start of device
fd while add_bar_mmap() expects the mmap offset from its BAR address.

When VFIO_REGION_INFO_CAP_MSIX_MAPPABLE is included, the entire BAR
region is considered mmap-able at first until add_bar_mmap_msix() carves
out the MSIX portions, so the offset should always be 0.

BUG=b:184904868
TEST=boot Linux kernel and verify MSIX-capable passthru devices work
properly

Fixes: 01527e39b3 ("add support for VFIO_REGION_INFO_CAP_MSIX_MAPPABLE")
Change-Id: Ib16c13b14199221ac247733feb05b3aa6fd4c73c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3696656
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Xiong Y Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-15 00:01:33 +00:00
Daniel Verkamp
29ba40cec9 crosvm: fix copyright headers
Remove the accidental trailing comma to silence repo pre-upload checks.

BUG=None
TEST=repo upload

Change-Id: I819c7584640065aceafa53ef8bca38879b4a39f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3703394
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-14 23:56:51 +00:00
Devin Moore
617c6ba837 crosvm: Add gpu parameter for the PCI BAR size
Some devices may need to use smaller sizes. The default of 8GB (1 <<33)
won't work with 32-bit.

BUG=b:228880581
TEST= build and boot 32-bit Cuttlefish with smaller size

Change-Id: Ic170fa655b963188c34ecaf32b51cc0ddafb84ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3703159
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Devin Moore <devinmoore@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Devin Moore <devinmoore@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-14 20:22:39 +00:00
Takaya Saeki
69c8d8093d devices: vvu: fix incorrect VVU PCI feature bits initialization
At present the VVU PCI driver writes the feature bits it wants to
enable to the device feature bits first, and then reads the device
feature bits in the initialization sequence. However, the correct
sequence is reading the device feature bits first, and writing the
feature bits to enable to the driver feature bits next. This incorrect
initialization sequence causes warning messages when you run the VVU
driver.

Fix the driver so that it follows the correct feature bits
initialization sequence.

BUG=b:216752120
TEST=VVU block device works with no warning message.
TEST=presubmit --quick

Change-Id: I7f7536143ee2a037fd71aa216513ad732b407cc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3705077
Commit-Queue: Takaya Saeki <takayas@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-14 17:22:35 +00:00
soichiro
f51e3a3ce2 docs: book: add balloon device docs
BUG=b:235067563
TEST=mdbook build

Change-Id: Ibf65e96adef4cebdd4356b7de55820018622ca01
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3697995
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-06-14 05:13:14 +00:00
Anton Romanov
7910b89eb3 crosvm: move run command to argh
Due to the way we allow arguments to be specified I was not able to
reuse Config structure for cmdline arguments. (eg we allow multiple ways
to specify same config)

There is still some usage of arguments mod that we need to cleanup
later.

Change-Id: Ia0c12d508d0a10d17f58944de71276e5984d69ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3684144
Auto-Submit: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-06-13 23:55:20 +00:00
Allen Webb
efdcf90a42 base: Minor Cargo.toml changes for ChromeOS support.
Add 'provided by ebuild' in necessary places to install crosvm's base
crate on ChromeOS as crosvm_base. Also fix dependency ordering and add a
missing version attribute.

BUG=b:229016539
TEST=FEATURES=test emerge-${BOARD} crosvm_base

Change-Id: Ie09e16819e7e27664b5897afd8c6a40e19cc87ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3703158
Auto-Submit: Allen Webb <allenwebb@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-06-13 23:16:13 +00:00
Vikram Auradkar
3a2f600275 devices: Conditionally depend on unix only crates
BUG=b:213149155
TEST=presubmit

Change-Id: I89a1aaf3e171cbd6c1591ae510dd46424d6f8752
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3703221
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-06-13 23:08:52 +00:00
Vaibhav Nagarnaik
e88a40eb9e haxm: Switch from haxm/mod.rs to haxm.rs
Use the upstream style for adding module specific file in the crate
instead of adding a `mod.rs`.

TEST=compiled.

Change-Id: I2225f6615b68738cd3e1cdce68b4d011dfaab790
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3700982
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
2022-06-13 22:35:36 +00:00
Vaibhav Nagarnaik
ed632b56a8 cpuid.rs: Fix Formatting
From the change https://crrev.com/c/3690369, some unexpected indentation
happened which rustfmt didn't/couldn't catch.

Fix the whitespacing.

Test: NA
Change-Id: Ic8bd80a9c72b8d57b9131ba7e37165dba934bc8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3703224
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-13 20:53:54 +00:00
Vaibhav Nagarnaik
f007f335a4 tsc: Refactor test imports
Use `cfg_if` to refactor test imports to provide test only definition
for `__cpuid_count`. Otherwise use the definition from
`std::arch::x86_64`.

BUG=b:234508273
TEST=Compiled.

Change-Id: I0d93f6a86522451c540af9d520bfdeffd4f8dbf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3701441
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-13 20:53:52 +00:00
Daniel Verkamp
cdbe5cb842 docs: book: add pmem device docs
BUG=b:235067568
TEST=mdbook build

Change-Id: I38d58a4ce3910ad382c1cf3e7bdc5a43f5b0b4ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3692420
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-06-13 20:06:44 +00:00
Daniel Verkamp
9cba352186 docs: book: link devices subpages from index
Replace the source code links with the documentation pages for the
devices that have them.

BUG=None
TEST=mdbook build docs/book
TEST=Verify that devices/index.html links to the right pages

Change-Id: Ie7e61adec9326466b2e1236fed4e768c2d5d3dd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691975
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-13 20:06:42 +00:00
Dennis Kempin
7522871fe2 Add new email lists to README.md and book
BUG=b:234519125
TEST=None

Change-Id: I8b4bed949fc66c87c5f2bf388b3d618b055244a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3698994
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-13 19:39:11 +00:00
Vikram Auradkar
7874d2011e vm_control: Upstream windows patches and enable tests
BUG=b:213152502
TEST=presubmit after enabling vm_control tests

Change-Id: Ie4709dfeb428c527091447bd6f0bda2c14b5492e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3698049
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-13 17:34:44 +00:00
Vikram Auradkar
69f3931ee6 rutabaga_gfx: Upstream cross_domain.rs
BUG=b:213151426
TEST=presubmit. enables windows tests

Change-Id: I1ec80b88c8e66454d7eb911a8d366747528ff4fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3698048
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-13 17:34:42 +00:00
Keiichi Watanabe
77ca3e34e6 devices: vvu-proxy: Support reconnecting when a sibling exits
This change will allow the guest to start a new VVU device backend
after an old VVU device backend process exited due to sibling
disconnection.

More specifically, this CL will allow the vvu-proxy to support scenarios
like follows:
1. A device backend starts in the guest and a sibling VM connects to
the socket.
2. The sibling VM shuts down. Then, the device backend process exists in
the guest. And, the vvu-proxy's state is changed from `Running` to
`Activated`.
3. Return to 1.

Note that we don't support more complicated reconnection scenario such
as:
* reconnection after sibling's unexpected crash
* restart after device backend's unexpected crash

To support the reconnection feature, the vvu-proxy device needs to clean
its status when a sibling disconnected. Specifically, it needs to
* reset virtqueues' state,
* unregister memory regions that it registered via VmMemoryRequest, and
* update the device state from the worker thread.

BUG=b:216407443
TEST=run on workstation; sibling could reconnect after the first
instance exits.

Change-Id: I4c01e6069484ff74a0d643edd6a3b3231fb5c2d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3602361
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-13 09:19:37 +00:00
Keiichi Watanabe
45ed48f213 docs: Add a page about VVU
BUG=b:233174191
TEST=mdbook build
TEST=test in my github repo

Change-Id: Ib1692b1ad64f3f6219cd549044efadd749177c69
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3659819
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-06-13 08:48:23 +00:00
Daniel Verkamp
9cac83921f docs: book: add --disk options
Document the various optional disk settings.

BUG=None
TEST=read mdbook

Change-Id: I0f797c840e35a7993d13386d2dc6e75e2898f854
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691973
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-13 03:45:45 +00:00
Noah Gold
c7ddaec446 x86_64: refactor cpuid passthrough code.
Reworks the way we organize parameters to this module, and
adds CPU manufacturer detection.

BUG=213152505
TEST=builds

Change-Id: Ibb96f08cacbdfdaff5ef971c3d6d7b901b5d73fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3690369
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-10 23:43:02 +00:00
Noah Gold
dfcc146b02 devices: upstream userspace apic.
This APIC is used by the userspace irqchip (to be upstreamed soon).

Original author: Steven Richman <srichman@google.com>

BUG=213152505
TEST=builds

Change-Id: I51b89e96af88f2f1c08998b70053fc37bd3cfcaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3696535
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-10 23:19:38 +00:00
Noah Gold
4679ac4183 devices: add IrqChipX86_64::lapic_frequency.
This function is used to generate cpuid leaf 15H in some situations.

BUG=213152505
TEST=builds

Change-Id: Ia5a7c46b32f1bdba366a500caa650edb2e3ae99f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3696534
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-06-10 20:24:09 +00:00
Richard
2efb19303d win_audio: Upstream Window's audio crate
This crate has been copied upstream verbatim. This crate is used as an
audio backend for playback (capture has not been implemented yet).

The next CLs are will upstream the usage of win_audio.

Bug: 232462411
Test: built and presubmits (although this crate won't be built locally or
presubmits yet)

Change-Id: Iae374b2b575fbd19b016cae403a00024896cba56
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3694097
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-10 19:04:05 +00:00
Richard
7aac156d53 devices: Upstream remaining Windows code for iommu
This CL will:
 * Fix the test in ipc_memory_mapper for Windows
 * Conditionally compile out the Vfio error for Windows

On Windows, when one end of a Tube is dropped, the underlying named pipe
connection will be severed. `response_tx` could be dropped due to a race
condition, so this CL fixes that.

BUG=b:234497712
TEST=built and ran test

Change-Id: I4a8b475e117639fd3615cbf9e958aac8af1d00f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3696672
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
2022-06-10 18:30:38 +00:00
Vaibhav Nagarnaik
839fc21eb2 devices: Add tsc handling
Add `tsc` as a device. Includes operations to calibrate and sync the
TSC values across the physical cores in order to minimize variations
found when moving vcpu threads across cores.

BUG=b:234508273
TEST=Compiled.

Change-Id: I5c79deebc9471dacf9d6596384ee77a8811a58bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3682118
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
2022-06-09 22:15:01 +00:00
Daniel Verkamp
656192e273 crosvm: tweak create_qcow2 usage text
The description for the command would get lumped together into a single
line by argh, so move the description of which options are valid
together into the descriptions of those options instead.

BUG=None
TEST=crosvm create_qcow2 --help

Change-Id: Ie465a678de1df063e921d0f308b214c5a6b103c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3694096
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-06-09 21:53:59 +00:00
Noah Gold
0bb3f1c3eb devices: document interrupt supression.
There's some ring related wrapping math for interrupt suppression
(aka VIRTIO_F_EVENT_IDX) that had some documentation, but was still a little
tricky to follow. This CL adds some diagrams & further details.

BUG=none
TEST=n/a

Change-Id: I591661a676eb6506fbfea2afa20da28aaa1722f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3689972
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-06-09 02:51:27 +00:00
Anton Romanov
ded868a59f crosvm: use vcpu cgorups for plugin
BUG=b:228634930
TEST=presubmit --quick

Change-Id: I92f0a025280fca0cdfdf6b2420cbfd213ec0bc08
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3696460
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
2022-06-09 01:01:48 +00:00
Richard
2ada57d26e devices: Upstream Window's virtio iommu implementation
This doesn't split iommu submodules into their own sys directory. That
will be done in subsequent CLs.

BUG=b:213149162
TEST=built and presubmits

Change-Id: I66c4e9b7dec730f259b9f94adac5a39cb0d2ff48
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3692397
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-08 20:32:25 +00:00
Dennis Kempin
079bbe99e0 infra: Update merge builder to run periodically
The Infra console view is replaced with a list view, since
the builds are no longer just post submit builds.

BUG=b:233913643
TEST=lucicfg validate main.star

Change-Id: Ia1ccc75251ccdb7ae567418235e2bf8b7d6aa16a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3692687
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-08 17:20:27 +00:00
Dennis Kempin
5156976b7f merge_bot: Enable on luci
To enable the merge bot on luci we had to solve a couple of problems:

- We cannot use http cookies for auth, so added gcloud auth into
  merge_bot.
- Switch back to original HEAD after running merge bot. Otherwise
  the version of the merge_bot script can change between invocations.
- Do not soft reset when checking out crosvm source.
- For less invasive testing, also added a few more exceptions when
  using MERGE_BOT_TEST so it won't email, etc.
- Rename to update_chromeos_merges, as it is more fitting to what
  the bot is doing

BUG=b:233913643
TEST=https://ci.chromium.org/swarming/task/5b58ed4497fda510

Change-Id: Iaa9b4821b70a1e90d19637d01856196bd7852ed5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3692686
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-08 17:20:27 +00:00
Alexandre Courbot
9defdd860c devices: vhost-user: cras: fix build with audio_cras feature
http://crrev.com/c/3592633 make `run_with_listener` generic, but did not
update the cras vhost-user device to use this new version.

BUG=None
TEST=Chrome OS build succeeds.

Change-Id: I82342e3a2505dc97e5cdaa1749b9091fb986fa35
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3694880
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-08 09:09:56 +00:00
Keiichi Watanabe
19d2fd9c47 integration_tests: Remove debug field
Remove `TestVm`'s `debug` field and print guest outputs unconditionally.
This won't make the test log messy because the output is hidden unless
the test case fails.

BUG=none
TEST=./integration_tests/run

Change-Id: Ica77492229b547f2e244f2751992869b00b78f7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686716
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-08 07:19:40 +00:00
Keiichi Watanabe
52d56f1d37 integration_tests: Print guest logs only when a test failed
Forward crosvm command processes' stdout/stderr to the test process's
stdout so that the messages will be hidden by `cargo test` unless the
test case fails.

BUG=none
TEST=./integration_tests/run with/without additional panic!() in a test

Change-Id: Ife290fb5333fd792cabdad35acea54732f864610
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686715
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-08 07:19:38 +00:00
Alexandre Courbot
1cbf6665b1 virtio: video: encoder: remove never-read fields
These fields were reported as never read by the compiler.

BUG=None
TEST=cargo clippy --features "video-decoder,video-encoder,libvda"

Change-Id: I7580fa9161ba8239398bb7a5b547d67c0c2591e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3685675
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-08 03:24:04 +00:00
Alexandre Courbot
e67e969534 virtio: video: fix wrong_self_convention clippy lints
Since `Self` implements Copy, these methods can and should take their
parameter by value.

BUG=None
TEST=cargo clippy --features "video-decoder,video-encoder,libvda"

Change-Id: I13c4ed627e4cddc1873cf8fa6e3d5c9ac89eccd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3685676
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-08 03:24:03 +00:00
Alexandre Courbot
da0025851c devices: vhost-user: handler: make run_with_listener() generic
The run_with_listener() method can now be made generic and be used for
both the socket and VVU handlers.

BUG=b:229554679
TEST=vhost-user console device works.
TEST=vvu console device works.

Change-Id: Ic1ae286e573383d6b66c8a406227d6cf51cbd578
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3592633
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-06-08 02:29:21 +00:00
Alexandre Courbot
d60bf43903 devices: vhost-user: handler: stop spawning a thread for the socket listener
The async methods of the socket VVU handler were calling the non-async
accept() on a dedicated thread so the async method does not get blocked
awaiting for a connection. This socket-specific behavior forces us to
have dedicated code for the socket and VVU handlers.

Fix this by adding a poll_descriptor() method to vmm_vhost's Listener
trait that returns a descriptor that callers can poll on if a call to
accept() can block. This way we can wait for the connection
asynchronously and avoid using a thread for that. It also opens the way
towards factorizing the socket and VVU specific code.

BUG=b:229554679
TEST=vhost-user console device works.

Change-Id: I3fbc96d3904f777c6165b04564f577c553ce55d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3592632
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-06-08 02:29:20 +00:00
Alexandre Courbot
a5c1b2ff7f cros_async: add async_from_local()
Add an async_from_local() method, which does the same thing as
async_from() (create an IoSourceExt for asynchronous I/O), but without
the requirement that the passed argument implements Send. Async I/O
sources created that way can only be used in thread-local executors.

BUG=b:229554679
TEST=cargo build

Change-Id: Id4cd0cb177e5fed4b72fab12a6f82f964b9bac28
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3670773
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-08 02:29:19 +00:00
Vikram Auradkar
3cd90a401e crosvm: enable windows tests for vhost crate
BUG=b:213149155
TEST=presubmit

Change-Id: I980e6a6883345768db59064287f836ef66fdbd2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691962
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-06-07 20:46:28 +00:00
Anton Romanov
9ac4427d7b crosvm: vm_control: make handle_request generic over AsRef<Path>
All the Path::new(string var) are very repeptitive and completely
unnecessary

Change-Id: I05e86bcf9ad35519cd74ed8de78c4ddabd88abe0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3680296
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-06-07 20:19:34 +00:00
Anton Romanov
d19b575fd1 crosvm: argh-ify vfio command
Usage: crosvm vfio <command> [<args>]

add/remove host vfio pci device into guest

Options:
  --help            display usage information

Commands: add               ADD
  remove            REMOVE

Change-Id: I79d0b5205b1ae8d880b26cf12d61a2f70bb73756
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3680295
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-07 20:19:33 +00:00
Anton Romanov
9140f8d41c crosvm: argh-ify disk command
Usage: crosvm disk resize <DISK_INDEX> <NEW_SIZE> <VM_SOCKET>

resize disk

Positional Arguments:
  DISK_INDEX        disk index
  NEW_SIZE          new disk size
  VM_SOCKET         VM Socket path

Options: --help            display usage information

Change-Id: I416aae6bc898bef39870a9b3252405b1cdd9bc88
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3680294
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-06-07 20:19:32 +00:00