Use the latest version of cfg-if and paste, which gdbstub crate will require.
BUG=chromium:1141812
TEST=cargo build
Cq-Depend: chromium:2507270
Change-Id: I9187cfc9a880f62b2aa1fcf5e5d47a720e5fbe60
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2499241
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This change will allow sending messages other than the run state to
vcpus. Different messages will be used to interrigate and set the state
of the vcpu from the debugger.
BUG=chromium:1141812
TEST=run a VM
Change-Id: Ied6c8b6ee5a037e5593087ca665a84fdb462c287
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2440220
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Using a channel will allow for more complicated messages to be sent to
the vcpu thread. Adding debug support will require being able to process
each message from the main thread. The atomic state worked well when
every CPU needed a message and when transient state changes can be
dropped. Neither of those assumptions will hold true when using this
communication channel for debugging message such as setting and getting
vcpu registers or single stepping a particular cpu.
The run state is now per-cpu so that individual CPUs can be stopped and
stepped by GDB in later commits.
BUG=chromium:1141812
TEST=run a VM
Change-Id: Ibe3b71af0c99057666d30e302090a8a4364c064a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2440219
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Instead of creating IoSourceExt from AsRawFd implementers, we've
switched to creating from a marker trait `IntoAsync`. This lets us use
other types like RawDescriptor easily with this crate. By using the
marker, we also provide some type safety by requiring consumers of
IoSourceExt to declare that their type is expected to work with async
operations. This way we can provide stronger guarantees that an async
IO trait object will behave in a reasonable way.
This CL also purges the cros_async -> base and io_uring -> base
references, and provides the base types needed to add new async
primitives to base.
BUG=none
TEST=builds
Change-Id: I0b0ce6ca7938b22ae8e8fb4e604439f0292678f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2504481
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
This CL fixes the wrong value being used when configuring a bitrate
using the V4L2_CID_MPEG_VIDEO_BITRATE control. Rather than using the
requested value, the original value was wrongly being used.
BUG=b:162804477
TEST=tast run DUT arc.VideoEncodeAccel.h264_1080p_i420_vm
Change-Id: I1381277c324eff035643b5f65c1e03832085e3f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2522772
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: David Staessens <dstaessens@chromium.org>
Commit-Queue: David Staessens <dstaessens@chromium.org>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Along with this rename comes updating all usages to the
appropriate RawDescriptor traits. As per usual it touches
many files, but makes no significant changes.
The only remaining instance of "keep_fds" is to call out to
3p lib adhd.
BUG=b:162363783
TEST=./build_test
Change-Id: I6d292cc6404a9f84ffa5bf1320b6545a28842afa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2488071
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
Tested-by: Michael Hoyle <mikehoyle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Without this, non-root X fails with
[ 7.544] (EE) modeset(0): drmSetMaster failed: Permission denied
because of the fallback
[ 7.367] (II) systemd-logind: took control of session /org/freedesktop/login1/session/_31
[ 7.368] (II) xfree86: Adding drm device (/dev/dri/card0)
[ 7.368] (II) Platform probe for /sys/devices/pci0000:00/0000:00:06.0/virtio5/drm/card0
[ 7.368] (II) systemd-logind: got fd for /dev/dri/card0 226:0 fd 10 paused 0
[ 7.369] (II) no primary bus or device found
[ 7.369] falling back to /sys/devices/pci0000:00/0000:00:06.0/virtio5/drm/card0
BUG=None
TEST=Arch Linux guest
Change-Id: I4921fbd22b77d43d190b7adeb0399fc77fcec908
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2518656
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
Very small renaming to generify the mod.
BUG=b:159741216
TEST=./build_test
Change-Id: Iba156b36ba0a1b2da9518eae4af6cd9cb7ba71ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2477735
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
A decoder session is always associated to a given context ; therefore
our session map ends up having the same keys as the context map, with
the only difference that sessions are created a bit later.
Move the DecoderSession into the Context struct so we don't need to do
this double-lookup and to maintain consistency between the two maps. Since
the context can lack an associated session until the first output buffer
is queued, put the session behind an Option<>.
BUG=b:161774071
TEST=Youtube video playback works on kukui-arc-r.
TEST=Youtube video playback works on hatch-arc-r.
Change-Id: I0511e51d422700a161457bb796ced3f2ef4732e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2484064
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Clippy is not happy because this method uses too many arguments. Since
we just happened to introduce a Rect type, use it to reduce them to an
acceptable number.
BUG=b:161774071
TEST=Youtube video playback works on kukui-arc-r.
TEST=Youtube video playback works on hatch-arc-r.
Change-Id: I88fd0af5be75e3ddf3d3e2c03593aa492a18830e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2484063
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Introduce our own event type to avoid using the libvda one in the
DecoderDevice interface. The current type is a 1:1 mapping from the
libvda event type, but we may simplify it in the future.
BUG=b:169295147
BUG=b:161774071
TEST=Youtube video playback works on kukui-arc-r.
TEST=Youtube video playback works on hatch-arc-r.
Change-Id: Ic0fa1276ffe33c510f8a36ff26a69ece4e271974
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2477407
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Introduce our own plane type to avoid using the libvda one in the
DecoderDevice interface.
BUG=b:169295147
BUG=b:161774071
TEST=Youtube video playback works on kukui-arc-r.
TEST=Youtube video playback works on hatch-arc-r.
Change-Id: I59e7dd0003a4fd5cb5cc10501f8167d8434addc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2477406
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Use the decoder's own pixel format type to avoid using the libvda one in
the DecoderDevice interface.
BUG=b:169295147
BUG=b:161774071
TEST=Youtube video playback works on kukui-arc-r.
TEST=Youtube video playback works on hatch-arc-r.
Change-Id: I85589c25d337a517e4d98c55e8fb4e968c0c3e46
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2477405
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Replace the libvda profile type by the more generic crosvm format type
to make this part of the interface portable.
BUG=b:169295147
BUG=b:161774071
TEST=Youtube video playback works on kukui-arc-r.
TEST=Youtube video playback works on hatch-arc-r.
Change-Id: Ia0eb210278e4e4d945a4caa304c072ce68771440
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2477404
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Replace libvda::Result by the more generic VideoResult in the
DecoderDevice interface. Since all callers of the interface ended up
converting libvda errors into VideoErrors anyway, this turns out to be a
better fit.
BUG=b:169295147
BUG=b:161774071
TEST=Youtube video playback works on kukui-arc-r.
TEST=Youtube video playback works on hatch-arc-r.
Change-Id: Idc3be76ab312c95b9d234550270adef44ea86f3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2477403
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
The virtio video decoder was working directly with libvda to
provide the video decoding service to the guest. In the future we may
want to add other ways of providing decoding support, like
software-based decoding (useful for testing the virtio device and the
guest support), or direct decoding using the host's native capabilities.
Introduce a DecoderBackend interface that the decoder will use to
perform the actual decoding, and start moving the libvda-related code as
an implementation of it. At the moment the interface still uses libvda
types for parameters and return values for the purpose of keeping the
change simple, but we will replace them in the subsequent changes.
BUG=b:169295147
BUG=b:161774071
TEST=Youtube video playback works on kukui-arc-r.
TEST=Youtube video playback works on hatch-arc-r.
Change-Id: I9d47cc934d34a0c706c2112831e827b6b1aa5d0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2460526
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
New Vcpu methods get the vcpu ID for a vcpu and the current thread.
A new VcpuX86_64 method injects NMIs. request_interrupt_window now
takes a bool parameter, so the request window flag can be turned off.
These methods are to support the userspace irqchip. The thread-local
vcpu ID will help route MMIO requests to the appropriate APIC. Clearing
the interrupt window request is needed because KVM won't clear the
flag if the kernel APIC is disabled.
BUG=chromium:1077058
TEST=boots with KVM kernel irqchip, KVM split irqchip
Change-Id: I2a08988e71663f0d2a63985f3239568c7a9befea
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2419673
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
Enable ascii casefold support for the 9p server when requested on the
command line. Needed by arcvm.
BUG=b:162388795
TEST=`stat foo.txt` and `stat FoO.TXt` return identical results even
though only foo.txt exists
Cq-Depend: chromium:2498170
Change-Id: Icf507ac0d8413e7794fdd643296d507781897039
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2501545
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
The p9 crate API changed so that the new() function now returns a
result. Update the caller to match.
Additionally, the implementation also changed to use different syscalls
so update the seccomp filters to match.
BUG=b:162388795
TEST=Start a vm with a 9p mount and test the changed operations to make
sure they still work.
Cq-Depend: chromium:2494169
Change-Id: I7c4e1fd2fb192206402e895b09e519c3e769ae3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2494328
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
... to allow configuring Gfxstream host renderer based
on whether or not the guest Android is using ANGLE as
its native OpenGL driver.
BUG=b:165022040
TEST=launch_cvd --gpu_mode=gfxstream
Change-Id: I566ed1e7590f7f3db99960440421fd65bba08f7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2466604
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
This CL increases the maximum resolution in the virtio video encoder
from 1920x1080 to 4096x4096. While devices are typically not able to do
realtime encoding in huge resolutions, they are usually still supported
by the HW encoder.
BUG=b:168262411
TEST=Record using Camera test app in 1600x1200 resolution on hatch
Change-Id: I62bdead25861dd3384d7c9d8ad1a8877e5af3215
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2508094
Reviewed-by: Alex Lau <alexlau@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: David Staessens <dstaessens@chromium.org>
Commit-Queue: David Staessens <dstaessens@chromium.org>
This CL justs adds two very simple tests to improve overall test coverage.
Not sure what the best practices would be for mocking out the system
time, so I have skipped that functionality for now.
BUG=b:171750410
TEST=No change in functionality, just an added test.
Change-Id: I7a4e99c9d11203c5569ff28d2a5477bf8fd1b3a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2500948
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Previously the caller of ioapic::new was responsible for calling
register_irq_event on the IOAPIC's outgoing events. The MSI IrqRoutes
for these outgoing events used the same GSIs < 24 as the incoming
PIC/IOAPIC routes.
This worked for the split irqchip, because PIC/IOAPIC events are handled
in userspace and MSI events in the kernel, so there was no confusion
about which route an event should use. But with the userspace irqchip,
the routes have to be differentiated, otherwise incoming and outgoing
IOAPIC events with the same GSI trigger each other in a loop. Also,
registering all outgoing IOAPIC events upfront increased the number of
irq event tokens by 24, even though only a few outgoing events are used.
Now the IOAPIC is responsible for registering outgoing events and it
allocates new GSIs >= 24 for its MSI routes. An event and route are
only set up when a redirection table entry is configured with non-zero
MSI data.
BUG=chromium:1077058
TES=boots with split irqchip
Change-Id: I87c1df6150d50205810759ef152e1c9b33bcfe4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2419672
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
There were some assumptions built into the hypervisor abstraction
implementations that we would only ever be registering a single Event
for any irq number, but that is no longer the case since 1d0f160. So
this change updates the hypervisor abstraction trait functions to allow
callers of irq_event_tokens to distinguish between multiple events that
refer to the same irq number using an IrqEventIndex. This index is then
used when calling service_irq_event.
Also, if register_irq_event would add a new irq event that the main
thread should wait on, register_irq_event will return the associated
IrqEventIndex. This change also updates linux.rs to use these changes.
The --split-irqchip mode may work even without this fix, depending on
which devices are sharing irqs. If the devices using shared irqs are all
virtio pci devices they may switch to MSIx mode and then not need their
original interrupt event.
BUG=chromium:1077058
TEST=disabled MSI mode on pci devices, forced additional irq sharing,
and verified that --split-irqchip mode still works + cargo test -p
devices
Change-Id: I4feb2817b6c477284ad463c0221d1f156813b6ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2405300
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
For hypervisors that do not handle ioevents in-kernel, we need to make
some minor adjustments to the hypervisor abstraction api:
- register/unregister_ioevents needs &mut self instead of &self
- move handle_io_events from Vcpu to Vm, because the ioevents are
registered on the Vm not the Vcpu.
BUG=chromium:1077058
TEST=cargo test -p hypervisor
Change-Id: Iddd61502a716143e117c454e64a9c9bd2578148d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2405299
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
The Event API has changed so that it exposes only RawDescriptor, not
RawFd, so the block fuzzer's use of as_raw_fd() no longer worked.
The actual intent of the code using as_raw_fd() was to clone the Event,
so just use the existing Event::try_clone function which achieves the
same result without using platform-specific code.
BUG=chromium:1144535
TEST=`FEATURES=test USE='asan fuzzer' emerge-amd64-generic crosvm`
Change-Id: I64689dde1b1351997aa2f11ed440416e3d226815
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2514901
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
This simplies the complexity to deal with ownership and mutability,
while considering both the virtio-fs and regular FUSE use cases.
BUG=b:168305155
TEST=./build_test
Change-Id: Ic77d8e0b922e74a5733b99eeff41946177666c8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2500944
Tested-by: Victor Hsieh <victorhsieh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>
Just another small step towards AsRawDescriptor universal
usage.
BUG=b:162363783
TEST=./build_test
Change-Id: I370f6dbeec10b9e4df75e5e4a5258c4d00a0ac9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2488724
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
Reviewed-by: Udam Saini <udam@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This involves removing RawFd trait implementations from
Event and Timer, and resolving the echoing dependencies from
there.
Ultimately, this results mostly in changes across ioctl
(new thin layer in base), kvm, msg_on_socket, and a few other
areas. As usual, most changes are negligible.
BUG=b:162363783
TEST=./build_test
Change-Id: I47dec94666bc3430fed627b4767919c9cb4fce6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2462330
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
This is a layer above PollContext with a more generic interface.
As PollContext is used so widely, this is quite a large change
in order to accomodate the interface update, especially with the
use of RawDescriptor. In some cases this has caused an echo
of updates to RawDescriptor, which is fine because of our eventual
goal to move the whole codebase to it regardless.
Note there are a few instances of forcing the RawDescriptor update
chain to stop, ex. ioctl. This is to keep the scope of this CL
concentrated and avoid changing entire other areas.
Note that this CL leaves out a few additional pieces of work:
- The sole usage of EpollContext over PollContext (event_loop),
which poses a bigger challenge for interface changes
- Full PollToken renaming, which is a tiny change turned difficult
due to the unavailability of type aliases for traits.
- Renaming certain methods which have been updated to use
RawDescriptor such as keep_fds. Some have enough dependencies that
they are worth avoiding to keep this CL pointed, but will be
addressed in future CLs to make sure the whole codebase is on the
fd->descriptor train
BUG=b:162363783
TEST=./build_test
Change-Id: Iff2cfe8f90dea55f1388f8e91bdc698e121a8e43
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2455726
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
At CL:2494322, we moved the clearing output resources logic from
handle_provide_picture_buffers() to clear_queue(). That CL only
considered the resolution change case, but didn't handle the flush
case correctly.
When the userspace flush the decoding, it streamoff the output queue.
But VDA doesn't request new set of buffers, ProvidePictureBuffers()
won't be called. In this case, crosvm shouldn't clear the output
resources. Crosvm only needs to clear the set of queued resource ids.
Also, when VDA sends ProvidePictureBuffers() the first time, V4L2
output queue at the userspace is not streaming. So the userspace won't
streamoff the output queue. In this case, we also don't need to clear
the output resources.
BUG=b:171860073
TEST=pass android.media.cts.MediaCodecTest#testDecodeAfterFlush
TEST=pass android.media.cts.AdaptivePlaybackTest
Change-Id: I2a425c1fd9e61322d92dc54930dd88242c964de3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2505284
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alex Lau <alexlau@chromium.org>
A prior CL (@81d5adbad7) removed VIRTIO_F_VERSION_1 from the features on
virtio-input, which causes boot failures on VMs that require those input
devices. This CL pipes protected-vm down to virtio-input & restores the
features.
BUG=none
TEST=builds
Change-Id: Ic54c7135c3ed4abf4c9d0a2c6969a0abaef7e7b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2503486
Auto-Submit: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Will Deacon <willdeacon@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Move MemSlotOrd out of the kvm hypervisor implementation so other
implementations can share the same struct.
BUG=chromium:1077058
TEST=cargo test -p hypervisor
Change-Id: I9d992699defab53e32517bb40e29192e31c45983
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2405301
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
This will allow allocating an MMIO region that can be in the high (>4G)
address space, but prefers to be in the low region if possible.
BUG=b:169430664
TEST=Boot Crostini with GPU
Change-Id: If90c0d90c95b0dcb3cb451eb7f573eede5ea3b2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2436370
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
This will allow IO BARs that need to be in the low (32-bit) memory
region to be allocated first, followed by device BARs, allowing device
BARs to be allocated in the low 32 bits of address space when possible.
BUG=b:169430664
TEST=Boot Crostini with GPU enabled
Change-Id: I5387b1e00ed6d5cbcff7b25e10f6115ff797c85b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2436369
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The current crate still require some work to be really reusable as a
regular FUSE, i.e. with a new reader/writer against /dev/fuse. This
change intends to focus on creating the crate, without trying to find
the optimal interface, and still keep virtio/fs working.
BUG=b:168305155
TEST=./build_test
TEST=USE='asan fuzzer' emerge-hatch crosvm
Change-Id: I8b623c9262221113b720c10125a6770763f14dc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2466484
Tested-by: Victor Hsieh <victorhsieh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>
Seemed like an easy test to add.
BUG=b:171082843
TEST=This is a test
Change-Id: I2a10c0965be2952cd3150965e4127a27a3ec6dff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2495844
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
One script to run coverage for the whole smoke test suite,
the resulting file can be uploaded to codecov.io for consumption:
https://codecov.io/gh/denniskempin/crosvm
Another script to run tests + coverage for a single crate,
which is useful during development to keep track of coverage
while adding tests (IDEs can display the generated lcov.info file)
BUG=b:171082843
TEST=Manual testing of both scripts
Change-Id: I52384762400a146cb0e7deb3d54dccf59b6134db
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2492914
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Originally, we clear all the output resources when getting
ProvidePictureBuffers command from VDA. At this point only VDA
discards the output buffers. crosvm should keep the output resources
until the output queue is cleared.
Note that at crrev.com/c/2494602, GAVDA will ignore the output buffers
after calling ProvidePictureBuffers(). So it's safe that crosvm passes
the output buffers after getting ProvidePictureBuffers command.
BUG=b:171442927
TEST=pass android.media.cts.AdaptivePlaybackTest#testVP9_adaptiveDrc
Change-Id: I54dd364e7509c18fb3a3cd193da97dd107ceec44
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2494322
Tested-by: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
When creating a serial device of type UnixSocket crosvm will race with
vmlog_forwarder to bind a socket to the address. This is expected to
fail in most cases, so don't log an error message if it does unless
the reason was unexpected.
BUG=none
TEST=Booted termina and checked for logs about failing to bind sockets
Disallow-Recycled-Builds: test-failures
Change-Id: I446dd803662de57221b501a6f87957035c4593de
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2494321
Tested-by: Fergus Dall <sidereal@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Fergus Dall <sidereal@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The qcow disk format implemented the discard and write zeroes requests
by deallocating the underlying cluster when possible, with the
assumption that a deallocated cluster would return all zeroes if it is
read until it is written again.
Add an alternate implementation of write_zeroes that is used when a
backing file is present that uses the straightforward approach of
allocating all clusters and zeroing them out in the raw file rather than
using deallocation.
BUG=b:171230599
TEST=BLKZEROOUT test case
TEST=cargo test -p disk
Change-Id: I745f6dc7aa411ec9b1be0150ba1bc96c011ada9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2490605
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Cody Schuffelen <schuffelen@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
BUG=b:140082257
TEST=emerge-$BOARD crosvm
TEST=v4l2-encoder-sample
TEST=tast run DUT arc.VideoEncodeAccel.h264_192p_i420_vm after crrev.com/c/2256525 (on hatch and eve)
Change-Id: I7f1c1bb6a8ba192ab7a598227e59fc9ec307ad8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2167311
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Alex Lau <alexlau@chromium.org>
Commit-Queue: Alex Lau <alexlau@chromium.org>
When using uring, we can just call `read_to_vec` rather than having to
call `libc::read`. Unfortunately, PollSource cannot do the same without
hitting an illegal seek (e.g. with eventfds), so we still have to keep
the read_u64 method around.
BUG=None
TEST=`cargo test` in `cros_async`.
Change-Id: I2c61468bec4a3f130c153eccf2875c047c61a2a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2482430
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
The argument passed to get() and get_mut() is already a reference, so we
don't need to add another redirection to it.
BUG=b:161774071
TEST=Youtube video playback works on kukui-arc-r.
TEST=Youtube video playback works on hatch-arc-r.
Change-Id: I0d299c284c00b68160676332dcf5387aed078b7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2484062
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>