Having a default protocol implementation is dangerous, as implementors
can just ignore this method and return an erroneous type.
BUG=None
TEST=cargo build
Change-Id: Iee7dbcf563be1e5b15903b0fd7bdfb7ff5823545
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3565619
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This field is not used beyond the constructor and was only stored so it
can be referred by the init() method. Get rid of it by slightly
reorganizing the code.
BUG=b:194137301
TEST=cargo build
Change-Id: I4532a40ef1998ca20fdece9f0f016a36331c2e73
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3565618
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
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>
The logic for the None branch quickly becomes verbose as more video backends
are added. In preparation for the new libva backend, use the cfg_if crate
to disambiguate the chosen VideoBackendType when the user does not specify one.
BUG=b:214478588
TEST="cargo-expand --bin crosvm --features=video-decoder,vaapi,ffmpeg -- parse_video_options
shows a single None branch"
Change-Id: I0b7489924c30b2834cecc636446ac96034f6adc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3422776
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Sometimes I want numeric key in addition to value.
BUG=b:215297064
TEST=cargo test
Change-Id: I75ae37905d1a27709e2fa694ab01e0ac8ed8596c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3556930
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Split the creation of the software TPM emulator from the virtio-tpm
device so that other backends can be used with virtio-tpm.
BUG=b:227283268
TEST=cargo build --features=tpm
Change-Id: Ic1ebd2ebd49615201892afbf86cd5be68f6fde8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3213271
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Moved shared code to the upper module
Test: built and presubmits
Bug: 215619368
Change-Id: Id369eb2108fbe4615bb2f4249be80b9efed4a5b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3555736
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
descriptor_reflection.rs is the exact same on both windows and unix, so
moved it to the outer module in base
Test: built and presubmit
Bug: 215619368
Change-Id: I346fa58e651953e2a77b806fa7456af2c1b02cb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3555732
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
This CL mainly splits up Window's and Unix code into their own files.
seg_max is now a part of windows, but will always be set to 0
now. seg_max
in virtio_blk_config was being set to 0 on windows anyways.`
Bug: b:213149164
Test: cargo test and presubmit
Change-Id: Icdd481dd8e05c90ac8c1f29773d51312b64d3b2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553760
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Also fixes few warning introduced during upstream which linux clippy
run does not catch.
test: py tools\clippy
bug: 226966790
Change-Id: I6979f87be5d6d34727afabafcaccb57631975567
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553401
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Jailing a process currently requires to pass the whole VM configuration
structure, which is inconvenient as we will want to reuse our jail
functions from a different context, e.g. to start vhost device processes
without a whole VM.
Address this by moving all jail-related options under a struct that is
passed to jail-related functions. This allows us to replace the sandbox
boolean in the config structure by an Option, making sure that
jail-related members are not even visible if we disabled sandboxing
altogether. The jail configuration structure can also be reused from
other contexts.
BUG=b:217480043
BUG=b:218223240
TEST=`crosvm run` boots with and without the `--disable-sandbox` option.
Change-Id: Ic4b7db923fb1dbbafba0137d5cc53a9e7e800747
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3546579
Reviewed-by: Anton Romanov <romanton@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Use our new serde_keyvalue crate to annotate the
VhostVsockDeviceParameter config structure and allow us to create a
vsock device configuration from a key-values string. Add tests to make
sure parsing happens as expected.
Currently the vsock device is configured using the `--cid`,
`--vhost-vsock-fd` and `--vhost-vsock-device` command-line options.
While this CL introduces a way to set the vsock device up with a single
option (an ability we will eventually use), we retain the existing ones
for compatibility reasons.
BUG=b:218223240
TEST=cargo test -p devices vsock::tests::params
TEST=crosvm run with --cid parameter and check that virtio socket device
is present in the output of `lspci`.
Change-Id: Id58beee57f2ada3d2c0d353a430b038bb6c7eef3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3473709
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
When a vfio MSI-X vector got masked by guest, host vfio will release
the corresponding irqfd. Thus host device cannot trigger interrupt
via this fd and we then cannot set the pending bit. What we do instead
is to not release the irqfd but switch the registered kvm irqfd into
a new crosvm irqfd. So that when host device do trigger an interrupt,
crsovm will know about it and set the pending bit accordingly.
BUG=None
TEST=Pass through a nvme disk and tested its functionality.
Change-Id: I81c6fae7b89f1e1a445b8076bd9451a8aa9f0255
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3490239
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
To emulate pending bit for MSI-X, we need to add a new interrupt
delivery path in crosvm. We will make VfioPciWorker share vfio msix
cap with VfioPciDevice, fire interrupt via msix cap when receiving
irq from host device. This makes vfio msix cap shareable.
BUG=None
TEST=./tools/presubmit
Change-Id: I77f5c377a41e7b2bd795e69c1ddcad9a9376f111
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3490238
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Previous vfio's MSI-X emulation lacks per vector masking support. This
patch adds per vector masking for vfio. Now MSI-X vectors are enabled
only if they are currently in use, so host will not allocate extra IRQ
which guest does not use.
BUG=None
TEST=Pass through a nvme disk that uses MSI-X and test its functionality.
Change-Id: If9b3ec907518513d1694b981d94994d8b7e5ea36
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3490237
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
If device does not use all of the MSI vectors, we do not need to
register all for them. This patch pushes the MSI vector registery
to the first time they are enabled.
BUG=None
TEST=./tools/presubmit
Change-Id: I5453e93af4f4f5596d82ad126dc294fa5896846a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3490236
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This allows the bot to account for manually cherry-picked commits.
To make rebases work properly, we had to fix the commit message
trailers to be added in a separate paragraph. This ensures
git inspect-trailers can add and find the Commit-Id trailer.
BUG=b:226975273
TEST=./ci/kokoro/simulate.py ./ci/kokoro/build-merge-into-chromeos.sh
Change-Id: If008be1f1c671ef1d79c6f223f10ea0e8f6742b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3561015
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Maciek Swiech <drmasquatch@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
crosvm sets up an emulated serial device for ttyS0 as a default device
unless virtio-console is specified.
The setup should be skipped when a vhost-user console is specified as well.
BUG=b:196186396
BUG=b:227407433
TEST=no serial output when one vhost-user console is specified.
Change-Id: Ib17e218fd01a13c109fc1246fd3a6d99031d3181
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3557729
Reviewed-by: Morg <morg@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This function is used internally in the SafeDescriptor code, but it
should not be needed outside its module. Remove its pub to make it
harder to use by accident.
Users can call SafeDescriptor::try_from() to clone a descriptor and
convert the result into a SafeDescriptor.
BUG=None
TEST=cargo build
Change-Id: Ibc0e439b993d1ead0c0bc356da312a1d8f28a97f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3546571
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Does couple of things
- move tube under right directory
- cleanup cros_async dependency
- export tube module from base
- enable base windows tests
- add verbose flag to test runner
test: built on window and presubmit
bug: b:213151429
bug: b:213153157
Change-Id: I0d1906d7edcc3352db53325ea7527550eaf00895
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3550296
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
install-deps is now a Python script, update the message to make user's
life easier.
BUG=None
TEST=./tools/presubmit
Change-Id: Id1eca4f5b1fb0066574b6b7c381c908e65d919e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3536892
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Use the existing base::open_file function to replace the open-coded
equivalent of file_from_path + File::open fallback.
BUG=None
TEST=tools/presubmit
Change-Id: Ic6190e87056e661be5d552566c466339cefabbfe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553764
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This cleans up the API and makes it easier to tell what is happening at
the call site. Additionally, callers may now use any options supported
by OpenOptions rather than the two specific flags (read_only and
o_direct) that were previously supported.
BUG=None
TEST=tools/presubmit
Change-Id: Ib8b5350c60807f14ebe0816d71bbf31e4bfef67f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553763
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Change-Ids can refer to multiple CLs when they are cherry-picked.
Use the 'id' field instead wich contains repo and branch info and
is unique across gerrit.
BUG=None
TEST=./ci/kokoro/simulate.py ./ci/kokoro/build-merge-into-chromeos.sh
Change-Id: I7074e310ec7f795527610010c849acceaeb0eb06
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3556231
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
This is the revert of 77aa069b67.
At present, when set no_smt, if there are more than 1 logical processor
in a package for Guest, the HTT is set as 0 in CPUID. This does not
comply with the intel SDM specification.
From SDM, HTT indicates:
A value of 0 for HTT indicates there is only a single logical processor
in the package and software should assume only a single APIC ID is
reserved.
In fact, Intel has 2 differnet muti-threading capabilities:
Hyper-Threading Technology and Multi-Core Technology. But with
definition of lastest SDM, HTT flag in CPUID is not equivalent to
Hyper-Threading Technology.
no_smt means disable Hyper-Threading Technology feature so that each
core has 1 logical processor. But with Multi-Core Technology, there
still can be more than 1 logical processors in a package. In this case,
the HTT flag should be set as 1.
BUG=chromium:1304418
TEST=cargo build
TEST=set no_smt and check if there's HT flag in /proc/cpuinfo
Change-Id: Id53320407e247ba61a1ad7cedea8301e1c3469fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3545896
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Create the goldfish batter device before ACPIPMResource. This order is
necessary because ACPIPMResource creates a thread, which causes forking
the sandboxed device process to fail.
BUG=none
TEST=boot ARCVM
Change-Id: Iedc84c408eb0e124912dfa411d19b773c1ccc860
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3552477
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Now we can use option `--pcie-root-port` to create a virtual pcie root
port with some attributes same as host. So a vfio device may be
connected to it statically.
And only hot-pluggable devices and vfio devices with option
`iommu=viommu` are needed to be attached to virtio-iommu. So we just
append the sub pci range of a leaf node root port to viot.
BUG=b:185084350
TEST=Boot a guest with option '--virtio-iommu' and '--pcie-root-port',
check the PCI range node in guest viot.
Change-Id: Iff59b5210fb85511370ede19bf1ca2095b4d603b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3541469
Reviewed-by: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Check whether or not the rebase succeeds and fix a check that the script
is being run by kokoro.
BUG=None
TEST=tools/presubmit
Change-Id: I59ae6604c3535238f40a7df20c43b9db9e357fe3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3546578
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
For vitual pcie root port which link to host pcie root port need to
know host hotplug GPE number, so that acpi modal could notify pcie
root port that hw hotplug event happens, virtual pcie root port
could use this notification to do power managerment and inject
virtual pcie hotplug event into CrOS.
BUG=b:185084350
TEST=pass --pcie-root-port sysfs_path,hp_gpe=NUN into crosvm,
then verify TBT pcie in CrOS
Change-Id: Id4bb71f18a9715f2cb84205f5139b9ed1475452c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3539567
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Device want to get notification when a specific gpe happens, this commit
add register_gpe_notify_dev(gpe_num, dev) interface into PmResource trait,
so that others could register (gpe_num, dev) into acpi, then they
could get notification at specific gpe trigger.
BUG=b:185084350
TEST=Verify TBT pcie hotplug function in ManaTEE, virtual pcie root port
must get gpe notification during this process
Change-Id: I56eb90361a6b96be364d35c4b6a5ec598a50757e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3539566
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Add a release-test profile that is the release profile with
panic=unwind. This profile is needed because crosvm has a cdylib
dependency (crosvm_plugin). If we try to run cargo test with
panic=abort, cargo builds a second version of the cdylib artifact
without panic=abort. However, cargo doesn't actually support duplicate
artifacts [1]. This can lead to flaky build failures if cargo ends up
trying to build both artifacts at the same time.
[1] https://github.com/rust-lang/cargo/issues/6313
BUG=None
TEST=CQ
Change-Id: Ie5881878efdee654e9a665fa58d21aa2280a1876
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3545739
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Currently, VfioPciDevice always use the same BDF as the device's BDF in
the host OS. However, in certain applications (e.g. Borealis), it is
desired to map the device to a different BDF.
This patch introduces a new parameter to `vfio` so that user could set
the device's BDF to a desired address.
BUG=b:208545409
TEST=Boot Borealis with `--vfio=/path/to/dGPU,guest-address=00:11.0` and
confirmed that the dGPU is at 00:11.0 in the guest OS.
Change-Id: I7ee9e9a7f74e3541e74f89d452f9aad45302eeb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3535461
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Victor Ding <victording@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Victor Ding <victording@chromium.org>
The vhost-user VMM process is supposed to stop before the device
process, and the device process is supposed to get
`vmm_vhost::Error::ClientExit` when the VMM stops. Add the check in the
existing unit test.
BUG=b:219674197
BUG=b:220639724
TEST=cargo test in /devices/
Change-Id: I1768b9b43855e3b80f1e6e175877317338309e8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3543005
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Add dedicated tracking for mmio bar mmaps. This allows us to remove the
special case handing that ignores writes of 0 and 0xffffffff to the bar
configuration registers. That handling was actually broken because it
used || instead of &&, which resulted in bars being redundantly
remapped.
BUG=none
TEST=Add logs to set_user_memory_region, boot manatee, and check that
the same regions are mapped.
Change-Id: Ic9905330874a4c05f79dbdaee3b40b4d21a488ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3535468
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Use our new serde_keyvalue crate to annotate the DiskOption structure
and allow us to deserialize it from a key-values string. Add tests to
help ensure parsing won't break in the future.
The existing `root`, `rwroot`, `disk` and `rwdisk` arguments can be
parsed in a compatible manner. In the future it would probably make
sense to merge them all into a single `disk` option since all variants
can now be specified as key-values.
BUG=b:218223240
TEST=crosvm run ... --rwroot /path/to/disk.raw
TEST=cargo test -p devices virtio::block::block::tests::params_from_key_values
Change-Id: I2c8b853b9817aefce0c5f0f5c4d5a1da1f9a45d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3473708
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Use our new serde_keyvalue crate to annotate the SerialParameters
structure and allow us to create it from a key-values string. Add tests
to help ensure parsing doesn't break in the future.
The existing arguments can be parsed identically by this new code, so
replace the old serial options.
BUG=b:218223240
TEST=cargo test -p devices serial_device::tests::params_from_key_values
TEST=cargo test parse_serial
Change-Id: I4898a45399b69b87a44f80d3a214daf081b06173
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439670
Reviewed-by: Anton Romanov <romanton@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Add a crate for deserializing command-line options given as key-values.
This crate leverages serde to deserialize key-value argument strings (a
commonly used pattern in crosvm) into configuration structures. This
will allow us to remove a big part of the manual parsing currently done
in `main.rs`, will provide consistent arguments to the `crosvm run` and
`crosvm device` commands, and results in more precise error reporting.
The use of serde will also allow us to similarly deserialize
configuration structures from configuration files with very little extra
code involved.
As explained in the crate's documentation, its main entry point is a
`from_key_values` function that allows a build a struct implementing
serde's `Deserialize` trait from a key/values string.
In order to integrate transparently with `argh`, there is also a
`FromKeyValue` derive macro that automatically implements `FromArgValue`
for structs deriving from it.
BUG=b:218223240
BUG=b:217480043
TEST=cargo build
TEST=cargo test -p serde_keyvalue
Change-Id: Id6316e40150d5f08a05e6f04e39ecbc73d72dfa0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439669
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This is follow-up of CL:3468235.
For vhost-user, a device (i.e. slave) works like a server while a
vmm (i.e., master) does like a client. So the devices should allow the
vmm to close the connection. An error handling code added by CL:3468235
was opposite. It should have been added to `slave_req_handler.rs`
instead of `master_req_handler.rs`.
BUG=b:219674197
BUG=b:220639724
TEST=run tast.vm.Audio*.vhost_user_cras and tast.vm.VhostUserNet
Change-Id: Ie661c02bed8287d9d770c6c6c0c658ef6681db10
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3533239
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Fill the fd offset into the VmMemoryRequest::RegisterMemory source field
now that it is supported.
BUG=b:194136484
TEST=tools/presubmit
Change-Id: I9f8ae069d73cf0974bb739a768b731d6b0c289ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3508321
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The values that were cast in these expressions were already MemSlot, so
there is no need to cast back and forth between MemSlot and u32.
BUG=None
TEST=tools/presubmit
Change-Id: I8a215bc50d10a93b21f6d2fe7e4ed7267242a50b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3508320
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Many of the subtypes of VmMemoryRequest share similar or exactly
identical code, but it is difficult to tell how they differ and what
each variant does. Reorganize the various memory registration requests
into a single RegisterMemory variant with orthogonal source and
destination structures to unify the shared functionality into a single
implementation.
BUG=None
TEST=tools/presubmit
TEST=Boot Crostini on trogdor
TEST=Boot Crostini on hatch
Change-Id: I059ce40b90812067e5ec882320ea7c8b6a3cc0fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3470539
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
add_bind_mount is a unix specific function that uses only public
fields of SerialParameters. So moved the function closer to call site.
Bug: b:213149155
Test: cargo test and presubmit
Upstream-Crate: devices
Change-Id: I05232c10ddc474421b6dba4ff34ecec9965c3913
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3543886
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Add optional `uuid` argument to `--vvu-proxy` so a user can specify a
UUID that will be stored in virtio_vhost_user_config space so that the
guest can read the value by reading /sys/devices/pci*/*/resources.
We can use this value to allow the guest to know the socket path that
the VVU proxy device uses.
BUG=b:215472603
TEST=pcimem /sys/device/pci.../resource0 0x2008 b*16,
where 0x2008 == (DEVICE_CONFIG_BAR_OFFSET + offset in vvu config)
Change-Id: I99f1d988cb793b44682ddf927837139dabd42cf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3516669
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Unfold the anyhow errors returned so we can identify their source
precisely.
BUG=None
TEST=cargo build
Change-Id: I5bdfcc893b7ca98d83561cac820bcee443013547
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3543011
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
It is now relatively easy to build and run sommelier against a regular
Linux guest, and doing so enables the powerful feature of being able to
show guest Wayland clients on a compositor running on the host. Document
the process for those interested in doing it.
BUG=None
TEST=mdbook serve
TEST=./tools/fmt --check
Change-Id: I45b99243481ee66c1e88e597669a219a4e5b9376
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3531694
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
At the moment compiling with the "virgl_renderer" feature enabled but
"x" disabled results in a link error because the virgl_renderer enables
all its platforms without checking. Fix this by enabling the glx
platform only if the x feature has also been enabled.
BUG=b:226033718
TEST=`cargo build --features "virgl_renderer"` passes.
TEST=`cargo build --features "virgl_renderer,x"` passes and enables GLX
in virgl_renderer.
Change-Id: I85041fc2a3db7e49415add69389bee3160ba4a5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3539327
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This commit uses physical pcie hotplug GPE as virtual hotplug event
trigger point.
When virtual pcie root port gets such physical GPE notification, it
will prepare hotplug and inject PME to wakeup virtual pcie root port,
once virtual pcie root port is waken up, it will let host pcie root
port to rescan and probe the added new pcie device, finally request
crosvm to add the new pcie device into CrOS.
BUG=b:185084350
TEST=Verify TBT pcie hotplug function in ManaTEE
Change-Id: I5d02582d0eb9bcfd9d8998065ccc758c91169f81
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3520985
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>