Commit graph

3610 commits

Author SHA1 Message Date
Daniel Verkamp
45b0920767 doc: add a top-level comment to all crates
This provides at least a minimal one-line description to show what each
crate is about.

BUG=None
TEST=tools/cargo-doc

Change-Id: I26732e8c29062e622d5be09bdc120a49d564b9fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630422
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-06 20:46:57 +00:00
Daniel Verkamp
132957468f devices: pci: fix markdown quoting in doc comments
Escape the square brackets in doc comments to resolve the rustdoc
warning.

BUG=None
TEST=tools/cargo-doc

Change-Id: I78f60ef65f57b213da2f0e687ee295b7e046db9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630421
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-06 20:46:56 +00:00
Daniel Verkamp
5e43f03d80 Fix rustdoc bare URL warnings
BUG=None
TEST=cargo doc

Change-Id: Ib9d14d8aa38eef97c02c60fca3928b70a833b6bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630420
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-05-06 20:46:55 +00:00
Xiong Zhang
314dbc3afe pcie: Hotplug out interrupt for multi devices
When multi pcie endpoint devices are connected to one virtual pcie
root port as pcie multi function device, virtual pcie root port couldn't
inject hotplug out interrupt for each removed pcie device. Only one
hotplug out interrupt is needed for all the removed pcie devices.

When the first vfio-pci device send hotplug out vfio command, virtual
pcie root port will inject hotplug out interrrupt. Other vfio-pci device's
hotplug out vfio command just clean virtual pcie root port's structure,
and let virtual pcie root port prepare for the next hotplug in.

BUG=b:185084350
TEST=Check TBT dock's hotplug out function, TBT dock has multi pcie
devices.

Change-Id: I15c2807097c0065d2a78ef269720e57d15eeaf9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3604291
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-06 20:33:16 +00:00
Xiong Zhang
7245ebd353 pcie: hotplug in interrupt for mutli devices
When multi pcie endpoint devices are connected to one virtual pcie
root port as pcie multi function device, virtual pcie root port couldn't
inject hotplug in interrupt for each added pcie device. Only one hotplug
in interrupt is needed for all the added pcie devices.

So this commit adds a hp_interupt field into VfioCommandRequest, only
the last added pcie device sets hp_interrupt to true and requests virtual
pcie root port to inject hotplug in interrupt. Ohter added pcie devices
just create and configure vfio-pci device.

BUG=b:185084350
TEST=Check TBT dock's hotplug in function, TBT dock has multi pcie
devices.

Change-Id: I5a68ec38af9a32de9d4233b48e0aa3681e5a3ba3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3604290
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-06 20:33:15 +00:00
Kazuhiro Inaba
6b8153e9c1 seccomp: add sched_yield for arm64
We already allow the system call in arm32.
Testing revealed that the call is actually in use.

BUG=b:231660764, b:230609113
TEST=cheets_CTS_R.internal.arm.CtsSkQP

Change-Id: Ia04089d1454312ac637e5c76d0aceafd2ab55134
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3632320
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-06 20:19:04 +00:00
Daniel Verkamp
418c33e605 base: unify WriteZeroes and PunchHole traits
Move the trait definitions and tests into a single cross-platform file.
The File impl is also defined in the top-level crate so it can be
exported, and that impl calls new platform-specific functions that
provide the actual implementations.

BUG=None
TEST=cargo test -p base write_zeroes
TEST=tools/dev_container tools/run_tests --target=host --arch=win64

Change-Id: I15267c27bd43385545bc406a0143e943e06b16e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3631027
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-06 18:14:25 +00:00
Noah Gold
f1bd7230be devices: vhost-user net device => multi-platform
Splits out the unix specific code in the vhost-user net device into the
sys module, and adds Windows support.

BUG=b:226233737
TEST=builds

Change-Id: I62690d007700f4ea1f55e1079b18115d6f7e0876
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621416
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-06 18:03:53 +00:00
Vaibhav Nagarnaik
609872d779 hypervisor: Trait changes for VmX86_64
There are 3 new methods added to the trait:
- `handle_cpuid`
- `get_tsc_offset`
- `set_tsc_offset`

These methods allow handling of cpu exit for reading CPUID which is
required for Hyper-V support. The other 2 methods related to TSC are
required for special Hyper-V handling.

BUG=b:213150327
TEST=Compiled crosvm

