Was only needed for QcowFile, which can now use its internal mutex.
BUG=b:338274203
Change-Id: I810b537e971bf007b6b34f0cbc605f2b3943a763
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5507754
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Add PCI PM capability to virtio pci devices, and generate PMEs for all
virtio device interrupts. PMEs are GPEs advertised ACPI, so they are x86
only. PCIe PME signalling can be investigated in the future.
This is the VMM side patch to [1], which allows Linux guests to enter
system-wide low power states like s2idle without needing to reset the
virtio devices when PCI PM with No_Soft_Reset is advertised.
[1] https://lore.kernel.org/all/20231208070754.3132339-1-stevensd@chromium.org/
BUG=b:301865273
TEST=Manually enable ARCVM s2idle feature
Change-Id: I6b0a122820c5d6932dc3e181d2fd2852b3640e5e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4666701
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
IoBuf is defined in a platform-specific way (it is either iovec on unix
or WSABUF for windows), so it fits into the mission statement of the
base crate, which is meant to be *the* platform abstraction layer in
crosvm.
IoBufMut and VolatileMemory/VolatileSlice are defined in terms of IoBuf,
so they are also moved into base for consistency. Every crate that uses
these types already depended on base, so no extra dependencies are
added, and a few can be removed.
BUG=b:312312646
TEST=tools/dev_container tools/presubmit
Change-Id: I4dddc55d46906dfc55b88e8e6a967d7e1c1922dd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5046605
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Updates are made to source and documentation.
This more accurately represents the currently supported platforms of
Android/Linux and Windows, without unexpectedly including other
unix-like operating systems.
Command to reproduce:
$ find . -type f -not -path '*/\.git/*' | xargs -I {} sed -i 's/cfg(unix)/cfg(any(target_os = "android", target_os = "linux"))/g' {}
$ cargo fmt
md files manually updated to fix line lengths.
Renaming `unix` modules to `linux` will be done in a later CL.
Test: ./tools/dev_container ./tools/presubmit
Bug: b/298269162
Change-Id: I42c1bf0abf80b9a0df25551613910293217c7295
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4909059
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Currently, crosvm running with --bios <OVMF executable> will only boot
from available block devices if started with a clean BIOS pflash. If
crosvm is not run with a clean pflash, OVMF will get confused and refuse
to boot. The reason for this behavior is that OVMF expects a "bootorder"
file to be present in the fw_cfg device to calibrate its boot order.
This CL allows fw_cfg to specify bootorder, solving the inconsistent
booting behavior. Boot order is specified from the command line with the
bootindex=NUM argument.The bootindex argument is available for block
devices specified with the --block flag. Note that the --fw-cfg flag
must be specified w/ at least on file (can be an empty file with a
random name) on the command line for fw_cfg to actually be made
available to the guest. Also, further investigation is needed if we wish
to boot from pmem devices in the future. See crosvm run -h for more
information about the bootindex argument.
BUG=b:243051819
Change-Id: Ieae1e2cacc14c018832b228db898884281c38a96
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4755415
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Sebastian Hereu <sebastianhereu@google.com>
This cleans up the activate() signature and avoids the need to pass two
related (Queue, Event) variables everywhere a queue is needed.
No functional change intended.
BUG=None
TEST=tools/dev_container tools/presubmit
Change-Id: I9e5259428b39ad3a677fbb8a0bf574b3f15a7f35
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4738991
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Now that an active Queue is a separate type than the pre-activation
QueueConfig, we can ensure that a Queue has a valid reference to the
GuestMemory at creation time instead of passing it to every queue
operation.
No functional change, but simplifies Queue callers and prepares for
use of AtomicU* types in a later change.
BUG=b:264931437
TEST=tools/dev_container tools/presubmit
Change-Id: I30266a5eadbd4f643da5595fbdd2c8f5df34bab3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4671481
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
To support packed virtqueue in block device, add packed-queue runtime
flag to block device. If flag is set true, block deivice uses packed
virtqueue. If flag is not set or set to false, block device use split
virtqueue as default.
BUG=b:243621596
TEST=crosvm run —block ”…,packed-queue=true”
Change-Id: Iaca015392103858e06c9368553540ba937ec3b3d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4648470
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
This reverts commit 0efcbc5a46.
Reason for revert: Adjusted virtio-balloon code to match linux and qemu behavior instead of the virtio spec
Original change's description:
> Revert "virtio: pass explicit queue indices on device activation"
>
> This reverts commit 6199bb371a.
>
> Reason for revert: it broke virtio-balloon on ChromeOS
>
> Original change's description:
> > virtio: pass explicit queue indices on device activation
> >
> > In some cases, I changed the code to actually use the explicit indices
> > defined by the virito spec. In other cases, I was lazy and used
> > `pop_first` to emulate the old behavior.
> >
> > Change-Id: I9f1e4b6681e84b54ddca19e4d41c6508404fce4b
> > Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4697479
> > Reviewed-by: Noah Gold <nkgold@google.com>
> > Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> > Commit-Queue: Frederick Mayle <fmayle@google.com>
>
> Change-Id: I13ac499308f29d8a6a226e98d0eb4748b8e60944
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4705624
> Commit-Queue: Frederick Mayle <fmayle@google.com>
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Test: use kernel with CONFIG_VIRTIO_BALLOON=y and boot crosvm with --balloon-page-reporting
Change-Id: I59691b1a9c60a44708a0e6c5c05e77e122675934
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4706390
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
This reverts commit 6199bb371a.
Reason for revert: it broke virtio-balloon on ChromeOS
Original change's description:
> virtio: pass explicit queue indices on device activation
>
> In some cases, I changed the code to actually use the explicit indices
> defined by the virito spec. In other cases, I was lazy and used
> `pop_first` to emulate the old behavior.
>
> Change-Id: I9f1e4b6681e84b54ddca19e4d41c6508404fce4b
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4697479
> Reviewed-by: Noah Gold <nkgold@google.com>
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Commit-Queue: Frederick Mayle <fmayle@google.com>
Change-Id: I13ac499308f29d8a6a226e98d0eb4748b8e60944
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4705624
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
In some cases, I changed the code to actually use the explicit indices
defined by the virito spec. In other cases, I was lazy and used
`pop_first` to emulate the old behavior.
Change-Id: I9f1e4b6681e84b54ddca19e4d41c6508404fce4b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4697479
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
This change creates a new type (QueueConfig) that represents a queue
configuration before it has been activated. The QueueConfig::activate
function serves the same purpose as the previous Queue::activate, but
now it also returns the Queue type, which now always represents an
actively running queue.
BUG=b:290268617
TEST=tools/dev_container tools/presubmit
Change-Id: I502ac6b29bf9f0cfc33ef15f6fb7fe482214eafd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4111872
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Yuan Yao <yuanyaogoog@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Previously, devices used the split virtqueue implemented in
/src/virtio/queue.rs by default. In order to support packed virtqueue in
the future, we implemented the enum type for virtqueue to abstract over
different virtqueue types. We migrated existing split virtqueue to a new
mod in /src/virtio/queue/ directory.
To support different types of virtqueue for each device, we enhanced
virtio_device trait by defining queue_type method to decide which
virtqueue type the device should use. We also modified base_feature function to accept queue type as a parameter.
BUG=b:243621596
TEST=tools/dev_container tools/presubmit
Change-Id: If6cb3e3dd93a7ee3621e54a95742f6f9a524c79b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4648252
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
Exercise more of the virtqueue descriptor chain API by consuming the
reader and writer. This also makes the fuzzer match the real-world usage
of the DescriptorChain APIs.
BUG=None
TEST=cargo +nightly fuzz run virtqueue_fuzzer
Change-Id: Ic56362cda87dd482a7c8fa6b3dd89cebfee8bc30
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4553720
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This simplifies `cargo fuzz` usage. Fuzzers can be built with
`cargo fuzz build` without any other arguments.
BUG=b:279217867
TEST=`cargo fuzz build`
Change-Id: I11b8a8ba4c2b3e2d1a42973699e4d9c3920635b6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4540001
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>