Make status queue properly optional. As part of this, refactor how the
optional event queue is handled, to prevent exponential growth in the
number of select statements needed to handle optional queues.
BUG=None
TEST=ARCVM boots and balloon works
Change-Id: I55d59875b7e0223a57f1c8c5d0e0d8a4a6b9a26c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3779083
Tested-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Currently this only builds and runs for Windows
BUG=b:213149155
TEST=built and presubmits
Change-Id: Icc874da61c987fc36c4c9ccea56bd136d660f453
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764469
Tested-by: Richard Zhang <rizhang@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
When running tools/cl on a branch without an upstream set, ask if the
user would like the script to fix it automatically.
BUG=None
TEST=tools/cl upload # on a new branch with no upstream
Change-Id: Id5f4ee30058a209ac352013159d09278cd92a23b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3780873
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
It was missing in some commands. Also runs them when no command
is specified. This will ensure the git hook is installed and
print documentation when calling: "./tools/cl"
BUG=b:239823229
TEST=./tools/cl
Change-Id: Id2248310011f4692cf477ac51d52b578d2f00a8d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3780868
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
The doc was long outdated.
BUG=b:239823229
TEST=None
Change-Id: If324c7b3fe22f03df4307a5eed1002465b5cce4d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3780867
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
We want to ensure that ChromeOS workflows to not break over time.
This is the primary supported workflow for building and testing
crosvm.
BUG=b:239255196
TEST=led get-builder luci.crosvm.ci:chromeos_amd64-generic | led
edit-recipe-bundle | led launch
https://ci.chromium.org/swarming/task/5c3a9bd9490cad10
Change-Id: I3afed9ebeff3ac2829fc7990ff520c24017ac812
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3780866
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Reflecting the new repository, supported workflows
and code submission process.
BUG=b:239255196
TEST=None
Change-Id: I52d7130ec3d72ea5ef8748875cae029f0b1f701b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3780864
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The group will allow us to give service accounts CQ access.
Notably it'll allow us to add the recipe autoroller.
BUG=None
TEST=lucicfg validate
Change-Id: I3127dc2127a93ea8b76bfd31941095eb243556c2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764437
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Fill in some of the missing imports and adjust the ones with paths that
differ in upstream crosvm.
This change was tested by removing crosvm from WIN64_DISABLED_CRATES in
tools/impl/test_config.py. Some dependencies are still missing, so the
crosvm bin crate does not fully compile yet.
BUG=b:213146388
TEST=run_tests --build-target=mingw64
Change-Id: I112e1db8bf34eed9fba7e539ce8ec84318acd291
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3777070
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
This is used in src/sys/windows/main.rs.
BUG=b:213152497
TEST=Attempt to build crosvm bin crate for Windows
Change-Id: Ia49b9925a85ed738bcc6a229efd79840e9fd6c72
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3777069
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Exclude crash-report feature when generating cargo-doc because the
feature only works on Windows. This should fix GitHub action's failure
started by crrev.com/c/3765346 [1].
[1] https://github.com/google/crosvm/runs/7417889096?check_suite_focus=true
BUG=none
TEST=run ./tools/cargo-doc locally
Change-Id: I1481bf8221fc7a583b9147992d116278b4df9e05
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3780081
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
This adds a new dt node identified by "qemu,vm-watchdog". The watchdog
is instantiated per-cpu and each instance has the following layout
described in this document:
https://docs.google.com/document/d/1DYmk2roxlwHZsOfcJi8xDMdWOHAmomvs2SDh7KPud3Y/edit?resourcekey=0-oSNabc-t040a1q0K4cyI8Q#heading=h.4hbqud2zl941
The watchdog uses an internal clock which is driven by the
timerfd at regular intervals. When the internal clock expires, a counter
value is decremented. When the counter register reaches value "0",
the watchdog expires. To prevent 'watchdog expiration', regular pet
events should be sent from the guest kernel driver.
BUG=b:213422094
Signed-off-by: Sebastian Ene <sebastianene@google.com>
Change-Id: Ic8c0488ffdfed1a43b6deb34b72d37f46e5e18a2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3768290
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Nobody ever toggles this flag, implying this flag can be removed.
By default, the gfxstream assumes ANDROID_EMU_virtio_gpu_native_sync
is present, which is the desired behavior.
BUG=b:239639751
TEST=compile gfxstream
Change-Id: I64d19c5fc2c0ac59a87ee25fbd1e7b6ed9522410
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3778078
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
It was a bit difficult to see that the config parsing errors would be
printed out before init_log(); split it into a separate block to make it
more understandable.
BUG=b:239622092
TEST=tools/presubmit --all
Change-Id: Id7fb76c706c2e9f5e0161dac28099bff95fd5f78
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3774317
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
If run_vm fails to convert the RunCommand into a Config (e.g. due to
failures in validate_config), no error message would get printed, since
the error!() logging macro was used before logging was initialized.
Instead of error!(), use eprintln!() to print the error to stderr so we
actually get useful output for configuration validation errors.
BUG=b:239622092
TEST=crosvm run --kvm-device /does/not/exist vm_kernel
Change-Id: Ia63f5b10f6ac7087aca10aa71df7d45a6fd5b70e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3774316
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
BUG=None
TEST=./infra/recipes.py test run
led get-builder luci.crosvm.ci:health_check | led edit-recipe-bundle | led launch
Change-Id: Idd6b0b70271bbc0b489bd4a25470ca53e1e2a4ac
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3777063
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
The submodules on our builders were getting into a bad state.
This change should be able to repair those cases.
BUG=None
TEST=./infra/recipes.py test run
Change-Id: I87198c30478f25d505f9a9ad5211af6fe7bbd547
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3777061
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
This allows the selection of the hypervisor kind from the command line;
it was previously added to Config, but there was no way to set it from
the CLI.
Linux builds only have one hypervisor available (kvm), but the config
support is stubbed out to match the Windows platform code so it can
potentially be hoisted into a common implementation later.
BUG=None
TEST=tools/presubmit --all
TEST=crosvm run --hypervisor kvm ...
Change-Id: I6eedb6f8179233bfd51f56efd6713cfe9453dc25
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3774503
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Remove the redundant file existence checks and replace them with a
better error message from the call where we open /dev/kvm or the path
specified by the user with --kvm-device.
Example error message:
crosvm has exited with error: failed to open kvm device
/does/not/exist: No such file or directory (os error 2)
BUG=None
TEST=crosvm run --kvm-device /does/not/exist vm_kernel
Change-Id: I8ba7ce5d77441f193174ec891709a47165787a9f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3774502
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Now that we no longer switch drivers for VVU PCI devices when accessing
them via VFIO, open_vfio_device() need not be aware that it is dealing
with a PCI device and can instead handle any device given its sysfs
path.
BUG=b:196186396
TEST=Boot redrix-manatee, start crostini.
Change-Id: Ieda8f2b846a96b9c054dfdd0602101a4b3c11424
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3766820
Auto-Submit: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Tested-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
- Upstreams all windows specific files in src/
- Adds windows specific args to Config/Command parsing.
- Adds noop anti tamper crate.
There are still some deltas between upstream and downstream src because
of moving HEAD in upstream and some code refactors downstream. But this
is most of the code.
BUG=b:213146388
TEST=built on windows downstream. upstream crosvm does not build on
windows yet because of to-be-upstreamed dependency crates.
presubmit.
Change-Id: I3445975749f8108ae51d5fb6e1c2f1447439e1fb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3765346
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Tested-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
As part of the split, we're re-enabling the Windows code (it was
commented out as part of earlier refactoring).
BUG=b:237597358
TEST=builds
Change-Id: I04554b109033b4616c0a6521757c4aeb70d2ea5d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3767462
Tested-by: Noah Gold <nkgold@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
A few PciDevice implementations were providing an ioevents function that
did the same thing as the default trait implementation. Remove them to
clarify which devices actually need ioevent support.
BUG=None
TEST=cargo build
Change-Id: I40a6ca14028ea1d739f169c81079ffac648e7035
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3770820
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reconfigure usage of audio_cras cfg to allow virtio-snd device
to be compiled with null audio device. audio cfg is still needed
to compile audio device. Also fix clippy errors in virtio-snd.
BUG=b:233542268
TEST=emerge and aplay with enabled and disabled audio_cras cfg
Change-Id: I2e0a4114314891794dbf3c060f47247f876db80a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3765005
Commit-Queue: Norman Bintang <normanbt@chromium.org>
Tested-by: Norman Bintang <normanbt@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Mount the cros root instead so the git worktree or symlink can be
resolved.
BUG=b:234322274
TEST=./tools/dev_container
Change-Id: I52d0cbe5e9a38cb6febcf1f328970e13209bcf9f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3768048
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
This removes a bunch of boilerplate parsing code.
BUG=None
TEST=cargo test
Change-Id: I8c557feb9f483552f3ba7f905eb49b53f48d8177
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3767095
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Implement custom serde Serialize/Deserialize versions that just format
the PciAddress as a plain string rather than a struct so it can be used
for parsing command-line options.
BUG=None
TEST=cargo test -p devices
Change-Id: Ia6e5891c614be1fc7e1d136e40835e1622f5a2c0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3767094
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Windows does not use monitor. Move unix specific monitor feature
under sys/unix.
Enable bat module for windows.
BUG=b:213149155
TEST=presubmit
Change-Id: Ic48562f4d7e78a332e5387e5274131d35a59a7b5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764428
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Tested-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
The crosvm run --syslog-tag argument was accepted, but it did not do
anything after the argh refactor. Tweak the LogConfig setup so the
default tag is "crosvm" and can be overriden by the --syslog-tag option.
BUG=None
TEST=crosvm run --syslog-tag="TESTVM" ... # observe tag in syslog
Change-Id: I7cd83b0623ac725c59a1dc1fcc4f8952e749e00a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764041
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
We recently started to map VVU device registers into the process address
space, but accessed them like regular memory. This is dangerous as the
compiler can reorder and optimize these accesses.
Add new `write_obj_volatile` and `read_obj_volatile` ops to
`MemoryMapping` that are designed to perform such I/O accesses and use
them where appropriate.
BUG=b:238282334
BUG=b:237647217
TEST=VVU console device can be created from Linux.
Change-Id: I40f30acfd358248d4f9d0c00d5cd708eabae047d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762971
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Move MemoryMapping's implementations of write/read_slice, write/read_obj
and get_slice as well as the definition of the MappedRegion from the
platform module into the base mmap module, since these definitions were
strictly identical between Windows and Linux. This removes quite a bit
of duplicated code.
In the process, some tests need to be adapted in order to work with the
common MemoryMapping type instead of the platform one, as the above
mentioned methods become unavailable on the platform type.
BUG=b:213153157
TEST=./tools/dev_container ./tools/run_tests --target=host
TEST=./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64
TEST=cargo test -p base --doc
Change-Id: I20e6f47c3c4763b63eae707a527a084b229cd951
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762970
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Windows and Unix now use identical code for their Protection
implementation, the only difference being the value of their PROT_*
constants. Make the contants part of the platform and use these from the
common mmap module to avoid duplicated code.
BUG=None
TEST=./tools/dev_container ./tools/run_tests --target=host
TEST=./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64
Change-Id: I95f2769e868f32ae70de8159ac4fbb481c4ef467
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762969
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
This state is invalid for Windows, and we can easily avoid using it
altogether.
BUG=None
TEST=./tools/dev_container ./tools/run_tests
TEST=./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64
Change-Id: Id5aba0498f9c19df0d95e86aea04fbe8a4023707
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762968
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
The Windows and Unix Protection struct are extremely close, with the
only difference being how they internally represent their state. Make
the Windows implementation adopt the same storage type as the Unix one
so we can merge them.
BUG=None
TEST=./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64
Change-Id: Idb47243e7d2003d7eb499e683993dba2419e8841
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762967
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This cleans up the output a bit when there are many local branches that
don't have an upstream configured.
BUG=None
TEST=tools/cl prune
Change-Id: Ic5892dcbca315613682326c5615fce28d49b421d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764046
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
If a core is offline, we will not be able to set the cpu affinity to
that core. The TSC calibration code attempts to determine the TSC offset
of all cores. Determining which cores are online requires parsing the
contents of /sys/devices/system/cpu/online on linux, and it's not clear
how to do it on Windows. Instead, the calibration code will treat errors
when calling set_cpu_affinity as legitimate reasons for a core to be
offline, and will exclude that core from the offset information in the
TscState. This will prevent the TSC sync mitigation logic from setting
any vpu's affinity to that core.
This also changes how number_of_logical_cores is implemented on linux,
to count the number of configured cores instead of the number of online
cores, which seems more correct.
BUG=b:230372694
TEST=added a new unittest, also ran unittests with an offline core
Change-Id: I12c187a7ca1dd06e25b396eaeae542628fdf563c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764280
Tested-by: Colin Downs-Razouk <colindr@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>