Commit graph

4308 commits

Author SHA1 Message Date
crosvm-luci-ci-builder
3b2bbe7fce Merge with upstream 2022-07-12
93b6042f3 crosvm_control: Expose USB_CONTROL_MAX_PORTS
7ec522a1b devices: iommu: remove Translate trait
eb077b850 devices: iommu: remove custom permission enum
c206d1a3d devices: iommu: replace memory_mapper::Error with anyhow
92fabf70b infra: Add CQ list view and enable windows in CQ
4a764d2c8 main: add tests for argh compatibility code
a44e8a03e main: fix switch-or-option argh wrapper nits

de7835d9b0..93b6042f33

BUG=b:237334804
BUG=b:188858559
BUG=b:237620529

Change-Id: I03eadabb9a9382c00f643a3671c2137cf75110cb
2022-07-12 22:01:05 -07:00
Kameron Lutes
93b6042f33 crosvm_control: Expose USB_CONTROL_MAX_PORTS
Exposes the maximum number of USB ports that can be retrieved through a
call to crosvm_client_usb_list.

BUG=b:188858559
TEST=cq

Change-Id: I87c788f755763afaab021eb4126dadbcc3ac4090
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3757173
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-07-13 03:01:24 +00:00
David Stevens
7ec522a1b8 devices: iommu: remove Translate trait
Merge the Translate trait into the Mapper trait, and add a translate
method directly to IpcMemoryMapper. This is preparation for when the
frontend IpcMemoryMapper struct and the backend Translate trait will
diverge.

BUG=b:237620529
TEST=compiles

Change-Id: Iaeb98237aef2fb8d46719d6e6ec5669e49582ae7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3737407
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-07-13 01:50:57 +00:00
David Stevens
eb077b850a devices: iommu: remove custom permission enum
Replace custom memory_mapper::Permission with base::Protection.

BUG=b:237620529
TEST=boot ARCVM and crostini

Change-Id: Iceaca2ee417e0c37e23e956bf18b8853674caa40
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3737406
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-07-13 01:50:56 +00:00
David Stevens
c206d1a3d4 devices: iommu: replace memory_mapper::Error with anyhow
Replace thiserror enum with anyhow. The only error that needs to be
checked for is IovaPartialOverlap, which can be handled by changing the
add/remove map return types from () to bool. This CL also adds proper
handling of that case to the iommu device.

BUG=b:237620529
TEST=compiles

Change-Id: I066cf2d609d1264b235b019ec098f9a761535f9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3737405
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-13 01:50:54 +00:00
Dennis Kempin
92fabf70b8 infra: Add CQ list view and enable windows in CQ
Adds another dashboard of all presubmit / CQ builders and
enables windows in presubmit as well.

BUG=None
TEST=None

Change-Id: I36af76cec1306648993331dc8f9b9bfbec4637d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3759329
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-12 22:30:45 +00:00
Daniel Verkamp
4a764d2c83 main: add tests for argh compatibility code
This was previously untested, so split it into its own function and add
a few basic tests.

BUG=None
TEST=cargo test

Change-Id: I36ae7876d22684dfae1ec3f0edf1d06d3fc04cdd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3749940
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-07-12 22:02:08 +00:00
Daniel Verkamp
a44e8a03e3 main: fix switch-or-option argh wrapper nits
Fix two small bugs in the code that handles options that are valid with
or without extra options (--battery, --video-encoder, --video-decoder,
--gpu, and --gpu-display):
- If the next arg was a short option (e.g. `-p`), we didn't consider it
  the start of a new flag, so it would have been used as the parameters
  for a switch-or-option arg (e.g. `--gpu -p something` would parse as
  `--gpu=-p`). Fix this by only requiring a single dash instead of two.
- The `crosvm run` command requires a positional argument at the end
  (kernel filename), and the check for the switch-or-option arg had an
  off-by-one that did not consider the positional argument. This broke
  the case where one of these switches occurred right before the kernel
  filename argument, e.g. `crosvm run [...] --gpu vm_kernel`. Fix this
  by comparing against len - 2 instead of len - 1.