Change-Id: Ibc95163d9625883521a56ec9a1573725d0f41711
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630709
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
2022-05-06 15:55:25 +00:00
Andrew Walbran
0465b61b1e Move PVTIME down below MMIO_BASE.
This leaves the region between 0x4000_0000 and the start of RAM free of
MMIO, which simplifies the stage 1 page table mappings needed by the
guest, and makes room for the pVM firmware allocation to be expanded.

TEST=tools/dev_container tools/run_tests --target=vm:aarch64

Change-Id: Ibae73a946cadd16e6f03559d23cc256f4b9d3f3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3627454
Commit-Queue: Andrew Walbran <qwandor@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-06 13:01:31 +00:00
Andrew Walbran
d4bfea4bb9 Document memory layout.
Change-Id: I3ddd6b355a77527063886065ab2c576364709fc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3627453
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Andrew Walbran <qwandor@google.com>
2022-05-06 12:09:40 +00:00
Rob Clark
5807bd9d80 rutabaga_gfx: enable debug callback on aarch64
BUG=b:231459413
TEST:croslog --follow | grep virgl_renderer.rs:152

Change-Id: I597990dbb1f9e715627db544fa2f84caa6bdfdf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628235
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-06 00:45:00 +00:00
Daniel Verkamp
13e2950632 vcpu: restore behavior of reading unpopulated Bus regions
When handling a MMIO or IO read vcpu exit, we don't want to report an
error if there is nothing on the Bus at that location. Instead, we
should just return all zeroes. This matches the previous behavior before
https://crrev.com/c/3606975 and removes an error message during
integration_tests:boot.

BUG=b:213150327
TEST=tools/dev_container tools/presubmit --all

Fixes: 06c00d580d ("hypervisor: Trait changes for windows hypervisors support")
Change-Id: I6c955ece9184f253b1173e46465cd9a6dafe25bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3631029
Reviewed-by: Vaibhav Nagarnaik <vnagarnaik@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-05-06 00:33:11 +00:00
Anton Romanov
f94281434b crosvm:cros_async:uring: Implement async operation cancellation
BUG=None
TEST=presubmit

Change-Id: I8d0bd6109e8230f953ee736a805677609f5c434d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628241
Auto-Submit: Anton Romanov <romanton@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-06 00:13:38 +00:00
Xiong Zhang
98f0e3d29f pcie_host: Use pci multi function to attach multi devices under pcei root port
Usually a TBT dock has one pcie switch and one or more pcie endpoint device
which connect to pcie switch's downstream port, when such TBT dock is hotplug in,
crosvm will find the first pcie endpoint device, passthrough it into guest and
put it under virtual pcie root port in guest, as one pcie root port could
connect one device only, This means only one pcie endpoint device could work
in guest now.

In order to let all the TBT dock's pcie endpoint devices work in guest, virtual
pcie switch is needed. But virtual pcie switch need more development work, as a
short solution, this commit mark all the pcie endpoint devices as multi pci
function device, then all of them could connect to one virtual pcie root port.

This commit do the following three things:
1. Search all the pcie endpoint devices under host pcie root port.
2. Record all the pcie endpoint devices attached to virtual pcie root port,
so that they could be removed in hotplug out.
3. Allocate pci function number to all the pcie endpoint devices.

BUG=b:185084350
TEST=Check TBT dock's function in guest, the TBT dock has multi pcie
endpoint device.

Change-Id: I07df3b556ba1ac8f7a7a3e49f221f0bf6c7ce97b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3604289
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-05 22:35:39 +00:00
Xiong Zhang
1756efb801 Pcie: Bind hotplug vfio pci device into vfio-pci-pm driver first
This commit use the same logic as in initramfs, let hotplug vfio
pci device bind to vfio-pci-pm driver first, if it fails, then
bind to vfio-pci driver.

Without this, there are error message about hotplug vfio pci device's
pm_ops.

BUG=None
TEST=Check hotplug vfio pci device's driver in hypervisor

Change-Id: I8330c7859dff2b8b2db1baa67c16181e2de66ae1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3595227
Reviewed-by: Micah Morton <mortonm@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-05 22:35:38 +00:00
Vaibhav Nagarnaik
06c00d580d hypervisor: Trait changes for windows hypervisors support
No functional changes.

Add trait changes to allow upstreaming hypervisor implementations. This
change differentiates between the hypervisor related data structures
from the VM specific actions to take. The format chosen is using a FnMut
that gets passed to hypervisor handler which contains the VM specific
actions.

BUG=b:213150327
TEST=Compiled crosvm.

