Commit graph

3713 commits

Author SHA1 Message Date
Dennis Kempin
2adeed7042 dev_container: Default to non-interactive if a command is provided
This fixes problems with freezing when running luci recipes locally.
An interactive process can still be forced by flag -i or --interactive.

BUG=b:233230344
TEST=cd infra && ./recipes.py run build_linux

Change-Id: I261f0ffddcc3795e17bcbe023fa920f48769fdb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3657813
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-20 21:56:33 +00:00
Noah Gold
ebb6efe266 x86_64: set reset vector when using bios
BIOS expect all the cpus to be pointed at the i386 reset vector before
boot. We can't guarantee that a fresh vcpu will be pointed to the reset
vector by default, so we should set the reset vector when we're
configuring the vcpu when we're using a BIOS.

Cherrypick from downstream branch.
Actual author: Colin Downs-Razouk <colindr@google.com>.

TEST=builds
BUG=b:213152505

Change-Id: Idf4e0a200c8141adf5cbb83856cbd57362d84716
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3657811
Reviewed-by: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-20 21:06:04 +00:00
Rob Clark
953670c3ea virglrenderer: Add cross-domain support
For cross-domain, virgl_renderer needs to be able to import a dmabuf fd
allocated by another component.

BUG=b:230100768
TEST=gfxbench, android games in arcvm

Change-Id: I9d6f965589ec24f06a83a6d921a9c00db1f057f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3501130
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
2022-05-20 20:49:55 +00:00
Vineeth Pillai
d823be68e0 base: remove ScopedEvent
Now that we do not need ScopedEvent after moving to directional tubes
for VM events, remove the dead code.

BUG=None.
TEST=None

Change-Id: I37b1f7614afa9dc0a9ea1d742ec4872cadedbe2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3655288
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vineeth Pillai <vineethrp@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-20 18:30:34 +00:00
Vineeth Pillai
81b5e616d6 crosvm: vm_events: consolidate vm events into one framework.
crosvm waits on events like exit, reset, crash, guest panic etc and
uses eventfd to wait on these events. As of now, we have 4 eventfds
and may increase.

This is an attempt to consolidate all Vm events into one framework.
Use Tube instead of Event to get consistent behavior between OSes.
Implement a wrapper over Tube to have a consistent API for events.

BUG=None.
TEST=Built crosvm. Ran a minimal vm to panic and verified that crosvm
received the panic event. cargo test on devices.

Change-Id: I313d428de5e3ce3b879982f913918ec0a4a72c35
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3480577
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vineeth Pillai <vineethrp@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-05-20 18:04:21 +00:00
Noah Gold
d0b91ab0be vm_memory: upstream Windows support
Note that in tests, memory addresses were adjusted so that they work
with mmap allocation on Windows (the previous addresses/sizes were too
small; see `dwAllocationGranularity` at
https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info).

TEST=builds
BUG=b:213153154

Change-Id: I8ccecbf34b9f9799194447e04d69eb2ee3bf69b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3652703
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-20 04:24:43 +00:00
Noah Gold
6c291239af vm_memory: add GuestAddress::align
Originally added on Windows. Allows us to get an aligned address from a
GuestAddress.

TEST=builds
BUG=b:213153154

Change-Id: I4bca6609f0fc2346598a52bd71f2ec60ac7f08f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3653425
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-20 04:24:43 +00:00
Junichi Uekawa
6f2996bdde crosvm: Iterate over list of MSRs.
Instead of calling method each time, prepare a list and then iterate
over so that it's clearer we are doing the same thing many times.

BUG=b:215297064
TEST=build

Change-Id: I2556a9c12baa90ac0e5fa98e488e0586b1a4f010
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3653341
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-05-20 00:31:59 +00:00
Junichi Uekawa
e96813e469 crosvm: reorganize MsrRWType.
To simplify the construction and parsing, and put the impossible values
checking at parameter parsing time.

BUG=b:215297064
TEST=build

Change-Id: Ic601d61a73dba9e3ec40f3589c62a586e1c7a8c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3655032
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-05-20 00:31:59 +00:00
Vaibhav Nagarnaik
eb06419c56 hypervisor: Switch inflate/deflate functions
The methods names got switched in commit https://crrev.com/c/3640424.
Switch them to the right names.

BUG=b:213150327
TEST=compiled.

Change-Id: I7f8df13367abc2314f26c9da206bcbd9665e8ba5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3654202
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Reviewed-by: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
2022-05-20 00:15:25 +00:00
Vaibhav Nagarnaik
8c126493ad hypervisor: Add capability for early CPUID initialization
Some hypervisors (e.g. whpx) require that VM need to initialize their
`CPUID` early i.e. during VM creation. In this case, there is no
per-vcpu initialization of `CPUID`.

Allow this quirk through another entry in `VmCap` that avoids `CPUID`
initialization at vCPU creation time.

BUG=b:213150327
TEST=Compiled.