BUG=b:237334804
TEST=crosvm run --battery -p init=/bin/bash -r vm_rootfs.img vm_kernel
TEST=crosvm run -p init=/bin/bash -r vm_roofs.img --battery vm_kernel

Change-Id: I2c44ca124ba35b980e655f4f0cf9a9366e6be33d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3749939
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-07-12 20:18:47 +00:00
crosvm-luci-ci-builder
7c9175fe73 Merge with upstream 2022-07-12
de7835d9b rutagaba_gfx: set envvar "radv_require_etc2=true" to fix ARCVM CTS regression
500c403a5 devices: virtio: console: Fix stuck vm when virtio-console has no output
f436e2706 vmm_vhost: add shared memory region support

894b82c591..de7835d9b0

BUG=b:238440998
BUG=b:201745804
BUG=b:237493180

Change-Id: I3e19e957a5c7fbc889e5796de63b4bbbf7360172
2022-07-12 12:30:39 -07:00
Ryan Neph
de7835d9b0 rutagaba_gfx: set envvar "radv_require_etc2=true" to fix ARCVM CTS regression
This workaround is needed to fix an ARCVM CTS regression:
CtsGraphicsTestCases - android.graphics.cts.VulkanFeaturesTest#testVulkanHardwareFeatures

The test regressed after virgl_render_server changed it's execname in
crrev/c/3711405 to match each guest app's execname and mesa's dri-conf
no longer applies this setting automatically.

BUG=b:237493180
TEST=(passing on guybrush/nipperkin):
     cts-tradefed run commandAndExit cts -m CtsGraphicsTestCases \
     -t android.graphics.cts.VulkanFeaturesTest#testVulkanHardwareFeatures
     (on guybrush/nipperkin)

Change-Id: I60d16ecceb8dd84e40a3a4a76fb1d7e72f448b60
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3753417
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
2022-07-12 17:28:26 +00:00
Frederick Mayle
500c403a53 devices: virtio: console: Fix stuck vm when virtio-console has no output
If a virtio-console has type "sink" and the guest keeps writing to it,
the virtio queue would fill and then further writes would block the
guest.

Using an `io::sink` fallback matches the non-async virtio-console's
behavior.

TEST=android microdroid tests
BUG=b:238440998

Change-Id: I145e09052ec8ed166055ad73195c57bf63551efc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3756726
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Frederick Mayle <fmayle@google.com>
2022-07-12 03:48:19 +00:00
David Stevens
f436e27060 vmm_vhost: add shared memory region support
Add support for shared memory regions to vhost-user. This is adding
support for a front-end message to query for necessary shared memory
regions plus back-end message to support mapping/unmapping files from
the shared memory region.

go/vvu-shared-memory

BUG=b:201745804
TEST=compiles

Change-Id: I35c5d260ee09175b68f6778b81883e0070ee0265
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3716344
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-12 01:13:14 +00:00
crosvm-luci-ci-builder
99b6f805a3 Merge with upstream 2022-07-11
894b82c59 infra: Reduce number of repetitions to 3
7f9050662 Revert "Add a VAAPI wrapper crate"
213f9fe8a Add a VAAPI wrapper crate
12593ba64 infra: Add docs builder
0d49facc3 build_windows: Do not re-install rustup
b85a30bb7 devices: Narrower unsafe blocks.
030419327 test_runner: Run some binaries exclusively
21ec73fc4 test runner: Allow retries of flaky tests
f23ced2a1 crosvm: refactor main

970811a704..894b82c591

BUG=b:238232551
BUG=b:213146388
BUG=b:238026909
BUG=b:214478588
BUG=b:233411583

