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>
Regenerate bindings.rs for kvm and add comments about how to generate it.
As a result, manually-added hack related to zero-sized arrays' alignment
was removed, as the bug had been fixed:
https://github.com/rust-lang/rust-bindgen/issues/684
BUG=none
TEST=build_test
Change-Id: I257975ce3cd4667b39381ddafd8b08d9e91de655
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2532546
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>
Let main thread do the io_notify when the current run_mode is Running.
The previous implementation is to check if the last run_mode is suspending or
not. As here the checking object is the current run_mode, so should use
Running instead of Suspending.
BUG=chromium:1149266
TEST=boot a VM and do a suspend/resume test through both ways of the socket
and "#echo standby > /sys/power/state". VM can be suspended and resumed
back.
Change-Id: Iae187a18c707e5da0cfd1e241130a0981fb902ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2534253
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Mark the FlexibleArray doc comment code block as ignored so it does not
fail when tested with `cargo test -p data_model` (this is not a full
example, since it is missing the __IncompleteArrayField struct that is
typically provided by bindgen). Also fix a missing comma to at least
make the syntax valid.
BUG=None
TEST=cargo test -p data_model
Change-Id: Ic07daae1599df8afb272cda4f12b5f47b443f2c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2535351
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The S5 capability allows the VM to be powered off when user execute
'poweroff' command. This is done by trigger the exit event through
the ACPI PM1 control so that crosvm can shutdown the VM in the end.
BUG=None
TEST=boot a VM and then run 'poweroff' command from VM's shell. The
VM can exit.
Change-Id: Iaad5615fd72550568362090c3b876202055cc25a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2534098
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Wrap the code to access various parts of the virtio queue in-memory data
structures into helper functions to clarify the logic of the top-level
Queue functions. Previously, the memory address calculations and guest
memory read/write invocations were mixed together with queue "business
logic" in a way that made it hard to follow and led to duplicated code.
BUG=None
TEST=Boot crostini on eve
TEST=cargo test -p devices
Change-Id: I6e79b9909bde377cd078c75925c62de0234bb21b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2527815
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
It was broken by the RawFd removal from GuestMemory.
Change-Id: Ifa927fb7f6a84db55ca27e0f8ffa42475a3f8c58
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2533723
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Michael Hoyle <mikehoyle@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
This CL transitions most structs to RawDescriptor and the
associated traits if possible.
BUG=b:162363783
TEST=./build_test
Change-Id: Iabae6ac212787836d77de2b9ffb5d451421ab0dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2530911
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Michael Hoyle <mikehoyle@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
Add a new command "battery" which is used to modify the virtual
battery/ac status.
When there is goldfish battery device model created, the command
is able to sent to the goldfish battery monitoring thread. If no,
the command won't be sent.
The supported commands are:
1. crosvm battery goldfish status <status string> crosvm.sock
2. crosvm battery goldfish health <health string> crosvm.sock
3. crosvm battery goldfish present <number> crosvm.sock
4. crosvm battery goldfish capacity <number> crosvm.sock
5. crosvm battery goldfish aconline <number> crosvm.sock
"goldfish" is the battery identifier to specify which virtual battery
is going to be modified by this command in case there are multiple
virtual batteries in the guest in future. Right now only one goldfish
battery is supported.
BUG=chromium:1050432
BUG=b:137890633
TEST=create VM with parameter "--battery" or "--battery=type=goldfish"
and boot linux guest with goldfish_battery driver enabled. From host
side, execute command "#crosvm battery goldfish status discharging
crosvm.sock" can make the guest receive an interrupt, and the status
sysfs is changed to "Discharging". Also tested the other commands
as well.
TEST=modified values are visible in ARCVM and interrupts are triggered
Change-Id: I82177811a6f2b1960f7895522760ff3b8143163f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2119574
Tested-by: Alex Lau <alexlau@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alex Lau <alexlau@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
By opening the directory containing a socket we can use
/proc/self/fd/%d/ to get a shorter path to that socket that can fit in
the 108 character limit when the original did not.
This allows us to increase the maximum size of VM names from 21 to 63
characters.
BUG=chromium:1144639
TEST=vmc start {61 character name} - rejected
TEST=vmc start {60 character name} - works
Cq-Depend: 2517276
Disallow-Recycled-Builds: test-failures
Change-Id: Id5aba6372e3ef7840406ddf6e7553a459824c9fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2519335
Tested-by: Fergus Dall <sidereal@google.com>
Commit-Queue: Fergus Dall <sidereal@google.com>
Reviewed-by: Nicholas Verne <nverne@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Currently both vmlog_forwarder and crosvm will try to bind the logging
socket with the idea that one will succeed and the other will get an
error and know to connect instead. This fails because once a socket
has been bound to a file path it will continue to hold that path (and
block further binds to it) even after the process that did the bind
exits.
This means that a failed bind can mean *both* that the other party has
already bound the socket and you should connect to it, *and* that
there's an old socket holding the address which needs to be deleted.
If both sides try to connect, then an old socket will block the
connection forever. If both sides try to delete and recreate, then
neither will ever connect. What we actually do is have one side try to
delete and recreate while the other falls back to connecting. This
works when the re-creator acts first, but if the connector acts first
they will bind a socket, and then have it removed from the file-system,
and again neither side ever connects.
The only correct option is for one side to bind (deleting old sockets
if needed) and the other only ever calls connect, never binding.
Since crosvm is sending and vmlog_forwarder is receiving, and
vmlog_forwarder is already acting correctly for the bind side of this
protocol, it makes sense for crosvm to do the connecting. Therefore,
this CL makes crosvm block in create_serial_device until it succeeds in
connecting to the logging socket.
BUG=chromium:1040272
TEST=manually tested
Disallow-Recycled-Builds: test-failures
Change-Id: I45fdbb325a06fc04e2e93fb5f5d47b5b82cb8592
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2497351
Tested-by: Fergus Dall <sidereal@google.com>
Commit-Queue: Fergus Dall <sidereal@google.com>
Reviewed-by: Nicholas Verne <nverne@chromium.org>
The goldfish battery irq will be used to notify the guest driver that
battery/ac status changed. And the status changing will be done through
external crosvm commands. So the irq injection needs to be done in a
seperate thread which can receive these commands.
BUG=chromium:1050432
BUG=b:137890633
TEST=create VM with parameter "--battery" or "--battery=type=goldfish"
and boot linux guest with goldfish_battery driver enabled. The sysfs
created by the goldfish_battery driver have no issue observed.
TEST=goldfish_battery driver is loaded on ARCVM and interrupts are enabled
Change-Id: Icc902dd8c00bdcf6cb271b20d928a4081533dde6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2119573
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>
Add a flag '--gdb <port>' to provide GDB remote protocol interface so
a developer can attach GDB to the guest kernel.
In this CL, we support read/write operations for registers and memories.
BUG=chromium:1141812
TEST=Attach gdb and see register values on workstation and intel DUT
Change-Id: Ia07763870d94e87867f6df43f039196aa703ee59
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2440221
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>