Commit graph

10 commits

Author SHA1 Message Date
David Reveman
5f5e7ec3ba virtwl: better multi-plane DMABuf support
Multi-plane DMABufs are useful for efficient video playback. The
guest can already use this but has to guess the stride and offsets
for the second and third plane as they are not passed by virtwl
to the guest kernel.

This extracts the correct strides and offsets for each buffer and
passes them back to the guest in the allocation response message.

BUG=chromium:837209
TEST=sommelier can use nv12 buffers without guessing stride/offset

Change-Id: I36ae2fad6605293c907802121676296cbc607a57
Reviewed-on: https://chromium-review.googlesource.com/1070799
Commit-Ready: David Reveman <reveman@chromium.org>
Tested-by: David Reveman <reveman@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-05-26 10:19:50 -07:00
David Reveman
52ba4e5c64 virtwl: Add DMABuf allocation support.
This implements DMABuf allocation type in the virtio wayland
device.

We attempt to locate a supported DRM device prior to engaging
the device jail. If found, the DRM device is passed to the
wayland device code and used to serve DMABuf allocations.

DMABuf support can be disabled by not providing crosvm with
access to any DRM device nodes.

The guest is expected to handle the case when DMABuf allocation
fails and fall-back to standard shared memory.

This initial change uses DRM directly but is structured in a
way that would allow the allocator to be replaced by minigbm
with minimal effort.

BUG=chromium:837209
TEST=crosvm finds drm device and returns valid dmabufs to guest

Change-Id: Ic1fd776dfdfefae2d7b321d449273ef269e9cc62
Reviewed-on: https://chromium-review.googlesource.com/1034088
Commit-Ready: David Reveman <reveman@chromium.org>
Tested-by: David Reveman <reveman@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-05-16 08:34:40 -07:00
Dmitry Torokhov
505c6f9888 vm_control: more error signedness fixes
Fix a couple more spaces where we used negative errno values.

TEST=cargo test -p vm_control
BUG=None

Change-Id: Id622192d025d0ac733419411492ca53a50f957f3
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/942087
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-03-01 16:13:07 -08:00
Dmitry Torokhov
8283248a60 vm_control: do not use negative error coded for errno-based errors
Errors derived from sysem errors delivered via -1 return code/errno
should use positive error codes, not negative, in order for them to be
recognized by other components. I.e. we should use
errno::Error::new(EINVAL) and not -EINVAL.

TEST=cargo test --features plugin; cargo test -p kvm
BUG=None

Change-Id: I10d5992cb1e1750aa9b8a7269c4f574d7c753683
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/939866
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-02-27 20:17:07 -08:00
Zach Reizner
e0e8e56732 kvm: support adding read only memory to VMs
Read only memory is useful for triggering VM exits when the VM writes to
memory while allowing reads transparently and quickly. For example, a
virtual device implementation might not care if the VM reads a memory
mapped device register, but a exit would be required if the VM wrote to
the same register.

TEST=cargo test -p kvm; ./build_test
BUG=chromium:800626

Change-Id: Ic605b2cfc2a1e44941d91945f9390b9abb820040
Reviewed-on: https://chromium-review.googlesource.com/903075
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-02-06 21:32:39 -08:00
Sonny Rao
29cd40a1d6 crosvm: change GuestAddress to always be a u64
We want to be able to run 64-bit ARM kernels using a 32-bit version of
crosvm, to make it more consistent use a u64 to represent
GuestAddress.

BUG=chromium:797868
TEST=./build_test passes on all architectures
TEST=crosvm runs on caroline

Change-Id: I43bf993592caf46891e3e5e05258ab70b6bf3045
Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/896398
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-02-01 18:08:55 -08:00
Zach Reizner
855ac29cf2 kvm: add dirty log support
This add safe support for KVM's KVM_GET_DIRTY_LOG ioctl.

TEST=./build_test
BUG=None

Change-Id: I3d0f996927844a33addd072f2bfc62361f8b7fe0
Reviewed-on: https://chromium-review.googlesource.com/848019
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-01-03 16:54:34 -08:00
Dylan Reid
d44320488f main: Add inflate/deflate interface for balloon
Change-Id: I0fc63abbed8db303c7d283ce392fd47777b60d19
Reviewed-on: https://chromium-review.googlesource.com/818207
Commit-Ready: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-01-02 23:36:26 -08:00
Dylan Reid
f31455e966 sys_util/vm_control: Don't test shm if memfd_create doesn't exist
On older kernels, the memfd_create syscall isn't available. Skip shm
tests if that is the case.

Change-Id: I39c1f1779f1f02e90df727c6ca18b5bdae52e855
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/768102
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2017-11-16 21:07:43 -08:00
Dylan Reid
94bf1bf6b4 Move vm_control to a top-level crate
Break out vm_control to a crate that will be able to used by more
modules. Having vm_control usable from outside crosvm makes it possible
to move the devices out of crosvm in a later commit.

Change-Id: I1f060700ed49b5d77519d55efa2430490d521256
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/706558
Reviewed-by: Zach Reizner <zachr@chromium.org>
2017-10-09 17:39:04 -07:00