This seems to build fine upstream, so re-enable it to ensure it does not
get broken accidentally.
Change-Id: I1fcb5678ce33edb24d1aa047fa405b1d27100206
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5321440
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Replace the OnceCell<()>, which is effectively a slightly quirky
AtomicBool, with an actual Mutex, since we can construct them statically
now.
This ensures that the early logging init is finished before returning
from either early_init() or test_only_ensure_inited(); this doesn't
really matter for non-test code, since we would immediately panic if
early_init() were called twice, but for tests, it makes sure that the
second thread does not start calling logging functions before the first
thread finishes running apply_logging_state().
Change-Id: Ic857426cbd02096d5971ff7c41f79964ee294887
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5318702
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The standard library versions of these functions have been const since
Rust 1.63. Make our sync wrappers match.
Change-Id: I63ec097aa9fbb63735528827576f08ced2304a16
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5318701
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This has been replaced by individual feature flags, which are enabled by
the downstream ChromeOS chromeos-base/crosvm package.
BUG=b:244618505
TEST=tools/dev_container tools/presubmit
TEST=emerge-$BOARD chromeos-base/crosvm
Change-Id: I9f540d947ef8050335e5f8ca3e33ebbbf32a1836
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5311522
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
BUG=b:326256145
BUG=b:257987535
This was used by chrono::Local, which we aren't using anymore.
Change-Id: I2fb828044a319f6bc65d23748f97d3e271a617ff
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5314564
Commit-Queue: Andrew Walbran <qwandor@google.com>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Turns out impl Trait in return position means we only get *one* concrete
return type for all branches. In a future CL we'll have multiple return
types, so paradoxically, we'll have to think inside the Box.
BUG=b:326170473
TEST=builds
Change-Id: If759995d47e717adfeae6153f81f9940062e1e4e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5320337
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
It used to be a debug message, change it to an error message.
BUG=b:307946404
TEST=./tools/presubmit
TEST=emerge-board crosvm, and deploy to dut
TEST=CQ
Change-Id: Ib0a9cc55dd56708dc20d96dc45b12cbc72a6ea0f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5299852
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Dawn Han <dawnhan@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
The current host backend implementation does not make use of this, but
future backend implementations require explicitly stopping the device
before dropping it.
BUG=b:297957754
TEST=presubmit and CQ
Change-Id: Ie929102075ad54fe09b60ccd36f35fc21a2a4279
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5316377
Auto-Submit: Morg <morg@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Some systems do not populate cpu-map information and
use other ways of grouping CPUs in a frequency/topology
domain instead. Use normalized cpu_capacity information
to determine clustering instead.
BUG=b:326170473
Test=./tools/presubmit
Change-Id: If4ba7d224338798fcf2c0ffbaa91547dc2f2e16d
Signed-off-by: David Dai <davidai@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5319790
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
These can share the generic unix versions that are also used on Linux.
BUG=b:309011910
Change-Id: Iad78c11cf4fff3099331b6cee585d617772e48bd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5310530
Reviewed-by: Cody Schuffelen <schuffelen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
The current SnapshotReader/Writer interface returns Files for raw
fragments. When we add snapshot encryption, we will need to return an
encrypting or decrypting streaming wrapper, and this won't be a File.
This CL changes the interface to return impl Read or impl Write. As
part of that, we also had to make a significant safety change to
how memory snapshots are taken.
Memory snapshots used to be written with FileReadWriteVolatile. This is
because we assume GuestMemory is always mutably borrowed by the guest,
and it is UB to have aliased references in Rust. While formally
undefined, the rough reasoning for this is that LLVM optimizations
assume noalias on mutable references, and if that is violated at
runtime, optimizations can result in changed behavior. In the snapshot &
restore case though, we know the guest is not running because its VCPUs
are stopped, so its mutable reference can be ignored (temporal overlap
for aliasing is required for UB to occur). Luckily for us, the host code
will never alias guest memory because up until this CL, we assumed that
was never safe.
Credit: thanks to fmayle@, who originally proposed using Read/Write in this
manner in a CL that added snapshot compression.
BUG=b:326170473
TEST=builds
Change-Id: Iafd9175f684bc197329a0f5aae57685f5cfd677e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5313630
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Refactor handling of control tube events into a dedicated function,
rather than inline in the run loop.
BUG=None
TEST=tast run DUT arc.Boot.vm
Change-Id: I74ccba1f653717b44b3e65275db5ce15d5e86dc3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5316376
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This CL implements interrupt moderation as defined by the xhci specs
section 4.17.2. Instead of using the IMODC (Interrupt Moderation
Counter) we just store the timestamp of the last interrupt event and
calculate the amount of time elapsed according to the formula provided.
BUG=b:325388860
TEST=Verified that USB functionality works on bulk and interrupt devices
Change-Id: Ie7892de3af5b8c2f8f8aead722e4d94d115ea030
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5298957
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Morg <morg@google.com>
Commit-Queue: Morg <morg@google.com>
1. Introduced two structs for window management:
a. WindowResources: a host window that isn't currently used (no
Surface associated).
b. WindowMessageProcessor: a host window associated with a guest
display/Surface.
2. Enabled WindowMessageDispatcher to manage multiple
WindowResources and WindowMessageProcessors.
3. Enabled adding/removing multiple Surfaces. See the CreateSurface
and ReleaseSurface commands in DisplaySendToWndProc.
BUG=b:254702853
TEST=presubmit
Change-Id: I5940a597e00f58dfb99b43149d72a7e36f196f7e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5286460
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Until the tokio executor is implemented, there are only
platform-specific executors.
Bug: b/320603688
Test: tools/presubmit
Change-Id: I380a6b61f6f6a0cca2fbd3e89d63a2c9c8d051ef
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5201658
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
The env-logger crate's default features are:
- auto-color
- humantime (unused since we override the format string)
- regex (allows regex-based filtering)
I don't think anyone is actually using the regex functionality when
filtering log messages, and module-based filtering is still possible:
crosvm --log-level=info,devices::usb=debug run ...
This is the only place the regex crate is pulled into crosvm, and
removing it reduces the binary by about 500 KB (!) in a normal ChromeOS
build configuration.
Change-Id: Ia1275e2a3f70790ee805fab25139a2da2f578559
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5313755
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
- Functions should be marked as unsafe, as the caller needs to
guarantee that the directory is a valid string.
- Comment fixes
BUG=324440526
TEST=cargo test
Change-Id: I43405fd2d63a8de3c9b73f349f7e8928373cf9ab
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5313625
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Andrew Walbran <qwandor@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Currently crosvm does not allow users to give multiple serial devices
with `console=true`. However, actually Linux kernel can have multiple
`console=` options at the same time. Each serial hardware type can have
one console. Kernel logs will be copied to all consoles, and the inputs
will be taken from the last `console=` device. Even if multiple
`console=` options for the same device type are given, no error occurs
and the last one is effective. Therefore, crosvm doesn't have to
restrict console option.
Thus, this CL removes the restriction on multiple consoles of crosvm.
BUG=b:325362584
TEST=`crosvm run --serial type=file,path=serial,console=true --serial
type=stdout,hardware=virtio-console,console=true,stdin=true ...`. Both
file and stdout have console outputs
Change-Id: I911c9223704eb91f369b74e9cdcd901f115aa7eb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5306814
Commit-Queue: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This CL reverts a change from https://crrev.com/c/2202745 where we had
to remove a busy check due to a bug in our implementation. The fix to
the bug is to make sure we set both EHB and Event Ring Dequeue pointer in
the same function so we don't call interrupts multiple times on the same
event.
BUG=b:309889022
TEST=`while adb shell echo hi; do : ; done` and old crash doesn't happen
Change-Id: I26f06774238fc0f40f1363012e8c41bab0d50e56
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5294354
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Morg <morg@google.com>
There don't appear to be any new clippy warnings, and this is the
version of Rust that Android is now using: b/303252546. Work for the
next version is tracked in b/310977762.
This doesn't have any particular features I'm looking for (async traits
only come in 1.75.0). I'm not particularly attached to this change. If
it's easy to upgrade the container though, we could ensure no new clippy
warnings appear.
Android rust versions appear here:
https://cs.android.com/android/platform/superproject/main/+/main:prebuilts/rust/linux-x86/
Also not sure what the ChromeOS release schedule is.
Release docs: https://releases.rs/docs/1.73.0/
Test: tools/dev_container --clean bash -c "rustc --version && tools/presubmit clippy"
Change-Id: I2d3010c3032053709f0c0beb7dcbe2b80d782415
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5201659
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
libc6:arm64 will call telinit to restart affected services.
This will block indefinitely in the container without init running.
The workaround is to replace telinit with true to make it a
no-op.
Also removes the mount caches from the build process as they seem
don't seem to work with APTs file lock.
BUG=b:322015733
TEST=make -C tools/impl/dev_container
Change-Id: If1079581680ac9edc981ad46afb3173508668335
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5230818
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Specify patch version explicitly to improve the reproducibility of
e2e_test image generation. This patch version is determined based on r11
of the prebuilt images, which is the currently used version at this
point.
BUG=b:295256641
TEST=./tools/dev_container ./tools/presubmit
Change-Id: I6e91ce88bec4827168a61c682c3de9f0e94e4c70
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5308635
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Hikaru Nishida <hikalium@chromium.org>
On Azure Dv3 instances `unrestricted guest` is not available.
This prevents crosvm from booting, because TSS address overlaps
with BIOS memory region when BIOS is larger than ~250K.
This fix allows 16M BIOS maximum size and enables identity map address
which allows crosvm to boot on machines where `unrestricted guest` is
not available.
BUG=None
TEST=tools/presubmit
TEST=Boot an AOSP Cuttlefish VM on Azure (without unrestricted guest) and GCP (with unrestricted guest)
Co-authored-by: Bogdan-Cosmin Chifor <bogdan.chifor@tii.ae>
Co-authored-by: Mikko Koivisto <mikko.koivisto@unikie.com>
Co-authored-by: Myung Kyu Kim <myung.kyu.kim@unikie.com>
Change-Id: Ibf7b6685eca969f5f52dd6e5f3510bf919c14e2c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5290234
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This is only intended to be used on the downstream ChromeOS version of
crosvm, so we should really be patching it there rather than carrying
this code in upstream crosvm.
The crosvm version of the memfd panic handler will be replaced with the
version from libchromeos-rs.
BUG=b:325081271
BUG=b:309651697
Change-Id: I0587bacd103a3f2471d2ac7227903df6cd7e0028
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5293235
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Ensure cluster lists are unique, while the current cluster
configurations are handled by Linux, they bloat the devicetree and are
difficult to parse by some secure firmwares.
Bug=b:284369518
Test: ./tools/presubmit
Change-Id: If26fe8d82b0056f656ac29bca130969fdd303ce7
Signed-off-by: David Dai <davidai@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5303156
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Certain platforms use the noncoherent-dma feature to appropriately
consider the guest PAT's memory type (caching mode) when configuring the
effective memory type in SLAT, instead of simply ignoring it in favor of
the host PAT.
Dynamic blob mapping has already integrated support for noncoherent-dma
upon setting up each mapped blob's memory region (e.g. KVM memslot),
but fixed_blob_mapping merged while naively ignoring the feature.
Now, we respect the feature when setting up the shared/prepared memory
region (appropriately passing the new MemCacheType enum through to the
hypervisor).
BUG=b:246334944
TEST=tools/presubmit
TEST=(in venus-enabled VM w/ noncoherent-dma) `deqp-vk -n dEQP-VK.memory*` passing
TEST=(in venus-enabled VM w/ noncoherent-dma) Hollow Knight, Portal 2,
Valheim, CS:Source all look fine.
Change-Id: Ia31763c80765a42a1932bfb347ffa57a2faf6fab
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5285309
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>