Commit graph

2403 commits

Author SHA1 Message Date
Dylan Reid
0adfa99fd4 README: Remove IRC channel
The crosvm IRC channel never took off. With recent events many Chromium
team members can't conveniently access it anymore anyways.

Change-Id: I848f90885e08613640ae84ee7f4cd95cec6b1875
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2959463
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
2021-06-16 18:38:04 +00:00
Jason Macnak
6f392c575f gpu_display: Fix variable type
... to fix Android build.

BUG=b:173523402
TEST=build

Change-Id: Ifee00141eb804f31361aa1d7bdec2ff9e391f52d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2964312
Auto-Submit: Jason Macnak <natsu@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-06-15 22:44:54 +00:00
Hikaru Nishida
a0e381b0d8 Change balloon_stats output format to JSON
This CL changes the output format of `crosvm balloon_stats` command to
JSON to ease parsing the result.

BUG=b:181267848
TEST=built and checked the output of crosvm balloon_stats

Change-Id: I4af40237109efdd02b5b70375ef8aa706cf5de55
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2914247
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Hikaru Nishida <hikalium@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Charles William Dick <cwd@google.com>
2021-06-15 17:29:30 +00:00
Hikaru Nishida
6b51c75a35 crosvm: Report correct exit code on error in balloon_stats command
This CL changes the return value of balloon_stats to reflect error
response correctly to an exit code.

BUG=None
TEST=Observed exit code is 1 on error when running crosvm balloon_stats

Change-Id: Ic319b1948ebe5edb409a5ec8afd838034e7f0931
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2909699
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Hikaru Nishida <hikalium@chromium.org>
Reviewed-by: Charles William Dick <cwd@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-06-15 17:29:29 +00:00
Hikaru Nishida
af3f3bbecd linux: Set recv timeout for balloon_host_tube to avoid deadlock
Before this change, crosvm process will be stall when `crosvm
balloon_stats` command is called before the first message is received
because the logic waits reply from balloon device forever and it blocks
the VM going forward.
This CL sets recv timeout on balloon_host_tube to unblock the execution
in such case.

BUG=None
TEST=Sent `crosvm ballon_stats <socket>` command right after crosvm
started and observed Resource temporarily unavailable error instead of
stall.

Change-Id: I9e7716fdbd3493846993d0a3f727eed2043df4c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2909697
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Hikaru Nishida <hikalium@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Charles William Dick <cwd@google.com>
2021-06-15 17:29:28 +00:00
Woody Chow
e6bf005d26 cros_async: Add TimerAsync::sleep
to reduce boilerplate code.

BUG=None
TEST=cargo test

Change-Id: Ia1485b63453145e0b0dfaa6730caee34b52bc0b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2960408
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Woody Chow <woodychow@google.com>
2021-06-15 08:38:52 +00:00
Robert Tarasov
bb95fc4512 gpu_display/wayland: Added keyboard and pointing devices
Added preliminary version of keyboard and pointing device routine
for wayland implementation. The pointing input is wired as a multi
touch device. Due to the fact that wayland client is callback based,
all the necessary incoming events are serialized and stashed in the
temp circular buffer and then processed afterwards from the main event
loop.

Known issues:

1. Mouse input can't be properly wired inside the guest as a mouse
   device without pointer locking, but this is not what we want. The
   approach emulates it as a multitouch device, but, of course, it
   implies limitations in functionality.  Limitations include cursor
   in the VM that doesn't move in unison with the host cursor.