Change-Id: I05fde5ff3d6b5f42684c7bfe8a135b6805c9dc06
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3606975
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
2022-05-05 22:22:54 +00:00
Vaibhav Nagarnaik
235d76e9d2 tools/clippy: Allow json formatted output
This helps with integration of `tools/clippy` in `rust-analyzer` and
potentially other IDEs which can parse the json output better than the
text output.

TEST=Ran it with `rust-analyzer` in VSCode.

Change-Id: Iceb2748994cbbacf48dc473a9ad06eec567beb0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630700
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-05 22:22:53 +00:00
Vikram Auradkar
71902a2af5 flatten windows/ directory tree a bit
Moves most of the files out of windows/win into windows/. There are a
few files still in windows/win which will be moved in later cls.

BUG=b:213153157
TEST=presubmit

Change-Id: I1fe1bf0cfdcf6ddfdbe35611c0592bac9cc1e6ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630710
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-05 21:35:50 +00:00
Vikram Auradkar
1018275948 base: Prefer descriptor over raw fd in shm
BUG=b:213153157
TEST=presubmit

Change-Id: I308ca7a554bffa0887705a294e0f53c9d2bd1299
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630705
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-05 21:35:49 +00:00
Vikram Auradkar
eee515bb56 base: windows shm support
BUG=b:213153157
TEST=presubmit

Change-Id: I1a6b17821ff274ac8c0b010c44c3927881975aaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630704
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-05-05 21:35:48 +00:00
Daniel Verkamp
d47ca53c26 third_party/minijail: update to latest
Pull in ff062d54f9a4 ("rust: remove redundant format in unreachable") to
fix warnings in Rust 1.60.

BUG=None
TEST=cargo build # no warnings with Rust 1.60.0

Change-Id: Ib2bf2445bc064fe3f81589e426de104565805bbf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3624801
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-05 21:12:48 +00:00
Daniel Verkamp
b12dcb5405 base: enable WriteZeroes tests on wine
Replace the File::set_len() call with a normal write to set the initial
file size. Wine does not support the SetFileInformationByHandle features
that set_len() needs:

  0009:fixme:file:SetFileInformationByHandle 0000000000000078, 6,
  00000000002ED970, 8

BUG=None
TEST=tools/dev_container tools/run_tests --target=host --arch=win64

Change-Id: Ib63cef7fd909d8f8a2163f6fe8a27ad8a2e27e76
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626024
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-05-05 21:12:01 +00:00
Daniel Verkamp
eaac8ba442 base: remove WriteZeroes trait
Only WriteZeroesAt is required now, so remove the unused trait.

BUG=None
TEST=cargo test -p base write_zeroes

Change-Id: I138529c4242d8307fab423fb1f1092b00cb3e950
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626023
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-05-05 21:12:00 +00:00
Daniel Verkamp
97c11d70bf disk: qcow: switch to WriteZeroesAt
This removes the last usage of the non-At WriteZeroes trait.

BUG=None
TEST=cargo test -p disk

Change-Id: I54e9990140afdebccfd1b97dd2b6e75b17f3135a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626022
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-05 21:11:59 +00:00
Daniel Verkamp
404c8261e9 cros_async: ignore punch_hole tests on wine
Wine does not support the FSCTL_SET_ZERO_DATA request:

  fixme:ntdll:server_ioctl_file Unsupported ioctl 980c8 (device=9 access=2
  func=32 method=0)

So ignore the tests that require it when using the mingw toolchain,
which we assume means testing in wine for now.

BUG=None
TEST=tools/dev_container ./tools/run_tests --target=host --arch=win64

Change-Id: I351758fac3b3e1eb44545bb1d2340ddec4461120
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626021
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
2022-05-05 21:11:58 +00:00
Dennis Kempin
1f43c67a12 infra: Also support gitlies input to support use as post-submit
BUG=1300370
TEST=./recipes.py test run

Change-Id: I5db70526f728aebd9dd253da0d85056a340c7c22
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3627054
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
2022-05-05 20:18:39 +00:00
Daniel Verkamp
9ab4f29e7a devices: vhost-user: fs: keep executor fd inside jail
A previous commit moved the creation of the executor for the vhost-user
device processes before the minijail jail_and_fork() call, and the file
descriptor of the executor was not marked for preservation when entering
the jail, so running the vhost-user-fs device would result in errors
like this:

  [WARNING:cros_async/src/sys/unix/uring_executor.rs:343] Failed to
  submit NOP for waking up executor: Failed to enter io uring: 9

This is because the io_uring context file descriptor was no longer
valid, so uring system calls would return 9 (EBADF).

Add AsRawDescriptors implementations to UringExecutor and FdExecutor so
we can preserve the fd across the minijail fork.