Change-Id: Ia74434ead1fff244042d03347c82cb73f243bdbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3654206
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
2022-05-20 00:15:25 +00:00
Devin Moore
cbc8d507d0 virtio: Remove default case from fmt() function
The default case can't call format! with the unexpected type because it
will end up back in fmt until the stack overflows.

BUG=b:232259781
TEST=build and boot Cuttlefish in aosp which uses the unhandled type

Change-Id: I80d9b745cf78859bc7e7e939fcc5f9955507241c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3655281
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Steven Moreland <smoreland@google.com>
Commit-Queue: Devin Moore <devinmoore@google.com>
2022-05-19 23:38:47 +00:00
Anton Romanov
56c0d02760 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: I6731b4ee9eaecdd65aebdd3f530f0932b0660c85
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3652887
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
2022-05-19 23:34:28 +00:00
Anton Romanov
ace7edca0e crosvm: cros_async: disable unstable test
Test verifies if operation is not executed if executor is dropped before
running. We do not currently guarantee that

BUG=none
TEST=cargo test

Change-Id: I56d98e4af869c26542c7ebacb127ed3bfd980553
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3655277
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-19 23:34:28 +00:00
Gurchetan Singh
c1a2fa27b4 rutabaga_gfx: stop unconditionally advertising the cross domain capset
Currently, there are two use cases for the cross domain capset:
   (1) Sommelier
   (2) minigbm

Niether is used by a production VM yet and it was unconditionally
enabled only to enable testing.  To effectively productize, it should
be conditionally enabled, which is done later in this patch series.

BUG=b:173630595
TEST=compile

Change-Id: I736f58065c692d7ee4736f28da30fa28de43f0c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3655285
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-19 22:39:47 +00:00
Ryan Neph
bfe3bcf96a rutabaga_gfx: virglrenderer: add support for per-context fencing
Permits virglrenderer contexts to make use of per-context/per-ring
fencing.

BUG=b:175527587
BUG=b:193892617
TEST=cargo build --features=virgl_renderer,virgl_renderer_next,gfxstream
TEST=Run glxgears and vkcube in a crosvm guest VM with virglrenderer

Cq-Depend: chromium:3654708
Change-Id: I30028afa5daff2a7a1b0ade13bc9fae2cd548f8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628302
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2022-05-19 22:39:47 +00:00
Noah Gold
30074cb734 disk: upstream windows support
Splits out unix/windows code in to sys & adds windows code.

TEST=builds
BUG=b:213150316

Change-Id: I1dcc63ae978a5d72ee51b916181317b8f7008dbe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3654613
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-05-19 18:25:30 +00:00
Noah Gold
67b8f92b85 disk: only fsync composite when needed
This CL avoids fsyncing when unncessary (optimization originally created for
Windows).

TEST=builds
BUG=b:213150316

Change-Id: I9dc7d2d9c394ac83e4220e2a7ae99d670f4a5630
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3654618
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-05-19 18:25:30 +00:00
Noah Gold
ce57578ce8 disk: fix composite disk component path handling.
Currently we treat any version 1 path as absolute, and any non version 1
path as relative. The proto files don't indicate that this assumption
can be made, and we don't make it on Windows. This CL changes path
handling so that a version 1 path must actually be absolute for us to
treat it as such.

TEST=builds
BUG=b:213150316

Change-Id: I95a1c8751428a9e2f7311f9136940fbdb2410ef1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3654207
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-05-19 18:25:30 +00:00
Dmytro Maluka
d61e24be2c Revert "direct_irq: Add support for host wakeup capable IRQs"
This reverts commit 0ac97979b6.

Reason for revert: This static configuration for wakeup IRQs is
no longer needed since we have a mechanism for automatic dynamic
configuration of wakeup IRQs based on requests from ChromeOS VM.

BUG=b:228449597
TEST=Boot ManaTEE and verify wakeup from touchpad and other devices.

Change-Id: Ifce6919d3c3ab9e677ee0a6566aba4d720168db5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3593741
Reviewed-by: Tomasz Nowicki <tnowicki@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Micah Morton <mortonm@chromium.org>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
2022-05-19 14:28:46 +00:00
Xiong Zhang
8c97db443b x86_64: Add parameter to specify pci low mmio start address
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>
2022-05-19 07:47:18 +00:00
Junichi Uekawa
97c4df7ba0 crosvm: Introduce utility for MSR map.
To reduce duplication in error handling.

BUG=None
TEST=build

Change-Id: I423ab174a2ca4c8823633ed381b368c62a186981
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3649388
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-05-19 02:43:49 +00:00
Dennis Kempin
97306a2bfa Add check_cq_depend to PRESUBMIT
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>
2022-05-18 18:54:34 +00:00
Daniel Verkamp
ddbb57d355 base: unix: timer: factor out timerfd_settime call
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>
2022-05-18 17:47:05 +00:00
Daniel Verkamp
6fd2272510 base: unix: remove unsafe in duration_to_timespec()
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>
2022-05-18 17:47:05 +00:00
Daniel Verkamp
515694f155 base: unix: timer: use duration_to_timespec()
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>
2022-05-18 17:47:05 +00:00
Daniel Verkamp
f3be99cd03 base: unix: timer: use mark_waited() in wait_for()
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>
2022-05-18 17:47:05 +00:00
Daniel Verkamp
1e8aae8b8d base: improve Timer wait/wait_for documentation
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>
2022-05-18 17:47:05 +00:00
Daniel Verkamp
0809b02831 devices: switch Timer::wait to Timer::mark_waited
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>
2022-05-18 17:47:05 +00:00
Keiichi Watanabe
416a9cdd85 devices: vvu-proxy: Reports an error happening in worker thread
BUG=none
TEST=run vvu

