Remove the deprecated timer-based fence polling strategy, leaving the
async callback-based strategy that is now in use by all Rutabaga
components.
BUG=b:175527587
TEST=glxgears & vkcube in ChromeOS VM
TEST=Vulkan & OpenGL games in ChromeOS VM
TEST=GfxBench in ARCVM
TEST=Asphalt 9 in ARCVM
Change-Id: I75714f82e36f1d6291a875fe3dd47d850ff2eb82
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3880586
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Tested-by: Ryan Neph <ryanneph@google.com>
Type 11 SMBIOS OEM strings entries are commonly used to pass arbitrary
information into a VM. For example, systemd's credentials[1] system
looks for specially formatted values here.
The main goal here is to allow parameterization of a VM when we're
booting with OVMF, in which case providing parameters via the kernel
cmdline is less useful.
QEMU suports something similar, but this is a significantly simplified
approach, allowing only OEM strings instead of a wider range of DMI
table entries QEMU allows customizing.
[1]: https://systemd.io/CREDENTIALS/
BUG=b:244366989
TEST=cargo test; passed oem strings into vm and confirmed they are in
dmi tables
Change-Id: I5e106983e624c8a244b8074d6944bc0c9acfd748
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3868327
Auto-Submit: Mike Gerow <gerow@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Mike Gerow <gerow@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The derived method matches what we provide, so just use the derived
method instead of unnecessarily creating our own.
BUG=b:244366989
TEST=build, confirm smbios entries still work
Change-Id: Ia5668c4bcf496cfadcc8f7ca153661df6a1d180d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3881045
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Mike Gerow <gerow@google.com>
Tested-by: Mike Gerow <gerow@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Allow PciDevice implementations to indicate that they do not want an IRQ
assigned at all (e.g. for modern PCIe devices that do not support INTx#
interrupts, only MSI/MSI-X) or if they do not have a preferred IRQ but
just want any available IRQ allocation.
BUG=b:245361233
TEST=tools/presubmit --all
Change-Id: Ic6c86d4ce727a7c1b91080873deee5add23f3c9f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3877203
Reviewed-by: Dmytro Maluka <dmy@semihalf.com>
Tested-by: Dmytro Maluka <dmy@semihalf.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Now that Interrupt owns the interrupt_status as well, we can merge the
two separate Arc wrappers into a single one.
BUG=b:244204463
TEST=tools/presubmit --all
Change-Id: I1c21da31c3e4e8d11ac29cd1c541c20db178591e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3866049
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Per ACPI Machine Language (AML) Specification, all integers encodings
are equally accepted; hence one can always the shortest possible forms.
BUG=None
TEST=./tools/presubmit
Change-Id: I7f1802607e173d41d1ae9ba26a036e9bfcd95121
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3878738
Tested-by: Victor Ding <victording@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Victor Ding <victording@chromium.org>
LockRule indicates whether the Global Lock is to be used when accessing
a field, which is crucial for performing certain MMIO.
BUG=None
TEST=tools/presubmit
Change-Id: I2bbabaa87b85ae529878587c810166614383098c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3876762
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Victor Ding <victording@chromium.org>
Tested-by: Victor Ding <victording@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The Default impl for DiskOption was only used in one place (vhost-user
block device); that use can be replaced by filling in the two missing
fields.
The values used in the Default impl did not match the serde deserializer
defaults, which are used when parsing the --disk and related options
from the command line. Removing this unnecessary Default clarifies which
values are actually used.
BUG=b:237829580
TEST=tools/presubmit --all
Change-Id: I5ffaa4facab31402aeb84552cadce750d132c307
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3877202
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
For vfio-pci device, guest couldn't call this device's acpi method like
_DSM/_DSD/_PS0..., in order to let guest run it, crosvm will provide
virtual method to guest, this virtual method pass guest method call into
host and pass host return value into guest.
This commit adds a function into pci device trait, which returns the
aml code to construct virtual acpi method. Two pages mmio are used to
pass acpi parameters and return value, when guest access the first page,
vm exit happens and it is trapped into crosvm, when guest access the
second page, no vm exit happens.
Co-authored-by: Victor Ding <victording@google.com>
BUG=b:194390621
TEST=tools/presubmit
Change-Id: I71797394de61437d4d105e65488d36511c71cbd7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3813137
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Victor Ding <victording@chromium.org>
Commit-Queue: Victor Ding <victording@chromium.org>
Follow up from crrev/c/3753417 to cleanup implementation.
BUG=b:237493180
TEST=env for virgl_render_server process still has radv_require_etc2=true
Change-Id: I9aa6f9d8eb92e78e8ab8053be5df6406d6411ea9
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3877549
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This reverts commit 4811773029.
Reason for revert: set_params() uses a resource_type variable that does not exist, breaking the build when video-encoder is enabled
Original change's description:
> virtio: video: encoder: Handle SET_PARAMS_EXT's resource_type.
>
> Previously we kept using the initial value and while this was fine for
> ARC because VirtioObject was the initial value negotiated by the kernel
> and ARC only used VirtioObject anyway, but this broke when using FFmpeg
> which would use the mmap buffers of V4L2.
>
> Handle the type switch like we did in the decoder.
>
> BUG=None
> TEST=arc.VideoDecodeAccel*_vm,arc.VideoEncodeAccel*_vm on hatch
>
> Change-Id: I6f1c2d1bdaf18efb559528dfadb10baf32dbb757
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3840991
> Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
> Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com>
> Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Bug: None
Change-Id: Ic2852236b53e3db6b334ecb327a442df1a985b38
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3877547
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
presubmit has slightly diverged from what we are runnning in CI,
so things like running tests with user space emulation tend to break.
This should make sure that presubmit continues to work.
We can utilized user-space emulation as when we reorganize our tests
to have unit tests that do not have special system requirements. Then
CI will be running those tests with user-space emulation as well.
BUG=b:244185215
TEST=./tools/presubmit [--quick/--all]
Change-Id: I46f6498ad030ad50d42d3365c908a16e6573b5d7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867535
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Rather than requiring interrupts to be held inside a mutex everywhere,
make it possible to clone them so each thread handling a queue can have
its own SignalableInterrupt instance that does not require locking.
BUG=b:244204463
TEST=tools/presubmit --all
TEST=start x86_64 Linux bzImage in crosvm
Change-Id: Ifd4b101de2e00498c9f47b92a02f7ac649c17bff
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3858693
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Replace the vsock device's copy of handle_irq_resample() with the common
version in the async_utils module, since it is functionally identical.
BUG=b:237811512
TEST=tools/presubmit --all
Change-Id: Ibda6edf40e785ff099d9194c60efff1e856350f3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3871961
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Makes a temporary copy of the git repo for each test so we can
modify the repo for testing purposes.
It's not the fastest test (~12s), but is only run when python files
have been modified. In contrast to other developer tooling, tools/cl
is not used by Luci, so it needs a dedicated test.
BUG=b:244185215
TEST=./tools/health-check
Change-Id: I06c90a580aa8ed0fa267a41ca40895710121767f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3866692
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Previously we kept using the initial value and while this was fine for
ARC because VirtioObject was the initial value negotiated by the kernel
and ARC only used VirtioObject anyway, but this broke when using FFmpeg
which would use the mmap buffers of V4L2.
Handle the type switch like we did in the decoder.
BUG=None
TEST=arc.VideoDecodeAccel*_vm,arc.VideoEncodeAccel*_vm on hatch
Change-Id: I6f1c2d1bdaf18efb559528dfadb10baf32dbb757
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3840991
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
This is a follow-up to
https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3864926,
which implements this for QCOW.
Same rationale: allow to turn off support for disk formats that projects
do not need/want.
BUG=None
TEST=./tools/presubmit; cd crosvm-fuzz && cargo build
Change-Id: I401bad4d4ccb1a00a303ed86f1156f153b70b562
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3872278
Commit-Queue: Christian Blichmann <cblichmann@google.com>
Reviewed-by: David Stevens <stevensd@chromium.org>
Tested-by: Christian Blichmann <cblichmann@google.com>
Changed missed by accident in 61d72266 (media: ffmpeg: Take AvBuffer
directly in AvPacket::new_owned). The later commits were tested but it
was grouped into the wrong commit in rebase.
BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices
Change-Id: Iabdcc98833b24271f4701fb210e0e5733d1f9f12
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3868594
Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
A feature was recently added to allow qcow support to be disabled. Add
that feature to the fuzzer default list, since qcow is one of the fuzzer
targets.
BUG=None
TEST=cd crosvm-fuzz/; cargo build
Change-Id: I5ba86e907201eac8ed1a1db420bdb42eea9815ec
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3873273
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Auto-Submit: David Stevens <stevensd@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
Now that AsyncDiskFileWrapper is available, we don't need the original
non-async virtio-blk device.
BUG=b:219595052
TEST=cargo build --features=composite-disk
Change-Id: Ifabf878f97b3d9ef5997fa6bdb651114d280e066
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3824068
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Use the async block device rather than the non-async one.
BUG=b:219595052
TEST=tools/run_tests --target=host --build-target=mingw64
Change-Id: Ibcfa7eff95356e2fc0c09f669ec82b54a6d4c183
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3857129
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
The synchronous Block type will be removed, so fuzz the asynchronous
version.
BUG=b:219595052
TEST=build crosvm with amd64-generic asan profile
TEST=run crosvm_block_fuzzer
Change-Id: I34f667748738b3501481bc4814507f7a8b6af40c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3852305
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
With AsyncDiskFileWrapper, we can use all disk image formats via the
async API.
The create_async_disk_file() function is removed, and the existing
create_disk_file() function can be used to create async-capable disk
files, as the DiskFile trait now includes ToAsyncDisk.
BUG=b:219595052
TEST=cargo build --features=composite-disk
TEST=Boot x86-64 Linux in crosvm with a qcow2 disk attached
Change-Id: I430d306fe71c325ab529a7031353d20f8a9aa2f3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3824067
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
We will support two display modes on Windows:
(1) Borderless full screen mode, which can be specified with
"--gpu-display borderless_full_screen".
(2) Windowed mode, which can be specified with the expected display
size, e.g. "--gpu-display width=800,height=600".
If none of them is specified, we use windowed mode by default. Note
that on Unix, only windowed mode is supported for now.
BUG=b:233676779
TEST=presubmit
Change-Id: I5665ceedb31533c7c298eb7aa50e23eafb1e9411
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3806755
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Pujun Lun <lunpujun@google.com>
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Add an in-process control server-like mechanism which runs in the
devices command to enable controlling vhost-user devices with control
commands such as DiskControlCommands. Like the in-process version,
the vhost-user control server waits for connection on the specified
socket, processes the recevied command, and forwards it to the
corresponding device via established tubes. Currently, DiskCommands are
the only commands supported by the control server, as block devices are
the only devices which need this mechanism.
This patch also adds the mechanism to process forwarded commands in
the vhost-user block backend device, similar to the command processing
mechanism in the worker provided in the in-process block device.
BUG=b:191845881
TEST=cargo run devices -s /path/to/socket.sock --block ..., then run
cargo run disk resize 0 $SIZE /path/to/socket.sock
Change-Id: I7b96e6c4bb7371424ca220da5f95be88e82c1fc0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3841001
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Keita Suzuki <suzukikeita@google.com>
Reviewed-by: Morg <morg@chromium.org>
Commit-Queue: Keita Suzuki <suzukikeita@google.com>
Rename all local variables across the codebase to be consistent with the
recently renamed cfg.protection_type (from cfg.protected_vm). This
commit is intended to make the renaming less cumbersome to review.
Note: no functional change intended.
BUG=b:243646855
TEST=build
Change-Id: I495b0854ce60cb1dc041ef43480fe11b379883c2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867616
Tested-by: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Pierre-Clément Tosi <ptosi@google.com>
Improve clarity and consistency between the variable and its type, given
that it represents the protected/unprotected state AND whether some
firmware needs to be used. In particular, it isn't the protected VM
itself.
Similarly, rename components.protected_vm for the same reason.
OTOH, keep cmd.protected_vm for --protected-vm as it is dedicated to
making the VM protected and follows the name of the CLI flag.
Note: no functional change intended.
BUG=b:243646855
TEST=build
Change-Id: Id91d1c83e9efa79562022dacf37f4c89e451f2b5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867615
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Pierre-Clément Tosi <ptosi@google.com>
Flatten the logic for initializing the PC and group the pvmfw ABI code.
Note: no functional change intended
BUG=b:243646855
TEST=build
Change-Id: I973dfb324d9facdc3f79cbdb41b69b8a7fd1444e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867614
Tested-by: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Pierre-Clément Tosi <ptosi@google.com>
De-duplicate logic for when the VM isn't protected.
Note: no functional change intended.
BUG=b:243646855
TEST=build
Change-Id: I27dd23e8c437e4e0adb7d344cc3a8b86557672e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867613
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Pierre-Clément Tosi <ptosi@google.com>
Make the variable clearer by renaming it to represent the information it
holds i.e. the firmware file AND the fact that the VM is unprotected.
And to avoid confusing it with cfg.pvm_fw and components.pvm_fw, which
both actually hold the protected VM firmware (resp. path and image).
Note: no functional change intended.
BUG=b:243646855
TEST=build
Change-Id: Ieabc2f05798c3a0e969348d6dbd9a87ffb3a8ad0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867612
Commit-Queue: Pierre-Clément Tosi <ptosi@google.com>
Tested-by: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>