Change-Id: Ie4da6edb8c03425818fb2aa970580d9b99dde049
2022-07-11 17:00:41 -07:00
Dennis Kempin
894b82c591 infra: Reduce number of repetitions to 3
Tests run fast natively, 10 repetitions only take 5 minutes to run.
However for aarch64/armhf it can take >30 minutes. Which is ok for
post-submit but still unnecessarily slow.
3 repetitions is enough to find flakes.

BUG=b:238232551
TEST=None

Change-Id: I958ec734c85047c65a13d1cc172468622073d360
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751033
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-11 18:42:45 +00:00
Alexandre Courbot
7f9050662f Revert "Add a VAAPI wrapper crate"
This reverts commit 213f9fe8a7.

Reason for revert: breaks the ChromeOS builder.

Original change's description:
> Add a VAAPI wrapper crate
>
> In light of the upcoming VAAPI video decoder backend, add a VAAPI
> wrapper crate that exposes a safe Rust API for a subset of the VAAPI C
> code. This crate will be called from the VAAPI video decoder backend in
> order to decode frames.
>
> BUG=b:214478588
> TEST=cargo build --features "video-decoder,vaapi"
> TEST=`cargo test -- --include-ignored` in `media/libva` passes on a
> device with Intel GPU and libva installed.
>
> Change-Id: I4afa96c49d045251827b97bd78faeba57575aedc

Bug: b:214478588
Change-Id: Ib5a88cd4c5fdd2df2e69fd3a0896ee789585840d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3752267
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-07-11 04:32:15 +00:00
Daniel Almeida
213f9fe8a7 Add a VAAPI wrapper crate
In light of the upcoming VAAPI video decoder backend, add a VAAPI
wrapper crate that exposes a safe Rust API for a subset of the VAAPI C
code. This crate will be called from the VAAPI video decoder backend in
order to decode frames.

BUG=b:214478588
TEST=cargo build --features "video-decoder,vaapi"
TEST=`cargo test -- --include-ignored` in `media/libva` passes on a
device with Intel GPU and libva installed.

Change-Id: I4afa96c49d045251827b97bd78faeba57575aedc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3422779
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-07-11 02:16:00 +00:00
Dennis Kempin
12593ba642 infra: Add docs builder
The new builder will generate the mdbook and api docs, then
uploads them to GCS.

BUG=b:233411583
TEST=luci-auth context ./infra/recipes.py run build_docs

Change-Id: Ia22cdb20d73f9268db6299cd6f0875950d174b3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751832
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-08 22:26:31 +00:00
Dennis Kempin
0d49facc30 build_windows: Do not re-install rustup
Rustup does not seem to like to be re-installed on windows. So we can
just skip running rustup-init if it does not exist yet.

BUG=b:238232551
TEST=led get-build 8809175137568661169 | led edit-recipe-bundle | led launch
https://ci.chromium.org/swarming/task/5bf87806f4627f10

Change-Id: Ice0861a8d52499660b26ee259daf135b595aa053
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751029
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-08 22:26:16 +00:00
Junichi Uekawa
b85a30bb73 devices: Narrower unsafe blocks.
BUG=b:238026909
TEST=boot brya-manatee

Change-Id: Ib0d0152e98ad3da57df8b818c7e05c471bfb212c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3750541
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-08 21:42:37 +00:00
Dennis Kempin
0304193270 test_runner: Run some binaries exclusively
Normally we run test binaries in parallel, this change allows some to be
executed exclusively.
This fixes some of the odd issues and flakes we have been seeing.

integration_tests can hang if run in parallel with other tests and
cros_async has the odd habit of throwing the test_runner process into
the background.

Neither happens when the tests are the only ones being executed.

Also adds the capability to specify which test binaries to run,
which was helpful in debugging this issue.

BUG=b:238232551
TEST=./tools/run_tests --repeat 10

Change-Id: Ie5b82e329007399e95bf38111ec6e7cb6761ec0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751027
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-08 20:41:40 +00:00
Dennis Kempin
21ec73fc4c test runner: Allow retries of flaky tests
The test runner can now repeat tests in two ways:

