In Vcpu::on_suspend for WHPX, we were calling WHvSuspendPartitionTime
which didn't make sense for several reasons:
* on_suspend is intended to help with guest timekeeping. We don't need
this on WHPX because the clock is managed via virtio-pvclock.
* WHvSuspendPartitionTime is a partition (read: VM) wide operation.
That means it should be called once on the VM, not on every VCPU.
Calling it on every VCPU yields errors on subsequent VCPUs.
BUG=b:294134741
TEST=ran virtio-pvclock enabled VM across a S3 and S4 host suspend. No
complaints from the guest kernel in the serial logs.
Change-Id: Ic5f71d277bf393db74e809cf8e0de3d95b4f895b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4752840
Reviewed-by: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Previously we were masking bits off rather than appending them.
BUG=none
TEST=builds
Change-Id: Ia49f39c6dcbf8af83f102a7c999c86902f125ff5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4753007
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Noah Gold <nkgold@google.com>
0x0002_0000 is now standardized as VHOST_USER_PROTOCOL_F_XEN_MMAP[1].
Renumber SHARED_MEMORY_REGIONS to an available value to avoid
interoperability problems with other vhost-user implementations.
(It would be nice if VHOST_USER_PROTOCOL_F_SHARED_MEMORY was
standardised, to avoid this problem in future!)
[1]: f21e95ee97
TEST=run crosvm vhost-user-gpu device with cross domain
Change-Id: I56c36e5ef75b68fd4244dee1206a2cd1bee7c452
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4727935
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* If $(DESTDIR)$(libdir) wasn't already a directory, the library
would be installed to that path, rather than inside that directory.
* The unversioned library links would be installed directly into
prefix rather than into libdir, where nothing would find them.
TEST=make install with prefix pointing to an empty/non-existent path.
Change-Id: If6e2844e0d854a53dd61a88b02f91334f3311eeb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4754156
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This CL introduces support for Bulk Streams (USB3.2 spec Rev.1.1 Section
4.4.6.4).
At this point, we only support Linear Streams Array for Stream Context
Array structure (see xHCI spec Rev.1.2 Section 4.12.2) and up to 16 streams.
BUG=b:242816284
TEST=`./tools/dev_container ./tools/presubmit`
TEST=Confirmed a UAS device (Samsung PSSD T7) worked on refvm
Change-Id: I3186cc33ca04d52b9a090bbf5e08f4f04617ea28
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712778
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Morg <morg@google.com>
Commit-Queue: Ryuichiro Chiba <chibar@chromium.org>
This CL refactors codes for dealing with stalled commands as
preparation for Stream support.
BUG=None
TEST=`./tools/dev_container ./tools/presubmit`
TEST=termina vm recognizes a SanDisk Ultra USB 3.0 flash device without device reset
Change-Id: I3616bf47eea9a5d9e74ed238962a6f99e9566e28
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712777
Reviewed-by: Morg <morg@google.com>
Commit-Queue: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
As a part of migrating ArcQuota D-Bus methods from cryptohome to spaced,
this CL replaces the use of the following ArcQuota methods in crosvm
to the new ones in spaced added in CL:4714787.
- SetMediaRWDataFileProjectId (-> replaced with SetProjectId)
- SetMediaRWDataFileProjectInheritanceFlag (-> replaced with
SetProjectInheritanceFlag)
Also moves the validation of project ID which is done in cryptohome's
SetMediaRWDataFileProjectId, as the spaced counterpart does not have it.
BUG=b:229122701
TEST=See CL:4714787.
Change-Id: I1736efa68cc8bfae9b3bf9a3debb5de7aa925f61
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712775
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Commit-Queue: Momoko Hattori <momohatt@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This CL adds spaced D-Bus bindings, which will be used in a follow-up
CL. Also updates other bindings as a result of running
update_bindings.sh.
BUG=b:229122701
TEST=./update_bindings.sh
TEST=emerge-<BOARD> crosvm
Change-Id: I363272b223d399e82873fb6697f54742cebb874b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712774
Commit-Queue: Momoko Hattori <momohatt@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
The device name was missing in the logs, which made it tricky to
troubleshoot.
BUG=b:294134741
TEST=builds
Change-Id: I9b2420410090af313936611dbd6b2ccd4243d185
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4749228
Reviewed-by: Frederick Mayle <fmayle@google.com>
Auto-Submit: Noah Gold <nkgold@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
It looks like this wasn't implemented when the device was written, and
acked features were just written to the advertised features. This CL
fixes that problem.
BUG=b:294134741
TEST=snapshots don't fail with this device (snapshots verify advertised
features).
Change-Id: Ia7f438a7eaf3ab4060f91731786d66194c237f39
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4749227
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
Because unblock tasks cannot be canceled, and the ones started for
AsyncTube hold locks, this can cause code trying to convert the
AsyncTube back to a Tube to stall because the lock is held on the
unblock thread and won't ever be released until the global pool is
shutdown.
The right solution is to abandon unblock or make it cancellable.
Those are significant undertakings, so in the interim, we can
avoid starting unblock until the read notifier is triggered.
This way, we won't actually be in unblock, and the lock will
not be held.
BUG=b:294134741
TEST=snapshot no longer stalls on Windows.
Change-Id: I36bfd0ca5546c43f766c431a2fb97d2b87a679ae
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4749226
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
It looks like this logic was missed during the initial port. This CL
adds it.
BUG=b:294134741
TEST=verified the VM exits as expected instead of stalling when the
subsequent CL fixes the weird async bug that was causing the existing
broken state to somehow work correctly.
Change-Id: I3a6294e3e8f09ebfead71293168b0bfb7eb7ed52
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4749225
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
A light weight, purely static initramfs has been added to allow
running tests that are slightly more complex. This also allow
us to inject e2e_test components (e.g. delegate) into pre-built
containers from 3rd-party sources.
TEST=VM can boot from initramfs produced by make
Change-Id: Id27faa61a54bd151187dc6231d996efaaa6ae890
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4718770
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Rather than updating several flags during the VirtioDevice ack_features
callback, just accumulate the virtio feature bits in a single u64 like
other devices, and use those bits to determine the features to enable
during activate(). This should make it simpler to correctly snapshot and
restore the device state.
BUG=None
TEST=tools/dev_container tools/presubmit
TEST=Start Crostini and run Wayland GUI apps
Change-Id: I1f009137300b0d341e707f759bb5e8111f219fc7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4749224
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Elie Kheirallah <khei@google.com>
The cros-codecs API has changed a lot, and it supports zero-copy
decoding as well as HEVC now.
BUG=b:262824148
TEST=presubmit
Change-Id: Icc2a258642cef012b5640f1c71ccff481b5808f2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4744560
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
These devices are only in use during very early boot, and on split IRQ
chip implementations, not having a no-op implementation means that those
implementations can't use snapshotting at all. This CL adds a no-op
implementation for snapshot & restore for those devices.
BUG=b:294134741
TEST=snapshotting doesn't hit errors on these devices now, and succeeds
for WHPX (a split IRQ chip impl.).
Change-Id: I562ee00f6ec25d08fb516aba01a0b418f3e9f7d3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4749685
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
CONTRIBUTION.md instructs contributors to run a 'git checkout' instruction to switch to a new branch to make their changes. The old instruction used the --branch flag to specify the branch when -b really should have been used. Running the old command causes git to return an error.
Change-Id: I4a19592c59566e814fd5c16d900af568c32412ea
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4748941
Commit-Queue: Sebastian Hereu <sebastianhereu@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
OVMF was causing a subtraction overflow exception bc the FW_CFG_FILE_FIRST offset was erroneously subtracted from the u16 selector argument to write(). Subtracting the offset was necessary in previous versions of fw_cfg, but after the recent refactoring of fw_cfg's code, the subtraction is no longer needed
BUG=b:243051819
TEST=ran "cargo test fw_cfg" under /devices
Change-Id: I46c14383a98c55cec1f69515f7275875468bde61
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4743843
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Sebastian Hereu <sebastianhereu@google.com>
Reviewed-by: Denise Costin <dcostin@google.com>
The vmm handler code does not need to check that the queue index is in
range. This is already checked in two places already: the generic
VirtioDevice code will not produce invalid indexes, and the backend
vhost-user device must be prepared to handle invalid indexes by
returning an error.
Removing the max_queue_num parameter will help in cleaning up the
VhostUserVirtioDevice QueueSizes mechanism.
BUG=b:262291811
TEST=tools/presubmit --all
TEST=boot x86_64 Linux from a vhost-user block device
Change-Id: Ia44cb916aedadf0fbdecec8f0bf0d0299cc5816b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4103911
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Shoutout to akihiko.odaki@ for suggestions:
"Why not install dependencies in one command?
sudo apt install libdrm libglm-dev libstb-dev
The cmake command for AEMU is broken into two lines but the newline
character between them are not escaped. It should be one line or the
newline should be escaped.
It also gives a warning:
CMake Warning:
Ignoring extra path from command line:
"../"
And it's probably better to have a dedicated build directory. /build is
in .gitignore so you may:
cmake -DAEMU_COMMON_GEN_PKGCONFIG=ON \
-DAEMU_COMMON_BUILD_CONFIG=gfxstream \
-DENABLE_VKCEREAL_TESTS=OFF -B build
It's also better to use the following commands to build and install it
just in case the system has a different backend (like Ninja):
cmake --build build -j
sudo cmake --install build
The build directory of gfxstream may be named just "build" so that you
can blindly copy the command on Arm64 or whatever and to ignore it with
.gitignore.
You may build and install it with the following command:
meson install -C build
No need for separate build command and sudo. Meson takes care of that.
The documentation has one command for building and installing Rutabaga,
but that may cause a problem. For example, you may have rustup
configured for a normal user but not for the superuser. Perhaps it's
better not to have "build" as a dependency of "install" and have two
commands for each of the steps:
make
sudo make install"
BUG=b:291606715
TEST=compile book
Change-Id: I7f75b0ebfda825bcf0f7d0ffee574669ee6ee801
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4743519
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Fix request codes of USB device standard requests to match the values
defined in USB 2.0 specification.
BUG=None
TEST=`./tools/dev_container ./tools/presubmit`
Change-Id: Id2292f9ca763f04d875602561464b3c0dc927a9d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712776
Reviewed-by: Morg <morg@google.com>
Commit-Queue: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: 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>
The generate_pci_root() function added an extra field for ACPI GPEs,
which wasn't applied to the riscv architecture-specific code.
BUG=None
TEST=tools/dev_container tools/presubmit crosvm_unit_tests_riscv64
Fixes: 298be81446 ("acpi: x86: add support for ACPI Notify() forwarding")
Change-Id: I426c7855411abc30bc9d0b0f329ce1f52ae88430
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4736334
Reviewed-by: Grzegorz Jaszczyk <jaszczyk@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
crosvm_control unconditionally imports vm_control::BalloonControlCommand
which is only available when vm_control has the "balloon" feature
enabled. Declare this dependency in crosvm_control/Cargo.toml.
Fixes building crosvm_control with --no-default-features.
BUG=None
TEST=cargo build -p crosvm_control --no-default-features
Change-Id: I0f7a956318bd144fcbe9e09ee8319e992df87d5e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4736333
Reviewed-by: maciek swiech <drmasquatch@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Use the negotiated feature bits in QueueConfig to determine the queue
type for activated queues when restoring from a snapshot. This also
means that VirtioDevice::queue_type() is unused, so it can be removed.
BUG=b:243621596
TEST=tools/dev_container tools/presubmit
Change-Id: I15be4c0a0794f28ff36cb3c0e6149b45ea90e2ad
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4735113
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yuan Yao <yuanyaogoog@chromium.org>
Errors reading/writing/etc. the disk image will already be reported to
the guest and should be handled by the guest OS. Reporting them in the
host logs has the potential to fill the logs with noise. This change
makes I/O failures into debug-level log messages which do not get
printed by default (the log level can be modified with the crosvm
--log-level option).
BUG=b:290057170
TEST=tools/dev_container tools/presubmit
Change-Id: I09217997d8dec41cb4a832e3a033f81371300569
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4664551
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Devices currently printed errors and returned Ok when they failed, and
that was because errors were frequently expected.
We are at a stage where the basic devices all function properly and no
longer need to return Ok, we should hard fail if an error occurs.
BUG=b:253514925
TEST=presubmit
Change-Id: Id33c1dea603a471d815755495a269e4276a8ace8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4684441
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Auto-Submit: Elie Kheirallah <khei@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Add snapshot/restore to the net device.
BUG=b:293937476
TEST=presubmit
Change-Id: I6467d242964fbe9b0914924cacb113fd474669a9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4736331
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>