Other vhost-user devices were not affected because they don't enter a
jail; the fs device requires this so it can do uid/gid remapping.

BUG=b:231396155
TEST=crosvm device fs --socket /tmp/vhost.sock --tag test --shared-dir /

Fixes: d368c1520a ("devices: vhost-user: fs: remove global executor variable")
Change-Id: I38cf02034bbc28de2582e2ea92bdc13b1d6055d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628292
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Lepton Wu <lepton@chromium.org>
2022-05-05 20:03:03 +00:00
Daniel Verkamp
91c757e648 docs: rewrite PollContext architecture section to WaitContext
Describe the cross-platform abstraction from base rather than the
Linux-specific PollContext/EpollContext.

BUG=None
TEST=read mdbook output

Change-Id: I5733913d389b222fdbdcee39c3554435524c46ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3625928
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-05 18:18:40 +00:00
Vikram Auradkar
95707cfa9c io_uring: use WaitContext
BUG=b:213153157
TEST=presubmit

Change-Id: I5875151109f391fbd217269c864abe7d32b7b92e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626209
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-05 16:59:04 +00:00
Dennis Kempin
d724d41e19 infra: Add CQ status host
This will allow us to view Change Verifier task information
at https://luci-change-verifier.appspot.com/ui/recents/crosvm

BUG=1300370
TEST=lucicfg validate main.star

Change-Id: Ia9db97888a2d18241b56a0efbbebd406ae4980a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628240
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
2022-05-05 00:25:59 +00:00
Dennis Kempin
1b2000227f infra: Add CI and TRY builders to luci configuration
BUG=1300370
TEST=lucicfg validate main.star

Change-Id: I67eca30a694a69875eb585ad155fbf0419fed353
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626224
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-04 21:40:49 +00:00
Dennis Kempin
6b2b2184fd infra: Add example verify_cl recipe
The recipe follows luci onboarding instructions to verify configuration.

It currently just checks out the gerrit change provided as input.

BUG=1300370
TEST=Basic test included

Change-Id: I249ce2124f4b161465d7603155cbe25a85d2551a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626223
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
2022-05-04 21:40:49 +00:00
Andrew Walbran
ecbf9dcfa1 Derive Debug for SharedMemory.
This is useful when adding temporary logs to dump it for debugging.

TEST=tools/dev_container tools/run_tests --target=vm:aarch64

Change-Id: Ia982104943b214b67472f7bdd03c9511191c35cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3627452
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
2022-05-04 18:01:58 +00:00
Andrew Walbran
9ef18e4760 Use ? rather than Result::map.
It's simpler and cleaner.

TEST=tools/dev_container tools/run_tests --target=vm:aarch64

Change-Id: I6289722c2415e5afd51c337a8628ba7f5dcc0702
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3627451
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-04 17:01:41 +00:00
Shikha Panwar
dac771b644 Add --unprotected-vm-with-firmware flag to simulate protected mode.
This runs an unprotected VM but uses the same memory layout as for a
protected VM, loads pVM firmware, disables the same devices as for
protected mode. This is useful for debugging pVM firmware and other
protected VM issues.

TEST=crosvm --extended-status run --disable-sandbox --serial=stdout,hardware=serial,num=1 --unprotected-vm-with-firmware=pvmfw --bios=test_bootloader
TEST=tools/dev_container tools/run_tests --target=vm:aarch64
BUG=b:230475926

Change-Id: I9a8077d76874f10221071ea312291659d81da3d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3623760
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Andrew Walbran <qwandor@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-04 09:36:08 +00:00
Douglas Anderson
3df2a8db60 seccomp: Add memfd_create: arg1 == 3 for arm64
With testing, we're seeing secomp violations on aarch64. We need to
give access to "memfd_create" just like we did for arm32. Copy the
snippet from there.

BUG=b:223410173, b:230609113
TEST=Start arcvm; start android-sh; run tast arc.VMConfig

Change-Id: I4922e6decd67c3bc23fb090987b0318c384e0d68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626017
Auto-Submit: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-04 00:22:28 +00:00
Ryan Neph
60b6ed0e77 rutabaga_gfx: add context_name param to ffi/lib.rs
Follow-up to commit 13108989b1 to fix
broken rutabaga ffi after introducing the new context_name parameter
to create_context().

BUG=b:230678191
BUG=b:230788302
TEST=emerge crosvm

Change-Id: If1165662e66dd349ef4c52bece26fe724a861b78
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621210
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
2022-05-03 23:08:55 +00:00
Anton Romanov
bf27367aab Revert "Do not run cros_async tests on armhf"
This reverts commit 15a4ee3200.

