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>
Move opp-table nodes inside cpu nodes, this makes it
easier for some systems to strip out or patch opp table
nodes.
Bug=b:284369518
Test: ./tools/presubmit
Change-Id: I8ecec279f9ca1f4eb321bf33ba3e87f080e434fe
Signed-off-by: David Dai <davidai@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5270362
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Add a single --input command-line option that can accomodate all virtio
input device types. This will eventually replace the existing input
options such as --keyboard, --mouse, and --multi-touch. For now, a
deprecation notice is added and the existing options continue to work as
before.
BUG=b:255223604
BUG=b:321746987
Change-Id: I243c76a6e16ee0019b4538a39af0363bdfe32d59
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5226605
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Just print an error message rather than panicking.
Also fix the anyhow::Error formatting to use the alternte format
specifier {:#} that we use elsewhere in crosvm to get the full chain of
error context.
BUG=b:324966367
Change-Id: I529b2c369729c050943fe354cb3acbf45020c9d1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5293234
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This adds the plumbing to hook up the FFI snapshot API
to gfxstream.
Some 2D only checks were deleted as well.
BUG=324440526
TEST=cargo test
Change-Id: I052bdde1ce508684910c64463470e95f8b67b35f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5279413
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
GpuDisplay::create_surface() and GpuDisplay::set_scanout_id() were
called back-to-back. To support multi-display on Windows (where
host windows are associated with scanouts), it makes more sense to
pass in the scanout id when creating the surface so that we can
immediately use it for routing input events. This shouldn't affect
other platforms.
BUG=b:254702853
TEST=presubmit
Change-Id: I0c4081107706420492465e755f9440f3c4363b78
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5273974
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
e.g. windows needs to check compatibility other features (sandboxing,
external_blob, ...) before conditionally enabling - just like linux
does.
BUG=b:324649619,b:246334944
TEST=tools/presubmit
Change-Id: Icfddcbcd9d2e06a404a50c32f6bdc726cf46e4b1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5283205
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>