- Via --repeat to run tests multiple times and fail if any one of them
  fails. Which will help us find flakes in post-submit.
- Via --retry, which will retry a test if it has failed. Which makes
  pre-submit tests more resilient to flakes.

Both can be configured by builder configs to adjust as needed.

Also slighly changes the repeat behavior to repeat tests in batches, so
we do not run the same test multiple times simultaneously, which can
cause some of them to fail. It's also easier to read the results.

BUG=b:238232551
TEST=added a random flake into some tests and used --repeat and --retry

Change-Id: I78e0ff0751da40a99a56080d9baf207307c9e93a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751835
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-08 20:41:40 +00:00
Vikram Auradkar
f23ced2a1e crosvm: refactor main
- Use anyhow errors in run_vm
- Initialize logs in a separate function
- Add and use to_command_status()
- Avoid using "platform"

BUG=b:213146388
TEST=presubmit

Change-Id: I31dde911b13a77065e12b32c0981f13c33c39f04
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3749942
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-07-08 18:37:42 +00:00
crosvm-luci-ci-builder
65502e512d Merge with upstream 2022-07-08
970811a70 hypervisor: x86: remove apic_base and interrupt_bitmap from Sregs
0367dadf7 x86_64: pass Sregs via vcpu_init
0cba994f3 x86_64: expose setup_sregs steps as pub
91a4b090d hypervisor: x86_64: add Default impl for Sregs
6f576dd81 hypervisor: x86_64: default Regs::rip to reset vector
814114c64 x86_64: call set_lint() for BIOS as well
ad3914cd9 x86_64: move MSRs to vcpu_init
aef95d207 infra: Repeat tests in post-submit
b1abe5864 infra: Optimize cache usage among builders
909f10fef infra: Repack repo before running container
123061360 infra: Fix container cache after bad rebase
0c09cdbdb cros_async: Fix windows timer flake
5e7c6b1ab infra: Add email notifications for postsubmit and infra
aa52701db infra: Use latest version of github secret

365c8f9201..970811a704

BUG=b:233230027
BUG=b:238333690
BUG=b:237095693
BUG=b:238232551
BUG=b:238328665

Change-Id: If9ab8219e709da75068e2ab831f8ef2a8e4155c4
2022-07-08 06:01:22 -07:00
Daniel Verkamp
970811a704 hypervisor: x86: remove apic_base and interrupt_bitmap from Sregs
These are only used in KVM, not the other x86 hypervisors, and they
don't really fit into the same category as the rest of Sregs. The
apic_base can be set via set_msrs(), and the interrupt_bitmap is
part of the irqchip state.

To enable this removal, we change the KVM set_sregs() call to retrieve
the current state and use the existing apic_base and interrupt_bitmap.

BUG=b:237095693
TEST=Boot x86-64 kernel on KVM

Change-Id: I275eec83b74f1c364b7a543882f3ac5960201143
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3728988
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Vaibhav Nagarnaik <vnagarnaik@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-07-07 23:24:09 +00:00
Daniel Verkamp
0367dadf7f x86_64: pass Sregs via vcpu_init
Now that we have a Default implementation of Sregs that sets the
architecturally defined reset values, we can initialize the Sregs values
during build_vm(). This allows removal of the set_reset_vector()
function, as all of the values it set are now the defaults in Sregs and
Regs.

This also lets us set up the page tables and GDT only once during
build_vm() instead of rewriting them for every configure_vcpu() call.

This allows consolidation of the BIOS and non-BIOS configure_vcpu()
code.

BUG=b:237095693
TEST=Boot x86-64 Linux kernel
TEST=Boot --bios u-boot.rom

Change-Id: Ief19f983fd252dffa668ff2cfe96a64298e06cf2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3723802
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-07-07 23:24:08 +00:00
Daniel Verkamp
0cba994f32 x86_64: expose setup_sregs steps as pub
This will be used to move the page table initialization out of the
per-vcpu setup in an upcoming commit.

