syslog() is used on the error path for wayland display management. On
32-bit arm, the glibc implementation of syslog() uses send(), which
causes a seccomp violation. This was regressed a long time ago and never
found until now.
Fixing syslog() on 32-bit arm requires changes to gpu_device.policy on
32-bit arm (to add send() and socket()), but we'd prefer to call
crosvm's configured logger and drop syslog() anyways, so let's just do
that.
TEST=Run crosvm + glxgears/vkcube
BUG=b:281165392
Change-Id: I69bcf8cf3617d117360c4a255b1cc1234493eccc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4517955
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
`get_msrs` truncates the vector on partial success.
Haven't seen this fail. Adding the check as a precaution.
Change-Id: I7c3a4c2408daa9d7a00257ae758da45011a40311
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4515456
Reviewed-by: Elie Kheirallah <khei@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
At present, if we set up gerrit message hook using `./tool/cl`, there
will appear a usage message. Reader may think they did not install the
message hook successfully.
Add explanation to documentation to explain even the usage messages
appear, the message hook is still successfully installed.
BUG=b:281798401
TEST=mdbook build docs/book
Change-Id: I3be36315e20d79aff58d0777d0c454b42c8c688a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4520798
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
At present, the Testing section sits before Running crosvm section which
will confuse readers.
Swap the order of Testing section and Running crosvm section in
SUMMARY.md makes documentation clearer to readers.
BUG=b:281780797
TEST=mdbook build docs/book
Change-Id: I33d78b9eb456bd5ef529e1d3de607e7ec519dac2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4520797
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
We originally held this back when switching to the 2021 edition of rust
as it was causing issues in downstream projects. If this is still an
issue, I would recommend not merging this change downstream.
BUG=b:223855233
TEST=CQ
Change-Id: I4a3eb99ee34f4495dd42cd0dea0f4864002519c3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4517945
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
The build.rs file will be compiled for the host platform and cfg()
flags will reflect those of the host platform and not of the build
target.
Use CARGO_CFG_ environment variables instead.
BUG=b:240593511
TEST=CQ
Change-Id: Ib8b6c8e8bfb44ad83212bb2aa40a17a4e16a4adf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4518569
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
This was left over from commit a8985f0ba8 ("x86: remove deprecated
KVM based s2idle notification related code"). Additionally, the comment
about the bindgen script was removed even though it is still in the
script, so the generated output did not match what was checked in.
BUG=None
TEST=kvm_sys/bindgen.sh
Change-Id: I241220dd5d0121ce2dca1ce0597ebf1f258f1c20
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4518567
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Add devicetree node for a kvm-cpufreq device for arm64. If the guest
kernel has kvm-cpufreq driver and the host supports required hypercalls,
the kvm-cpufreq driver will start working.
This depends on out-of-tree kernel driver (crrev/c/4037181), so this
will be reverted when that driver is upstreamed correctly.
BUG=b:249685960
TEST=Boot ARCVM and confirm there are policies under
/sys/devices/system/cpu/cpufreq
UPSTREAM-TASK=b:256983979
Change-Id: I2f86e10a984b0adbbd93f34f39ee7e7b13571a6d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4453483
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Masami Hiramatsu <mhiramat@google.com>
Commit-Queue: Masami Hiramatsu <mhiramat@google.com>
On a normal Linux desktop system, the Wayland socket is usually in
/run/user/<id>, which can contain other mount points. The mount syscall
will fail when trying to use MS_BIND alone on this directory. Adding
MS_REC for a recursive mount allows the bind mount to succeed.
BUG=b:281542226
TEST=crosvm run --wayland-sock $XDG_RUNTIME_DIR/wayland-0 ...
Change-Id: I42c2a9492c01f224ef7e1b0fb77729b0aaf6cecc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4514518
Reviewed-by: Shin Kawamura <kawasin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This is a follow-up to commit 63f50362ec ("devices: virtio:
overhaul DescriptorChain API"). With this change, the normal case of
creating a single Reader and Writer per DescriptorChain, there is no
need to copy the MemRegion lists, which minimizes the extra allocation
and copying overhead.
Additionally, the ExportedRegion list is now stored in an Arc, so no
copying is required; instead, the reference count is incremented.
BUG=None
TEST=tools/dev_container tools/presubmit
Change-Id: Ibd0b2bfc5bfd2d8c84e7ed4d024e314cbdf33a81
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4510437
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Devices now handle ioevent registration dynamically, which makes
ioevents compatible with BAR reprogramming, so we can remove the
PciDevice trait function and its callers.
Change-Id: Ic178c48e585b24a56f017d824602f6856f6b40a6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4500898
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This makes sure the BAR location registered for ioevents is correct if
the guest reprograms the BAR registers before activating the device.
It is also the last use of the PciDevice::ioevents() function, which
will be cleaned up in another commit.
Change-Id: I57d0625974e67ce313d44c83b155bf906a686e92
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4500897
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
SwapStatus, SwapState, SwapStateTransition, SwapMetrics are directly
contained into crosvm_control.h
SwapState is translated as C++ enum.
SwapStateTransition::time_ms is now u64 because u128 does not support
repr(C).
Changed usize in the structs to u64 because usize is translated as
uintptr_t.
BUG=b:265386761
TEST=cargo build -p crosvm_control
Change-Id: Ia9df56d40c1884067a712620e0fc797e07af77a2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4486549
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This add one line log on x86 devices. This will be reverted after we
collect some samples from production.
BUG=b:183540186
TEST=emerge-$BOARD crosvm
Change-Id: Ib542742726cf4112953b959dfe5a88b71131991e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4510029
Auto-Submit: Lepton Wu <lepton@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Lepton Wu <lepton@chromium.org>
Adding Victual PMC device allows to trap on MMIO access caused by its
Linux driver counterpart upon entering s2idle state. Linux Virtual PMC
driver registers notify() hook, which is triggered before system
actually enters s2idle state and triggers _DSM method which in turn
triggers MMIO access causing mentioned trap.
More info can be found in relevant linux kernel mailing list thread which
implements kernel counterpart:
https://patchwork.kernel.org/project/linux-pm/patch/20230213100921.268770-2-jaz@semihalf.com/
Upon Virtual PMC BusDevice write() handling, trigger functionality
responsible for handling s2idle notification, which is: wakeup blocked
thread awaiting guest suspension to finish.
Old functionality for handling s2idle request based on non-accepted by
Linux community, hypercall based solution - is removed as separate patch
CL:4507305
BUG=b:194391015
TEST=Make sure that S2Idle notification from guest are seen by crosvm
when --s2idle parameter is used. In such case the guest suspension is
detected quite fast and 15s timeout is not reached.
Change-Id: I79e1755cd344c46e7fa0dabc211cf7e354583204
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3780642
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
The BufferData can be used for constructing the ACPI tables - make it
public so it can be used by different modules.
BUG=None
TEST=None
Change-Id: Ie35196dbff57845c410d895e73b9aafbac2cf66e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4507051
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit reverts 344e2432d1 "x86:
handle KVM_SYSTEM_EVENT_S2IDLE request" but also some other parts which
grow around this concept. The s2idle notification linux counterpart
based on KVM hypercall was rejected in the linux kernel mailing list and
new approach was suggested which is based on virtual PMC. Additionally
the privileged guest term was introduced only for ManaTEE, which is not
evaluated anymore.
The new Virtual PMC related approach is used instead for getting guest
s2idle notifications, see CL:3780642.
BUG=None
TEST=Build + tools/presubmit crosvm_tests_x86_64
Change-Id: I3cf4b77ab192198fe9e8b990b994a41105c2e72f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4507305
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
To more accurately model the underlying hardware, add dynamic power
coefficient as a parameter to pass from the host OS to the guest OS.
This gives an indication to the guest OS about which CPUs and which
clusters of CPUs are more efficient.
Add a config option "--dynamic-power-coefficient" that allows the power
coefficients of individual CPUs on the guest to be customized at a more
granular level. The new parameter is a scalar coefficient for
calculating power.
See Documentation/devicetree/bindings/arm/cpus.yaml for more info
Bug: b:280358794
Test: ./tools/presubmit passes; Verified new parameters show up when
running crosvm
Change-Id: I0246adcb893546a88a292fcfe9ff40fb08411b10
Signed-off-by: Sam Wu <wusamuel@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4497380
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Dai <davidai@google.com>
Remove the architecture-specific requirements from the gdb config
checks. This enables gdb across every supported target_arch without
having to manually add new architectures to each cfg check.
For the specific case of target_arch = "arm", this patch will newly
enable gdb support. The gdbstub protocol will still send aarch64 state,
matching the guest.
This stubs out enough riscv64 gdb functions and types to make
`cargo build --features=gdb` compile, but gdb support will not be
functional on that architecture without additional work.
Change-Id: I63b079b7a3dca4aec2c13c775c0ccb8850625884
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4506285
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dylan Reid <dgreid@rivosinc.com>
It is no longer needed.
BUG=b:267499599
TEST=CQ
Change-Id: I06b6cee2c09d8c24e424c341ce93ee091d83002c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4506282
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
It's a common problem that the system installed version of virglrenderer
is used during the build, which almost always is too old to be used
with crosvm.
BUG=b:220199446
TEST=CQ
Change-Id: Iaf8c8a6ac359eecee4fff4025c04c524ced2e329
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4506283
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Filter riscv crates that can't yet build so clippy can run on those that
do.
Change-Id: I43ddd5ab6c12a42812949d552037a35a1e928296
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4505758
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
In preparation for enabling tools/clippy to check riscv, clean up the
warning in the hypervisor crate.
Change-Id: I8b1c6ff54548ee5a3752fb453a4030b7d4582364
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4505757
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
In preparation for enabling tools/clippy to check riscv, clean up the
warning in the hypervisor crate.
Change-Id: Iab2d1f703e0ab5e40ed165873376cdfabdc3de60
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4505756
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This reduces the number of dependencies for development using
the container to just python and podman (or docker). All other
tooling can then be run inside the container where it will have
access to 3p packages (i.e. argh and rich).
BUG=b:267499599
TEST=dev_container workflows with --stop, --clean --use-docker etc.
Change-Id: I7f2d51cd6b7126fcde4967da2f9c526f71b93de5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4499659
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
Updates the riscv install script to use the debian ports repository
to install dependencies.
The container version is upreved to use the newly built image
that includes the changes in this CL.
BUG=b:280448021
TEST=dev_container run_tests -p riscv64
TEST=https://ci.chromium.org/swarming/task/61fca4b26ac4de10
Change-Id: I7dbfac56fd04c8fd9635c981c13dcfcbdad90bcc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4500611
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Status does not depend on any swap related feature. Exposing Status to
all variants is easy to implement swap status FFI at crosvm_control.
The new "swap/enable" feature switches the actual vmm-swap functionality
to be compiled. The feature is enabled by default on "swap" crate but
disabled on the root package for test dependency.
Vmm-swap feature is enabled by `--features=swap` flag on cargo build as
before.
swap/src/controller.rs is copied from swap/src/lib.rs.
BUG=b:265386761
TEST=tools/dev_container tools/run_tests2
Change-Id: Ifc2539a62d0f594fd5bbb41623c735ea2621f7b6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4486546
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Shin Kawamura <kawasin@google.com>
Reviewed-by: David Stevens <stevensd@chromium.org>
The name "swap" is used for both crate name and feature name. By
https://crrev.com/c/4486546 the swap crate is no longer optional crate
and "swap/enable" feature dependency in "swap" feature cause infinite
recursion on tools/custom_checks.
The optional crate consideration was introduced by
https://crrev.com/c/3943594.
The optional crate should be validated more accurately.
BUG=b:265386761
TEST=tools/presubmit
Change-Id: Icb787b37392576519dbaeb3f0d78a0a5d8775098
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4495925
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Shin Kawamura <kawasin@google.com>
This functionality is not used anywhere.
BUG=None
TEST=cargo test -p devices
TEST=tools/dev_container tools/presubmit
Change-Id: I8664c0a4f7c7b9ea8b074982a9eb9733e3e52f05
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4496847
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
The KVM docs say
If setting an MSR fails, ..., it stops processing the MSR list and
returns the number of MSRs that have been set successfully.
So, a return value of zero really means the operation completely failed.
Change-Id: Ic98cdb02513ff86e22fb6b048e7ceb2d6b7e554a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4500732
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>