This lets us use the common arg parsing infrastructure, and it should
work on Windows (as opposed to the previous bash script).
BUG=b:267672683
TEST=tools/cargo-doc
TEST=tools/cargo-doc --target-dir=/tmp/crosvm-doc
Change-Id: Ib56f4d28965d32ea01a9aa55d7840edfb71f3d59
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4483471
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Both single and multi process did not have realtime priority, due to us
dropping the multimedia trick handle in set_audio_thread_priority where
we should be holding it until the thread is finished.
BUG=b:276698085
TEST=Process explorer -> properties -> threads -> base priority
increases from 8 to 24
Change-Id: Ia9199f4816e087046b8718e85c60abc9479ec0f3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4416757
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
This is a new major version, and requires some code changes.
Change-Id: I294ce3604aad6e6dc5f50e33246b690e883c1e36
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4481294
Auto-Submit: Andrew Walbran <qwandor@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This was implicitly tested before, but seems worth an explicit test.
Change-Id: I0d31051a8422d61f91938fc5975f230346bbce65
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4478450
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Also use the arch definitions in the main crosvm crate to avoid
duplicating the cfg checks.
BUG=None
TEST=tools/dev_container tools/presubmit
Change-Id: Ia92b2840b0f6c8f0daa25f4b2b185ef7ef372860
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4477764
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Summary: DescriptorChain now reads the full chain when it is created.
Previously, DescriptorChain worked more like an iterator, returning one
descriptor at a time. This meant that DescriptorChain::checked_new()
returning Ok(...) did not guarantee the whole chain was valid, so
callers - in particular, Reader::new() and Writer::new() - had to be
fallible so they could report errors.
With the new API, DescriptorChain::new() reads the whole chain of
descriptors before returning, validating the required properties that
were previously deferred to Reader/Writer creation errors. This means
that Reader::new() and Writer::new() can now be infallible, which
eliminates error cases all over virtio device code.
Since the Reader::new() and Writer::new() function signatures are
changing anyway, take the opportunity to remove the redundant
GuestMemory parameter to those functions; DescriptorChain already holds
a reference to the GuestMemory.
The internal structure of DescriptorChain has been modified in
preparation for supporting packed virtqueues (in addition to the current
split virtqueues). The queue-type-specific code has been factored into a
separate trait implementation (DescriptorChainIter) so it is separate
from the high-level descriptor chain validation logic and IOMMU
translation.
BUG=None
TEST=tools/dev_container tools/presubmit
Change-Id: I48fd44b7f3e8b509dcb3683864a3f9621c744c4c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4391797
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Maciek Swiech <drmasquatch@google.com>
The presbumit tool takes care of truncating results in a readable
way. And we can see full output when things fail, and in CI logs.
BUG=b:279641456
TEST=presubmit --no-delta
Change-Id: I347dc938fd07f265d4adb641e2f2818cd37e7db2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4481511
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This seems to only generate bindings for ImmDisableIME(), which is
unused in upstream crosvm and also seems to be available without running
a build step now.
BUG=b:277957421
TEST=tools/dev_container tools/presubmit
Change-Id: Ic5a996eb9d8c7d7c65e2138fe92e8ea335cac76f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4477411
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Because bullseye's cross packages for riscv64 are broken, libcap needs to
be manually built and installed, and pkg-config needs a hacky define to
allow minijail to find it. Other than that, it's very similar to the
other architectures.
Change-Id: I903f7ccd2ccbd94168ba09b425fd649458fdee70
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460942
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Allows running crosvm on riscv64 devices.
Tested on a qemu host with `-machine virt,aia=aplic-imsic,aia-guests=4`
Change-Id: I9b369718bcb438f043e3342f1866c56fc4983304
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460941
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Instead of unconditionally depending on these dependencies only include
them for riscv64 builds. This will fix a build breakage on the windows
builders.
Thanks to denniskempin and dverkamp for suggesting this fix.
Change-Id: I035dc23cd0b58f63a3bcb3b8f883aba97d56492d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4477776
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Match version available in Debian.
BUG=b:265082456
TEST=build
Change-Id: I8fc3b65fb8bb6cc3f7e512921d96c8cbbc4291b5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4364561
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Any cargo invocation will update the lockefile. This ensures that we
can catch if the lockfile needs updating.
BUG=b:275372360
TEST=Tested by https://crrev.com/c/4475489
Change-Id: Ib43a30ef006604c0177e1bc4d1e91e669a4775af
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4476887
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This is no longer needed as crosvm direct support is turned down.
BUG=b:279218487
TEST=presubmit
Change-Id: I07fd936ab65d043313f901130f9cf4ff43876fab
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4476884
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Adds an invocation to run doctests to the health_checks builder.
To make this not run by default on every `tools/presubmit`
invocation, this CL splits default_health_checks out of the
health_checks group.
BUG=b:242635135
TEST=tools/presubmit health_checks
Change-Id: Ic850c461eb79e81c4b8118fc3182614fac907569
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4476090
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Add a basic starting point for riscv64.
constants generated with a slightly modified gerneate_constants script
to run on a riscv64 native system as there isn't a chroot for that:)
TEST: with the rest of the series applied, boot an ubuntu riscv64 VM
using crosvm from a riscv64 host with sandboxeing emabled.
Change-Id: I1ae7db4204df2ffdf1666ebc3e955a97d812f92a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460940
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This only supports systems with AIA virtualization support. Note that
AIA support is new, but has been frozen by riscv and the interfaces are
stable and landing upstream.
Change-Id: Ibdf58d4cd8710c11e1a2a158c2e9d8a53a97603a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460939
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Add basic support for linux kvm running on a riscv64 cpu. Mostly mirrors
the arm support as the interfaces are luckily similar.
Change-Id: I77c091d9b30758788b7c97bc0b3804879e27055d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460938
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This imports the basics that are needed and closely mirrors x86 and arm.
Change-Id: Ia7894166092bccf1ff13dd2e1c8fb17e0d2acca3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460937
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Basic support for riscv. This, combined with follow on commits adds
basic support for booting a linux kernel on a riscv machine. This has
been tested with a qemu host as the riscv hypervisor extension is not
yet widely available in hardware.
Change-Id: I44f83f1acf1be2297b62d1f10311e3e47319e5f8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460936
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This add around 60 lines of log for each boot. It only log in boot
stage. This will be reverted after we collected some samples from
production.
BUG=b:183540186
TEST=emerge-$BOARD crosvm
Change-Id: I599d49db7fe82e3a6857572298ab462e03f45cf6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4472969
Auto-Submit: Lepton Wu <lepton@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Since we default to podman, we can get rid of the _user container and
run as root inside the container, which greatly simplifies the tooling.
This also allows us to provide a single, default devcontainer.json
for local development as well as codespaces.
podman can be used with this devcontainer.json as well, e.g. in
VSCode by setting:
"dev.containers.dockerPath": "podman"
The with_kvm/devcontainer.json can be used to add access to kvm, which
may not be available on all machines. So it's an optional config.
BUG=b:273529620
TEST=Open with devcontainer in VSCode with both docker and podman,
run `presubmit --no-delta`
TEST=tools/dev_container tools/presubmit --no-delta
Change-Id: I10e04898a0e1adb6e4939f6f2e0259dc9b9aa62d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4419666
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
gfxstream has transitioned to simpler ways to configure the renderer,
use them.
BUG=278138335
TEST=launch_cvd
Change-Id: If0918495c2683cd2d99ed5c49c6bf01dd2edfe5f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4470287
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Allow the `cfg` field of RunCommand to be used in configuration files,
providing a mechanism for configuration inclusion.
Configurations are merged in the following order: first the included
files by order of specification (recursively), then the parent file,
then finally the other command-line arguments.
BUG=b:218223240
TEST=booted a VM with a configuration file that included another one and
confirmed both settings were applied.
Change-Id: I0c1e1b12b7c329510d450069e2e9de5b52af7734
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4414504
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Some features present on aarch64 and x86 aren't yet on riscv, add
conditional compile checks.
Change-Id: Ie29e0b7b78af1cb43c04fa1e22c48645c2de8386
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460934
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Add initial KVM bindings generated from a 6.2 tree with the AIA patches
applied.
See the riscv_kvm_aia_v1 branch here: https://github.com/avpatel/linux
The AIA changes should land soon upstream, but pulling them in early
won't hurt other arches and will allow riscv to get started.
Change-Id: I9e20c968e6c044100bc6ec1b2fb5f441f0276f77
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460933
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Later commits add basic support for riscv64 builds. This commit re-adds
the checks for compilation of debug output that were present before
aarch64 was ready. This allows unsupported architectures to build, even
if they don't have graphics support yet.
Change-Id: I42f2aadfed709378173ff6a6414c2896cc685baf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460932
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This ioctl has been long deprecated and is removed from 6.2+ kernels.
It's not used by crosvm so this change should have no affect.
Change-Id: Ieb1b7c1772643d221356ca1ecb8f6a32095febba
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4460931
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The previous maximum size was 64K minus 1 byte; this also did not leave
room for the request/response header, so the actual maximum transfer
size in a single request was slightly smaller.
Use 64K + 24 bytes, since this matches the P9_IOHDRSZ subtraction used
by the Linux 9p client to calculate the maximum I/O size.
BUG=b:265610073
TEST=strace 9s on host and verify larger read()/write() syscalls
Change-Id: Ia606222d3c52a7a6e3f6cfca1a9fcbd78e223855
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4455812
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The iounit value is meant to be an upper limit on the size of each I/O
sent by the client: <https://9p.io/magic/man2html/2/iounit>
Previously, we used the stat() st_blksize value for iounit; this caused
the Linux 9p client to split up every read/write request into 4096-byte
chunks in the usual case of an ext4 host filesystem, which causes very
low performance.
Report iounit=0 instead, which will allow the client to send Tread and
Twrite requests up to the negotiated msize (maximum message size).
BUG=b:265610073
TEST=strace 9s on host and verify larger read()/write() syscalls
Change-Id: I86341998f440ac1c567da7d8fc6e740189ccb44a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4455811
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
gfxstream has transitioned to consistent APIs and a simpler
fence API. Use it.
BUG=b:278138335
TEST=launch_cvd
Change-Id: I91a55021b79c65e057fca5891e64c023ba5cab0b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4428537
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
When we restore a snapshot, we need to refresh the set of Events that
the IRQ handler thread is listening on, otherwise it won't forward IRQs
from the restored/re-created events.
BUG=b:277651574
TEST=tools/dev-container e2e_tests/run
Change-Id: Icd61112c23f063af0f6f217efe2b3359f884e351
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4416558
Reviewed-by: Steven Moreland <smoreland@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
Now that RunCommands can be merged several times without ambiguity,
allow the `--cfg` argument to be used several times, allowing to augment
a base configuration with others. Configurations are merged in their
order or specification, with the other command-line arguments being
merged last.
BUG=b:218223240
TEST=added test passes, booted a VM while specifying `--cfg` several
times.
Change-Id: I94d4f02e403db0203a2757e78a5932805c6d8387
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4414503
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
We recently enabled configuration files with the limitation that only
one file could be specified, and configuration files cannot include
further files. This limitation was due to the fact that the argh crate
could not handle Option<bool> as switches, which forced us to use bool,
which cannot be merged unambiguously more than once.
argh 0.1.10 now allows to use Option<bool> for switches, which will
allow us to lift these limitations. Start by converting all bools in
RunCommand into Option<bool>, and mandating that all members of
RunCommand are either Option or Vec. Following CLs will implement the
features that doing so enables.
BUG=b:218223240
TEST=presubmit
Change-Id: Ica19c94b9509aec7145a6af954d3ebe04a73bc3d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4414502
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
We want support for #[switch] on Option<bool> in order to support
specifying several configuration files. This feature has been merged in
0.1.10.
BUG=b:218223240
TEST=cargo build
Change-Id: I4f1a2474f797907fbd180b0ebe67d87ea7920b46
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4414501
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Add Podman as an option in building crosvm.
Have `Example Usage` point to `Custom Kernel/Rootfs` for preparing a
custom kernel/rootfs, instead of building crosvm.
BUG=N/A
TEST=mdbook build && check the html page
Change-Id: I920526c01140439c416e929d4711ae996bb0831e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4455448
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Elie Kheirallah <khei@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
The virtio-pci device uses ioevents to monitor the notification region
of its BAR for guest-initiated kicks. This is not necessary until the
queues are actually started, so we can remove the ioevents() function
and instead use the existing VmMemory requests to add and remove the
ioevents when the device is activated or stopped/reset.
This avoids the need to remove and re-add the ioevents for the queues
during PCI device initialiation, where the guest may repeatedly disable
and re-enable memory decode.
BUG=b:278130202
TEST=Boot Crostini and ARCVM on x86_64 and aarch64
TEST=tools/dev_container tools/presubmit
Change-Id: I22e0b5a84c8cc9c4f60807624610dbbcabf982cc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4425869
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Ningyuan Wang <ningyuan@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
BUG=b:244553205
TEST=Patched into AOSP and ran some VMs.
Change-Id: I95710fdb264a3bd1e8e69ed6dfad77bbc05b3043
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4440589
Reviewed-by: Jiyong Park <jiyong@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Pierre-Clément Tosi <ptosi@google.com>
Commit-Queue: Andrew Walbran <qwandor@google.com>
Deprecate the crosvm_direct field in build_linux.proto and remove the
code that used it in build_linux.py.
BUG=b:276993009
Change-Id: I1c48064391f3201ad6e27bf9dbfe33e705477672
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4437033
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>