The names of the individual steps are a slight improvement over the
previous setup_sregs() as well, since that doesn't really say what it
does in any detail.

BUG=b:237095693
TEST=Boot x86-64 Linux kernel
TEST=cargo test -p x86_64

Change-Id: Ifecf00107d923d0c37389956a1b006fe370e2591
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3735641
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-07-07 23:24:07 +00:00
Daniel Verkamp
91a4b090da hypervisor: x86_64: add Default impl for Sregs
Replace the Sregs Default implementation with one that provides the
register values at reset, based on the Intel software developer
manual.

The x86_64 tests need to be adjusted to only check the CR0 bits they
intend to match, since the default Sregs value now includes other set
bits.

BUG=b:237095693
TEST=Boot x86-64 Linux kernel
TEST=cargo test -p x86_64

Change-Id: If966941df43225572e79ebd9213671348e2846f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3735640
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-07-07 23:24:06 +00:00
Daniel Verkamp
6f576dd813 hypervisor: x86_64: default Regs::rip to reset vector
This matches the reset value of the registers defined by the Intel
manuals. It is currently overwritten on all paths initializing Regs, but
it will be used in an upcoming commit to simplify the BIOS boot path.

BUG=b:237095693
TEST=Boot x86_64 Linux
TEST=cargo test -p x86_64

Change-Id: I7a96882fad05440c98bde2fad7ad15c0890f1cfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3735639
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-07-07 23:24:05 +00:00
Daniel Verkamp
814114c64c x86_64: call set_lint() for BIOS as well
This configures the IRQ chip and is not called anywhere else for the
normal BIOS path, so it should be moved above the `if has_bios` check.

BUG=b:237095693
TEST=crosvm run --bios u-boot.rom --disk test.img # virtio-blk works

Change-Id: I1813d59d7921a824c46a49de98d272f639cc5c07
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3723801
Reviewed-by: Steven Richman <srichman@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-07-07 23:24:04 +00:00
Daniel Verkamp
ad3914cd9a x86_64: move MSRs to vcpu_init
The MTRR-related MSR setup is split out into its own pub function for
clarity and to allow future reuse. The maximum variable MTRR check is
split out so we can generate MTRRs before having a valid VCPU object.

This unifies the MSR set calls in configure_vcpu() so that the BIOS and
non-BIOS cases use the same code.

BUG=b:237095693
TEST=Boot x86-64 Linux kernel
TEST=Boot x86 u-boot.rom

Change-Id: Ifa0020257a043190de69b7192c2d6b35c01d216e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3723800
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-07 23:24:02 +00:00
Dennis Kempin
aef95d2078 infra: Repeat tests in post-submit
This will help us find flaky test. Runtime increase is not that
significant (~10min).

BUG=b:238232551
TEST=Builder config needs to be tested in luci

Change-Id: Ie75cc9620177115623500fe2206f33464f4c8580
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751831
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-07 23:00:04 +00:00
Dennis Kempin
b1abe58649 infra: Optimize cache usage among builders
Then 'builder' cache dir is set up by default to be a cache directory
for each builder, so luci will try to schedule a builder to run on
the same bot as before.
We can optimize that by sharing the cache among all linux builders.

BUG=b:238333690
TEST=lucicfg validate main.star

Change-Id: If4639658271881f1bf1ad001ae54f50645e8890a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751828
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-07 23:00:04 +00:00
Dennis Kempin
909f10fef5 infra: Repack repo before running container
gclient will cache objects in a separate repo and points to them
via .git/objects/info/alternates

That cache won't be available in the container, which will prevent
us from properly using the repo.

git repack will ensure all those objects are brought into the
main repository.

BUG=b:238328665
TEST=led get-build 8809354906626249393 | led edit-recipe-bundle | led
launch

