This CL defines do_net_add/remove with the same function signature when
pci-hotplug feature flag is disabled. This allows crosvm_control to be
unaware of the pci-hotplug flag.
TEST=presubmit tests.
BUG=b:294777126
Change-Id: I4c6a3b96c01ecea9f9f01dcd1c7f65ca042a5664
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4851835
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
This CL factors out do_net_remove to vm_control from main.rs.
do_net_remove sends a VmRequest to remove a tap device.
Test= presubmit tests.
Bug=b:294777126
Change-Id: I82e2741a044b1144f04424deacc905fbe079560c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4846021
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
The VHOST_USER_GET_VRING_BASE message handler in the vhost-user backend
should be idempotent - stopping an already-stopped queue should be a
no-op instead of an error. Check the queue state before calling the
device's stop_queue() function in the vhost-user DeviceRequestHandle to
ensure the queue is started before stopping it.
BUG=b:299352366
TEST=tools/dev_container tools/presubmit
Change-Id: I20ac2c3024fcb6da8823c4d0ccca73bdd5c1c448
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4851710
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
We found that when we are using a remote desktop, the monitor DPI
reported by GetDpiForMonitor() may not make sense. For example, on
Chrome Remote Desktop we always get 25 DPI, while the standard DPI is
96. Because of that, the calculated guest DPI is also too low, and all
the UI elements in the guest appear very small.
This might be a flaw in Windows Remote Desktop Protocol. As a
workaround, we would just assume the monitor DPI is the standard value
if we find that KiwiVM is running in a remote session.
Bug: 273810154
Test: Ran B* in CRD and checked the Overlay UI size
Change-Id: Ie335fe8df394b19733bbee8f70931c29b836f3d3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4804796
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Kaiyi Li <kaiyili@google.com>
Updated sandbox policy for gpu process, and use
a clipboard manager object to scope open and close clipboard.
Test: ran multiple games to textboxes add tested paste
Change-Id: I7497fbcff3922ec44428bf9708b01eecdfb4904b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4804693
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Udam Saini <udam@google.com>
The downstream also relies on the keycode_converter module to translate
the input events.
Change-Id: I840226246dbf5112837b76ea7ad5677f75a4a5ca
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4804692
Commit-Queue: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
This is used if the start game button is pressed when a game is already
running. The user may hit that button if they have trouble in finding
the game window since it may be behind other windows or minimized. The
BSS will send an empty ShowWindowRequest and we will bring the window to
the foreground. If the window has been minimized, we will need to
restore it first.
Bug: 260061297
Test: Ran GPG and tested this feature
Change-Id: Id7c7253b2d82cddc9670804486d3bfed92379a12
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4804691
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Bug: 262705211
Test: ran emulator & verified scroll position is sent to the guest &
that the bug no longer repros.
Change-Id: Iaa8e748aeaa8faea361e7d6deb94fe152824c850
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4804795
Reviewed-by: Vikram Auradkar <auradkar@google.com>
This is a first CL in preparation of supporting alternative usb backends
that do not depend on usb_util and usbdevfs backends (like host_backend
does). We abstract error.rs and utils.rs as they will contain generic
backend-agnostic code.
BUG=b:299215250
TEST=presubmit
Change-Id: Ieae7afd90608bd5ca15db5aec4541e66756d9ea0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4845151
Auto-Submit: Morg <morg@google.com>
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Extract event_name and timestamp from input file and calculate latency of cros_tracing event and output it.
BUG=b:297954291
TEST= Run the tool with a trace.dat collected by trace-cmd.
Change-Id: Ia9b5814d35fa33a185278f7e3128592a2ac783d6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4806243
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Commit-Queue: Natsuko Mineno <natsukomineno@chromium.org>
Reviewed-by: Morg <morg@google.com>
Add empty snapshot/restore to vios_backend.
No state is necessary to get snapshot/restored.
BUG=b:297770176
TEST=presubmit
Change-Id: I09ac6aeac6dd866a9a0412f1ea8a89be7d300a28
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4822812
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
As usual, some unsorted and grouped imports have appeared.
Change-Id: I79b51e4c52cee38f5b8c238e46dfe3193c753554
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4847980
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Move the hypervisor-specific `use` statements inside the relevant run_vm
subfunction to cut down on the amount of conditional includes required.
Change-Id: Ib2a3e49f81522aab4cfaab598a8a8036e079a178
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4823124
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This code is unused and untested, while simultaneously making the rest
of the virtio device code more complex. Remove it.
BUG=b:276993009
TEST=tools/dev_container tools/presubmit
Change-Id: I9d44f92419c6912d1735043404d4f64efc95bba4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4676076
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
There is only one implementor right now and it seems unlikely we'll need
to support multiple vhost-user frontend implementations in the future.
Note that there are a few other very similar looking traits like
VhostUserSlaveReqHandler (used for backend implementations) and
VhostUserBackend (also used for backend implementations, but at a
different abstraction level).
The documentation of the traits was moved to the implementations. In
some cases there were redundant docs and so I made a judgement call on
which to keep.
Change-Id: Ib69270160c375c900fd9e3356cb387b78e4983be
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4553724
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This abstraction doesn't add much value and makes the `accept` call
dangerous (if `accept` is called after it returns `Some`, then it will
panic).
Change-Id: I0c749fccef582128bb66eb95132103427e2abf58
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4827925
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Restoring a snapshot on WHPX was failing with a SMP Linux guest. khei@
noticed that WHPX has a special "internal" register called
WHvRegisterInternalActivityState. This register is not in the Hypervisor
Top Level Specification, but it does appear in the WHPX headers & MSDN
docs. Its exact function is not specified, but by experimentation we
believe it contains state critical for SMP guests to restore
successfully (they restore successfully once this register is
saved/restored). Perhaps there is some IPI or kernel side LAPIC state
that is only available via this register, and that state is only
critical for SMP guests. In any event (pun intended), we treat the
register as opaque data, and that seems to work fine.
This CL also adds another register that we previously skipped over,
WHvX64RegisterDeliverabilityNotifications. This register is how we
request an interrupt injection window from WHPX for things like PIC
interrupts. Previously we weren't saving/restoring it, and it's possible
for such a request to be pending at snapshot time, so we shouldn't be
discarding that state as it could break things.
BUG=b:297294476
TEST=snapshotted & restored an Ubuntu SMP guest successfully.
Change-Id: I65c14432c9a56388bda7edeacfa21fe1fa8951a6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4827931
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
It turns out the TSC adjust register in the VMCS is already handled for
us by the generic x86_64 code. Actually trying to restore the TSC MSR
will clobber that in a way do not want. (Our goal in snapshotting for
WHPX is to ensure that TSC adjust remains the same, not that the guest's
views a TSC that does not change across snapshot/restore. We rely on
virtio-pvclock to fix up the guest clock after the restore operation,
and it requires TSC adjust to remain constant.)
BUG=b:297294476
TEST=ran the emulator and snapshotted with pvclock enabled. The kernel
did not complain about clock issues.
Change-Id: I04306339d6c11a094d2c81a13f225927b9a89911
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4827930
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Relands 42ee99f25e ("gpu: allow unsandboxed implicit render server spawn") with changes.
Add command line argument allowing virglrenderer to implicitly spawn a
render_server process when a render_server_socket is not provided and
sandboxing is disabled. Useful for simplifying local debugging and injection-based
profiling (ASAN lib injection) workflows.
BUG=b:298221126
TEST=cargo build --features=gpu,x,wl-dmabuf,virgl_renderer,virgl_renderer_next
TEST=Run crosvm with virglrenderer without render_server support built-in - works by default.
Change-Id: I83b888f84dffe055d144d8c9aee67f8feff9c0e2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4834111
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Signal PCM worker on stream release to let the worker break out of the
main loop and be released successfully while CRAS is suspended/broken
and doesn't send data to the worker.
After receiving the stream release command, wait up to 2 periods to
respond to the last buffer and stop the worker. If 2 periods passed
without receiving a new buffer, then stop the worker anyway.
Originally this CL is to handle the case when CRAS is suspended, but we
fixed it by changing the suspend order. We found that this CL can help
with b/297454482 when the worker get stuck due to broken mic.
BUG=b:248470751, b:297454482
TEST=Open/Close stream in ARCVM multiple times and check there is no
"Error reading msg" or "fetch err" error
TEST=`atest android.media.audio.cts.AudioNativeTest#testRecordAudit
android.media.audio.cts.AudioNativeTest#testRecordStreamData` on
chronicler
Change-Id: If9185e46173971d06af934d5054a0dda2866c592
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4054215
Auto-Submit: Pattara Teerapong <pteerapong@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Judy Hsiao <judyhsiao@google.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>