Change-Id: I80f05c7c0d066f458279f6908b4ba7296f873e49
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3640878
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-05-18 16:57:10 +00:00
Anton Romanov
0124707336 Revert "crosvm: remove balloon stats request timeout"
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>
2022-05-17 19:23:48 +00:00
Anton Romanov
716b698659 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>
2022-05-17 17:45:21 +00:00
Keiichi Watanabe
114f37d567 devices: vvu-proxy: Use anyhow::Error instead of thiserror
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>
2022-05-17 16:10:06 +00:00
Keiichi Watanabe
3a5ff984e3 devices: vvu-proxy: Remove Error::RxDescriptorsExhausted
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>
2022-05-17 16:10:05 +00:00
Keiichi Watanabe
0f6e096bbf devices: vvu-proxy: Introduce enum representing connection status
BUG=b:232273004, b🅱️216407443
TEST=cargo build

Change-Id: Ic3fecab7d3c04cdd09f5c77b849c1fac7ee43f7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3640875
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-05-17 06:06:40 +00:00
Junichi Uekawa
8a2188ae51 crosvm: Sort VmComponents and RunnableLinuxVm.
BUG=None
TEST=build

Change-Id: I64ebd32a24e28fdc7417b53a19c1ec94c833674d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3649385
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-05-16 23:49:22 +00:00
Vikram Auradkar
b448c016d8 crosvm: move unix specific host_ip and seccomp related args
BUG=b:227659915
TEST=presubmit

Change-Id: I1387f4a23098213e03cd694d76c625835608f821
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3647896
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-05-16 23:30:54 +00:00
Vikram Auradkar
ec482840b9 crosvm: Better error message
Prints only compiled-in options

BUG=b:227659915
TEST=presubmit

Change-Id: If58013fc0d0387237da0c4ab0677efcd317a6fed
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3649737
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-16 23:30:53 +00:00
Vikram Auradkar
9c2fe689b7 crosvm: move more unix specific code out of main
Also introduces helper function is_gpu_backend_deprecated.

BUG=b:227659915
TEST=presubmit

Change-Id: Ieee6e7fa747b5c2ef80b825487ae4f191e0550f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3647895
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-05-16 23:30:52 +00:00
Richard
df8201cfc6 vhost_user: Refactored mod.rs files to match style guide and to include
Windows imports

BUG=b:213149291
TEST=built and presubmits

Change-Id: I04c113accf23c82f1119835ae3570b3149694390
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3646780
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-05-16 14:24:44 +00:00
Junichi Uekawa
8958e11283 crosvm: Sort struct Config default initializers.
BUG=None
TEST=build

Change-Id: Id1d86ac775bd32375cd03456aba7a14e9cc4c00e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3644537
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-16 11:03:34 +00:00
Junichi Uekawa
90f281c1ff crosvm: Use /dev/zero instead of /dev/mem
/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>
2022-05-14 12:21:02 +00:00
Vikram Auradkar
cc3fcb8e9d crosvm: carve-out unix specific parts of parse_ac97_options
BUG=b:227659915
TEST=presubmit

Change-Id: Ie0ee9e751f36d8572270dcb68e9972ac0107dae0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3647894
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-14 00:31:56 +00:00
Vikram Auradkar
4281630b12 crosvm: carve-out unix specific parts of start_device
BUG=b:227659915
TEST=presubmit

Change-Id: I96f5e8ccaa30888f77e78c3b8a1ebf8b0947b70e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3646032
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-05-14 00:31:55 +00:00
Alistair Delva
e3cae7275b crosvm: drop a few useless legacy I/O ports
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>
2022-05-13 21:25:06 +00:00
Vikram Auradkar
5b3cfb9143 crosvm: carve-out unix specific set and get arguments
BUG=b:227659915
TEST=presubmit

Change-Id: I1e7080c6cb19ffe34c052524933711b12d750b2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3643041
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-05-13 20:11:25 +00:00
Sahitya Tummala
a6945f4a49 aarch64: Add support for loading kernel image formatted as ELF
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>
2022-05-13 18:48:12 +00:00
Ryan Neph
646de85eee gfxstream: fix fence_handler not stored in fencing cookie
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>
2022-05-13 18:37:56 +00:00
Richard
eb0cf09769 devices: vhost_user: Split up system specific code in fs device
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>
2022-05-13 16:07:33 +00:00
Vaibhav Nagarnaik
bb30f23ce0 hypervisor: Upstream traits changes for Vm
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>
2022-05-13 00:30:09 +00:00