Change-Id: Iba1374a4d34e410e2d2b565cbf5cfbaa0be2fe5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751827
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-07 23:00:04 +00:00
Dennis Kempin
123061360a infra: Fix container cache after bad rebase
An early return snuck in during a rebase.

BUG=b:233230027
TEST=./recipes.py test run

Change-Id: I152281dd55148ca56fc7300a66b6bdcc1eef0ada
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751830
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-07 23:00:04 +00:00
Dennis Kempin
0c09cdbdbc cros_async: Fix windows timer flake
The test is flaky by nature since there is no API guarantee on how
long SetWaitableTimer will sleep. This is flaky on our Luci bots, so
increase the permitted deviation a bit.

BUG=b:238232551
TEST=./tools/run_tests --build-target=mingw64

Change-Id: Ib227be097a0a5559898571cb6b77c37e7fd61cff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3749936
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
2022-07-07 22:23:08 +00:00
Dennis Kempin
5e7c6b1ab8 infra: Add email notifications for postsubmit and infra
Both only notify myself for now as the luci infra is not
launched yet.

BUG=None
TEST=None

Change-Id: I4794bb118f6c27f145af9027ec317da2fb578af7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3739370
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-07 21:08:19 +00:00
Dennis Kempin
aa52701db6 infra: Use latest version of github secret
The previous token expired and a new one was created and added to
GCP secrets manager.
This CL updates the script run by CI to always use the latest
secret instead of a fixed version.

BUG=None
TEST=sh push_to_github.sh

Change-Id: I7eff1a8b385b5cd48206ef54aad65151dfbbc961
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751430
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-07 20:26:46 +00:00
crosvm-luci-ci-builder
22d092084a Merge with upstream 2022-07-07
365c8f92 dev_container: Allow cargo home to be cached between runs
a8552e6d infra: Drop crosvm_ prefix of builder names
e3db2b56 Add crosvm_linux_x86_64_direct builder
fa0dd194 tools: fix triple shorthand error printing
cd9f1cc7 doc: contributing: remove named anchor #presubmit

edbaf7e141..365c8f9201

BUG=b:233230027
BUG=b:238234098

Change-Id: I3599ee8792ae2062bc539e59ee56856bd68cb46e
2022-07-07 13:01:00 -07:00
Dennis Kempin
365c8f9201 dev_container: Allow cargo home to be cached between runs
This Allows Luci builders to cache cargo home between builds. So we
do not have to download so many third party crates with each build.

CARGO_HOME is specifically intended to be cached in CI systems.

BUG=b:233230027
TEST=CROSVM_CONTAINER_CACHE=/tmp/test ./tools/dev_container --clean
cargo build

Change-Id: I11580c5ed3151519ece4a651cb22d059c7c3eb87
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3739368
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-07 17:49:47 +00:00
Dennis Kempin
a8552e6de4 infra: Drop crosvm_ prefix of builder names
Builders are already scoped to the crosvm.ci/try buckets, so there is
no need for the prefix.

BUG=None
TEST=lucicfg validate main.star

Change-Id: I997442e12c14d35e52b1a2c5bf145f0dc5bfd8f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3749938
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-07 17:48:51 +00:00
Dennis Kempin
e3db2b5638 Add crosvm_linux_x86_64_direct builder
Similar to the one we added to kokoro, run tests with --crosvm-direct.

BUG=b:238234098
TEST=recipe tests included

Change-Id: I2b03ca02fbfb577fd5cebf346eec468ebd625626
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3749937
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-07 17:48:49 +00:00
Daniel Verkamp
fa0dd194c1 tools: fix triple shorthand error printing
The format string wasn't actually formatted, so it just printed out the
literal "{shorthand}" string in the error message.

BUG=None
TEST=tools/run_tests --target=host --build-target=bogus

Change-Id: Idad47064db3112a37df3a630b92a4a4da8da82de
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3750069
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-07-07 17:36:27 +00:00
Daniel Verkamp
cd9f1cc7a9 doc: contributing: remove named anchor #presubmit
mdbook apparently does not support this syntax and just includes the
text in the section title.

