Adds a script that copies the bindings we need upstream. We cannot
use the original repository, as it's part of the large platform2 git
repository, and the original build.rs depends on ChromeOS tooling to
generate these bindings.
So instead, this change adds a script that can be called from a
chromiumos checkout of crosvm to update the upstream bindings.
This allows us to enable certain features that talk to ChromeOS
dbus services. They won't be functional upstream, but at least we
can compile and test the code.
To make things more consistent, we no longer replace the crate
with the ChromeOS version when building for ChromeOS.
BUG=b:244618505
TEST=presubmit
Change-Id: I504cbf6d12b0cb50d9935f5e49b7fa72b692d45c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3919814
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Generalize and move it out of the decoder for potential future use in
the encoder module.
A ffmpeg.rs module is introduced to accommodate any video-related code
that requires the ffmpeg feature flag, similar to what we have for
libvda.
BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices
Change-Id: I341d6d238b5593d16cbdc8dd8c96eb2fa4e143fe
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911109
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Some types have a typo on them. For the FFI case we don't currently use
the definition so it should be safe to rename.
BUG=b:244622199
TEST=presubmit
Change-Id: I9e3c29755f0c4479b54bef206f9173ab22030ab9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3913992
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Idan Raiter <idanr@google.com>
http://crrev.com/c/3911103 renamed a member of BufferInfo, but did not
update the video code that uses it.
BUG=b:3911103
TEST=cargo build --features "video-decoder,video-encoder,ffmpeg,vaapi,libvda"
Change-Id: Icc8c5c2f564ea2fdaeee12abe57cfd29c8373a72
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3920255
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
It used to use File instead. In VirtioGpu::export_fence() and
VirtioGpu::export_resource(), we had to turn SafeDescriptor into
File, which is not supported on Windows (to avoid converting a
SafeDescriptor that is not a file handle to a File). To make them
more platform-agnostic, we replace them with SafeDescriptor.
BUG=b:213149288
TEST=presubmit
Change-Id: I259bbc4d3461bc68b5a7a1e24d50bf77bdc6a5b0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911103
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
The generic type used in read_config() and write_config() was only used
to check the offset against the size of that type; the backend device is
capable of checking this itself, so we can drop the type from the
function signatures.
Additionally, fix the config functions to use the offset rather than
reading/writing the whole config and copying out the relevant parts.
This makes the config function implementation identical for all
vhost/user/vmm/ code.
BUG=None
TEST=mount vhost-user-fs filesystem in guest
Change-Id: I22493f4e87bff68ef9d68f1d1a0feeb29ec059da
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867543
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Implement `run_async` method in `Worker` for the video device.
`run_async` is necessary for implementing vhost-user video device, which
prefers async wait loop.
For now, the async runner depends on the wrapper of WaitContext, which
the implementation of decoder device depends on, rather than making the
decoder device async. In addition, this commit does not unify the block
`run` and `run_async` yet.
BUG=b:179756087
TEST=cargo build succeeds.
Change-Id: Iec14a342bade14bf1f68ec0211da3dd2b52c85da
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3783295
Commit-Queue: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Update `Worker` of the video device to make it easier to add async run
method; separate the interrupt into two `SignalableInterrupt`s for the
command/event queues, and move `Event`s to outside `Worker`. These are
changes preparing for introducing `run_async` method to `Worker`.
`run_async` will need separate Interrupts for the command queue and the
event queue, and will not need `Event`s inside `Worker`.
BUG=b:179756087
TEST=simple_decoder test script (see the crosvm book) worked with and
without -p "pci=nomsi" guest kernel parameter, which triggers interrupt
resample by disabling MSI-X interrupt.
Change-Id: Ia169e11bb5ecf992f768ab65cfb19a7a9f8fc9f0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3850019
Commit-Queue: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
When sandboxing is disabled, rutabaga.external_blob is unset and blob
resources with RUTABAGA_MEM_HANDLE_TYPE_OPAQUE_FD can be mapped via
rutabaga.map() as VmMemorySource::ExternalMapping. This is already
implicitly allowed for the Virglrenderer component, which doesn't
recognize the OPAQUE_FD handle type upon export_blob() and automatically
falls back on the ExternalMapping path. Mesa CI currently relies on this
for testing Venus in Crosvm with the host lavapipe driver.
When sandboxing is enabled, rutabaga.external_blob is set and opaque
fds MUST be mapped from the hypervisor process via Vulkano as
`VmMemorySource::Vulkan` instead.
This CL makes non-sandboxed OPAQUE_FD mapping explicit, documents the
two mapping paths, and prepares for virglrenderer to support sandboxed
OPAQUE_FD mapping.
For the non-sandboxed configuration, Crosvm exports a RutabagaHandle
with handle of type RUTABAGA_MEM_HANDLE_TYPE_OPAQUE_FD upon blob
creation with virglrenderer. When mapped, the RutabagaHandle is dropped,
closing the cloned opaque_fd, and virgl_renderer_resource_map()
completes the mapping internally by looking up the resource_id and
dispatching to the context type from which it was created.
BUG=b:244591751
TEST=`deqp-vk -n dEQP-VK.memory.mapping.*` using venus with lavapipe host driver
TEST=CQ
Change-Id: I2ff32cf8868d6c9c1eb16480456cde98d376cc65
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3900320
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
We want to hide this variable from platforms that don't use it.
BUG=b:213149288
TEST=presubmit
Change-Id: I0d44d2bc50843b86d82b4084f95c8d1a1f750aa6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3895401
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
Apart from being used for arg parsing, GpuParameters is also sent
through a Tube on Windows. Since we've added a deserializer for
the context_mask field, we also need a serializer for it.
BUG=b:233676779
TEST=cargo test -p devices --features=all-linux
virtio::gpu::parameters::tests::context_mask_serialize_deserialize
Change-Id: Ic0a01acc07ac39b5962e3cfad970dae1ae8c8b27
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3906468
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Resource bridges are not supported on Windows, so we shouldn't try
to add their raw descriptors in Gpu::keep_rds().
Struct Gpu is updated to hold the ResourceBridges struct rather
than the Vec<Tube>.
BUG=b:213149288
TEST=presubmit
Change-Id: I6b71076d17057728b927d93462e3aee29f3ac8af
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911100
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Hitherto the activation could succeed only once since take() function on
Option "Takes the value out of the option, leaving a None in its place."
Above resulted with crosvm crash in guest suspend/resume scenario when
the activate was called more than once (for the second time snd_data
and stream_source_generators was None).
To overcome above issue use clone for snd_data. For
stream_source_generator the clone can't be
easily used due to missing Clone support for stream_source_generators
embed data types (e.g.
369 | struct AudioBuffer<'a> {
370 | buffer: &'a mut [u8],
| ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for
`&mut [u8]`
and some other). Therefore for stream_source_generator move
create_stream_source_generators from new() to activate.
BUG=b:246728970
TEST=Perform multiple suspend/resume s2idle cycle for borealis VM and
make sure that 1) crosvm doesn't crash anymore 2) audio from borealis VM
is still working after VM suspend/resume cycles.
Change-Id: I8b27042e4cc0e5efb1d92756ac3b71a5a744f705
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3904649
Commit-Queue: Norman Bintang <normanbt@chromium.org>
Reviewed-by: Norman Bintang <normanbt@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
GLES 3.1 is not yet well tested with gfxstream backend on Windows
and we don't enable it by default. We control this via command
line arg for now.
BUG=b:213151426
TEST=presubmit
Change-Id: Ic3f8ac0e10ab988cc7bb4a5ab741ee6542617943
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911097
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Commit-Queue: Pujun Lun <lunpujun@google.com>
The offset field of the VHOST_USER_GET_CONFIG message indicates the
offset within the whole device configuration, not within the buffer in
the message, so offset does not need to be less than size.
BUG=None
TEST=connect fs device with modified read_config() impl
Change-Id: Ifabac14ec087da200a09f41aa3a0041e96cf56f3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867542
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
The previous implementation would silently not flush all buffers if not
enough output buffers were available. It would also unconditionally emit
the FlushCompleted event.
Fix this by retrying the flush whenever new output buffers are
available, and only exiting the flush state when there is nothing left
to flush.
BUG=b:214478588
TEST="cargo test --features=video-decoder,vaapi
virtio::video::decoder::backend::vaapi::tests::test_get_capabilities"
Change-Id: I47402d3e561ca98ba93462f448eb4eb76acd3eee
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3783001
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Some codecs might need to return frames on flush. This is notably the
case on h264, as it has to output the frames in the DPB on flush, but
the current design makes it impossible.
Fix it by changing the signature of flush to allow for possibly
returning frames when flushing. These frames are appended to the ready
queue and outputted as soon as output buffers become available.
BUG=b:214478588 TEST="cargo test --features=video-decoder,vaapi
virtio::video::decoder::backend::vaapi::tests::test_get_capabilities"
Change-Id: Ifd982518bc09cbdd3c32da5409e348a3a2e0b91d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3783000
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
* Fixes a regression where we stopped setting sparseness on Windows
disk images when they were opened.
* Simplifies how disk images are opened. io_concurrency is not
currently used and may be repurposed in a way that won't use the more
complicated code in disk image opening.
BUG=b:247582339
TEST=builds
Change-Id: I25dd71985d512e5d6991a74e4e1b01fa798856a9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3908372
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
We want to use this for the encoder too, so move it to a place that can
be accessed from both.
BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p devices video
Change-Id: I5f880a9907d0750249d50a8b36f8431f180c31a4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889332
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
We want to share this module between the encoder and decoder, so as a
prerequisite remove the test's dependency on decoder features by making
a test-local copy of the struct.
BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p devices video
Change-Id: I09726e2da823994d4a9000bb23a8f5dbed4fdbca
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889331
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
The decoder and encoder uses different calls for flushing. Add a new
flush_encoder helper for that, and rename the existing one to
flush_decoder.
BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices
Change-Id: Id237424209dc8d64d43424570003d735ee164d36
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3868598
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
try_send_frame and try_receive_packet together forms the basis of the
(AVFrame-based) encoding API. This change adds helper methods for them,
with the return value being handled similarly to their decoding
counterpart.
TryReceiveFrameResult has been renamed to TryReceiveResult as the
encoding interface shares the handling of these return codes, and we'll
be sharing this logic between try_receive_packet and try_receive_frame.
BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices
Change-Id: I32c11053daed86c32067ac2b2a8f7218f6dbcd4f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3868597
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Move the logic for locking and DiskFile creation into an implementation
of DiskOption::open(), matching the sys::unix structure. This will
allow future consolidation of the vhost-user devices.
For now, the Windows variant of DiskOption::open() only knows how to
create a SingleFileDisk (not qcow, composite, etc.); switching to
create_disk_file() is left as future work.
This also makes a few tweaks to the creation of the BlockAsync instance
in order to make the unix and windows versions more similar - compare:
- devices/src/virtio/vhost/user/device/block/sys/windows.rs
- devices/src/virtio/vhost/user/device/block/sys/unix.rs
No functional change intended.
BUG=None
TEST=tools/presubmit --all
Change-Id: Iadb1a8913a7445d7c091d0e359c7d8792704c35a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892136
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
We've seen third-party DLLs hooking into CreateWindowExA and
causing stack overflow (b:202288586, b:244141583). Adding the
offending DLLs to the blocklist fixed the issue, but it is hard
to know what other DLLs would cause the same issue in the wild.
Hence, we want to spawn WindowProcedureThread and create
windows as early as possible and then pass them all the way
down to GpuDisplay.
We are also passing the kiwi specific gpu_device_service_tube
along the stack.
BUG=b:213150276
TEST=presubmit
Change-Id: Ib1e3a4f11523ea36ede74c99f401c23a8c94a2c3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892519
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
Explicitly drop the device object before calling libc::exit() so that
the Drop impl for the device has a chance to be called.
Change-Id: Id93447925f71340c78a1d80efdff5b1574801409
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3900327
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Describe the resample event and how it is meant to be used by a device.
BUG=b:243465984
TEST=tools/cargo-doc
Change-Id: I0a2ad7b5593e0222e69c932fed20499f6d2fccbf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892525
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
StreamInfo unit tests leave the stream in an arbitrary state after
finish testing. Some streams have spawned a worker in `prepare()`, but
haven't released the worker in `release()`. These are reported as
memory leaks.
Implement drop on StreamInfo to release the stream if the end state is
PREPARE, START, or STOP.
BUG=b:242021318
TEST=1. `setup_board --board=amd64-generic --profile=asan`
2. `build_packages --board=amd64-generic crosvm`
3. `FEATURES=test emerge-amd64-generic crosvm`
Change-Id: I8cb7a25b61bfacdfcda4c7ba06ed2ab2b6a4ea40
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3901569
Commit-Queue: Pattara Teerapong <pteerapong@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Virglrenderer must not unmap from any thread other than the virtio-gpu
thread because virglrenderer is not thread-safe and EGL requires that
only one thread own a context concurrently.
For the VirglRenderer RutabagaComponent, we can unmap directly from the
virtio-gpu thread. In fact, we can greatly simplify the use of
ExternalMapping if we eliminate the associated map/unmap callbacks for
all RutabagaComponents.
Now VirtioGpu is responsible for ensuring that the map/unmap occurs and
is registered/unregistered. Also, the shared `map_request:
Arc<Mutex<ExternalMapping>>` spanning the KVM and virtio-gpu threads is
no longer necessary.
BUG=b:244626679
TEST=OpenGL and Vulkan gameplay with sandboxing disabled
TEST=OpenGL and Vulkan gameplay on ChromeOS with sandboxing
Change-Id: I4acaf4aabff3891536ca0439221cfbd021dba123
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3888602
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
This lifetime is not used anywhere and clippy complains about it.
BUG=None
TEST=cargo build --features video-decoder,ffmpeg
Change-Id: I09fe49b2c89cfc80891acb47592f0de6ebc26ea3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889320
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Refactor StreamInfo into a separate file and add unit tests for state
transitions.
BUG=b:242021318
TEST=unit test
TEST=play music and record audio in ARCVM
Change-Id: I3aa17bdbd29bb768f6471a91f4cf93c56d68574d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889321
Commit-Queue: Pattara Teerapong <pteerapong@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
The use of flatten is problematic as it introduces type ambiguity if we
need to parse a string from either the embedding or the embedded
structure. For this reason we are now discouraging its use.
Replace the only place where it was used (the VhostUserParams struct)
with a manual parser that requires the 'vhost' parameter to come first.
This is a bit more constraining but at the same time is probably clearer
than having it in the middle of device-parameters anyway.
BUG=b:217480043
BUG=b:241300017
TEST=cargo test -p devices vhost_user_params
Change-Id: I35847196fa6dc4858112ffe1e2883d64c2fae514
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889329
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
We are going to make some changes to VhostUserParams' parsing, so add
tests to make sure we don't break anything along the way.
BUG=b:217480043
TEST=cargo test -p devices vhost_user_params
Change-Id: I898b4b2293bc6233fed6703fb6de1b8238a16d5d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889326
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This is both a shorter and better name for this member.
BUG=b:217480043
TEST=cargo build
Change-Id: I4698fc9c411361837b65d42c4e64516a477eb2a5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889325
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This cleans up the remaining common.rs definitions.
No functional change.
BUG=b:237829580
TEST=tools/presubmit --all
Change-Id: I7a318648a7f16535e1f0525566fe49a6e4e57c3c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892135
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Now that the non-async block device is removed, it makes more sense for
these functions to live in the BlockAsync implementation. This partly
cleans up the remaining common.rs contents.
Also move the BlockId type into asynchronous.rs, as it is only used
within DiskOption.
No functional change.
BUG=b:219595052
TEST=tools/presubmit --all
Change-Id: Id848c401eac1d7ab6a6d38be5d6676718d30d460
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892134
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This requires a few tweaks to non-generated code:
- VIRTIO_ID_VIDEO_ENC/DEC -> ENCODER/DECODER
- io_uring unnamed union layout change
Change-Id: I58e118efa5c6bf28ff56d211fec5603651cb60bc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3893753
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
When converting the GpuParameters to serde_keyvalue, we moved the custom
parsing code into custom deserializations functions. However, in the
case of the 'wsi' member, it looks like the same result can be obtained
by using kebab-case and aliasing "vk" to the "Vulkan" variant.
BUG=b:218223240
TEST=cargo test --features "gpu" parse_gpu
Change-Id: Ie7b892a9aebd0b0915c089473e1a114ab992202e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889323
Reviewed-by: Pujun Lun <lunpujun@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
'GpuParameters' are used for parsing the command-line, but are also
passed through a tube. When that happens, the default serializer turns
the 'wsi' member to "Vulkan", but the custom deserializer function
expects 'vk' in order to build it properly.
Fix this by making RutabagaWsi use the kebab-case for
serializing/deserializing so it gets serialized into 'vulkan', and
making the 'deserialize_wsi' function accept 'vulkan' as a valid option.
BUG=b:218223240
TEST=cargo test --features "gpu" parse_gpu
Change-Id: I831ddc623ff6b5ddd74dbfe82cf7ccc0f7647272
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889322
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Pujun Lun <lunpujun@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This new struct tracks which resource bridges should be processed.
* For Unix, there should be no functional changes.
* For Windows, resource bridges are not supported so this struct
intentionally does nothing.
BUG=b:213149288
TEST=presubmit
Change-Id: I8da6a9fe073600c2982e7930108ebf159be95a30
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3880589
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
While we are tweaking all of the copyright headers, let's take the
opportunity to ensure there is always a blank line after the copyright
header for consistency. (Almost all files already follow this style.)
This includes a slightly ugly regex to allow the end of a C-style
comment block after the end of the copyright:
/*
* Example comment block
*/ <-- this line
Change-Id: Idfd0855861e5ecb3d33afae942fdba908af0dcff
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892521
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.
This fulfills the request from legal and unifies our notices.
./tools/health-check has been updated to only accept this style.
BUG=b:246579983
TEST=./tools/health-check
Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
We are going to need to start passing a new arch-dependent configuration
parameter to KvmVm::new in addition to protection_type. Since we can't
[cfg] a function argument, and to avoid churning the tests the next time
we need another argument, let's create a hypervisor::Config struct and
start passing protection_type that way.
Bug: b:234779841
Change-Id: I42ce9438b064658ebb9732e78ee5c82dac2636b6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892140
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
This makes it easier to diagnose what is going wrong with the --vfio
option, as it will now print the actual path (e.g. "/dev/vfio/38")
rather than just "/dev/vfio/$group_num".
BUG=None
TEST=crosvm run --vfio /some/sysfs/pci/path
Change-Id: I18c196151d807827bcba348b9453fd2ef7c1a9b9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892131
Commit-Queue: David Stevens <stevensd@chromium.org>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Brings up the master request handler on Windows. To stay within the
existing protocol, PackedTube was introduced, which is able to transmit
a Tube via a RawDescriptor.
BUG=b:221882601
TEST=presubmit & cargo test & tested downstream
Change-Id: Ibd4c2f55c42738392beed5b15b8d445e47890627
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3856828
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This patch modifies the way we program the watchdog internal counter to
prevent spurious resets when the guest is not scheduled to run.
The internal counter consists of a per-cpu POSIX timer and an associated
countdown register and is used to detect whether we missed periodic
heart-beat events from the guest. Add tests to verify the watchdog
expiration condition.
In this change we re-program the one-shot timer after we detected that
there are no events sent from the guest and the guest didn't run.
We detect that the guest is not running by looking
at the reported time from /proc/stat entry (guest_time).
We can enter in this state if the
guest is not scheduled to run, or is busy waiting for some MMIO
operation to finish. To detect a stall, we look for the value of the
guest_time field and if it changed between sub-sequent expiration events
then the guest is running, but it is not serving our watchdog.
Bug: 213422094
Change-Id: I0999f6ead350ac30a6ef6f600e57ec1805b40746
Signed-off-by: Sebastian Ene <sebastianene@google.com>
Reported-by: Will Deacon <willdeacon@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3872276
Reviewed-by: Will Deacon <willdeacon@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This is a reland of commit 4811773029
The landed commit was an old revision pushed by mistake. It was not the
latest reviewed revision and did not compile.
This reland replaces it with the intended revision.
Original change's description:
> virtio: video: encoder: Handle SET_PARAMS_EXT's resource_type.
>
> Previously we kept using the initial value and while this was fine for
> ARC because VirtioObject was the initial value negotiated by the kernel
> and ARC only used VirtioObject anyway, but this broke when using FFmpeg
> which would use the mmap buffers of V4L2.
>
> Handle the type switch like we did in the decoder.
>
> BUG=None
> TEST=arc.VideoDecodeAccel*_vm,arc.VideoEncodeAccel*_vm on hatch
>
> Change-Id: I6f1c2d1bdaf18efb559528dfadb10baf32dbb757
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3840991
> Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
> Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com>
> Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Bug: None
Change-Id: Ica1bcad2ffffa66d8561010e8355f2989e961fa5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3881683
Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Tatsuyuki Ishi <ishitatsuyuki@google.com>