clippy 1.48.0 has a bug in string parsing in doc comments.
https://github.com/rust-lang/rust-clippy/issues/6022
To avoid this issue, update to use double-quotation instead of single-quotation
inside a code block in a doc comment.
Also, this fixes wrong examples of commands there at the same time.
BUG=none
TEST=bin/clippy
Change-Id: I90e5699f6d4e839304f9d4e05e5c7b21467744cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2592001
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This CL adds support for VIRTIO_VIDEO_CONTROL_FORCE_KEYFRAME to the
crosvm encoder.
BUG=b:161498590,b:174444769
TEST=tast run DUT arc.VideoEncodeAccel.h264_192p_i420_vm
Change-Id: Ibe0c7d2aa7b41c6a0168a7aa312d6996cc22ef23
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2567308
Tested-by: David Staessens <dstaessens@chromium.org>
Commit-Queue: David Staessens <dstaessens@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This test was useful for debugging issues with the hypervisor
abstraction layer while it was in development. It's similar to some of
the kvm integration tests, but runs the x86_64 setup functions. It has
some commented out lines for having this test load a real kernel and/or
ramdisk, which can also be useful for debugging boot problems.
RESTRICT_AUTOMERGE
BUG=b:175025264
TEST=cargo test -p x86_64
Change-Id: If5b89fe48d34db50fb962382032881e4e588db6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2579896
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This error was observed:
wl_surface@5: error 3: buffer committed to unconfigured xdg_surface
Shout out to bugaevc for the diagnosis and fix:
"In addition to setting up the listeners, we have also made two
important changes. First, we call wl_surface.commit right away,
prior to attaching any buffer to it. This causes the compositor to
issue the appropriate configure events. We wait for them to be
received and handled with an additional wl_display_roundtrip() before
we attach the buffer."
https://bugaevc.gitbooks.io/writing-wayland-clients/content/beyond-the-black-square/xdg-shell.html
BUG=b:150239451
TEST=boot VM with wayland display, still doesn't work completely
correctly due to lack of {import, attach, detach}_event_device
implementations
Change-Id: I06fac4f8540ce410c20a367d1e5dbe3fc08c4f10
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2583164
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Currently only H.264 level 1 is reported to the virto encoder when the
supported H.264 levels are queried. This CL expands the list to contain
all levels up to 5.1 which are supported by most devices, as the VEA
interface currently has no way to query the maximum supported H.264
level.
BUG=b:174967472
TEST=android.media.cts.MediaRecorderTest#testProfileAvcBaselineLevel1
Change-Id: I960f9176fa00180da6f71bcdad558da06e8247c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2574583
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: David Staessens <dstaessens@chromium.org>
Commit-Queue: David Staessens <dstaessens@chromium.org>
Currently only the framerate requested on the CAPTURE queue is used to
configure the Chrome encoder's framerate. But according to the V4L2
standard setting the framerate on the OUTPUT queue should also set the
framerate on the CAPTURE queue to the same value.
BUG=b:173668157
TEST=android.media.cts.MediaRecorderTest#testProfileAvcBaselineLevel1
Change-Id: I0753d10d73d52ce4f17fd9bc230d4fa2f06a1b30
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2570833
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: David Staessens <dstaessens@chromium.org>
Commit-Queue: David Staessens <dstaessens@chromium.org>
New syscalls and /run/perfetto bind mount are required.
BUG=b:174162684
TEST=Run crosvm with perfetto instrumentation and confirm that
events can be traced through traced. Tested on both hatch
and ARM kukui device.
Cq-Depend: chromium:2570487
Change-Id: I809400ec393c2971ba9a1134ddbef7f48d818786
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2571659
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: John Bates <jbates@chromium.org>
Commit-Queue: John Bates <jbates@chromium.org>
As part of moving from RawFd to RawDescriptor and related types
(https://crrev.com/c/2462330), the USB attach code was modified to
accept a MaybeOwnedDescriptor instead of a MaybeOwnedFd. Since
MaybeOwnedDescriptor::Owned contains a SafeDescriptor instead of a File,
and the usb_util Device::new() constructor requires a File, a conversion
is required. However, the patch mentioned above used as_raw_descriptor
and File::from_raw_descriptor to do this conversion, but this leaves
both the SafeDescriptor and the newly-created File assuming ownership of
the USB fd. When the SafeDescriptor went out of scope, the fd would be
closed, causing the fd in the File to be invalid (meaning the USB device
does not function at all).
This would show up in the crosvm logs like this:
[devices/src/usb/host_backend/utils.rs:61] fail to submit transfer IoctlFailed(2151175434, Error(25))
[devices/src/usb/xhci/xhci_transfer.rs:399] backend is already disconnected
To fix this, use into_raw_descriptor rather than as_raw_descriptor to
transfer ownership out of the SafeDescriptor without closing the fd.
BUG=b:174289633
BUG=chromium:1151144
TEST=Attach USB serial device to Crostini and verify /dev/ttyUSB0 exists
Change-Id: Ia1c5f94f69ca31ab211ab9f63f23141b4e774ef4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2579884
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Michael Hoyle <mikehoyle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This is a chromeos extension to fuse to support the O_TMPFILE flag.
BUG=b:160932094
TEST=Open a file with O_TMPFILE on a virtio-fs mount
Change-Id: I21a6390e919d5949fbd12bb304b20374b9b9172a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2520561
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
IoSliceMut doesn't currently provide a way to access the fields of the
internal iovec. Additionally, the as_iobuf() method returns a copy of
the iovec rather than a reference, which can cause hard to diagnose
issues.
Replace the as_iobuf() method with implementations of the AsRef and
AsMut traits. This should also make it easier to hide these impls behind
a `#[cfg(unix)]` in the future.
BUG=none
TEST=unit tests
Change-Id: I58f8c5f579f3d03ec6e612a32343e8423eced8ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2571147
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Pointers in rust don't implement Send or Sync and so any struct that
contains a raw pointer doesn't implement those traits either. However,
there's nothing inherently unsafe about sending a pointer across thread
boundaries. The only unsafety comes from actually de-referencing the
pointer, which already requires an unsafe block.
Explicitly implement Send + Sync for IoSliceMut since the iovec
internally holds a *mut c_void, which prevents those traits from being
auto-implemented. Send + Sync is also implemented by
std::io::IoSliceMut, which is almost exactly the same as our IoSliceMut,
so that can provide some additional reassurance that this is safe.
Also add a missing copyright header in the file.
BUG=none
TEST=unit tests
Change-Id: Ic21fc0de9b29923420f36ab166fec80d4d4cf2e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2571146
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
When no_smt isn't set, guest works with hyperthread enabled, but crosvm
doesn't emulate processor topology cpuid at this case, so the output of
guest /proc/cpuinfo and lscpu is inconsitent, and guest cpuid is wrong.
This commit adds such support. If vcpu_num is >1 and is even, threads
per core is 2 and cores_num is vcpu_num/2. If vcpu_num is >1 and is odd,
threads per core is vcpu_num and cores_num is 1.
BUG=None
TEST=Check guest /proc/cpuinfo, lscpu, cpuid at different vcpu number
Change-Id: I8d9aaeac3fc911ee91bf2eb0586e457aac27a185
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2548450
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
rutabaga_gfx is a cross platform, Rust-based, Wayland and
Vulkan-centric Virtual Graphics Interface (VGI).
Apologies for the mega-change, but it was hard to do this piece
by piece.
The rationale for this change is:
1) Android graphics virtualization experts have been proposing
for a VGI for many months (years?). Their goal is to boot
Android anywhere, everywhere.
2) For the {wayland, cross-domain} context type prototype,
it's desirable to create a {wayland, camera} connection at the
appropriate time. Details can be found in the code, though the
RutabagaChannels have yet to be hooked up.
There's a high chance neither effort will work. As such,
rutabaga is just a prototype.
However, even (1) and (2) don't end up working, this
refactor/cleanup by itself makes a ton of sense.
Here's a summary of revelant changes:
* Removed auto-generated {p_defines, p_format, virgl_protocol}.
These files were added for tests when bringing up crosvm-gpu,
and AFAICT these tests are not run. There's actually now a
commit queue for virglrenderer changes and container boot tests
that provides excellent coverage.
* Removed command_buffer.rs. Used only for the previously
mentioned tests. It's quite nice, but couldn't determine the right
place to put it. Maybe data_model? But removed it in the interim.
* Removed {write_from_guest_memory, read_to_volatile}. The same
basic functionality has been moved into {transfer_write,
transfer_read} in Rutabaga.
* Removed VirtioResource, Virtio3DResource, Virtio2DResource,
and VirtioGfxStreamResource in favor of VirtioGpuResource and
RutabagaResource. This leads to less duplication and clearer
separation between external library functions and VMM functions.
* Moved display and hypervisor memory management functions to
virtio_gpu.rs. This is because external components do not interface
with this functionality, and there was a lot of duplication (for example
map/unmap blob).
* Added context management between gfxstream and virglrenderer.
* Added separate gfxstream and virglrenderer flags.
* Clearer naming.
* Added simple implementations for context init and multiple timelines.
These changes have no effect since all Google kernels don't pass the
revelant flags, but are useful for theoretical {wayland, cross-domain}
prototype.
* Unify RESOURCE_CREATE_3D and RESOURCE_CREATE_2D handling.
* Better error handling.
BUG=b:146066070, b:173630595, b:150239451
TEST=launch virtual machine with 2D mode
TEST=launch virtual machine with 3D mode
TEST=boot ARCVM
Change-Id: I240b0c134a3b562cbc65981837a41f6db7767c92
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2522452
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
This CL
- simplifies ac97_bus_master audio thread spawn logic
- makes data ownership more clear for future maintenance
- saves several redundant lock calls
High level design:
ac97_bus_master <=> one AudioThreadInfo for each Ac97Function
<=> start / stop an AudioWorker
Changes in this CL:
- Add AudioWorker which contains the data, logic inside spawn::thread()
and some controls which own by AudioThreadInfo
- Remove `fn audio_thread`.
- Make AudioThreadInfo an audio thread control interface for each
Ac97Function
- `start` consumes an worker and spawn a running thread
- `stop` stops the thread and destroy the worker
- Add is_running support
- Combine several regs.lock() calls to save mutex lock time.
- Add create_audio_worker to create AudioWorker
BUG=b:173364323
TEST=Build and test audio in VMs
Change-Id: Iac8090fac12ac91f50b3e601efb918d79ba089af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2550480
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Fletcher Woodruff <fletcherw@chromium.org>
Needed by arcvm. Also fix some style issues with the previous ioctl
definitions.
BUG=b:136127632
TEST=Call this ioctl from inside a VM and see that it is passed through
to the host.
Change-Id: Icdeff9e2c5b15237ed49e6814b8147258a50ccab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2560286
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
These don't work without a kernel change that we never merged. Arcvm
doesn't need these anymore so just drop them.
BUG=b:136127632
TEST=vm.Virtiofs
Change-Id: I427dee41720b0db1d14f4d03c95ff678ec3fd347
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2573709
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
These are causing the clippy pre-upload hook to fail for me.
BUG=none
TEST=bin/clippy
Change-Id: Ifa5b6b008ca1e930ba203034234ce3da56830b11
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2574584
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Fixes crosvm's failure to forward the "use_external_blob"
state flag to the host renderer (virglrenderer).
BUG=b:174794821
TEST=Start a crostini VM and run `DISPLAY=:0 glxgears`, verify graphical
output.
Change-Id: I1ef616079664224e7741cea00b9125c5061ea69d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2574669
Tested-by: Ryan Neph <ryanneph@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
The V4L2 standard allows specifying a stride by using the
v4l2_pix_format.bytesperline field when configuring the input format.
This CL makes changes to properly use the stride requested by the
virtio encode device.
BUG=b:173083834,b:173666696
TEST=android.video.cts.VideoEncoderDecoderTest.testAvcOther0Perf0720x0480
Change-Id: Id7d8bb11ef02ee79c70225202471b9a6d21963c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2567309
Tested-by: David Staessens <dstaessens@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Staessens <dstaessens@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This CL makes changes so the VIRTIO_VIDEO_BUFFER_FLAG_IFRAME flag is
set and propagated back to the virtio encoder whenever the Chrome
encoder creates a keyframe.
BUG=b:173077927
TEST=tast run DUT arc.PowerCameraRecordingPerf.vm
Change-Id: I4029f3d7b745937e7960abba896c458182cf942e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2567307
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: David Staessens <dstaessens@chromium.org>
Commit-Queue: David Staessens <dstaessens@chromium.org>
When a FDT's property contains multiple values, the property must be a byte
array which uses the null character ('\0') as the delimiter, but we didn't
so.
This CL fixes the format so the guest kernel can parse PSCI versions
properly.
BUG=b:174224484
TEST=arc.Reboot.vm on kukui-arc-r
Change-Id: I61a983251cdbe8c021f5999cbf5efd026bbc0c27
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2567837
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Marc Zyngier <mzyngier@google.com>
Reviewed-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This CL makes changes to use the output buffer size requested by the
encoder client. Typically this output buffer size will be overwritten
with what the underlying encoder requests in RequireInputBuffers, but
for correctness we initially store the requested buffer size. Changes
are also made to not set a resolution on the output parameters, as this
should be ignored according to the V4L2 standard.
BUG=b:162804477
TEST=tast run DUT arc.VideoEncodeAccel.h264_1080p_i420_vm
Change-Id: Id0c530271930eebd90e4f7ba00a186ea567ac10c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2519346
Tested-by: David Staessens <dstaessens@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Staessens <dstaessens@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This change adds support for exporting virtio_gpu fences into
virtio_wl.
Without support for sending fences over virtio_wl, ARCVM must wait in
the guest for fences to be signaled before sending the corresponding
buffers to the host compositor. Under normal composition, it is
relatively rare for fences to be unsignaled when they need to be sent
over virtio_wl, although it does still happen at the far tail end. If
ARCVM falls back to client composition, without this change ARCVM needs
to wait on average 5-15ms (depending on how heavyweight the app's
rendering is) for fences to be signaled.
Support for sending fences over virtio_wl allows this extra latency to
be hidden.
BUG=b:136129939
TEST=Run YouTube+Play Store+graphics benchmarks simultaneously
in ARCVM, with and without client composition.
Change-Id: Ic7f57069c4171104c497aee6721c5c93dc6bafa4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2363512
Tested-by: David Stevens <stevensd@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This CL wires up the powerd D-Bus PowerMonitor implementation to GoldfishBattery.
BUG=b:137890633
TEST=observe updated power data in ARCVM's /sys/class/power_supply after crrev.com/c/2550102
Change-Id: I38c613f13d3f7601435532213c7733558cb5f83f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2560276
Commit-Queue: Alex Lau <alexlau@chromium.org>
Tested-by: Alex Lau <alexlau@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Fixes compilation errors after crrev.com/c/2537349.
BUG=b:137890633
TEST=docker/build_crosvm_base.sh
Cq-Depend: chromium:2537349
Change-Id: Ia7bbf5d3475773c54cf711ed6035d259aed73f14
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2567834
Commit-Queue: Alex Lau <alexlau@chromium.org>
Tested-by: Alex Lau <alexlau@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
PowerMonitor trait objects can be used as a source of power supply data
and will be used by the goldfish battery. This CL includes a powerd backed
implementation of PowerMonitor available behind a feature flag which
receives updated data over D-Bus.
BUG=b:137890633
TEST=observe updated power data in ARCVM's /sys/class/power_supply at the end of this chain
Cq-Depend: chromium:2550102
Change-Id: Iacdc9bc7d11454d5b4f5d2639d19281174ad7e20
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2537349
Commit-Queue: Alex Lau <alexlau@chromium.org>
Tested-by: Alex Lau <alexlau@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This CL simplifies crosvm user interface since these kernel parameters
will always be used by ac97 devices.
BUG=b:172851292
TEST=Build and test VMs
Cq-Depend: chromium:2562988
Change-Id: I8461b9fa092c955b07cd88fbce582172a27fbb48
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2562808
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
Allow the user to specify a serial number for each virtio block device
using the new id= parameter:
crosvm run --disk disk.img,id=SERIALNO ...
These serial numbers show up in sysfs for each block device, which
allows them to be uniquely identified regardless of the number or order
of block devices added on the crosvm command line. This can be used to
find a specific device by serial number for mounting at boot time.
BUG=b:157687637
BUG=chromium:775781
TEST=crosvm run -r vm_rootfs.img,id=root -p init=/bin/bash vm_kernel
TEST=cat /sys/block/vda/serial # see serial is set to "root"
TEST=cargo test -p devices
Change-Id: I108cdc47c367fb038d6acd55da60f9e1aae59e68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2225559
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Add an asynchronous timer that is similar to EventAsync. This will allow
the timer to be used from async contexts such as the new block device.
Change-Id: I858f44e2165459c388a83735aba3ed23755a534b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2545128
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Inside new chroots, the Rust toolchain is new enough to write the v2
version of the lock file format by default when a new dependency is
added. This leads to large unintended diffs if a new package is added
and the newer toolchain is used to build. To avoid these hassles,
this CL updates CrosVM's lock file to use the new format.
BUG=None
TEST=builds
Change-Id: I2402748ee4ef86489391690ceb12b97f81004be8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2566773
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The mount API is useful especially in an environment without typical
fusermount setuid program (e.g. Android).
BUG=b:173507504
TEST=create a FUSE fs, run with cap_sys_admin, can read from the mount
point
TEST=build_test.py
Change-Id: Ibfc220e8cf59b54d55f5d030d2e4c4375d3654cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2556079
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>
Tested-by: Victor Hsieh <victorhsieh@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
When converting from VecDeque to Slab, the remove function return
changed from returning None when missing a token a panic.
Instead, of relying on that explicitly store an option to the waker so
there can be no mistake, log an error if there is ever an unexpected
token or if a waker fires twice.
Change-Id: Icfbb3124ca4ad3cd721a3722a299f28358e8547b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2545127
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Make the unit test explicitly run the poll or uring back end.
This will fix running the test if the host doesn't support uring.
Change-Id: I3b5e585c0b5ee442ef41c77c21ae6742c18a3ff4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2545126
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
A prior CL (@81d5adbad7) removed VIRTIO_F_VERSION_1 from the features on
virtio-rng, which causes Linux to skip and not utilize the RNG device.
This CL pipes protected-vm down to virtio-rng & restores the feature.
BUG=none
TEST=cuttlefish launch_cvd
Change-Id: I32d064ec1ac31e0fa622f14ea0f48988d8d6fa49
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2556080
Tested-by: Alistair Delva <adelva@google.com>
Auto-Submit: Alistair Delva <adelva@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
See crbug.com/1151517 for details on the failure.
See b/173833661 for a longer term fix.
BUG=b:173833661
TEST=None
Change-Id: I82499b72e39ab524584807dcc35c3d0be7ab1bff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2553215
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Derek Basehore <dbasehore@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Allow devices to be added to a Bus without a mutex. If a device
implements BusDeviceSync and is inserted into the Bus via the new
insert_sync function, the Bus will not lock the device before write and
read operations. This feature will allow IrqChip implementations to use
the mmio bus for APIC mmio, and allow each vcpu to write to their
respective APICs simultaneously.
This also changes the BusDevice trait so read and write functions take a
new BusAccessInfo struct. The BusAccessInfo conveys the full address of
the read/write operation, the offset of the address relative to the
device start address, and an id that in practice will hold the vcpu id
for the vcpu thread perforing the read/write.
As a result, inserts into the Bus are no longer distinguished between
full_addr and non full_addr inserts. Instead, each device's BusDevice
implementation must decide whether they use the absolute read/write
address or the relative read/write offset.
BUG=chromium:1077058
TEST=ran build_test
TEST=ran simple debian image
Change-Id: I9125aaa69869c1004b6c6a099b50f5c58038d4ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2514662
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
Add methods to the IrqChip trait to block in userspace on halted vcpus.
Add IrqChip::check_capability, used for cpuid setup.
Move interrupt injection logic from linux.rs to a new
IrqChip::inject_interrupts method, which replaces interrupt_requested
and get_external_interrupt.
These changes are to support setup, run loop, and injection in the
userspace irqchip.
BUG=chromium:1077058
TEST=boots with KVM kernel irqchip, KVM split irqchip
Change-Id: I8f46b5edf36acc485b5f76e7aed3e71c3b984c0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2419674
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This test exercises the jailing and communication with the forked
process.
The test must be run single-threaded for the
fork to be successful.
BUG=b:171750410
TEST=This is the test
Change-Id: I879dfa46a2d39ee8115ca6b81faf63c930aab3cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2503480
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
The write call would write in big endian, but the device should
be using native endian.
BUG=b:171750410
TEST=This bug was caught by the accompanying unit test.
Change-Id: I65aa4c89857766e5ef3280bde90e6ba3a33d1ebd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2515059
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Drain is cancelled by clearing either of the stream's queues. To work
around a limitation in the VDA api, the output queue is cleared
synchronously without going through VDA. Because of this, a drain
cancellation response from VDA might fail to find the drain's
AsyncCmdTag.
BUG=b:170184723
TEST=android.mediastress.cts.MediaRecorderStressTest#testStressRecordVideoAndPlayback
Change-Id: I1d54c9c4acfa7578addb947e1196313010a8431d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2535964
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Call KVM_REG_ARM_PSCI_VERSION to see the PSCI version and use the value
when creating a device-tree node.
Also stop setting PSCI constants which are ignored by kernel.
BUG=chromium:1141902
TEST=run crosvm on krane and check /proc/device-tree/psci/compatible
Change-Id: I4b8ed7620d7f0e2205b84b5f08cfaa5ae8d94339
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2529289
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>