BUG=None
TEST=mdbook build

Change-Id: I3dc4ae25e392b1260df59889926eba2044c4adc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3749605
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-07 17:35:57 +00:00
crosvm-luci-ci-builder
8a62d5762c Merge with upstream 2022-07-07
edbaf7e1 virtio: add generic shared memory region APIs
bb818203 devices: vvu: do rx notify after processing vq
e0293591 vmm_vhost: switch listener and endpoint relationship
f16b18f0 crosvm: use anyhow context in device helpers
382acd20 tools/cl: Support worktree checkouts
2689c838 base: simplify Clock/FakeClock API

8f6f1407cb..edbaf7e141

BUG=b:201745804
BUG=b:236645893

Change-Id: I31f6be05794baba5cccaf853a6abdefb09ebe9db
2022-07-07 01:30:47 -07:00
David Stevens
edbaf7e141 virtio: add generic shared memory region APIs
Present a generic shared memory region API to virtio devices, and take
care of pci transport specific parts in the core VirtioPciDevice code.
This will make it easier to share the same device implementation across
different virtio transports (i.e. vhost-user and vvu).

BUG=b:201745804
TEST=builds

Change-Id: Ic08ab3de0440f18aeaf9e946dc83c7565cd32eda
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3716341
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-07 02:04:54 +00:00
David Stevens
bb81820322 devices: vvu: do rx notify after processing vq
Send rx vq notification immediately after copying data out of the
descriptors, rather than later on when the data is actually processed.

BUG=b:201745804
TEST=launch sibling VM on manatee

Change-Id: I387a1573bde0157b1ab6f585fd6bb2a311448f7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3716348
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-07-07 02:04:53 +00:00
David Stevens
e0293591f4 vmm_vhost: switch listener and endpoint relationship
Make Listener type depend on Endpoint, instead of Endpoint type
depending on Listener. This will allow Endpoints to be used for the
slave_req_fd.

BUG=b:201745804
TEST=compiles

Change-Id: I1a0732bf7477a4e768f348f78e352a3b53607633
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3716342
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-07 00:58:11 +00:00
Daniel Verkamp
f16b18f046 crosvm: use anyhow context in device helpers
Use anyhow context consistently rather than logging with error!()
inside the helper functions.

BUG=None
TEST=Run crosvm twice with the same VVU socket name

Change-Id: Idadd4a65f5ce6188e9623b3311842e2f90eb4916
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3739586
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-07-06 22:02:20 +00:00
Dennis Kempin
382acd20d3 tools/cl: Support worktree checkouts
CrOS checkouts are experimenting with using git worktree, where
the path to the hook directory is not .git/hooks. So ask git
where the hooks are stored instead.

BUG=b:236645893
TEST=./tools/cl upload in a worktree checkout

Change-Id: Ib353da0aea5d27ce29d1c082268a326adb429d23
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3739373
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-06 18:02:43 +00:00
Daniel Verkamp
2689c838af base: simplify Clock/FakeClock API
Clock now has a single now() function that returns a std::time::Instant
rather than wrapping an Instant itself.

FakeClock provides the same now() API, except the Instant it reports is
only advanced when test code calls add_ns(). FakeClock continues to
provide the add_event() and add_ns() APIs used by tests.

The only functional difference is that the epoch used by FakeClock is
now whatever moment in (real) time it is created, rather than a fixed
timestamp, but this should not change the results of the tests. The only
way to observe the contents of an Instant is by comparing it to other
Instants, which should all be derived from the Clock/FakeClock now()
API.

BUG=None
TEST=cargo test -p base -- --test-threads=1
TEST=cargo test -p devices

Change-Id: I9a0ed8d252f213d85dba3dfbbcd1182e2db981f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3736922
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-06 17:44:05 +00:00