Reason for revert: Should pass now

Original change's description:
> Do not run cros_async tests on armhf
>
> The test has been flaking with segfaults occasionally.
>
> BUG=None
> TEST=presubmit
>
> Change-Id: Ifbfee7e7ed5de91b7bdf9b25db7983139951f81f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3606751
> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Dennis Kempin <denniskempin@google.com>

Bug: None
Change-Id: I85d0885ce9f9fa3d46dd86536a5a20a71ffbbabb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626010
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-05-03 22:48:46 +00:00
Anton Romanov
6cc69d676d crosvm: cros_async: Drain uring operations when dropping uring executor
Otherwise we may drop the memory that kernel still references.

BUG=b:230934649
TEST=cargo test

Change-Id: I1ab4fcc721118f744b8975d01fc907c511309585
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3625899
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-03 22:48:45 +00:00
Vikram Auradkar
d0e5b6ae83 base: export PollContext as EventContext
EventContext is a platform independent name.

BUG=b:213153157
TEST=presubmit

Change-Id: Ib0f51fabb622a4ff0b0678768cee8f0e1ab9bba0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3625896
Commit-Queue: Noah Gold <nkgold@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-05-03 21:23:12 +00:00
Vikram Auradkar
68fb967912 base: Export event related symbols from base in windows
BUG=b:213153157
TEST=presubmit

Change-Id: If4b122b70c11ec1b1591296ff2f67c389fa89671
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3625708
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-03 21:04:21 +00:00
Vikram Auradkar
cdb9e125ae base: rename EventFd to Event
Note that
- the file/symbols within `src/sys/unix/eventfd.rs` have not
  changed yet.
- base still exports EventFd to keep common/cros_asyncv2 happy

BUG=b:213153157
TEST=presubmit

Change-Id: Ie0a4308e8501d2e91364b049e6575d656af866cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3624568
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-03 21:04:19 +00:00
Peter Collingbourne
6ec88e1c1d aarch64: Expose pointer authentication to guests
As with any other CPU feature, if pointer authentication is supported
on the host, we should also support it in guests.

Change-Id: Ia09ba9e3b48a88a280bd1922e976393e10545ba2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3622797
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-03 20:10:35 +00:00
Vikram Auradkar
d67395808e base: move unix specific trait into sys/unix/shm.rs
Also makes symbols exported from sys/unix/mod.rs slightly more
explicit.

BUG=b:213153157
TEST=presubmit

Change-Id: Ibf4390ddf448ab8dc41973ea5071ca59f6abfc29
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621212
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-03 18:55:33 +00:00
Vikram Auradkar
cceb96ee3c base: add from_safe_descriptor to SharedMemory
from_safe_descriptor is used by both windows and unix - windows has to
supply size because the way `handle`s are treated. So make size
optional.

BUG=b:213153157
TEST=presubmit

Change-Id: I984b706852f91f5df6b8701df09526f40068f8fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621211
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-05-03 18:55:32 +00:00
Daniel Verkamp
df929efce3 base: timer: fix crate name in ignored tests
Update the crate name in the comments describing how to run the ignored
timer tests now that they've been moved into the base crate.

BUG=b:213153157
TEST=cargo test -p base timer -- --ignored

Change-Id: I6f8d233c7743c6d379ac4c78d20a70c82344876c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621200
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-05-03 17:09:19 +00:00
Daniel Verkamp
7b272a4a1b base: use a common FakeClock implementation
The unix and windows clock modules are almost identical now that they
both use the base::Event type, so we can merge them into a single
platform-independent version now.

BUG=b:213153157
TEST=tools/presubmit

Change-Id: I442f3b21b0425f86ca79d0090cae54acfbdfd344
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621204
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-05-03 16:33:49 +00:00
Vikram Auradkar
936b567452 base: move ioctl.rs from windows/win/ to windows/
BUG=b:213153157
TEST=presubmit

Change-Id: If3958b6f0a5075f11ecdad0cb8c02a91de667b24
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3602923
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-03 02:20:00 +00:00
Vikram Auradkar
c73a8581ca base: make src/mmap.rs platform independent
Mostly moves a code around. Note-worthy changes includes,
- Adds an optional file descriptor field to MemoryMapping.
- Adds is_file_descriptor to MemoryMappingBuilder.

BUG=b:213153157
TEST=presubmit

Change-Id: I288c666eb45bf2bd2fcbcb90c0d748674c287367
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3614853
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-05-03 02:19:31 +00:00