In 781d975d0b ("Revert "Revert "rutabaga_gfx: cross-domain: a
new year's miracle in February""), we went back to just bind mount
the wayland socket instead of all the sockets.
The logs indicated a weird interaction between the camera socket
and the Mali driver.
This is incorrect, and I would like to this opportunity to apologize
to the camera team for this outrageous slander. I'm sorry. Please
forgive me. I hope we can put this behind us.
In the end, we were just mounting the wrong directories.
BUG=b:150239451, b:173630595
TEST=arc.Boot.vm
Change-Id: I5e5d5afba074c3aaed79df058558a295d03732f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2906128
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Add a constructor for building a VDA-backed encoder instead of requiring
the user to build one.
BUG=b:169295147
TEST=arc.VideoEncodeAccel.h264_192p_i420_vm passes on hatch-arc-r.
Change-Id: I712499904845b3cccb52a3e9e07c87cc1a3c92c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891144
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
The current generic Worker code is being instanciated once per kind of
video decoder and encoder. This results in quite a bit of duplication to
avoid one virtual call per device event, and also prevents us from
selecting the codec backend dynamically.
Convert that code to use a Device trait object instead for both
simplicity and flexibility.
BUG=b:169295147
TEST=cargo build --features="video-decoder"
Change-Id: I9aacd0286022d9eaa44bd57656d1959de78322a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891143
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Move the backend code into a module of the same name, to mirror the
structure used by the decoder.
BUG=b:169295147
TEST=cargo build --features="video-decoder,video-encoder"
Change-Id: I9175b054811d294c338f8b58961e4b45b10c99ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891142
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Move VDA code that is used by both the decoder and encoder into its own
module, so it can be easily included (or not) during compilation.
BUG=b:169295147
TEST=cargo build --features="video-decoder"
Change-Id: Ic42f94a1118fad5d60da0d5358a28a9b27c3dbc4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891141
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
These operations are backend-specific and reference libvda, so move them
out of the generic code into the backend so they can easily be compiled
out.
BUG=b:169295147
TEST=cargo build --features="video-decoder"
Change-Id: Id5b32684df8aabef0c9ee2a00977339e0191d41b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891140
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
The thiserror crate is available to crosvm, so use it to make our
error handling code a bit more readable.
BUG=b:169295147
TEST=cargo build --features="video-decoder"
Change-Id: I2aacc63ffa8311d7e0bb4d1192fd0b11b4ca5d03
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891139
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Make all the encoder backend methods return a VideoError, similarly to
what the decoder does. This allows us to merge the EncoderError's enums
into VideoError and return a BackendFailure when a backend-related
problem has occured, removing references to the encoder-specific code in
the generic video code.
BUG=b:169295147
TEST=cargo build --features="video-encoder"
Change-Id: I948927ae43cbbac70c4b829fbbb314122a0b6628
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891138
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This follows the more flexible model that is used with the encoder and
removes references to libvda in the generic code.
BUG=b:169295147
TEST=cargo build --features="video-decoder"
Change-Id: Idff2894c9ea84c7bc26c5d02374c167756767a15
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891137
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
This is more idiomatic for constructors that take no arguments, and
spares us one compiler warning if decoding support is enabled without
any backend (in which case nobody creates ContextMaps).
BUG=b:169295147
TEST=cargo build --features="video-decoder"
Change-Id: I01b909eac6d443e43617f6e8cb91c6254dea5cc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891136
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Since this is a binary, we don't need a detailed error enum.
anyhow::Error + context should be enough.
BUG=none
TEST=`curl www.example.com` inside a vm with vhost-user-net still works
Change-Id: I859761c167823425f1c7f7dfb2862a114dfdd254
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2894327
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This should hopefully simplify some of the control flow and remove some
leaky abstractions.
BUG=none
TEST=`curl www.example.com` inside a vm with vhost-user-net
Cq-Depend: chromium:2893896
Change-Id: Ie22af368a2c0d92297e8a078c695d4015eae92d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891123
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reusing struct minijail for multiple forked children isn't supported and
was only accidentally functional. The new minijail fixed that bug and
now the jails must be explicitly cloned to be reused.
BUG=b:187741537
TEST=CQ passes
Cq-Depend: chromium:2850757
Change-Id: I986223c7089ded4a9a55e666a13663a625d760b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2889652
Reviewed-by: Allen Webb <allenwebb@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Allen Webb <allenwebb@google.com>
Enable support for runtime verification of number
of irqchip kernel emulated inputs, up to 120 pins.
KVM implementation supporting extended input pins shall
report KVM_CHECK_EXTENSION/KVM_CAP_IOAPIC_NUM_PINS value.
BUG=b:179648314
TEST=On systems with 24/120 pin IOAPIC kvm emulation.
Change-Id: I80063216310e427d664e3eaca3aba27e8a972cde
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2893366
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
We must have read the resample event before calling
`SignalableInterrupt::do_interrupt_resample`.
BUG=b:179755448
TEST=run crosvm with net device
Change-Id: Ic4bd74d3c89cc8af69401d2c1ebc095a474fba04
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2902057
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
These functions are only used when the gpu feature is enabled.
BUG=none
TEST=`cargo build` and see no warnings
Change-Id: I8c354b0122032a6d6c57d16837d9d9e857ac03c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891122
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This makes it easier to implement IntoAsync for foreign types.
BUG=none
TEST=Use it in a later change
Change-Id: I070fe3b63ac7458e21fa38b3a1b1bdb318c44d5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891120
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
SMI Interface is not supported by crosvm. Clear FADT.SMI_COMMAND field
to disable ACPI enable/disable transitions.
BUG=b:145604457
TEST=Boot system with user provided ACPI tables.
Change-Id: I17daafc4b2ffded5ba8235ad19e24aa67ad5c8a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2893368
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
Capability is read-only once it has been built, so access its members
using getter methods instead of making them public.
BUG=b:169295147
TEST=cargo build --features="video-decoder"
Change-Id: Ia5d30d94a04fc9b4e87d783c85b3ab5650ca9815
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891135
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Previously, kick_all_vcpus() would only accept VmControl::RunState
messages; extend it to accept any VmControl message type instead.
This required adding the Clone trait to a few types.
BUG=b:174705596
TEST=./test_all
Change-Id: I3c8c42ee8a96ff151fa8f01ab067931bdff2b7b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2718281
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
The --cpu-cluster option can be used to report a physical grouping of
CPUs in the device tree as a "cpu-map" node:
https://www.kernel.org/doc/Documentation/devicetree/bindings/arm/topology.txt
Each instance of the --cpu-cluster option specifies a new group
consisting of a list of CPUs, and it may be repeated to add multiple
groups.
The --cpu-capacity option can be used to specify the relative
performance of CPUs so that the guest kernel's scheduler can make better
decisions on systems with heterogeneous cores (e.g. big.LITTLE).
--cpu-capacity units are left up to each architecture; for devicetree
systems, capacity is used to fill the cpu capacity-dmips-mhz (Dhrystone
benchmark MIPS per MHz) field in each cpu node:
https://www.kernel.org/doc/Documentation/devicetree/bindings/arm/cpu-capacity.txt
For example, on a trogdor board, there are 6 little cores (0-5) with a
capacity of 452, and 2 big cores (6-7) with a capacity of 1024, which
results in a crosvm command line argument of:
--cpu-capacity 0-452,1=452,2=452,3=452,4=452,5=452,6=1024,7=1024
Currently, these options only have an effect on devicetree platforms and
are ignored elsewhere; they may be expanded in the future to fill in the
equivalent ACPI tables if systems with heterogeneous CPUs are used
there.
BUG=b:182198842
TEST=Start crosvm on kevin with --cpu-cluster options
TEST=crosvm run --cpu-cluster 0,1,2,3 --cpu-cluster 4,5
Change-Id: I59c466549ccd908f8eea1da0651d82716bc82972
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2762298
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
The current design of having the VEA instance outside of the encoder was
mandated by the use of lifetimes on libvda Sessions, which have been
removed from libvda. So it is now possible for the encoder to own its
VEA instance.
This makes sense in itself since there is no reason for the VEA instance
to also be used by someone else, but is also required to add support for
non-libvda encoder backends.
BUG=b:169295147
TEST=arc.VideoEncodeAccel.h264_192p_i420_vm passes on hatch-arc-r
Change-Id: Idb4356dde6124f00d87915da7da0910c7d816863
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2887526
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: David Staessens <dstaessens@chromium.org>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
The libvda API has been changed and both instances and sessions do not
use lifetimes anymore. Remove them from our code or it won't compile.
BUG=b:169295147
TEST=arc.VideoEncodeAccel.h264_192p_i420_vm passes on hatch-arc-r
Cq-Depend: chromium:2887389
Change-Id: I9821e7f3b92b89fceb843fb0e60d041a44602f20
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2887525
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: David Staessens <dstaessens@chromium.org>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This will be used to dynamically add and remove bus ranges when the PCI
command register is updated to enable/disable memory and IO decode.
BUG=b:174705596
TEST=cargo test -p devices
Change-Id: I6bb175e0628bf598d049562700e2f55a2a62df59
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2689081
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Add a vhost-user net device executable which communiates with a VMM having vhost-user net device.
Example command:
vhost-user-net-device \
--tap 10.0.2.2,255.255.255.0,12:34:56:78:9a:bc \
--socket /tmp/vhost-net.sock
BUG=b:179755448
TEST=run as a backend of crosvm with vhost-user net device
Cq-Depend: chromium:2861979
Change-Id: Ib723cdd00381b29464855378e568a9fa3de01536
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2807205
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Add `vhost_user_devices` crate which will be used to create a vhost-user
device executables.
BUG=b:185089400
TEST=cargo test in /vhost_user_devices
Change-Id: I7256d68316f7763d3ceaa65abc97663975e7608f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2822169
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This is required by the latest gfx changes.
BUG=None
TEST=./ci/kokoro/simulate_all
Change-Id: I13280a3c5213d12730bcb154514b7864663a1682
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2880148
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This will be used to enumerate BARs when the command register is updated
to enable/disable memory or I/O decode.
BUG=b:174705596
TEST=cargo test -p devices
Change-Id: I992a2004dc58955b464467914c4ad735fb2cdd44
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2689085
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Replace the VFIO-specific MmioInfo and IoInfo structs with
PciBarConfiguration.
This will allow a unified interface for retrieving BAR information for
all PciDevice implementations; all other PciDevices use PciConfiguration
to store a list of PciBarConfiguration, so this brings VfioPciDevice in
line with those.
BUG=b:174705596
TEST=cargo test -p devices
Change-Id: Idafd8f9af2ce817877450cfb842805475785ba20
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2689084
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Extend PciBarConfiguration to support the expansion ROM BAR in addition
to the usual 6 BARs.
This will be used when adapting vfio_pci to use PciBarConfiguration.
BUG=b:174705596
TEST=cargo test -p devices
Change-Id: I712728def41b0f2981029d77c3b9d7ec065e9d9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2689083
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
- Consistently use reg_idx to represent an index into all PCI
configuration space registers and bar_idx to represent an index into
just the BAR list. (e.g. bar_idx 0 is at reg_idx 0x10).
- Add a PciBarIndex type to make the related APIs clearer versus using
usize directly.
- Remove Default impl for PciBarConfiguration and fix up the previous
callers to fully configure the BAR type instead of depending on the
defaults.
- Omit "get_" from the names of getter functions to follow Rust
convention.
BUG=b:174705596
TEST=cargo test -p devices
Change-Id: I6921ac627f51e0df9c07585545be031ac3055a7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2689082
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
These need to be resolved in repositories outside crosvm, so add them to
the ignored list for now.
BUG=None
TEST=bin/clippy
Change-Id: I75b20ff2c84bfc72cd7d3c4421428a82600e6778
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2864371
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Fixes a new clippy warning ("this `else { if .. }` can be collapsed.").
BUG=None
TEST=bin/clippy
Change-Id: I58aec38b9fac6b7cbdcfe62e81e3b38ca3373a4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2864370
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>