Add support for virtio suspend feature, which is currently under
discussion upstream. This change implements a basic version of the
feature that simply defers interrupts while a device is suspended.
Device implementations can be quiesced to reduce their resource
consumption in later changes if necessary.
BUG=b:301862490
TEST=Manual test with ArcS2Idle feature flag
Change-Id: Id8f656e66577bb65b961523b97e42da4f248e613
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5491343
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Currently crosvm's virtio-scsi implementation only handles requests from
the request queues. This commit handles requests in the controlq and
also implements a sub-action of MAINTENANCE IN command.
The control requests contain operations such as async task cancellation,
LUN reset, asynchronous notifications. The sub-action REPORT SUPPORTED
TASK MANAGEMENT FUNCTIONS reports the supported actions, and we
currently implement LOGICAL UNIT RESET and TARGET RESET.
BUG=b:300042376
TEST=sg_opcodes --tmf /dev/sda
TEST=sg_reset -d /dev/sda
TEST=cargo t -p devices
TEST=./tools/run_tests2 --dut=vm -E 'test(test_scsi)'
Change-Id: Ie1015d7e78c02cb46e5f20ac724838fc91dff4fe
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4958314
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
zerocopy 0.7.x has finally released as a stable version, uprev it
to allow some remaining structs to be derivable.
TEST=CQ
BUG=b:300969352
FIXED=b:300969352
Change-Id: I90f0dfb09494f875fef1cd11bfcbd48030846092
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4878761
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Zihan Chen <zihanchen@google.com>
The ID used here was not the one in the kernel driver. Historically
61 was the ID for virtio-vhost-user, but that device no longer exists
and was only present in some ChromeOS kernels.
BUG=none
TEST=presubmit & tested downstream.
Change-Id: Ie1cdbe0d564e9c60084ca3a8bb11e7b973468c3d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4885410
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
This commit enables popping requests from virtqueue and processing them.
As for this commit, we pretend we do not have any SCSI device, therefore
we return status 3 (= VIRTIO_SCSI_S_BAD_TARGET) on every INQUIRY
request, which is the very first SCSI command from the guest driver.
This strategy makes the guest kernel boot successful but the scsi
device is not visible from the guest.
BUG=b:300042376
TEST=tools/presubmit
TEST=guest kernel boots with the --scsi-block option.
e.g.) ./crosvm run -b /path/to/root-image --scsi-block
"/path/to/another-image,ro" /path/to/kernel
Change-Id: I714d2bf908e6e210569c75e670baa52ec6e89703
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4845154
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Currently only used on windows, but should be able to work on other
platforms.
TEST=CQ
BUG=b:213149162
Change-Id: Ie2f518b0a5dc7f1b5650b15c76c0fbcfd5eadea6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4018114
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
Replace the hand-written bindings in the virtio-fs device with
automatically generated bindings from bindgen.
BUG=None
TEST=./virtio_sys/bindgen.sh
Change-Id: Ia11a2d97f3546515196a41764107e7aaece8ad82
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4103907
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This requires a few tweaks to non-generated code:
- VIRTIO_ID_VIDEO_ENC/DEC -> ENCODER/DECODER
- io_uring unnamed union layout change
Change-Id: I58e118efa5c6bf28ff56d211fec5603651cb60bc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3893753
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
While we are tweaking all of the copyright headers, let's take the
opportunity to ensure there is always a blank line after the copyright
header for consistency. (Almost all files already follow this style.)
This includes a slightly ugly regex to allow the end of a C-style
comment block after the end of the copyright:
/*
* Example comment block
*/ <-- this line
Change-Id: Idfd0855861e5ecb3d33afae942fdba908af0dcff
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892521
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.
This fulfills the request from legal and unifies our notices.
./tools/health-check has been updated to only accept this style.
BUG=b:246579983
TEST=./tools/health-check
Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Virtual environments without PCI support (a common situation in embedded
devices models) might use simple memory mapped device instead of the PCI
device. The memory mapped Virtio device behavior is based on the PCI
device specification. Therefore most operations including device
initialization, queues configuration and buffer transfers are nearly
identical. For more details and existing differences please see:
http://docs.oasis-open.org/virtio/virtio/v1.0/cs04/virtio-v1.0-cs04.html#x1-1090002
BUG=b:189182339
TEST=boot manatee and verify that Virtio PCI devices work properly
Change-Id: If7aeb03b96137a672438f85ba2b86296deeef9ca
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3855006
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Tomasz Nowicki <tnowicki@google.com>
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
This makes the VirtioDevice::device_type() function return type more
descriptive, and it lets us implement fmt::Display for the type instead
of a custom type_to_str() function.
BUG=None
TEST=tools/presubmit --all
Change-Id: Icfc2be37cf31ecab5e73f4b29c2eaaaa417317ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3582523
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Restrict the bindgen patterns so that only the declarations from the
appropriate header are included in each binding, and add the
virtio_config binding to get the source of the VIRTIO_F_ and
VIRTIO_CONFIG_ #defines.
BUG=None
TEST=tools/presubmit --all
Change-Id: I216bd8d3540d918ad9bba162db0ae86b76d73f31
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3582522
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
On Windows, we have to generate virtio_net_hdr_mrg_rxbuf ourselves since
there is no actual TAP device. Since we have to serialize it onto a
binary pipe, we need to get it as a binary slice, so here we implement
DataInit on that struct.
BUG=b:213151463
TEST=builds
Change-Id: I25a3333c20a87d6bf576f0225aac3e1c816a46ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3609237
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>