2. I kept the mouse cursor surface since it's not decided yet which
   approach for handling pointing input device will be used (see #1).

   Removing the mouse surface in the guest would remove the lagging
   guest cursor.  The alternatives to the multi-touch device are:

   "- Relative mice (e.g. a typical PC mouse). These are relative
      devices, meaning they send deltas from the current cursor
      position.  Some apps like games rely on these events.

    - Touchscreens (multitouch, single touch). These are absolute
      devices, and are much easier to implement seamless guest/host
      input for.

    - Touchpads (these are absolute devices). I'm not sure these are
      really compelling for any use case." -nkgold@

3. This code is for POC purpose only, so there are still lot of minor
   issues and negligence in it.

Looking forward for your comments and proposals.

BUG=b:177939148
TEST=crosvm $ARGS \
      --display-window-keyboard \
      --display-window-mouse \
      --gpu=3d,glx=false,egl=true \
      --wayland-sock=/run/user/1000/wayland-0 \
      $OTHER_ARGS

Change-Id: If4a9b73b8da4e0cc52fa619bbd6e5588ccdb7874
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2688439
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2021-06-15 03:14:07 +00:00
Keiichi Watanabe
8509e2229c vhost_user_devices: Remove O_NONBLOCK from given kick FD
Remove O_NONBLOCK from kick FD as uring_executor assumes so. Otherwise,
we may get EAGAIN when we read a value.

This patch is needed to use QEMU as a vmm.

BUG=b:190450677
TEST=run QEMU and vhost-user-net-devices with uring_executor

Change-Id: I8dc533c824909eb0298e4264f45d7a62998ebc6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2950028
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-06-14 21:50:04 +00:00
Keiichi Watanabe
53103e9df4 vhost_user_devices: Allow replacing call event after queue is started
Although the current crosvm won't change call fd once it's set, the
vhost-user allows it and QEMU does so.
So, we wrap CallEvent with `Arc<Mutex<...>>` so that we can replace the
fd later.

BUG=b:190450677
TEST=run with QEMU using vhost-user net device

Change-Id: I16cbcd843e370aeaf6b28c8a520b3bfa4a35286b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2950027
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-06-14 21:50:02 +00:00
Suleiman Souhlal
dc2cac8b3f wl: Increase size of queues.
The current queue size is too small for passing messages
made of multiple pages.

BUG=b:190126742
TEST=tast arc.PlayStore.vm passed.

Change-Id: I97d08ce1dd4c2e3ffeca72bc558dce80ae42f8a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2948485
Auto-Submit: Suleiman Souhlal <suleiman@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Suleiman Souhlal <suleiman@chromium.org>
2021-06-14 05:25:23 +00:00
Dylan Reid
5e80699a20 devices: block - move avail_features to common
The features bit manipulation was already duplicated and will be needed
again in the vhost_user implementation.

Change-Id: I8a75341053feac8c222c2d959370aa9f32a82258
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2948101
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
2021-06-10 05:03:37 +00:00
Dylan Reid
02259f78bb disk: qcow - remove extra semicolon
Newer compilers issue a warning when running tests.

Change-Id: I7c2396ba65771ef51443b3ebb644e2cbe7d1f565
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2947800
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
2021-06-10 05:03:36 +00:00
Dylan Reid
2eaabfd2c1 disk: Switch to ThisError
`ThisError` is now used as the standard across crosvm

Change-Id: I5e888c3af0bf98d6d00487ce48c92c929571bd6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2947799
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
2021-06-10 05:03:35 +00:00
Dylan Reid
6a1c64e1df vm_memory: Remove unused error type
This error hasn't been used for a while and now generates an unused
warning.

Change-Id: Ica4a26332966e12dff29f01c0e110c6a1262b23c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2947798
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
2021-06-10 05:03:34 +00:00
Gurchetan Singh
41daa354c7 gpu_display: refactor event loop
There is a desire for Wayland and possibly other display backends to
reasonably handle input.  Move the event device logic inside the X11
backend up to the common layer to prevent duplication.

The common layer also keeps track of surfaces and external memory
objects to make this easier.  The GpuDisplaySurface/GpuDisplayMemory
traits are  introduced in case the common layer needs to perform
compositor specific operation.

BUG=b:173630595
TEST=compile and run with X11

Change-Id: Ied060a7cc216ac6c084030aad1fc839c022a3395
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2852523
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2021-06-08 22:07:17 +00:00
Chirantan Ekbote
eca117b31e devices: Fix racy event_loop_test
It is inherently racy to wait on a Condvar without first checking if the
condition is already satisfied.  Additionally, Condvar::wait can
spuriously return early even when the condition is not satisfied so it
is necessary to check it in a loop.

BUG=b:190444698
TEST=cargo test

Change-Id: If7703c6e8b9015df3c463147f3ad2a1c10c3a7ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2944323
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>
2021-06-08 18:54:48 +00:00
Alexandre Courbot
5e601623d4 virtio: video: move resource bridge into device
The resource bridge is only used by 2 methods of Device, so it makes
little sense to have worker maintain it and pass it around. Make it a
member of Device instead.

BUG=b:161774071
TEST=GTS DashTest passes on hatch-arc-r.

Change-Id: I5d305177b5fa6d86ee49d404a0fd65ba573578a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2932301
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-06-08 01:52:06 +00:00
Alexandre Courbot
b6f790632e virtio: video: move desc_map into Worker
This removes the need to pass the descriptor map as an argument of all
Worker's methods.

BUG=b:161774071
TEST=GTS DashTest passes on hatch-arc-r.

Change-Id: Ide8d1a858bb09f1098a38c49643fdf365ae7aec1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2932300
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-06-08 01:52:05 +00:00
Alexandre Courbot
0e8e812921 virtio: video: add command and event queues to Worker
The command and event queues are not replaced throughout the Worker's
life, and their ownership is given to it when run() is invoked. Make
them members of Worker so we don't need to pass them around with each
method call.

BUG=b:161774071
TEST=GTS DashTest passes on hatch-arc-r.

Change-Id: I92441a8be5e9dbc2fdaddc1546632ea404de0aaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2932299
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Staessens <dstaessens@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2021-06-08 01:52:03 +00:00
Stephen Barber
76cc214ce7 net: implement VIRTIO_NET_F_MTU
A given net device should expose the minimum MTU of all its
tap interfaces. This ensures that the guest won't inadvertently
produce frames that the host will have to drop, if a lower MTU
is in use on the host (common with cellular links).

BUG=b:171098377
TEST=create tap with MTU < 1500 and start crosvm

Change-Id: I6add14b532e4c2d070d2fe4410272421afc1303f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2917620
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-06-05 01:39:35 +00:00
Jiyong Park
7b6672a33c fuse: support general mount options
MountOption::Extra is added to pass mount options that are not specific
to FUSE, such as fscontext.

BUG=b:189096565
TEST=cargo test

Change-Id: I27f720a028a6133339d03cba6ed473a63c74edab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2927178
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Auto-Submit: Jiyong Park <jiyong@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>
2021-06-04 23:03:03 +00:00
Keiichi Watanabe
a2c71de3a3 vhost_user_devices: net: Support passing in tap fd
BUG=b:179755448
TEST=run two VMs on Chrome OS with tap FDs given by patchpanel

Change-Id: I94a8a5356dd4cf4432b377ee704c75168ab78ab8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2919160
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-06-04 12:01:30 +00:00
Keiichi Watanabe
2fdee8368c vhost_user_devices: net: Accept multiple VMMs
vhost-user-net device is now able to take multiple --device flags to run
multiple device backends in different threads.

BUG=b:179755448
TEST=start two VMs and run iperf3 between them

Change-Id: Id64c0d6116e3c8f32cbe2e83e17ef9e04e6df855
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2916117
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-06-04 12:01:29 +00:00
Keiichi Watanabe
468f8fc59a vhost_user_devices: net: Change format of command line argument
Make the net device take all of socket, IP address, net mask and MAC
address in one flag so that we can easily update it to support multiple
devices.

Also, this commit includes miscellaneous refactoring for future changes.

BUG=b:179755448
TEST=run curl on VM

Change-Id: I4d2b8361a8ba0c2586429078669afbed95dd6afd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2921972
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-06-04 12:01:28 +00:00
Alexandre Courbot
ecd3a42fb4 virtio: video: worker: add constructor
All the members of Worker are currently public to allow users to
build them inline. Use a constructor instead so all members can be made
private.

BUG=b:161774071
TEST=GTS DashTest passes on hatch-arc-r.

Change-Id: I093d7e9b9183b46c7ffe6717199e0ed654b6236e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2932298
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-06-03 12:48:29 +00:00
Chirantan Ekbote
2ee9dcd4bb devices: Support vhost-user-wl
Support running the wl device as an out-of-tree process.  Unlike other
vhost-user devices, this one uses a second socket for additional
wayland-specific messages between the device and VMM.  Since
virtio-wayland is not a standardized device and it's likely it will be
merged into the gpu device, it's not worth the effort to try to
incorporate the wayland-specific extensions into the regular vhost-user
protocol.

BUG=b:179755841
TEST=start a crostini vm with a vhost-user-wl device and play
     gnome-mahjongg

Change-Id: I455d32393426aff2acd392092ff82f6cc970d903
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2919156
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-06-03 09:58:01 +00:00
Chirantan Ekbote
a409b106e4 Add vhost-user-wl device
BUG=b:179755841
TEST=start a crostini vm with a vhost-user-wl device and play
     gnome-mahjongg

Change-Id: I4bbb084eed972e783908b23b37443ebb2f4847ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2919155
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-06-03 09:58:00 +00:00
Chirantan Ekbote
701b55adf4 sys_util: Add clone_descriptor
This is like `clone_fd` but takes a `dyn AsRawDescriptor` instead.

BUG=b:179755841
TEST=use it in a later change

Change-Id: I432a57f139f88ca7771e83a3edf09eb4f3d6156f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2927189
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-06-03 09:57:58 +00:00
Alexandre Courbot
0cd9040119 virtio: video: worker: avoid unneeded call to peek()
We can directly call pop() in write_event() and return an error if no
item is available. pop() actually does exactly what we were doing, but
makes the code a bit shorter.

BUG=b:161774071
TEST=GTS DashTest passes on hatch-arc-r.

Change-Id: I893666de0132f573164687e78fe0ac4e8996da71
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2932297
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2021-06-03 06:44:24 +00:00
Zach Reizner
026f72f9fb enable core scheduling regardless of enabled features
Now that core scheduling has been upstreamed, it can be enabled for all
platforms. This change keeps the Chrome OS version as a fallback if the
chromeos feature is enabled.

This change was patterned after http://crrev.com/c/2896464.

TEST=./test_all
BUG=b:153989878

Change-Id: I22a88c7af30e38f58acc7189cfe27a1af89d271d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2929044
Auto-Submit: Zach Reizner <zachr@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Joel Fernandes <joelaf@google.com>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-06-03 00:06:11 +00:00
Chirantan Ekbote
4d5b350602 wl: Move queue handling to standalone functions
This will make it easier to run the virtqueues from a vhost-user
process.

BUG=b:179755841
TEST=Start crostini and play gnome-mahjongg.

Change-Id: Ic4132a66ef7718fe85307f5d743110645288967a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2910215
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2021-05-31 11:56:05 +00:00
Woody Chow
b47434378d devices: vios: Fix SampleFormat => VIRTIO_SND_PCM_FMT mapping
Signed should be mapped to sigend

BUG=None
TEST=CQ

Change-Id: I06aa06e895dab63efe7f4e72de800fae614800d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2919153
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Woody Chow <woodychow@google.com>
2021-05-31 06:17:07 +00:00
Phong Tran
7f84f62839 README.md: Add install bindgen for cras-sys
For avoiding build failure cause of
lacking the bindgen command in cras-sys/build.rs

BUG=None
TEST=None

Change-Id: Id552c88316ec1f835ac38892b1f72d760f2d45e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2927175
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-05-31 06:12:09 +00:00
Alexandre Courbot
fbd2559acd virtio: video: encoder: wait until EOS buffer is available if needed
Currently, the encoder returns an error if no buffer was available to
signal the end of stream after a flush had completed. Fix this
non-compliant behavior by just waiting until the next output buffer is
queued by the client, and returning that buffer immediately to signal
the end of stream.

Since this behavior is also needed for the decoder, and is a workaround
for libvda's inability to signal the last buffer of a stream, make that
functionality available through a new EosBufferManager struct that can
easily be reused and removed.

BUG=b:168750131
BUG=b:186374269
BUG=b:161774071
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch-arc-r.
TEST=android.mediav2.cts.EncoderProfileLevelTest passes 100 times on
eve-arc-r.

Change-Id: Iebac5f3342393cc6763dbeedda041cf0c3983085
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2914232
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2021-05-30 05:37:34 +00:00
Noah Gold
e6b5a3725d Move VMM usages of rust-vmm/vhost into the wrapper.
For cross platform purposes, we need to be able to switch out the
implementation of rust-vmm/vhost. To make this easier, this CL moves all
VMM side calls into that crate into VhostUesrHandler. (The device side
calls are already in DeviceRequestHandler, so no further change is
needed there.)

Note that vmm_vhost::vhost_user::message::* are fine to use directly for cross
platform purposes.

BUG=None
TEST=builds

Change-Id: I5252e8522efa61dc773a74889915ec9a7ef58ec5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2913139
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-05-28 21:13:47 +00:00
Robert Tarasov
3cfec9e59b gpu_display/wayland: Switch to the stable version of xdg_shell
Promote xdg_shell_v6_unstable to the stable version of xdg shell
protocol.

In addition, we must fix the the build.rs file.  It looks for:

/usr/share/wayland-protocols

not

/build/${BOARD}/usr/share/wayland-protocols

Fix this by looking at pkg-config, and not the environment when
looking for the protocol path.

BUG=b:177939148
TEST=Tested on Ubuntu (gnome)

Cq-Depend: chromium:2914164
Change-Id: I7beff3845a3bf9f248171492ffd55ee3991a32ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2666159
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2021-05-27 20:03:07 +00:00
David Stevens
8c9cf43614 acpi: Don't pass most of host MADT to guest
Most of the MADT describes hardware that isn't passed through to the
guest. Instead of passing that information to the guest, use a MADT
generated by crosvm. However, we do want to pass through the irq
override structures, so append those to the generated MADT.

BUG=none
TEST=boot kindred and observe 2 cores in the CrOS guest

Change-Id: Ia7279578f2eab6be1092817e3c2700905c10dd05
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2908281
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
2021-05-27 17:46:50 +00:00
Alexandre Courbot
e0c32ce8d0 virtio: video: decoder: remove Default impl of Context
We don't have (neither do we want) to build Contexts without parameters.

BUG=b:161774071
TEST=cargo build --features "video-decoder,video-encoder"

Change-Id: I62d60b7baa820a16b5a188e8196b0b04643b0a85
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2918809
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: David Staessens <dstaessens@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2021-05-27 06:03:14 +00:00
Stephen Boyd
895c90c5f2 aarch64: Implement ARM_VCPU_PVTIME for "stolen time" accounting
ARM supports paravirtual clocks or "stolen time" accounting by
allocating a page of memory in the guest memory map for a pvtime
structure and then sharing that address with the guest and updating it
in the host to tell the guest about how much time has been stolen from
the guest because the guest hasn't been running. Read all about it
here[1]. Add support to crosvm to allocate this page (for now a 64K size
chunk of memory that all VCPUs share access to) and then set the address
of the page in each VCPU when starting up.

[1] https://www.kernel.org/doc/html/latest/virt/kvm/arm/pvtime.html#stolen-time

BUG=chromium:1130828, b:169094241
TEST=emerge-trogdor crosvm && cros deploy $DUT crosvm && \
     tast run $DUT crostini.Basic.buster_stable;
     dmesg | grep pv # in the guest shows "steal time"

Change-Id: Ie3497bb22fb0e38eeff8ebac14b4213824bb6ca6
Disallow-Recycled-Builds: test-failures
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2871394
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-05-26 23:37:05 +00:00
Abhishek Kumar
f426f9ed08 devices: vfio: Fix io bar index calculation
Fixes https://crrev.com/c/2689084 , wrong bar_idx cause
gpu hang in TGL(volteer-manatee).

BUG=b:187772152
TEST=Boot volteer-manatee

Change-Id: Ia9394d61e509c87d082ffc3923be2820535cec2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2915767
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-05-26 17:55:42 +00:00
Dylan Reid
050c9b8205 devices: Move block code to a module
Move all the block related code to a module under virtio.
This is deemed better than manual namespacing with block_....rs

Change-Id: I8543ef0345011679e02d3762ff94729b0a4eb1f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2915763
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
2021-05-26 05:10:32 +00:00
Dylan Reid
4452db6ba0 devices: block - move duplicated code to common file
It has taken a while to get the non-async code removed so make the
shared parts explicitly shared instead of duplicated.

Change-Id: I58d092eefad37bc23da80f0ecac394bb6155efc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2910993
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
2021-05-26 05:10:31 +00:00
Daniel Verkamp
80e69a6c86 clippy: re-enable warnings that don't match anything
Some of the "To be resolved" warnings no longer match any of the current
crosvm code, so remove them from the list so new instances can be
caught.

BUG=None
TEST=bin/clippy

Change-Id: I29de2ef49ba1b84250c46fd41844b45b7a3f79a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2885788
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-05-25 21:50:49 +00:00
Daniel Verkamp
b792ffdcec devices: vios: remove unnecessary mut reference
The seq_socket_send() function only requires a non-mutable reference;
drop the mut.

Fixes clippy warning "the function `seq_socket_send` doesn't need a
mutable reference".

BUG=None
TEST=bin/clippy

Change-Id: I517a8d782601f33653db33c201666707beddd5ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2885787
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Jorge Moreira Broche <jemoreira@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2021-05-25 21:50:48 +00:00
Daniel Verkamp
c80319182d tree-wide: replace single-leaf match with if let
Fixes the clippy warning:

  you seem to be trying to use `match` for destructuring a single
  pattern. Consider using `if let`

https://rust-lang.github.io/rust-clippy/master/index.html#single_match

BUG=None
TEST=bin/clippy

Change-Id: I5901a1fa0f487e0f012bad4c21b43ea300348031
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2885786
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2021-05-25 21:50:46 +00:00
Alexandre Courbot
d6c0f61489 virtio: video: encoder: move EOS buffer dequeueing into a method
Make the act of dequeueing the EOS buffer a method of its own, so it can
be invoked from different points of the code.

BUG=b:168750131
BUG=b:186374269
TEST=arc.VideoEncodeAccel.h264_360p_i420_vm passes on hatch-arc-r.

Change-Id: Ic8c2cc118df234093ae15aada0737063c8ad80c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2914231
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Staessens <dstaessens@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2021-05-25 03:25:31 +00:00
Daniel Verkamp
f7bc0580e8 Cargo.lock: add net_util dependency on cros_async
This dependency was added in crrev.com/c/2891121 but was not reflected
in Cargo.lock.

Also update the version of the minijail crate to match the in-tree
version.

BUG=None
TEST=cargo build

Change-Id: I016ce14eb7ce3313dc23f1d66edfa5b80b8e39b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2904732
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2021-05-24 23:11:54 +00:00
Daniel Verkamp
f1439d444b devices: add "usb" feature for emulated xHCI
Add a default-enabled "usb" feature to allow compiling out the emulated
USB controller and host device provider when not needed (e.g. for
crosvm-direct).

This reduces the crosvm-direct binary size by about 400 KiB.

BUG=b:173824333
TEST=cargo build --no-default-features
TEST=cargo build # ensure xhci controller is added

Change-Id: I1fc0eeb09c647854e5df57cd2fe7e92140256853
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2913136
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-05-24 21:37:22 +00:00
Jorge E. Moreira
6635ca47cb Allow more than one input device per type
In order to have multiple touchscreen devices working with multiple displays.

BUG=b:186263031

Change-Id: I02334f49dee4c57f139bcba84757089bd4bd4d37
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2857171
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Jorge Moreira Broche <jemoreira@google.com>
Commit-Queue: Jorge Moreira Broche <jemoreira@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2021-05-24 20:03:14 +00:00
Stephen Boyd
d28aaa6c2d kvm_sys: Update aarch64 bindings.rs
Update to v5.10 kernel headers so we can get new features such as
ARM's PV_TIME. Keep the temporary hack from CL:2623942 too.

BUG=chromium:1130828
TEST=emerge-trogdor crosvm && cros deploy $DUT crosvm && \
     tast run $DUT crostini.Basic.buster_stable

Change-Id: I58f7e2bd3bd50f9deadc15786d6bde660d84ecc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2871393
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-05-22 19:23:01 +00:00