The panic hook calls read_to_string, which relies on lseek internally.
Most devices already allow lseek, but add it to the common policy files
to ensure that devices can properly panic.
BUG=None
TEST=compiles
Change-Id: I99d6d1d258706874cc04ce550108991631d71706
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960213
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This replaces the handwritten arg parser with the serde_keyvalue
based parser. Eventually we will unify the arg parsing with Unix.
BUG=b:233676779
TEST=cargo b --features all-msvc64,gpu --no-default-features
TEST=cargo t -p vm_control --features all-msvc64,gpu
--no-default-features
TEST=cargo t -p crosvm sys::windows::config::
--features all-msvc64,gpu --no-default-features
Change-Id: I36a563be9767c7e5cbd3ab44f6a9ba23cd64cdb6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3939033
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
It's not necessary to build 3D rendering support to run the
cross-domain context type.
Default implementations are added for some hypercalls, since
the guest kernel may still think it's running a KMS display.
That adds log-spam if errors are present.
BUG=b:173630595
TEST=Run weston terminal in the guest
Change-Id: I8155cf9d9867a329927b7dd4bb22c385510966a2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3961536
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Add the test for disk resize command. This patch also updates the Vm
fixture to support additional argument to the command, and also updates
the Vhost-user backend fixture to use devices command.
BUG=b:243127910, b:191845881
TEST=./integration_tests/run
Change-Id: I8f1f4bd6a986ea77507a2ed6f1ae8582b10d3178
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3954786
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This allow GCP cloud build to fresh and incrementally build updated
docker containers to test upstream crosvm in CrOS tree efficiently.
Currently this resides in an experimental GCP project while being WIP.
TEST=Both fresh and incremental can build, emerge-hatch in pulled container
BUG=b:240692674
Change-Id: Id54014f347c00e4dae16674b430159dd8cfa67aa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3934983
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
`tracing` conflicts with a crates.io crate. Since we may support tokio
tracing in the future, and want to submit some benchmarks against it
right now, we should rename our crate.
BUG=b:253517247
TEST=presubmit
Change-Id: I32bf64a7ce1830e881bd582e4606932782df65c6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3957598
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
As we always report the maximum number of displays (16), the kernel
would issue VIRTIO_GPU_CMD_GET_EDID for all displays even if they
are marked as not enabled. However, VirtioGpu::get_edid() would
return an error if the display is not enabled.
We could report some default EDID for disabled displays. Also
noticed that EdidBytes has 2 impl blocks, which doesn't seem
necessary, so they are merged now.
BUG=b:253482501
TEST=tested in Windows downstream
Change-Id: I666961fe33a6143b9d022049abf05be4ec757a8d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3957536
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When decoding using libvda, the frame timestamp is truncated to 32-bits
and needs to be restored to its original value. This is done by doing a
multiplication with the truncation factor. However, if libvda gives us
an invalid timestamp, the multiplication can overflow and cause the
video device process to panic. Avoid this by switching to a wrapping
multiplication - the passed timestamp will still be invalid, but the
decoder device will signal an error instead of crashing.
BUG=None
TEST=cargo build --features "video-decoder,libvda"
Change-Id: Iabe683a997e0e9dea8c2bea53ef520f53868e590
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3958881
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Getting the following error at HEAD.
error: unused import: `base::Descriptor`
--> src/crosvm/plugin/process.rs:24:5
|
24 | use base::Descriptor;
| ^^^^^^^^^^^^^^^^
|
Change-Id: Ic638c277941fcdc41542c84a184d71680218b42a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3956728
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Frederick Mayle <fmayle@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This feature can be enabled now that we have ffmpeg enabled.
BUG=b:244618273
TEST=presubmit
Change-Id: Ic1c36ffa46729fcbdc408135f4167c49042ea56a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3953083
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
The feature can be built but not tested without access to an intel
GPU.
To enable the build, the testvm and dev container are updated to
include libva.
BUG=b:244619376
TEST=presubmit
Change-Id: Ia8c4dc46ccbcd244bf57441f2c550a6b73c67b1c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3946027
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This feature was used for experiments and is no longer needed.
BUG=b:253086623
TEST=presubmit
Change-Id: Id8ece0e1e8588a5716794961c359482bc60dc729
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3946029
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
The feature flags are documented using the document_features
crate.
Each platform gets one feature set that enables the features that
are built and tested for that platform.
The only functional difference is that the plugin feature is now
enabled in clippy. Otherwise this should be a no-op.
BUG=b:243894033
TEST=presubmit && cargo doc
Change-Id: Ia910bc2670696172daedcc503f7ad5844a844964
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3946024
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This allows the tests to work in the dev_container wine environment and
should not have any negative effects on actual Windows.
BUG=None
TEST=tools/dev_container tools/run_tests --target=host --build-target=mingw64
Change-Id: Ic94511573b83e6dd82163185098d3f1fdd871a4e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3935522
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The loop that generates the CPU affinity mask uses a shift by the CPU
index to generate a u64, so if the shift count is 64 or greater, it will
shift past the end of the u64 and panic when overflow checks are enabled
(which we enable by default in release builds in Cargo.toml).
Add a bounds check so set_cpu_affinity() will return an error rather
than causing a panic in this case.
BUG=None
TEST=run tests via wine on 72 logical core machine
Change-Id: I2ac4a0602b2c014aeca4939ec2882926cdfe2c29
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3935523
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
- Spawn detached tasks with an AbortHandle like other devices.
- Bug fix: without calling queue.ack_features at the beginning of
start_queue, VIRTIO_RING_F_EVENT_IDX causes a hang.
BUG=b:243061269
TEST=presubmit, downstream
Change-Id: I03eba1c60a541cf7862feb434fc9fc1064319629
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3950853
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
In an earlier refactor, mistakenly called .properties instead of
properties()
BUG=b:244622199
TEST=downstream
Change-Id: Ia34e6167ad04e9b42580193b9fcd6b4f8acaf1fd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3939622
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Some devices support so many features, that they collide. In Vulkano's
autogenerated out\features.rs, some are tagged as:
crate::device::FeatureRestriction::ConflictsFeature
Meaning both cannot be on at the same time. An example failure is
on Nvidia for:
shading_rate_image
attachment_fragment_shading_rate
My GPU supports both and thus cannot be created since we attempt to
enable all supported features.
This is VUID 04480
https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkDeviceCreateInfo-shadingRateImage-04480
This change just removes features from being requested. Instead we
should choose the specific features we want as they come up. Currently
for GPU mapping we don't need features.
BUG=b:244622199
TEST=downstream
Change-Id: Ic511d04cf2987bfc7189182a1dc002a367b5d9f7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3936679
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
... and include this information in the EDID blob.
BUG=b:163864461
TEST=cargo build
TEST=Android build
TEST=launch Cuttlefish with various DPIs and inspect
`adb shell dumpsys SurfaceFlinger`
Change-Id: I3f9ca0283f335d51063bf8e555ff2ffa7ead104b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3954473
Reviewed-by: Pujun Lun <lunpujun@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
cros_async and by extension serde_keyvalue are needed on ChromeOS, so
add the `# provided by ebuild` comments where appropriate to make it
possible to uprev cros_async (which requires pulling in serde_keyvalue).
BUG=b:250883877
TEST=kokoro passes
Change-Id: I423cac0c4e5e30afac058b914358caca7d27edbf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3953082
Auto-Submit: Allen Webb <allenwebb@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Add a mode where the VM is placed in protected mode but the protected
firmware has been provided to crosvm and preloaded at its usual address,
instead of being loaded by the hypervisor at VM boot time. This is
useful for automated testing of firmware builds and development.
BUG=b:243646855
TEST=build
Change-Id: I849f3c6f0de55607893862d1d7739f6e1b410990
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3944853
Commit-Queue: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Andrew Walbran <qwandor@google.com>
Reviewed-by: Jiyong Park <jiyong@google.com>
Introduce a set of helper methods that expose individual characteristics
that particular subsets of the ProtectionType variants share. These will
simplify various match statements into conditionals by encapsulating the
deduction of those characteristics, making the calling code more concise
and robust.
BUG=b:243646855
TEST=build
Change-Id: I65ff3e61c448d90704551b79c21c64d1b4c11dc4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3944852
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Even if it isn't functionally necessary, use swiotlb and virtio bouncing
in UnprotectedWithFirmware as the mode is supposed to emulate protected
mode (e.g. for debugging), which matches when VIRTIO_F_ACCESS_PLATFORM
is set by virtio::base_features().
BUG=b:243646855
TEST=build
Change-Id: I987707060805aadce9f00faddc137a62c0d9993f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3944851
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Andrew Walbran <qwandor@google.com>
Also fixes health-check to recognize that the proto optional
crate is referred to by other features.
Change-Id: Ie0e8f9ee8960ccb31539eeb2604e8c9654798de4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3943594
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This now requires --platform instead of --target, per the error message
from tools/run_tests:
Warning: Setting --target for running crosvm tests is deprecated.
Use --platform instead to specify which platform to test for.
BUG=None
TEST=tools/presubmit
Change-Id: I0e52f97273774b968617007c098aa80d33103263
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3950716
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Vhost worker uses the maximum queue size the host offers when setting a
queue size to the vhost device, which leads inappropriate behavior when
a guest preapares a virtqueue whose size is smaller than the maximum
size.
Fix the vhost worker to set the actual queue size to the vhost device.
BUG=b:235857465
TEST=`cargo build`
TEST=`./tools/run_tests`
TEST=host and guest can communicate via vhost-vsock
Change-Id: I99af745788c347ca2770b979252f8ea8dde34462
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3946422
Commit-Queue: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Some distributions (such as Debian) put the mkfs.ext4 binary in /sbin or
/usr/sbin. However, in our case, we don't need to be root, since we are
only using it to create a filesystem inside a normal file, not on a
block device. Adding these directories to the path lets us find the mkfs
binary on these systems without requiring sudo privileges.
BUG=None
TEST=cargo test -p integration_tests -- --test-threads=1
Change-Id: I9b180f941ee81c5febf78004050d211fe1912621
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3940108
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
1. gpu_control_tube is not used on Windows yet. We will make use of
it and test it in the downstream first before removing the Unix
feature flag.
2. In Gpu::keep_rds(), skip appending descriptors of stdout and
stderr since it is hard to find such descriptors on Windows, and
this function won't be called on Windows anyways.
3. Some functions in gpu_display should be guarded with gfxstream
feature flag, since we don't need to link against gfxstream
binary when we are building/tesing without gfxstream.
BUG=b:213149288
TEST=presubmit
Change-Id: I28c3d16d82916e6d4a542aa008dd09015141716c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3947825
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The pVM firmware memory region is allocated before
AARCH64_PHYS_MEM_START, but several parts of the code were assuming that
all memory was contiguous and after that.
BUG=b:244553205
TEST=Patched into AOSP and ran some VMs.
Change-Id: I8caefc9cae79c98ea62ee02a506b1b485d3f09a6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3921604
Reviewed-by: Pierre-Clément Tosi <ptosi@google.com>
Commit-Queue: Andrew Walbran <qwandor@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Jiyong Park <jiyong@google.com>
It's not ergonomic for the calling code to pass in an array of
references.
Just take ownership of that array, as it's not going to be used again
when the calling code succeeds in creating the wrapper.
BUG=b:214478588
TEST="cargo build --features=video-decoder,vaapi" successfully builds
the libva crate
Change-Id: I97d91f9f996c298450e65c21c126a9739ec4615f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3900314
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Implement access to vaQuerySurfaceStatus for Picture<PictureEnd>. This
means that a decoder can initiate a decode operation and query its
status at a convenient time instead of blocking on it for completion.
Also expose libva::VASurfaceStatus to calling code while at it, since it
is needed to interface with this API.
BUG=b:214478588
TEST="cargo build --features=video-decoder,vaapi" successfully builds
the libva crate
Change-Id: I8a20455ef9937a4a54943325d359fa361190d8a4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3875042
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Previously, only PictureSync would allow us to retrieve a borrow to the
underlying surface, but this is too restrictive. If we can take the
Surface back by calling take_surface() in PictureReclaimableSurface,
there is no reason not to be able to get a borrow to a Surface as well.
This makes the calling code more ergonomic.
BUG=b:214478588
TEST="cargo build --features=video-decoder,vaapi" successfully builds
the libva crate
Change-Id: I71f9f46e6bac6188c4c3862332c445c68028dbef
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3783006
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
In preparation for interlaced support, allow for picture creation using
another picture's Surface. This is so one can decode both fields to the
same underlying surface.
BUG=b:214478588
TEST="cargo build --features=video-decoder,vaapi" successfully builds
the libva crate
Change-Id: If3ffcc2592b7213644ed92f7202502fc92bac4b3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3783005
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
While the current design works well for progressive content, in
interlaced content a common strategy is to decode both fields to the
same Surface.
Thus, add support for sharing the underlying Surface. This means that we
can only retrieve the Surface if we are the last Picture with a
reference to it.
While we are at it: only retrieve Surfaces if we are the last users
In preparation for interlaced decoding support, only retrieve Surfaces
back into the surface pool if we are the last users. This means that the
surface will not be dropped until both of its fields have been dropped.
BUG=b:214478588
TEST="cargo build --features=video-decoder,vaapi" successfully
builds the libva crate
Change-Id: I80412a86f51ab639fab6af229572fb7bc800a928
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3946300
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
When we detect a VCPU stall we propagate the watchdog reboot error code
to the event tube. The newly added error code WATCHDOG_REBOOT = 36 is
returned from the crovm process.
Bug: 245900797
Test: manual testing, build and Virtualization apk on a device
Signed-off-by: Sebastian Ene <sebastianene@google.com>
Change-Id: Ib1ce97de911784b33d130d40536be26813edc3d7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3936647
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The current crosvm implementation is using
`GuestMemory::checked_offset()` for the following two cases:
(1) To get a valid `GuestAddress` representing `addr + offset`.
(2) Guarantee that the memory range `[addr, addr+offset]` is valid.
However, using `checked_offset()` for the case (2) is wrong because the
method only checks if the end address `addr+offset` is valid and doesn't
check if an invalid region exists between `addr` and `addr+offset`.
So, this CL adds `GuestMemory::is_valid_range()` to replace the (2)
cases.
BUG=b:251753217
TEST=cargo test in vm_memory
TEST=start a vm with virtio devices
Change-Id: I21bce5d1c60acdff79284cdad963849a6e19e19c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3945520
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>