In preparation for the upcoming VAAPI backend, derive Clone for Capability.
This is so a Decoder can own a Capability and merely clone it in the
DecoderBackend::get_capabilities call, reducing the number of calls into
the libva driver.
BUG=b:214478588
TEST=None
Change-Id: Ide3d410e0e0a89e774400ea466cac5875ebc8dc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3422777
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
When resources are overlapping we probably want to know what is
overlapping.
BUG=b:236574949
TEST=boot
Change-Id: I4f99f742bda91945f7fe6e94d60bc8adbfe4326f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3715074
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Create an `IrqEventSource` for each instance of IRQ registration with
the `direct` feature.
This fixes a compilation issue with the `direct` feature.
TEST=Compiled with `cargo build --features=direct`
Change-Id: I691b156f84bc6795c887d5203aad7d15aaad22e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3715270
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
We need base features to prevent the "virtio: device uses modern
interface but does not have VIRTIO_F_VERSION_1" error in the kernel
driver.
BUG=b:227283268
TEST=Build OK.
TEST=vmc start --software-tpm termina
TEST=ls /dev/tpm0
Change-Id: Icf3c288f2acc39ec1e8e23250a9d0cd6b8f84eb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3696295
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Leo Lai <cylai@google.com>
Commit-Queue: Yi Chou <yich@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
This CL will introduce a new TpmBackend called VTpmProxy.
This proxy will bridge the VM tpm device and the vtpm daemon on
ChromeOS.
BUG=b:227283268
TEST=Build OK.
Change-Id: Ibfbfdddbaca2af1d066920bb62918d88b0943d59
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3696292
Commit-Queue: Yi Chou <yich@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Leo Lai <cylai@google.com>
The bus/address and vendor/product IDs are unused internally; only the
usbdevfs device path matters. Update the internal API parameters and
documentation to match.
The crosvm_control `crosvm_client_usb_attach()` function must keep the
extra parameters to maintain API compatibility, but its documentation is
updated to note that they are unused.
BUG=None
TEST=Attach USB device to Crostini on trogdor
Change-Id: I7086f61a420be1dbf3dd1877fa86a5e82c0c5c77
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3708640
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This irqchip is currently used with Haxm which doesn't implement a local
APIC.
BUG=b:213149158
TEST=Compiled.
Change-Id: I3088ea5cad68451230dc3d5f8b649d54e83b938b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3701442
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This allows irq processing thread to log statistics and metrics and
track them using the source of the device. To be upstreamed later.
Introduce `PCI_VENDOR_ID_CROSVM` which identifies devices created by
crosvm. And introduce `CrosvmDeviceId` which adds a unique device ID for
each type of crosvm device.
BUG=b:213149158
BUG=b:213152505
TEST=Compiled.
Change-Id: Ica1374d8a2d8fd627c9397553bb7fb62baeaff7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687418
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Pcie upstream/downstream port will also have their related host port,
and their functionality should be similar with pcie host root port.
So I refactored PcieHostRootPort to PcieHostPort here, so that
pcie upstream/downstream port could use them later.
BUG=b:199986018
TEST=./tools/presubmit
Change-Id: I34d46f82c3b3adcfd7b5eb178cda29e902b3eb1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3692430
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Since all pcie ports (root port, upstream port, downstream port)
have similiar pci config space and handling logic, we could have
a common code base for them to use for code simplicity. This
patch adds the code base PciePort structure that could be used
later for both pcie root port and pcie upstream/downstream port.
BUG=b:199986018
TEST=./tools/presubmit
Change-Id: I23cfaf561432ed2cb977d0d2a020fc05370bb4b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3692429
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
To add support for pcie switch, we need to make crosvm support pci
device tree. This patch introduces a new structure PciBus which
stores topology information of a pci bus using a tree-like structure,
so that we can handle bridge window/MMIO allocation properly before
boot up. That is, we have to allocate device MMIO based on their
pre-order in the device tree, otherwise some pci bridge's bridge
window would intersect and guest won't boot. This PciBus structure
is stored in PciRoot later, make it possible for us to modify pci
topology during runtime.
BUG=b:199986018
TEST=run crosvm to see if pci device model has any issues
Change-Id: Ieb677cb7787650804051c43355ba27ce7926819a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3503103
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
To support pcie switch, we need a correct way to calculate pci
bridge window. This patch is refactoring configure_bridge_window()
for preparation.
This patch does 3 things:
1. The original code does not calculate bridge window correctly.
For the following bar_ranges, the old version would fail:
[[0xd0400000, 0x1000, false], [0xd0000000, 0x100000, false],
[0xd0100000, 0x1000, false]], [0xd0200000, 0x200000, false]]
This patch fixes this bug.
2. We need to round bridge window base down to 1MB aligned, round
window size up to 1MB aligned.
3. Since bridge window are also bar ranges, we need to return
the configured bridge window so that parent bridge can use it.
BUG=b:199986018
TEST=./tools/presubmit
Change-Id: Iff26fdd7e500671688897652ac16aff792882707
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3503102
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The AddressRange type is used for representing contiguous memory or I/O
address ranges, mostly equivalent to RangeInclusive<u64> but with the
added benefit of implementing Copy and not carrying an extra field used
only for iteration, which we don't need.
Using an inclusive range means we can represent the full address space
with no weird corner cases around the upper limit of the range (for
example, an AddressRange covering the full 64-bit space can be
represented as start: 0, end: u64::MAX).
AddressRange also replaces the previous MemRegion type, which was a
start/size pair.
This normalizes the interface of the resources crates to use
AddressRange rather than a start/size pair; more cleanups throughout the
tree may be possible, but this commit attempts to be somewhat smaller to
have a hope of being reviewable.
BUG=b:222769529
TEST=tools/presubmit --all
TEST=cargo test -p resources
Change-Id: I8c90bdc28456221b5107ef7e589233315ea739c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3696671
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Using generic code for the whole vhost-user processing loop results in
the same code being instantiated per-device, which turns out to be quite
a bit of code just to avoid a few virtual calls on the VhostUserBackend
interface. Let's make DeviceRequestHandler work with boxed
VhostUserBackend trait objects instead and avoid generating that much
code.
With this patch, the size of the crosvm binary obtained using
$ cargo build --profile chromeos && strip target/chromeos/crosvm && ls -l target/chromeos/crosvm
Goes from 6577240 to 6249560 bytes, i.e. a reduction of 320KB, of ~5% of
the binary size.
BUG=b:217480043
TEST=vhost-user console device works.
Change-Id: I1cc48404b0eb72a38aeff48bf6731d858cae9349
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3702779
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The virtio video decoder device is currently only available under very
drastic conditions: a build linked against libvda (a ChromeOS-only
library that needs the cros chroot to be built and linked against), and
a ChromeOS-flavored Chrome instance running alongside crosvm, so the
browser can provide the video decoding service through Mojo.
This makes the decoder device very difficult to develop on for
non-Chromies, and also for Chromies actually since they will always need
a DUT to test it on.
This patch introduces an alternative decoder backend based on
ffmpeg's libraries that performs decoding on the host's CPU. It supports both
guest pages and virtio objects as target, and can be considered a
reliable and predictable way to test the decoder in any environment.
We introduce our own ffmpeg bindings after a quick state of the art
revealed that the existing ones were all unsuitable, either for
technical or licensing reasons. Doing so is also not a big effort and
does not add any new external crate dependency to crosvm.
BUG=b:169295147
TEST=cargo test --features "video-decoder,ffmpeg" -p devices ffmpeg
TEST=v4l2r's simple_decoder example decodes test-25fps.h264 properly with the
following command:
./simple_decoder test-25fps.h264 /dev/video0 --input_format h264 --save test-25fps.nv12
TEST=ARCVM Android youtube plays videos correctly when the ffmpeg
backend is used.
Change-Id: Ic9c586193f7939f2a3fe59d009c3666585a8bbc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026355
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This change enables memory mapping of the vfio device doorbell regions so
we can access the vfio bar more efficiently by limiting the scope of the vvu
device interactions with the guest kernel.
BUG=b:231938067
TEST=built and run, verified vvu communication happens as expected
Change-Id: I16925d99a467d44ce7f74316770f1c665de75433
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3670459
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Morg <morg@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Morg <morg@chromium.org>
The outer set of parentheses is redundant.
BUG=None
TEST=emerge-kevin crosvm
Change-Id: I482e04601b0f7a3ef22221a77c00ef746bbd288a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691969
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The flexible_array_impl! macro should not rely on the caller to import
FlexibleArray; use $crate::FlexibleArray to refer to it instead.
BUG=None
TEST=tools/presubmit
Change-Id: I9743a4cbc01deb6cdfadd98e63f4803a5572421c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687064
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Introduce `State` enum to handle vvu-proxy's lifecycle.
This state will be used to support recovery from sibling disconnection in the follow-up CL.
BUG=b:216407443
TEST=run VVU
Change-Id: I47f9c69abb9d08520ec90a4a9a87fc4d230c96a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3591105
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
vhost-user implementations of the net device can currently not
specify a MAC for the guest, even though they would support this.
This adds the corresponding feature to the allowlist and increases
the queue size to 1k to avoid situations where the device runs out
of available descriptors.
BUG=None
TEST=./tools/run_tests
Change-Id: Iefe8ce21215b36c65ee2516428249c41bf13f285
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3683380
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Kevin Hamacher <hamacher@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Pull the declaration of the `EventToken` enum up to the top level of the
base crate, replacing the identical implementations inside sys/windows
and sys/unix.
Use the `EventToken` name consistently throughout the tree to remove the
unix-flavored "poll" nomenclature.
BUG=b:213153157
TEST=tools/dev_container tools/presubmit --all
Change-Id: I0ba42037b533b796797a7a3f6d8d7e71a5592aba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3642673
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>