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>
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>
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>
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>
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>
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>
There is very little of ioctl that is shared across platforms. This
cl moves all of code from src/ioctl.rs into src/sys/unix/ioctl.rs.
We also prefer to keep descriptor version of the interfaces.
Deletes unused windows ioctl.rs file located under src/sys/windows/.
Windows version of the file will have same interfaces but completely
different implementation.
BUG=b:213153157
TEST=presubmit
Change-Id: I047f58c3732c05a16dfe6885b2b875b07fedf860
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3602921
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
On Windows, we have to generate virtio_net_hdr_mrg_rxbuf ourselves since
there is no actual TAP device. Since we have to serialize it onto a
binary pipe, we need to get it as a binary slice, so here we implement
DataInit on that struct.
BUG=b:213151463
TEST=builds
Change-Id: I25a3333c20a87d6bf576f0225aac3e1c816a46ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3609237
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Our original code sample was missing some elements in the use statements
that clarified how modules were organized with sys.
BUG=none
TEST=n/a
Change-Id: I62d6a294218fa7c9c5853dbefc6550de763e7c8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3614852
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
The sys_util crate has been merged into base, but a few places still
refer to the old name. Fix or remove them as appropriate.
BUG=b:227226222
TEST=tools/presubmit --all
Change-Id: Icf9b57aff672b7c1afec768c9694e059f0f9a43d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621205
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Previously, err_buf would just be a slice of 1024 zero bytes, but it
seems like we wanted to print out the warning message instead.
BUG=None
TEST=tools/presubmit
Change-Id: I92613fd4b9e09b951cd52f5a1ab227068e9de092
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617366
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Minor style improvement - no functional changes.
BUG=None
TEST=Make sure that "crosvm powerbtn /run/<>/crosvm.sock" works as
expected.
Change-Id: Ide843707d69c25c9e0473bc8e55db8c4a6da7553
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3616883
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Add support for injecting an ACPI sleep button event using the command
line. Upon receiving crosvm sleep command, emulate vPM1 accordingly and
trigger vSCI to the guest if ACPI fixed sleep button event is enabled.
Additionally do not mask the ACPI sleep button event in FADT flags for
the guest anymore. Quoting ACPI specification regarding the sleep button
flag: "If the system does not have a sleep button, this value would be
“1” and no sleep button device would be present".
BUG=b:194391015
TEST=Boot the VM, issue "crosvm sleepbtn /run/vm/vm.<hash>/crosvm.sock",
check guest /sys/firmware/acpi/interrupts/ff_slp_btn counter and if vSCI
was injected. With some additional changes (e.g. acpid on the guest)
suspend guest by issuing sleepbtn command from the host.
Change-Id: Ie50a3a781ba4fbfa04da75186fb5549919a5bd68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3602867
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Fixes cases when we use target vm:aarch64 but arch armhf and test_runner
picks up tests for aarch64
BUG=none
TEST=run and made sure armhf-disabled tests are not picked up
Change-Id: I4d0734bb6320fc698bf16adc59de5e03b00a4a68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617081
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
Move and use windows timer. With this, windows base should export/test
Timer/FakeTimer functionality.
A series of patches move unix specific code into src/sys/unix/timer.rs,
retain platform independent code in src/timer.rs and then introduces
windows timer.rs.
BUG=b:213153157
TEST=presubmit
Change-Id: Icbd48756c270184395f0b324e9e1f49d564a929a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600761
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
- Use SafeDescriptor in Timer is it platform independent
- Move FakeTimer into src/timer.rs as it can be shared across platforms
- Add windows required but unix only(for now) functionality
A series of patches move unix specific code into src/sys/unix/timer.rs,
retain platform independent code in src/timer.rs and then introduces
windows timer.rs.
BUG=b:213153157
TEST=presubmit
Change-Id: I902cae151f7c6d073711b6055e343246f2bea2af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600760
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Alias TimerFd to Timer for now. Next patch should get rid of the alias.
A series of patches move unix specific code into src/sys/unix/timer.rs,
retain platform independent code in src/timer.rs and then introduces
windows timer.rs.
BUG=b:213153157
TEST=presubmit
Change-Id: I155936fb14c2435a121d8ef602e208ffb88ebf3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600759
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
These are not used in the downstream fork. Removing them lets us get rid
of the build.rs file for the base crate.
BUG=None
TEST=tools/presubmit --all
Change-Id: I8d8dfea77b0dc49d2179f0825edb4d1525d8724a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617364
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The constants herein are used on Windows. Normally we'd prefer to get
them from libc, but on Windows, these constants aren't available. For
consistency, cross platform code has been adjusted to use the net_sys
versions of the constants.
BUG=b:213151463
TEST= builds
Change-Id: I9048269483b9553f316aa8690da3ba4acdc8272a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3609236
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
All users have been migrated to the more portable Descriptor type.
BUG=None
TEST=tools/presubmit
Change-Id: I41ea238995242c48f9ad02a78491a73e0d9bdbe6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3616617
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Fix validation errors in luci-scheduler.cfg:
1. (acl_sets): aclSet "ci" has no entries
2. (job / Example Builder / task): legacy v1 bucket names like
"luci.crosvm.ci" are no longer allowed, use "ci" instead
3. (job / Example Builder / acl_sets): referencing AclSet "ci" which
doesn't exist
4. (job / Example Builder): Job or Trigger must have OWNER acl set
The setup doc doesn’t mention what the ACL values should be. So I coped
ACL configs from `projects/infra` configs and those can be changed later.
Bug: chromium:1300370
Change-Id: Iffc57e37b62d5048ccff83836bb6dddec9e34c68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617164
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Yuanjun Huang <yuanjunh@google.com>
base::Timer's sleep may wake early on Windows, which has knockon effects
here where we consume it.
BUG=b:229680949
TEST=n/a
Change-Id: I44a8f78e3dbc01ef562101c2706b89d2a88e5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617161
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
The Windows timer can wake up early, which may be unexpected. This CL
documents that behavior.
BUG=b:229680949
TEST=n/a
Change-Id: I2047c1cdcf0819ed1c4b5f5d4ed9c70e8cb71caf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615343
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
These files are left-over from a couple of earlier refactors.
BUG=b:213153157
TEST=`cargo test` from base/
Change-Id: I9944d42db6101f3f77a140021f0fa7d0111b075d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615335
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
In <https://crrev.com/c/1952565> we moved gettid to the common
policy. Let's move the definition in the gpu common policy to the
same place to match.
This change was requested for arm64 in the code review of
<https://crrev.com/c/3543889>. This makes the call be in the same
place for arm32 and arm64.
BUG=None
TEST=CQ
Change-Id: I40628d344ca36267302e621709bb632406595b59
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615332
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
With these changes arcvm starts when running with 64-bit userspace and
this grep turns up blank:
grep SECCOMP /var/log/audit/audit.log
Generated by:
* Hacking minijail0 to always log <https://r.android.com/2072091> and
making sure it was compiled in debug mode.
* Hacking "crosvm run" to be "crosvm run --seccomp-log-failures". I
don't truly know if this is needed but it didn't hurt.
* Diffing arm vs. arm64
From comparing arm vs. arm64 there could still be some things missing,
or it's possible that arm has simply accumulated some cruft. More can
be added later if we find it's needed.
BUG=b:223410173, b:230609113
TEST=Start arcvm; start android-sh; run tast arc.VMConfig
Change-Id: Ib5407ddecc3d19f43e14e5b036ac64baee9335bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3543889
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Douglas Anderson <dianders@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Use target_env as heuristic to detect wine as we build wine tests with
mingw while real tests use msvc
BUG=none
TEST=cargo test --target x86_64-pc-windows-gnu -- --test-threads=1
Change-Id: I96afd964d52539ab40b56d236442aa3651637991
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615511
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
The vhost-vsock device had some special-case code to handle a file
descriptor as the vhost device rather than a path. However, crosvm
already has base::open_file(), which has special handling for magic
/proc/self/fd/<N> paths and treats them as already-open file descriptors
without requiring a separate command-line option.
This change converts the vhost vsock device to accept only a path
instead of a special path/fd enum, using base::open_file() to support
passing already-open file descriptors via the /proc/self/fd path format.
The existing --vhost-vsock-fd option is kept for compatibility, but it
now just creates a /proc/self/fd path from the passed fd. Existing users
are encouraged to migrate to --vhost-vsock-device.
BUG=b:218223240
TEST=cargo test -p devices vsock::tests::params
Change-Id: Ifad2b7ad0824d4f24d9b12a4af1448557fadcdc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3564224
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
We want to auto-submit trivial rolls and send non-trivial ones
to denniskempin@ for now. This will later be replaced with
a rotation.
BUG=None
TEST=None
Change-Id: I57c4707262cc3a09a70dff9013b9e1c8c434eef0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615514
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
RutabagaComponents receive an Option<String> with calls to
Rutabaga::create_context(). This is desirable for virglrenderer so that
the guest application name can be used by the host renderer,
particularly to enable application specific GPU driver configs based on
program name matching. It is ignored by other RutabagaComponents for
now.
BUG=b:230678191
TEST=emerge crosvm
TEST=vkcube in VM
Change-Id: Ic08a02040ecc1d2e62795c248a66a88394b268e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3612467
Commit-Queue: Ryan Neph <ryanneph@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The early cross platformization work was done prior to finalization of
the styleguide. This CL reorganizes the files to match the intended long
term state.
BUG=b:226233737
TEST=bots
Change-Id: If2058aa69122606071b3fc26fd85bbd31f5977fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3597037
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Kokoro will treat the files as build artifacts and tries to rsync
the ~80GB to the executor. See b/30309837.
BUG=b:2089374426
TEST=None
Change-Id: I71df011025a7cff664a134bdfbf5783709365358
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3611872
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
At least for now, to keep previous behaviour fully.
BUG=none
TEST=cq
Change-Id: Idb6114d1ea5145cdafa9ab25e4e5f2f9887e8dc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3611465
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Hotpluggable devices are always automatically attached to virtio-iommu.
There's really no reason virtio-iommu needs to be its ovwn flag. So
remove the '--virtio-iommu' option and automatically instantiate a
virtio-iommu device if hotplug is supported.
BUG=b:185084350
TEST=Boot on manatee and a virtio-iommu device can be seen through lspci
command in CrOS
Change-Id: I42dce58d60d2f04e37279d5623fc52829946e5d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3595226
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Previously the iova_max_addr was got according to the cpu physical
address size. Since the cpu physical address is no more than the maximum
iova size provided by hardware iommu, the iova space size can work for
any passthrough devices. But it may not utilize the whole iova space, as
the iova size isn't got from the underlying hardware iommu.
This patch introduces a way to get iova_max_addr according to the iommu
ranges' info, therefore the iova_max_addr can be precisely calculated.
BUG=b:185084350
TEST=Boot a crosvm guest with vIOMMU enabled
Change-Id: I4ed37bf158208d61663a4bf474549df4fce3adf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3580373
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Assign a sensible default value to page_size_mask and reject the empty
page_size_mask case.
BUG=b:185084350
TEST=Boot a crosvm guest with vIOMMU enabled
Change-Id: Id711c9ff25265f707618a58eb212fd5ca16383e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3580372
Reviewed-by: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>