Developers may need to manually clean up the common/enumn directory - it
will be left behind if there are build artifacts (Cargo.lock, target
directory, etc.):
rm -rf common/enumn
BUG=b:205344148
TEST=cargo build
TEST=tools/presubmit
TEST=emerge-hatch crosvm # with https://crrev.com/c/3265967
Change-Id: I1af3bdd22f40e87895a78a5cbc8033476058c927
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3278774
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This change will allow the script to be executed from any path.
BUG=none
TEST=run tools/chromeos/setup_cargo from outside of crosvm directory
Change-Id: I9752f4a41987259f446431bf89c322095ef26e63
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3280361
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
There were not too many cases here. This fixes:
- comparison_chain
- wrong_self_convention
- upper_case_acronyms
- from_over_into
- let-and-return
The collapsible_if check is moved to the permanently
allowed checks. The cases we do have improve
readability or semantics.
BUG=chromium:908640
TEST=Kokoro
Change-Id: I6e905d08e2a87aa0862d4d1cf5ff57b60e95fa7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3278776
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Sprinkle cfg checks throughout build.rs to get rid of the compiler
warnings about unused functions when building with the default features
(without --features=virgl_renderer).
BUG=None
TEST=cargo build
TEST=cargo build --features=virgl_renderer
Change-Id: I2a1548ec0de33d958c5cd5b6658ec92cd6840566
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3243013
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This applies the same clippy config to rust_analyzer
as well.
BUG=b:193893457
TEST=./tools/clippy and VSCode show the same linter results
Change-Id: I5deec4a24d71fec4692ed708664130f46c1311b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3278773
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This ensures that we can open files whose sizes may be larger than a
32-bit off_t.
BUG=b:181113648
TEST=emerge-kukui crosvm
Change-Id: I2322480dcf507f83609117b4def40846d619b69b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3270100
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This currently gives a compiler warning:
warning: dereferencing a null pointer
--> aarch64/src/lib.rs:71:19
|
71 | unsafe { &(*(0 as *const $str))$(.$field)* $([$idx])* as *const _ as usize }
| ^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
...
622 | arm64_core_reg!(pc)
| ------------------- in this macro invocation
|
= note: this warning originates in the macro `offset__of` (in Nightly builds, run with -Z macro-backtrace for more info)
Fix the UB with an implementation based on memoffset::offset_of and
addr_of_mut! instead.
BUG=none
TEST=`emerge-kukui crosvm` no longer complains about UB
Change-Id: I0ab55dc7527c3a4acffe02ee587742dbddd45a0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3270099
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
We have not been running clippy on many crates before. This CL
does not contain any clippy fixes, but documents how many issues
each disabled clippy check and crate currently has.
Many of them should be easy to fix.
BUG=b:192425184
TEST=./tools/presubmit --quick
Change-Id: I9ea25bc9a24d405700027ca4e72fb2a50e376c9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276668
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Fixes https://crrev.com/c/3199298, which only added the new ioctl
argument to the seccomp syscall filters on x86.
BUG=b:169908659
TEST=tast.crostini.SecureCopyPaste.* on scarlet
Change-Id: Ifd44c7b403f862d5528d8cc3655f0cd2c71c6e13
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276675
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
This should fix the current uprev problem.
BUG=b:205997217
TEST=FEATURES=test emerge-amd64-generic crosvm
Change-Id: I0a0bb46fb004a7a057be9b2e4b13878038551e81
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276714
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This CL fixes a bug that was introduced by [1] where max_nesting_depth
is used to prevent unbounded nesting of qcow images.
When a qcow image is backed by a composite disk, the composite disk is
parsed twice: (1) once before the qcow header is created, and (2) once
again after the composite disk is written to the header and the header
is parsed. The max_nesting_depth was set correctly for (1), but was set
to 1 for (2). Since a composite disk inherently is nested,
max_nesting_depth drops to 0 and it causes an error.
This CL fixes the bug by respecting max_nesting_depth also for the case
(2).
Bug: N/A
Test: launch cuttlefish
[1] https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3146214
Change-Id: Ic2d30df6c76a0c1965e222960e0094fe847b1097
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3267734
Auto-Submit: Jiyong Park <jiyong@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andrew Walbran <qwandor@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
An error occured when passthrough some nvme to a guest based on vfio:
[ERROR:devices/src/pci/vfio_pci.rs:773] add_bar_mmap_msix failed:
Out-of-space detected in MSIX Allocator
Althrough the issue may only happen to some devices whose msix table
overlaps with its msix pba table, as it was mentioned before[1], this
situation must be covered by some validation test. Otherwise, it will
block crosvm booting.
[1] https://patchwork.kernel.org/project/qemu-devel/patch/099db937-3fa3-465e-9a23-a900df9adb7c@default/
BUG=b:1971693450
TEST=passthrough a nvme with a msix table overlapping the msix pba table,
then boot Linux kernel and verify MSIX-capable passed-through devices
work properly.
Change-Id: I602dda95d4671682dc03478415f6a96d7c40ec6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3152434
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Calling `unshare(CLONE_FS)` from worker threads means we can freely
modify the current working directory and umask without having to guard
theses attributes with locks.
BUG=none
TEST=./tools/presubmit --quick
Change-Id: I29144b3d233b84e761c11a5e46efe541117e7f2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3263932
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Christian Blichmann <cblichmann@google.com>
Auto-Submit: Christian Blichmann <cblichmann@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
More SocketListener code to socket.rs so that we can easily add a new
file for a new VFIO backend. No behavior will be changed by this CL.
BUG=b:194137301
TEST=cargo test --all-features
Change-Id: I8d987f85a63ba666619882559e5cceddd91814bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3268268
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Rename Listener struct to SocketListener and introduce Listener trait.
This is a preparation for adding VFIO backend for virtio-vhost-user.
BUG=b:194137301
TEST=cargo test --all-features --all-targets
Change-Id: Iea1e5b4378606b696c4022e3e2e6f4bbf80be55f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3268267
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Implement DataInit for message structs and use `.as_slice()` when
sending them.
This change makes `trait Req` require `Send + Sync`. This is needed to
implement `DataInit` for `VhostUserMsgHeader<R> where `R: Req`.
BUG=b:204720423
TEST=cargo test --all-features
Change-Id: Icd32861b8d4fef16606a35b387c35271aebe061a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3268265
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Fix clippy::bool_assert_comparison and clippy::needless_borrow, which
were temporally added at crrev.com/c/3267912.
Most changes are trivial.
`test_should_reconnect` in vhost_user/mod.rs was deleted because the
test doesn't make much sense as a unit test, because it just copies and
pastes the logic of `Error::should_reconnect()`.
BUG=b:205511695, b:204720423
TEST=./tools/clippy
TEST=cargo test --all-features in third_party/vmm_vhost
Change-Id: I664b3aa7df054871d7e127b6dffd0315f9d4c48c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3267918
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Remove vmm-vhost's OWNERS file because it became a part of the crosvm
repository now.
BUG=b:205511695
TEST=kokoro
Change-Id: Iba9f64e647d905a4bdd4580b0115bb79085c9a9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3267921
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Move rust-vmm/vhost code from chromiumos's third_party directory to
crosvm's one.
Note that we have crrev.com/c/3269863 for license files in Chrome OS
ebuild.
Changes:
* Copied vmm_vhost files at "7c95b4a2 rust-vmm/vhost: switch to upstream
tempfile", whose latest upstream commit is "488b3adc fix warning:
unaligned_references".
* Remove [patch.crates-io] section from its Cargo.toml.
* Add attributes to skip `clippy::bool_assert_comparison` and
`clippy::needless_borrow`, which will be fixed in following CLs.
* Update crosvm's Cargo.toml and tools/chromeos/setup_cargo
BUG=b:205511695
TEST=tools/chromeos/setup_cargo && cargo build
Change-Id: Icee201b39ff1d352df59469a6c8668fc7cb92ab9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3267912
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
By default, the memory of a protected VM is inaccessible to the host
and crosvm. Consequently, attempts to access guest memory are fatal and
must be avoided in order for the guest to run.
Mlock guest pages as they are faulted in for protected VMs, ensuring
that the host doesn't try to age or swap them out as a result of memory
pressure.
Bug: b:204298056
Test: cargo test on x86 and arm64
Cc: Quentin Perret <qperret@google.com>
Cc: Andrew Walbran <qwandor@google.com>
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I618ec1e8b1136a47a8b3ef563e45bc41d75ab517
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3257689
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
libcras_stub and system_api_stub are empty replacements for libcras and
system_api respectively. so cargo is happy even if they're missing
BUG=none
TEST=cargo build with CL:3267568
Change-Id: I20ba2ca77a241e354a45816605282d06d26f895f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3267907
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
It's not obvious it's possible to search API docs, it's one of the
things I would use the most often if it's reachable.
BUG=None
TEST=read it.
Change-Id: I29df6ae4df3eb667f17e22d0afc00aee80912187
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3267906
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This reverts commit 4ceec18783.
Reason for revert: This breaks all ARCVM HW encoding
BUG=b:205488531
TEST=arc.VideoEncodeAccel.h264_192p_i420_vm
Original change's description:
> virtio: video: reject resources with more than one entry
>
> The crosvm video device cannot currently work with resources that have
> more than one memory/object entry. Enforce this rule at the command
> level.
>
> BUG=b:161774071
> BUG=b:169295147
> TEST=Android Youtube plays properly on Hatch.
>
> Cq-Depend: chromium:3247491
> Cq-Depend: chromium:3247492
> Change-Id: Ibfe2e420b4a77062cca940c5e97e7053aa4b76a7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026345
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Bug: b:161774071
Bug: b:169295147
Change-Id: Ib24bd8098b37d696b74bc942cdb7c81719d1b8b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3267727
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: David Staessens <dstaessens@chromium.org>
Use the anyhow crate to provide ad-hoc errors with context. This removes
the large, manually-updated enum, which we never use programmatically
anyway (error messages are printed in human-readable form and otherwise
not matched against).
BUG=b:190433480
TEST=cargo build
TEST=./test_all
Change-Id: Ia7b90b33774d4031054b346d650861d3105044ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3105436
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Previous commit "devices: Add/Remove device mmio at config memory enable
/disable", it has an assumption that when driver update bar's location,
driver should disable bar's memory/io at first.
But some driver reallocate bar's address even with memory/io enabled,
this commit monitor bar's config write, if address is modified, it
return this modification.
BUG=b:174705596
TEST=boot a vm, monitor resource reallocation and check function.
Change-Id: I9aa883192f5e2fec344d3e86c818c7a29287f49a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3184726
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
get_bar_configuration() returnis bar's info, this ignores memory/io enable
bit. Usually driver disable memory/io first, then wrtie 0xFFFFFFFF to
probe bar's existence and size, finally write real address and enable
memory/io.
if get_bar_configuration is called after mmio/io disabled, current
it may return invalid info. In order to filter these invalid info,
this commit checks memory/io enable bit, only return info at memory/io
enabled.
BUG=b:174705996
TEST=carto test -p devices
Change-Id: Ib8bf1a7f7f959025117f319f8f6c5a9e5efea2e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3252779
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This change allows to override the command line tool that is used to
start the dev container in the `tools/dev_container` script. The
Makefile for creating the dev container uses the `DOCKER` env var to
implement this, so this is used here as well.
Rationale: Googlers are advised to not install Docker
(go/dont-install-docker) and to use Podman instead.
If the `DOCKER` variable is unset, the script will try to use
Docker first and podman.
Change-Id: I33bc8e4af632fa982406e838e762572407ccdc22
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3259939
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Christian Blichmann <cblichmann@google.com>
When initializing the device for encoding the underlying encoder
session is immediately brought up, as this is required to determine
parameters such as the desired output buffer size. This causes further
configuration changes to be refused, even when the device isn't
encoding anything yet. This CL makes changes to allow configuration
changes by recreating the encoder sessions as long as no buffers have
been queued.
BUG=b:203608233
TEST=tast run DUT arc.VideoEncodeAccel.h264_192p_i420_vm
Change-Id: I7e9d8b41ea2497b5d86aaca7db7ed13af056f11d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3252185
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Staessens <dstaessens@chromium.org>
We need the access id for some future changes that will be posted soon
for a userspace irqchip.
Each vcpu will have a clone of the Bus itself, not the Arc<Bus>, so that
they can each have their own access id.
This also adds a call to set_access_id to run_vcpu.
BUG=b:160610704
TEST=ran local presubmit, and ran test image
Change-Id: I4afb0ef9c234f25150ce2f89d6fb228ad5b88745
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3261627
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
The current way for building a codec device is to call the corresponding
constructor method of the backend we want to use. However doing this
forces us to pass the resource bridge to these constructors, introducing
dependencies from the backend to parts of the code that are not used
otherwise.
Switch the construction method to one constructor per backend, which
only takes the arguments relevant to the backend, and one device
constructor that takes the backend to use as parameter.
BUG=b:161774071
BUG=b:169295147
TEST=Android Youtube plays properly on Hatch.
Change-Id: I493f421e982a1d2ba8292a69bae575afeee17e4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026349
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
We have two separate features for video decoder and encoder, but
selecting any of them results in all the video code being included. Add
some #[cfg] statements to compile out the unneeded code if only one of
the features is selected.
BUG=b:161774071
TEST=`cargo build` passes without warning
TEST=`cargo build --features "video-decoder"` passes without warning
TEST=`cargo build --features "video-encoder"` passes without warning
TEST=`cargo build --features "video-decoder,video-encoder"` passes without warning
Change-Id: I3e5f2173695ee9dd5e8d26ace14374d426e570a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026347
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Make the backends accept our generic resource types as inputs instead of
expecting virtio objects. This makes the backends able to deal with any
kind of resource, the counterpart being that they must now check what
kind of resource they received. The VDA can only deal with virtio
objects and will reject other kinds of resources.
On top of making backends not limited to virtio objects, this is also
safer than passing FDs because it becomes clear when we are transferring
ownership of a resource, and when we need to clone them. Also since
resources carry information about their layout, the number of arguments
we need to pass to the backends is reduced.
BUG=b:161774071
BUG=b:169295147
TEST=arc.VideoDecodeAccel.h264_vm passes on hatch
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch
TEST=GtsExoPlayerTestCases com.google.android.exoplayer.gts.DashTest
passes on hatch
Change-Id: I09dd81bac13a46fa908a4107a376fa7d59fb9759
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983096
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Currently the video device only accepts virtio objects (as file
descriptors) for resources, and file descriptors are hard-coded a bit
all over the place to represent buffers and frames. This causes two issues:
1) Multiple buffers cannot currently be used to represent frames, i.e. 1
frame is exactly one virtio object,
2) Resources that are not virtio objects, like guest memory, cannot
be used at the moment.
This patch introduces more flexibility in the way resources are handled:
first, all the resource-related code, including their resolution using
the resource bridge, is consolidated into a new resource module. Then,
the command module does not arbitrarily decide that all resources are
virtio objects, and leaves that decision to the queues. Finally,
resources now have their enum type that can unfold into any of the
resource types we will support (currently only virtio objects). This
forces consumers of resources to check their type before using them.
Semantically, very little should change. The only noticeable side-effect
should be that we now call the resource bridge only once per input
buffer instead of once per decoder operation.
BUG=b:161774071
BUG=b:169295147
TEST=arc.VideoDecodeAccel.h264_vm passes on hatch
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch
Change-Id: I93b203117b5c96e91d4f1b8007e95ec5c501ea5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2983095
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
The crosvm video device cannot currently work with resources that have
more than one memory/object entry. Enforce this rule at the command
level.
BUG=b:161774071
BUG=b:169295147
TEST=Android Youtube plays properly on Hatch.
Cq-Depend: chromium:3247491
Cq-Depend: chromium:3247492
Change-Id: Ibfe2e420b4a77062cca940c5e97e7053aa4b76a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026345
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Add support for guest fences backed by host sync_files. Rather than
adding a new fence type, fences are implemented as vfds that only
support hup. The host simply waits on the sync_file and sends the guest
a hup when the fence is signaled.
BUG=b:169908659
TEST=Revert ag/15543199, resize ArcCameraFpsTest
Change-Id: I8c79ec9f418b1d71150b5a19f500c5ac7a6c9b02
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3199298
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When device memory/io is disabled, its mmio/io range should be
removed from mmio_bus/io_bus.
When device memory/io is enabled, its mmio/io range should be
added into mmio_bus/io_bus.
BUG=b:174705596
TEST=Boot a vm, monitor device mmio/io enable/disable, then check
vm function.
Change-Id: Ic77565b9828599d574329bea76146cff597a94fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3252778
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When device's bar are reallocated, all the old resource ranges should be
deleted, the new resouce ranges shoud be added, this commit add the
interface to get device mmmio/io old/new ranges.
BUG=b:174705596
TEST=Boot a vm, monitor device bar reallocation and check function
Change-Id: I1000607d9f766ff8b445bf92f17969b094f3b2ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2718280
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
When device's bar is reallocated, the old ranges will be deleted,
this commit add remove() function to delete one old range from
bus->devices.
BUG=b:174705596
TEST=Boot a vm, monitor Bar Reallocation then check function
Change-Id: Id0600ae1d7a3d04c7f05a90abcc8807b7f1020c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3184725
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
All of the developer tooling has moved to ./tools to make them
easier to discover.
BUG=None
TEST=None
Change-Id: I4daf6a0ca08c94a0c35ce8bc52f9d86e4cb15de9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3251781
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Original reason for revert: Causes crosvm to not start on AMD based devices b/204222491
Fixed by clamping the maximum physical address to 64 TiB, which is the
largest physical address supported by x86-64 Linux with only 4-level
page tables enabled.
In addition, the high MMIO region size calculation has been split into a
separate function, get_high_mmio_size(), and an off-by-one error in the
size calculation was fixed.
Original change's description:
> Devices: Allocate non pci bar mmio at top of HighMmio
>
> Some devices like virtio-pmem, intel host bridge need private mmio, these private
> mmio isn't exposed to Vm through pci bar, and crosvm use mmio allocation interface
> to allocate them, so guest OS pci bus driver couldn't detect them, and once guest
> OS reallocate pci mmio, these private mmmio could be assigned to pci device bar.
> then resource conflict happens.
>
> This patch allocates these non pci bar mmio at the top of HighMmio, since HighMmio
> is large enough and OS allocates pci mmio from low to high. So these non pci bar
> mmio won't conflict with pci bar.
>
> BUG=b:199442120
> BUG=b:185084350
> TEST=crosvm run --pmem-device xxxx
>
> Change-Id: I615d7901d595dd46ba6362f88b71d96baa9c4c8f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3184549
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This is a reland of https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3184549
BUG=b:199442120
BUG=b:185084350
TEST=Crostini starts on grunt (AMD device)
TEST=crosvm run --pmem-device rootfs -p 'root=/dev/pmem0' kernel
Change-Id: I7c93f7132dbfbc3f38ecbfa0504b59214a1eb6bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3251788
Reviewed-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This is required for the following step.
Updated installation steps so that it is possible to follow the steps
and build.
BUG=chromium:1265286
TEST=./install-deps inside docker container running ubuntu.
Change-Id: Icd6b1c9c3c74c790aba2fd41050ebd2f3470e946
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3255185
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>