Commit graph

2198 commits

Author SHA1 Message Date
Daniel Verkamp
0ee9babf9c rutabaga_gfx: replace u8 cast with byte literal
Fixes clippy warning: "casting a character literal to `u8` truncates"

https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8

BUG=None
TEST=bin/clippy

Change-Id: I822de805f122ee14cc4856c36c9ef48de6432fa2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2885780
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2021-05-22 00:43:25 +00:00
Gurchetan Singh
1bbbf1cad3 crosvm: bind mount all wayland socket directories (take 3)
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>
2021-05-21 19:09:43 +00:00
Chirantan Ekbote
584fc8944d wl: Switch to thiserror
BUG=b:179755841
TEST=cargo build

Change-Id: Iaafae1cb235b7611f36f1b88d3e9e20d6a36d2ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2910214
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-05-21 10:55:51 +00:00
Alexandre Courbot
582d68acf9 virtio: video: encoder: add VDA encoder constructor
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>
2021-05-21 09:36:40 +00:00
Alexandre Courbot
71b2ddb962 virtio: video: make Worker work on Device trait objects
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>
2021-05-21 09:36:39 +00:00
Alexandre Courbot
2ddc36d222 virtio: video: encoder: use the same backend code layout as the decoder
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>
2021-05-21 09:36:38 +00:00
Alexandre Courbot
de3a48a651 virtio: video: move VDA common code into its own module
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>
2021-05-21 09:36:37 +00:00
Alexandre Courbot
c9f43bf6be virtio: video: decoder: move capability and decoder building into VDA backend
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>
2021-05-21 09:36:36 +00:00
Junichi Uekawa
dc2f396277 kokoro: Remove mention of manifest.xml.
We are no longer pinned to a specific version since
https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2840057

BUG=None
TEST=read it.

Change-Id: I23750d5404f776c21de4ba11e17b5704751b247a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2902915
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Junichi Uekawa <uekawa@chromium.org>
2021-05-21 08:07:02 +00:00
Fergus Dall
2f4a80f366 README.md: Add more known issues for running crosvm on Linux
BUG=none
TEST=none

Change-Id: Ic63772785256bc01648ec53e60ec725ee14fbd88
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2896073
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Fergus Dall <sidereal@google.com>
2021-05-21 05:03:47 +00:00
Alexandre Courbot
96e3fb363f virtio: video: use the thiserror crate with VideoError
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>
2021-05-20 19:29:28 +00:00
Alexandre Courbot
f148e1b0df virtio: video: encoder: remove EncoderError
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>
2021-05-20 19:29:27 +00:00
Alexandre Courbot
0d714e1572 virtio: video: decoder: replace decoder VDA errors with generic backend error.
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>
2021-05-20 19:29:26 +00:00
Alexandre Courbot
3727976368 virtio: video: decoder: replace ContextMap's new() method by Default implementation
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>
2021-05-20 19:29:25 +00:00
Junichi Uekawa
b6ae6517ae kokoro: format README.md with Google style.
BUG=None
TEST=Read it.

Change-Id: I477a4d18255c8cc5ed2e4eb903d6651615473ad6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2902914
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-05-20 08:38:23 +00:00
Chirantan Ekbote
e3d1a0278c vhost-user-net: Use anyhow
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>
2021-05-20 06:07:41 +00:00
Chirantan Ekbote
3040cf0284 vhost_user_devices: Use async style
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>
2021-05-20 06:07:40 +00:00
Dylan Reid
a51b1bfe1b arch: Clone minijail instead of re-using for serial
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>
2021-05-20 03:45:04 +00:00
Jorge E. Moreira
3a5178e3b2 Error on stream creation no longer blocks stream ids
BUG=b:184059723
Change-Id: I553b77e5557e6c2058d4bacac96093736dfb8c86

Change-Id: I226e6eeb92b3d9e73fe5fcfbf43e2fa61bc2033c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2854381
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Jorge Moreira Broche <jemoreira@google.com>
Auto-Submit: Jorge Moreira Broche <jemoreira@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2021-05-20 00:56:46 +00:00
Tomasz Jeznach
f622e504d3 crosvm/kvm: enable runtime detection of IOAPIC pins
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>
2021-05-20 00:37:59 +00:00
Keiichi Watanabe
ac63740cf7 devices: virtio: Remove unused method
Remove `VirtioDevice::acked_features()` which is unused.

BUG=none
TEST=build

Change-Id: I35323bb67b23e0d739a100643a81a890919df589
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2902072
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>
2021-05-18 18:52:33 +00:00
Keiichi Watanabe
03f4c754d7 devices: net: Avoid causing busy loop for interrupt resample
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>
2021-05-18 18:52:29 +00:00
Kuo-Hsin Yang
1b21dec7b1 data_model: Add safety section for unsafe functions
When running presubmit for a module depends on sys_util, clippy shows
the following error message.

error: unsafe function's docs miss `# Safety` section
  --> .../src/platform/crosvm/data_model/src/flexible_array.rs:77:5
   |
