In order to let host and guest have ths similiar pci mmio layout in
manatee, this commit add a pci-start parameter.
BUG=b:197877871
TEST=boot vm with --pci-start and check vm's mmio layout
Change-Id: I0e83dfb3ab3c3b2ea1b0a1554d532e8414924b36
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578017
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
This will be run when using repo upload from a chromiumos checkout
and reminds developers that Cq-Depend cannot be used with crosvm.
BUG=b:226975263
TEST=./tools/chromeos/check_cq_depend
Change-Id: Ib9cafaba181cb2103838369123e6c1288e653486
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3651674
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Deduplicate the unsafe block and the update of interval into a helper
function so that reset() and clear() can be greatly simplified.
BUG=None
TEST=tools/presubmit --all
Change-Id: Ic0210bc3dd2239b575d47f718709333bce842509
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3653256
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This function just initializes a simple struct with two elements; it
does not need to use `unsafe`.
BUG=None
TEST=cargo test -p base
Change-Id: I6f7db5df29cb8a181d2f69ea4cede1ad8be12234
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3652894
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Replace the duplicated Duration to timespec conversion code with calls
to the existing helper function.
BUG=None
TEST=cargo test -p base timer -- --include-ignored
Change-Id: I99d9e77c2056c760c37fd014ca99363276a473d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3652892
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Remove some duplicated code that called read() on the timerfd in an
almost identical way in two functions by reusing mark_waited() within
wait_for().
BUG=None
TEST=cargo test -p base timer -- --include-ignored
Change-Id: I3bf4a6eb3c777aa9314c408281e4d60ff218fd2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3652891
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
wait() blocks indefinitely, and it does not take a timeout argument, so
remove the wording about `timeout`.
wait_for() can return because of either timeout or timer expiration;
clarify which return value means what.
BUG=None
TEST=tools/cargo-doc
Change-Id: I84ee01d3595510c36a4651d36424883e5bb3c9d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3652890
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
All of these call sites are used in cases where a Timer has triggered
a WaitContext because it has expired, so we don't actually want to wait,
just mark the timer expiry as acknowledged.
BUG=b:213153157
TEST=tools/presubmit --all
Change-Id: If91ca66e1810756c0b441e1253f0022870ce1a3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3652886
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This reverts commit 716b698659.
Reason for revert: this is wrong in multithreaded mode
Original change's description:
> crosvm: remove balloon stats request timeout
>
> It was done to avoid deadlock when stats are requested before guest is
> up. Implement a stub BalloonStats::NotReady replier until host is up so
> that timeout is no longer necessary.
>
> BUG=b:232289535
> TEST=few tast crostini/arc tests
>
> Change-Id: Ieb6888487ea5b10664b76d8f94330564e7a3c726
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3647161
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Auto-Submit: Anton Romanov <romanton@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Anton Romanov <romanton@google.com>
Bug: b:232289535
Change-Id: I11faa967d6030ad4a0c292069b0678260757fda8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3651672
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Anton Romanov <romanton@google.com>
It was done to avoid deadlock when stats are requested before guest is
up. Implement a stub BalloonStats::NotReady replier until host is up so
that timeout is no longer necessary.
BUG=b:232289535
TEST=few tast crostini/arc tests
Change-Id: Ieb6888487ea5b10664b76d8f94330564e7a3c726
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3647161
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Use anyhow::Error instead of defining Error enum so that we can provide
more precise error messages easily.
BUG=b:232273004
TEST=run VVU on workstation
Change-Id: I6107fb79b3e7b1a20b11b24c8ec62e2fd8564b78
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3640877
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Remove `Error::RxDescriptorsExhausted`, which was matched against.
As a result, no variants in `Error` enum appears in pattern matching and
we can switching to `anyhow::Error` easily in a following CL.
BUG=b:232273004
TEST=cargo build
Change-Id: Ie0fb0897b7ec09d901011d7d9e62af3a00b08bc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3640876
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
/dev/mem doesn't exist inside the dev_container and test failed because
/dev/mem is not there. We don't actually care about what file it is here
although it is typically /dev/mem, so use /dev/zero instead.
BUG=None
TEST=DOCKER=podman ./tools/dev_container cargo build --features=direct
Change-Id: Ic07ed6c3bf222c24eea1387028afbeb52e5c8563
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3643357
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Remove a few ioports that did nothing, but were specifically wired up to
stubs so they would not generate debug prints.
Port 0xed will only be used by Linux if io_delay=alternate is set on the
cmdline, which was only required for some quirky PC hardware.
Ports 0xf0 ("busy latch reset") and 0xf1 ("coprocessor reset") were only
required by some i386 PC clones without native FPU support.
Dropping this code simplifies the removal of the no_legacy cfg which
will be done by a future change.
BUG=b:223443221
TEST=crosvm run kernel
TEST=crosvm run --bios u-boot.rom --disk kernel
Change-Id: I7b71bd6799759ac3d35be4eb9e157d4eedd9f0c5
Signed-off-by: Alistair Delva <adelva@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3510981
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This is done similar to x86 platform to check if a kernel image have
ELF signature first and if it doesn't, then it is passed to the Image
loader as a fallback.
BUG=b:232360323
Change-Id: I27b362952bd7f2678d1c7646b1b1c052c3518fca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3646449
Commit-Queue: Steven Moreland <smoreland@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
While we support both the old and new fence handling methods of
b:175527587, we need two copies of the RutabagaFenceHandler (one for
each method).
BUG=b:228051513,b:175527587
TEST=emerge crosvm
TEST=tested by gfxstream team
Change-Id: I516cf135819aebb5128e41b8a9d585e17680c6a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3646777
Commit-Queue: Ryan Neph <ryanneph@google.com>
Auto-Submit: Ryan Neph <ryanneph@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Kaiyi Li <kaiyili@google.com>
The fs device doesn't have Windows specific code. This CL just splits up
system specific code in order be consistent with the formats of other
devices.
BUG=b:229902431
TEST=built and presubmits
Change-Id: I6a1a7c68d89536d8d5f6a1d45c4727739bdca6a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3642341
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Add to the `trait Vm` 2 new methods that allow more control for
hypervisors when dealing with memory (un)mapping. This is intended for
dealing with expanding and releasing memory from `virtio-balloon`.
For windows based hypervisors, balloon expansion triggers OS interaction
with reclaiming memory pages, which is automatically managed in KVM.
Similarly, a balloon deflation will cause OS interaction for releasing
memory back to the OS.
Update the error return for `remove_mapping` when `madvise` call fails.
BUG=b:213150327
TEST=compiled.
Change-Id: I6ac04d27ac06ea97825f4d22e36543b5dde5b032
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3640424
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Previous pcie cfg mmio is predefined as constand to avoid conflict with pci mmio,
this has two issues:
a. The size of pcie cfg mmio is limited to 64MB, so the max pci bus number is 64.
This isn't ennough for vfio-pci device, as such device's bus number is same as
host bus number, it may be above 64.
b. In manatee, CrOS may be required to have the same pcie cfg mmio base and size
as host.
So this commit add a parameter and let user could specify pcie cfg mmio base and
size. Then the guest memory layout will be adjusted to avoid conflict between
guest ram and pci low mmio.
BUG=b:197877871
TEST=run crosvm with --pcie-ecam=xxxx,xxxx, check vm's memory layout and pcie
ECAM function
Change-Id: I22cf7e2b3f01ab3f48dff9f5246cb1c24faa9703
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3305948
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
When the virgl_renderer and gfxstream features are not enabled (e.g. in
a default `cargo build`), the use_timer_based_fence_polling variable is
never written, so the compiler warns about an unused `mut`. Add an allow
to silence this warning (we could use cfg checks to optionally add the
mut, but that would be much more complex for no real gain).
BUG=None
TEST=cargo build # no warnings
Change-Id: I176185328322d9d65cadce602ed09d43ef9eb4e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3646451
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
On Windows, this changes the EventContext::wait() return type from Vec
to SmallVec; this removes an extra conversion step, since the only
caller, WaitContext::wait(), constructed a SmallVec from the return
value anyway.
On Linux, this lets us get rid of the PollEventsOwned structure, since
the SmallVec contains the events and does not need to point back at a
separate type for storage.
BUG=b:213153157
TEST=tools/dev_container tools/presubmit --all
Change-Id: I7857a306ad71be020af309d4186d9e3e651fcc05
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3633110
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Main update is separating unix and windows to have their own `Block::new` constructor. Also made a `get_all_features` platform agnostic constructor helper since it can be shared on both platforms.
BUG=b:227364312
TEST=built and presubmits
Change-Id: Ie5073389c7e6961fa397bd07275cafb3d571d66d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578375
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
The biggest change is adding a platform agnostic constructor helper method
`BlockBackend::new_from_async_disk`. `BlockBackend::new` is moved to the
sys module since it's only used by Linux and Windows will have a
`BlockBackend::new_from_files` constructor.
Next step will be to upstream Windows vhost-user block vmm.
BUG=b:227364312
TEST=built and presubmits
Change-Id: I80a6e219f7139c17abb5a00d3ba3e89a9a994030
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3576953
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This reverts commit b10fa49a6f.
Reason for revert: made ARCVM unresponsive during CTS tests
Original change's description:
> base: Add CloseNotifier support to Linux
>
> This is necessary for its cross-platform usage in metrics.
>
> BUG=b:213152497
> TEST=build
>
> Change-Id: I6618777679349d1f6298f79e1f93fe4e9a3ecf7a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3622798
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Michael Hoyle <mikehoyle@google.com>
BUG=b:213152497,b:232316549
TEST=CtsAccessibilityServiceTestCases
Change-Id: If27d2ad016878896a261d6d80c4ea3e252ddd08e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3641219
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Michael Hoyle <mikehoyle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Shao-Chuan Lee <shaochuan@chromium.org>
For MSR handlers with "from running CPU" configuration, they will open
and store the MSR file descriptior immediately while their creation.
So move their creation after crosvm sets CPU affinity for each vCPU
thread can avoid storing redundant MSR file fds.
BUG=b:225375705
TEST=Set `--userspace-msr=0x1a2,type=r,action=pass,from=cpu0`
Change-Id: Iaa7bf804595ef45eec150e826be87c86ffeeef24
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3641478
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
When pcie cfg mmio and pci low mmio address could be specified by user,
guest memory layout will be changed to avoid conflict between guest ram,
and pci mmio below 4G. So this commit changes them from constant to
variables, the default value is prefined constand value, but it could
be changed later.
BUG=b:197877871
TEST=tools/presubmit
Change-Id: I5ad1f9d6a050d83ea16a53b926d1fadfac1ed75d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3305947
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
By default PCIE config mmio is above pci low mmio, and they are adjacent.
When user could specify pcie config mmio address and size, the specified
address range will be highly overlap with pci low mmio or guest memory,
then it will split pci low mmio or guest memory. Finally three memory
regions exist in the below 4G space: guest ram, pci low mmio and
pcie config mmio.
In order to simplify memory space management, this commit move pcie
config mmio into pci low mmio, and pcie config mmio is reserved from
pci low mmio at the beginning. In this way, only guest ram and pci
low mmio exist in below 4G space.
BUG=None
TEST=boot a vm and check memory layout below 4G.
Change-Id: I0b253b7bf7fb0287a27a88b34ee28b0a0bd2d172
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3578016
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Direct mmio range couldn't be assigned to any device, so this commit
exclude them from mmio allocator before build_vm().
BUG=None
TEST=tools/presubimt and boot manatee
Change-Id: I71414de1d44545e2c490ce75f5ced5545752858f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3605163
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Some mmio should be reserved from mmio allocator such as direct mmio and pcie config mmio,
and the space of mmio allocator is determined by arch and mmio-address-range parameter
which are in different model, it is hard to exclude the reserved mmio at mmio allocator
creation.
So this commit add a reserve_mmio() function, so that different model could call it.
If any part of the reserved mmio has been allocated, it returns Error, the caller
should handler it.
BUG=b:197877871
TEST=tools/presubmit
Change-Id: If64542ee0cef7b8949e4bd01d27f6119aea4eea0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3605162
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The order doesn't matter and every time I add something it conflicts.
BUG=None
TEST=build
Change-Id: Iebf3bc2636160e05ad120f5f8d2a16de60e54034
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3636539
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
When a sibling shuts down, the VVU device process in the guest will exit
BUG=b:216407443
TEST=run vvu on workstation
Change-Id: I0c067b3fbea705dab362f9a3fd05e3770f1dc519
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3591104
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
When a usb device is attached to guest kernel, guest kernel will
Try to set the usb configuration to value returned by
usb_choose_configuration. Unless the device has multiple configurations
and host side set it before attach to guest os, it will be same value
as what host kernel would set it during initialization. This would casue
a device reset and for Android devices in adb mode it will cause a
disconnect and reconnect.
Also we should allow user space trying to reset the device by setting
device configuration to active configuration.
BUG=b:123374026
BUG=b:232272092
TEST=Able to attach Pixel2 and Pixel4 to vm
TEST=Run CTS usb device verifer test on both phones
TEST=adb from crostini to test phones
Change-Id: I0e30aaa1b42a18741a2981e256d2268c1a70c46f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3631026
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Long Cheng <lgcheng@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Flip the switch for Gfxstream to stop using timer-based fence
polling and start using async fence handling callback.
BUG=b:175527587
BUG=b:192614792
TEST=cargo build --features=virgl_renderer,virgl_renderer_next,gfxstream
TEST=Run glxgears and vkcube in a crosvm guest VM with virglrenderer
Change-Id: I5f00f44d29bd584ad554d8892e9f13448c29c712
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628303
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
This adds the asynchronous interrupts in crosvm-gpu for gfxstream.
This will allow gfxstream to alternate between the main signalling
method (ASG [1]) and the more traditional interrupts when it
makes sense performance-wise.
gfxstream also requires new write fence callbacks that take into
account the ring_idx and ctx_id where the fence is on.
[1] goto.google.com/address-space-graphics
BUG=b:175527587
BUG=b:192614792
TEST=cargo build --features=virgl_renderer,virgl_renderer_next,gfxstream
TEST=Run glxgears and vkcube in a crosvm guest VM with virglrenderer
Change-Id: I52b8eb0e70671e8b43bae6e9e5264268bfb076df
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628301
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Kaiyi Li <kaiyili@google.com>
An optional performance optimization that almost completely avoids the
wakeup cost of timer-based fence polling when all RutabagaComponents use
async_fence_cb. There is still a small overhead from the per-loop
virtio_gpu.needs_fence_poll() tests. This overhead will be removed in
later CLs, when timer-based fencing support is removed.
BUG=b:175527587
TEST=cargo build --features=virgl_renderer,virgl_renderer_next,gfxstream
TEST=Run glxgears and vkcube in a crosvm guest VM with virglrenderer
Change-Id: Id9f14bcbdaa4dcdc42b24be12d85cad2ea0efed5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628300
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Adds another method for fencing where a rutabaga component may provide
an asynchronous callback for fence completion. When this method is
enabled, fences no longer need to be polled on the main thread.
When async_fence_cb is enabled, optional polling still occurs for
Rutabaga Components that still rely on it for other purposes (e.g.
virglrenderer for GL query checking).
Both the old and new methods of fence handling are supported with this
CL; e.g. timer-based polling and async callback, but timer-based polling
is the only one active. Follow-up CL(s) will switch to using the async
callback for each RutabagaComponent. Support for the old timer-based
polling will be removed after the async callback method stabilizes in
production.
Also, use a BTreeMap rather a HashMap since we only expect a dozen or so
entries at most. In such cases, a BTreeMap is faster.
* v1 (lfrb@collabora.com): remove all polling + add async_cb
* v2 (ryanneph@google.com): re-introduce optional polling to fix
virglrenderer that relies on it for GL query checking.
* v3 (ryanneph@google.com): replace timer-based polling with
eventfd-based poll() signaling for components that want to use it.
* v4 (ryanneph@google.com): add async fence handling beside timer-based
polling to support both for a short time.
This is a pseudo-reland of commit
a999284da2, but modifications have been
made to support both fencing methods simultaneously.
BUG=b:175527587
TEST=cargo build --features=virgl_renderer,virgl_renderer_next,gfxstream
TEST=Run glxgears and vkcube in a crosvm guest VM with virglrenderer
Change-Id: I28f754aeef01972a01dab7990267415814a36c77
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628299
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>