77 |     unsafe fn get_slice(&self, len: usize) -> &[S];
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::missing-safety-doc` implied by `-D warnings`

BUG=none
TEST=Cq preflight

Change-Id: If296f145b68d6c2734a0fb58b37fd0452791aed7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2879285
Reviewed-by: Kuo-Hsin Yang <vovoy@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Auto-Submit: Kuo-Hsin Yang <vovoy@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kuo-Hsin Yang <vovoy@chromium.org>
2021-05-18 17:44:19 +00:00
Chirantan Ekbote
a60ffb8c36 sys_util: Switch syslog error to thiserror
BUG=none
TEST=cargo build

Cq-Depend: chromium:2900011
Change-Id: I97d8fcef1b0c381a5adb691813b15dfe534f66e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2894326
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2021-05-18 16:42:20 +00:00
Chirantan Ekbote
82cddfef8e net: Switch to thiserror
BUG=none
TEST=cargo build

Change-Id: Iec87dca59eb577e01fb772efb11bb435174d482f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2894325
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2021-05-17 11:23:24 +00:00
Chirantan Ekbote
c4ce3791e9 wl: Fix unused_imports and dead_code warnings
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>
2021-05-17 11:23:22 +00:00
Chirantan Ekbote
0c6d96af7b net_util: Implement IntoAsync + try_clone() for Tap
BUG=none
TEST=Use it in a later change

Change-Id: I6fa8084dd47e84e6a67fdf4bcc194552d8f9f45a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891121
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2021-05-17 11:23:21 +00:00
Chirantan Ekbote
d2399b7d6f cros_async: Add AsyncWrapper type
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>
2021-05-17 11:23:19 +00:00
Tomasz Jeznach
d8e37614d9 x86/acpi: clear SMI COMMAND field.
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>
2021-05-14 10:34:35 +00:00
Alexandre Courbot
e1dff2eef8 virtio: video: decoder: add format getters to Capability
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>
2021-05-14 05:32:22 +00:00
Daniel Verkamp
2940980d2e linux: generalize kick_all_vcpus to send any VcpuControl message
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>
2021-05-14 05:24:47 +00:00
Daniel Verkamp
8a72afc44c main: add --cpu-cluster and --cpu-capacity options
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>
2021-05-13 22:49:09 +00:00
Alexandre Courbot
b77b936d42 virtio: video: encoder: make encoder own its VEA instance
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>
2021-05-13 04:41:13 +00:00
Alexandre Courbot
0b96ae0720 virtio: video: encoder: remove lifetimes on VEA instance/sessions
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>
2021-05-13 04:40:59 +00:00
Tomasz Jeznach
1eea877519 crosvm: use ACPI for PCI routing if available.
BUG=b:179648314
TEST=Provide DSDT/MADT to the guest OS.

Change-Id: I46d221de9b5d942915c6e6f46f2630bdaaccbaac
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2891216
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
2021-05-13 04:34:06 +00:00
Tomasz Jeznach
d93c29fdf1 crosvm: flag to disable legacy x86 IO devices.
BUG=b:179648314
TEST=Keyboard pass-through enabled.

Change-Id: Ie2e5fdc85367ddb9d5f216291773cf8065d8c956
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2885078
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-05-13 04:34:04 +00:00
Daniel Verkamp
a8423d73c3 devices: pass MMIO and IO bus to PciRoot::new()
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>
2021-05-12 00:09:37 +00:00
Keiichi Watanabe
8c817dd349 vhost_user_devices: Add vhost-user net device
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>
2021-05-11 18:34:40 +00:00
Keiichi Watanabe
8e7bc96616 Add vhost_user_devices crate
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>
2021-05-11 18:34:39 +00:00
Dennis Kempin
acdf8de5c6 Kokoro: Add debian bullseye version of libwayland/protocols
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>
2021-05-10 18:27:07 +00:00
Keiichi Watanabe
8ec40a7fa0 device: vhost: user: Fix offset of GET_CONFIG
BUG=none
TEST=run vhost-user block vmm with dpdk

Cq-Depend: chromium:2861979
Change-Id: I7cf6694338b3eadf910e85af7c0db85805e32451
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2856171
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2021-05-10 13:08:00 +00:00
Dennis Kempin
e6216f926c Uprev rust-toolchain for Kokoro to 1.51.0
Change-Id: I27b30762207021bbaf307bb02118992442021a93
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2877257
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
2021-05-07 00:49:19 +00:00
Daniel Verkamp
7fb40344ff devices: pci: add PciDevice function to get BARs
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>
2021-05-07 00:37:49 +00:00
Daniel Verkamp
2da1f27fd5 devices: vfio: use PciBarConfiguration struct
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>
2021-05-07 00:37:49 +00:00
Daniel Verkamp
8954f04e82 devices: pci: add config support for ROM BAR
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>
2021-05-07 00:37:48 +00:00
Daniel Verkamp
b2b4d8cabf devices: pci: PciBarConfiguration cleanup
- 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>
2021-05-07 00:37:46 +00:00
Daniel Verkamp
34050dc2e1 bin/clippy: temporarily ignore warnings from external crates
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>
2021-05-06 22:06:58 +00:00
Daniel Verkamp
18750c09df devices: acpi: collapsed nested if inside else
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>
2021-05-06 22:06:57 +00:00
Daniel Verkamp
d8ff7fa7e4 devices: fix redundant ? inside Ok
Fixes a new clippy warning ("Question mark operator is useless here").

https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark

BUG=None
TEST=bin/clippy

Change-Id: I2888f070030d2838b8fb63e5d98a929f57cdfde7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2864369
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-05-06 22:06:57 +00:00
Daniel Verkamp
0fe970bd9a rutabaga_gfx: collapse nested if in else block
Fixes a new clippy warning ("this `else { if .. }` block can be
collapsed").

https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if

BUG=None
TEST=bin/clippy

Change-Id: Ib8a080a9afc39c272936012c9c1ecb92862e4189
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2864368
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-05-06 22:06:56 +00:00