Commit graph

3306 commits

Author SHA1 Message Date
Keiichi Watanabe
b757f0d398 vmm_vhost: vfio: Remove unused File return value
BUG=none
TEST=build

Change-Id: I3f031c9d6488c9380fd328182d8f0ef00bad0c68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3474158
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-22 06:50:11 +00:00
Woody Chow
022170a9f1 iommu: MemoryMapper::translate returns Result<Vec<MemRegion>>
to support contiguous iova but discontiguous gpa memory block.
`MemRegion` also contains `perm`. `perm` allows R/W permission
enforcement.

The function will be used in virtio-iommu (CL coming soon).

BUG=b:215307964
TEST=cargo test

Change-Id: I37975480321a07741bfea232e9e6234cf0b93614
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3450022
Reviewed-by: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Woody Chow <woodychow@google.com>
2022-02-22 05:44:40 +00:00
Keiichi Watanabe
8e43858be1 github: Change target directory for cargo-doc
As CL:3423291 and CL:3428606 changed the path to store generated GitHub
pages contents in, we needed to chage it for cargo-doc as well.

BUG=none
TEST=check in my local GitHub repo

Change-Id: I27ae705c99968c060ede3ee514792d8ac1b7975e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3479038
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-22 05:41:52 +00:00
Grzegorz Jaszczyk
d33874ea04 acpi: x86: add option for setting LP S0 capable flag for guest ACPI tables
Fixed ACPI Description Table (FADT) contains Low Power S0 Idle Capable
Flag. This commit introduces "--s2idle" argument allowing to set proper
bit in the guest FADT table. This is required to inform guest OS to use
s2idle instead of traditional S3 power mode.

BUG=b:194391015
TEST=Build crosvm and run "crosvm run --s2idle ..", dump FADT table and
     confirm that proper flag was set.

Change-Id: I243bfe2cc4840278fcdbf33dcb147b2eda50856d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3457402
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
2022-02-21 20:41:08 +00:00
Keiichi Watanabe
ad606ec2ca devices: vvu: Allow user to specify vvu-proxy's PCI address
crosvm --vvu-proxy="/tmp/vvu.socket,00:00:01.0" ...

BUG=b:220076867
TEST=Start vvu-proxy with an address specified and checked

Change-Id: Iabf2636b4fd5367105e2bb2a14201a368983bc61
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3474168
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-21 16:23:17 +00:00
Daniel Verkamp
237581bfa8 devices: virtio-wl: reuse register_memory() helper
Use the existing register_memory() function that does the same thing as
the open-coded registration request.

BUG=None
TEST=tools/presubmit

Change-Id: I62956c2b4ceb288f7b76a4e85c27e288c496c73b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3470538
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-19 00:46:38 +00:00
Shao-Chuan Lee
18cccb3d65 Revert "virtio: video: encoder: set frame rate only if successfully changed"
This reverts commit 73072d6d16.

Reason for revert: broke ARCVM GTS tests

Original change's description:
> virtio: video: encoder: set frame rate only if successfully changed
>
> Encoders Stream's frame rate was updated before a request was made.
> This could cause hypervisor to report incorrect frame rate to guest and other
> invalid behaviour if the request failed.
>
> This CL changes the order in which frame rate is updated. First a
> request is made, and then if successful, the frame rate is updated in
> the stream structure.
>
> BUG=b:160440787
> BUG=b:161774071
> TEST=v4l2-compliance -d /dev/video1
> TEST=v4l2-ctl -d 1 --set-fmt-video-out
> width=1280,height=1280,pixelformat=NV12 \
>         --set-output-parm 10 --get-output-parm
>         TEST=tast run eve arc.Video*
>
> Change-Id: I11a93d6d6338829ee0622f40f9b544a4ef2a69dc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3425362
> Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Marcin Wojtas <mwojtas@google.com>

BUG=b:160440787,b:161774071,b:220101996
TEST=GtsMediaTestCases com.google.android.media.gts.RtcVideoCodecTest#testDynamicFramerateChangeVp8

Change-Id: Ic10d93f0d3b29bef623ef3d9e3ff00d524a66ebd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3474731
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Shao-Chuan Lee <shaochuan@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-18 12:36:49 +00:00
Alexandre Courbot
eb8e906d2a devices: vhost-user: console: support VVU
Device can be started with

    crosvm device console --vfio <PCI ID>

BUG=b:213531730
TEST=console is usable from a sibling guest when using VVU.

Change-Id: Id19ea8d8d1e11f29a024a30b09622513ad8b172f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3429063
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-18 06:03:15 +00:00
Keiichi Watanabe
90fe105644 vmm_vhost: Remove unused should_reconnect()
Removed `vmm_vhost::Error::should_reconnect()` which we're not using at
all. We don't support reconnect feature at this point.

This function exists even in rust-vmm/vhost, but neither
cloud-hypervisor or rust-vmm/vhost-user-backend is using it.

BUG=none
TEST=cargo check

Change-Id: I4fda22d927573acfedcb189ad786aeb2cf7496e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3468234
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-18 04:00:20 +00:00
Alexandre Courbot
235ee05f3d Revert "devices: vhost-user: cras_snd: remove global executor variable"
This reverts commit 95d104fdd9.

Reason for revert: build fails with cras_snd enabled.

Original change's description:
> devices: vhost-user: cras_snd: remove global executor variable
>
> This variable can be passed as part of the backend structure.
>
> BUG=None
> TEST=cargo build
>
> Change-Id: Id8f905cc87de261a1a547da66fb93dafc1b7686d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3451754
> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Alexandre Courbot <acourbot@chromium.org>

Bug: None
Change-Id: I4828944fadbbf1213533f737073de3a09befd740
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3474155
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Woody Chow <woodychow@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-18 03:34:04 +00:00
Vikram Auradkar
ae5118f5c7 Enable windows tests for a few crates
Run tests for sys_util_core, poll_token_derive and balloon_control on
windows.

Using dotfiles to disable/serialize test runs of a subset of crates does
not work well with third party crates as it forces us to commit the dot
file to the crate.

The patch modifies and uses the script that runs linux tests.
This patch also allows us to
- build/test child crate even if parent crate has disabled build/test.
- avoid building crosvm if it is not explicitly specified.

RIP short lived .windows_build_test_skip. You allowed us to run noop
kokoro tests.

Test: py .\tools\impl\test_runner.py --arch x86_64
Bug: b:215610772
Change-Id: Icc6d04ffd7c0c33d4f60aeac16fc7d23881c387d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3459809
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-02-18 03:18:58 +00:00
Dennis Kempin
2b1b78c6ef tools/dev_container: stop old container if new image is available
When the container image is updated, developers may not notice and
continue running a different version. Detect this and restart the
container.

BUG=b:217465164
TEST=./tools/dev_container while changing image_version

Change-Id: Ib1df871c5c6fba9421c436d39ab7065be966f41e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3469050
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-18 00:18:57 +00:00
Dennis Kempin
9b7471e51a tools/dev_container: Pythonify
Use the new common.py utilities to make turn this bash script into
python. The behavior should be the same.

BUG=b:218559770
TEST=./tools/presubmit

Change-Id: Id1412c2076089fd21f280959d6cde1f4cb64e163
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3469049
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-18 00:18:56 +00:00
Daniel Verkamp
be451c2a8c disk: qcow: pass raw file offset in write_cb
Modify the write callback function to take the offset into the raw
(backing) file as a parameter rather than seeking to the expected
location of the write. This allows removal of the FileReadWriteVolatile
import in qcow, since this was the last use. This also matches the
read_cb, which already passed the backing file offset explicitly.

BUG=b:219595052
TEST=tools/presubmit

Change-Id: I4ac18d4dbe26e8b196eb8a9c056036565eb39501
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3462641
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-17 22:04:24 +00:00
Daniel Verkamp
3de62e6468 disk: qcow: rewrite tests using FileReadWriteAtVolatile
The standard Read/Write/Seek impls were only being used in the tests.
Remove them and use the FileReadWriteAtVolatile trait instead. That way,
we are also testing what we actually use in the block device.

BUG=b:219595052
TEST=cargo test -p disk
TEST=tools/presubmit

Change-Id: I21adee0fc057acfb2aed6fbaaed01f92befe895a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3462640
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-17 22:04:23 +00:00
Daniel Verkamp
7f400e70fb disk: qcow: remove unused FileReadWriteVolatile impl
Only FileReadWriteAtVolatile is used for disks, so remove the dead code.

BUG=b:219595052
TEST=tools/presubmit

Change-Id: I35280d9218a3f39bdc0e62ca3f30b66d6abb39ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3462639
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-17 22:04:22 +00:00
Daniel Verkamp
06771581f4 sys_util: remove SeekHole trait
This was only used in the qcow_img utility, so it is dead code now.

BUG=b:219595052
TEST=tools/presubmit

Change-Id: Ie0872df9a02c5a0ccb62b2884db0dfcfeceaa7c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3462638
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-17 22:04:21 +00:00
Daniel Verkamp
8fb8084032 qcow_utils: remove qcow_img utility and debug fns
This was a utility created to test the qcow disk implementation, but it
is not used anywhere in the running Chrome OS system and has served its
purpose for testing the qcow crate. Removing it will allow further
cleanups and make it easier to convert the qcow and other disk types to
async.

BUG=b:219595052
TEST=cargo build
TEST=cargo test -p disk

Change-Id: I7dddcfdb0685ee8d55fdb13452fa4ebd95bc78db
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3462637
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-17 22:04:20 +00:00
Junichi Uekawa
0bb6066ef8 system_allocator: Check io range.
io ports is a 16 bit thing, check that it is actually 16 bits and fix
the parameters.

BUG=None
TEST=read intel SDM, run crosvm test

Change-Id: I50b6d5593b0699317ac2f852836208a46240714b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3470601
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-02-17 22:03:47 +00:00
Dennis Kempin
eb962a6993 create_merge: Add BUG= lines into merge commit message
This will trigger the usual gerrit automation to notify the bugs
about the merge being submitted, which will help identify when
fixes have landed in chromeos.

BUG=b:219743659
TEST=./tools/chromeos/create_merge

Change-Id: I6365f3c5596a94a6990caf1e1733e8040e5e8fff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3469495
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-17 19:11:03 +00:00
Alexandre Courbot
05bd01793d devices: vvu: proxy: handle VIRTIO_MSI_NO_VECTOR
The driver can send VIRTIO_MSI_NO_VECTOR as a MSI notification vector in
order to indicate this vector should not be used. We are not using this
currently but the spec mentions it.

BUG=b:194136484
TEST=VVU-enabled console device works properly.

Change-Id: I7023926b4acc8c46c193af6a4c3fb5b6d2383096
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3467299
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-17 12:42:20 +00:00
Alexandre Courbot
777348bbae devices: vvu: proxy: do not mandate a MSI vector for each queue
Currently the proxy code aborts if the sibling did not set a MSI vector
for each of the 16 potentially supported queues. This prevents devices
that use less queues than that (like console, which uses 2) to even
start.

Fix this by putting the MSI vector into an option, and returning an
error at runtime if an unset interrupt is ever signaled.

BUG=b:194136484
BUG=b:213531730
TEST=VVU-enabled console device can start.

Change-Id: I985870c23365ff97fc97553206d6b1a2bfdf8b06
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3467298
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-17 12:33:42 +00:00
Alexandre Courbot
27b4506000 devices: vvu: proxy: use same type for sending and receiving doorbell indices
`process_doorbell_message` receives a usize, so make sure that
`write_bar_doorbell` sends an index of the same type. The
current code is only working on 64-bit machines where both types have
the same size by accident.

BUG=b:194136484
TEST=VVU-enabled console device works properly.

Change-Id: Idf01d4846edcf9bcc5c2d6c36dbc739c81f363e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3467296
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-17 11:55:10 +00:00
Andrew Walbran
cdea9aef39 Allow sandbox pivot root directory to be given on command-line.
This will be useful on Android, which doesn't have /var/empty.

BUG=b:215305014
TEST=tools/dev_container tools/run_tests
TEST=tools/dev_container tools/run_tests --target=vm:aarch64

Change-Id: I3ae013bc29940b223607ca10788c571883acd7ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3468676
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Andrew Walbran <qwandor@google.com>
2022-02-17 11:29:59 +00:00
Alexandre Courbot
516e536a11 devices: vvu: proxy: divide doorbell write offset by multiplier
As specified by the VVU spec, the adress of a doorbell within a BAR is

    cap.offset doorbell_idx * doorbell_off_multiplier

The `cap.offset` is properly accounted for, but not the multiplier,
resulting in a invalid doorbell being notified if the write offset is
bigger than 0.

BUG=b:194136484
BUG=b:213531730
TEST=VVU-enabled console device works properly.

Change-Id: I96a2b67d905d2453017cdd230b2dda21345d236a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3467295
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-17 11:14:28 +00:00
Dennis Kempin
278849cbe1 test_runner: More flexible timeouts
Tests can now be marked as large to increase the timeout from it's
original 60s to 120s.
The test runner is also updated to detect if the test is running in
an emulated environment, and doubles the timeout for those.

BUG=b:218681921
TEST=./tools/presubmit --all

Change-Id: I95fc238dcd23a5035826f422752eaf0ca215706c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3469496
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-16 22:54:17 +00:00
Daniel Verkamp
310d4b3593 aarch64: generalize FDT PCI node parameters
Rather than hard-coding knowledge of the low and high MMIO regions and
configuration space access region in the fdt creation code, we can move
this to the aarch64 VM setup code that has more visibility into memory
layout and allocators.

This will enable future refactoring to collapse the multiple MMIO
regions into a single allocator.

BUG=b:188011323
TEST=Boot Crostini on trogdor

Change-Id: I2709b831d94b467b772cd37465e3431072c7a49d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3457884
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-16 21:44:56 +00:00
Alexandre Courbot
488af9c977 devices: vhost-user: vsock: remove global executor variable
This variable can be passed as part of the backend structure.

BUG=None
TEST=cargo build

Change-Id: Ic279af17e67ffe31baae5db5cb2b3c5a511b0c13
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3451758
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-16 12:10:53 +00:00
Alexandre Courbot
2e7d926f90 devices: vhost-user: wl: remove global executor variable
This variable can be passed as part of the backend structure.

BUG=None
TEST=cargo build

Change-Id: I085761711fe3d214217541e91bb23f00eafc67c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3451757
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-16 12:01:41 +00:00
Alexandre Courbot
b0ba179eb1 devices: vhost-user: gpu: remove global executor variable
This variable can be passed as part of the backend structure.

BUG=None
TEST=cargo build

Change-Id: Ic41c9dbcea780e0251743bc63d7935969fa4550b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3451756
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-16 10:31:34 +00:00
Alexandre Courbot
d368c1520a devices: vhost-user: fs: remove global executor variable
This variable can be passed as part of the backend structure.

BUG=None
TEST=cargo build

Change-Id: Ic2f5987110acb54bd5486bd63924d052bded17cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3451755
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-16 09:56:48 +00:00
Alexandre Courbot
95d104fdd9 devices: vhost-user: cras_snd: remove global executor variable
This variable can be passed as part of the backend structure.

BUG=None
TEST=cargo build

Change-Id: Id8f905cc87de261a1a547da66fb93dafc1b7686d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3451754
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-16 08:36:03 +00:00
Alexandre Courbot
405608118a devices: vhost-user: console: remove global executor variable
This variable can be passed as part of the backend structure.

BUG=None
TEST=cargo build

Change-Id: Ib849a1479c8559b9482b0a96e97e3452a9519cd8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3450028
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Morg <morg@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-16 06:50:38 +00:00
Alexandre Courbot
8068fd74fc devices: vhost-user: block: remove global executor variable
This variable can be passed as part of the backend structure.

BUG=None
TEST=cargo build

Change-Id: I3c1f6e04417ea2e6c8b2d4d662829cf24b353fdf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3450027
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-16 04:54:54 +00:00
Junichi Uekawa
120318d6e6 resources: remove unneeded export of AddressAllocator
Nobody relies on this.

BUG=None
TEST=build

Change-Id: I79e34103079a0e9660a0ff79db4a154125f04bfc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3450016
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-02-16 03:23:55 +00:00
Junichi Uekawa
b451dc78f1 devices: fix some test example values for allocator
Some tests had unrealistic values, fix them in case I want to add some
validation in the future.

BUG=None
TEST=None

Change-Id: I126c83b4ac91442f87aae8be9e84565a7a3d98a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3446980
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-02-16 02:32:52 +00:00
Dennis Kempin
27ecaad405 Pythonify clippy/fmt scripts and add common.py
We are replacing most of our bash tools with python versions so we
can support cross-platform development.

To facilitate writing shell-like scripts in Python, this CL adds
a common.py file to share common utilities. It curretly contains
tools to simplify shell-like command execution and argument parsing.

BUG=b:218559770
TEST=./tools/clippy && ./tools/fmt && ./tools/impl/common.py

Change-Id: I7f8b3523394973ed5c741b926fdc41e52133189f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3461240
Reviewed-by: Maciek Swiech <drmasquatch@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-15 22:01:58 +00:00
Vikram Auradkar
7c9b08aae9 Prepare vmm_vhost to be milti-platform 2/2
The patch prepares backend.rs and connection.rs to be platform
independent by
- depending on base instead on sys_util
- using base::Event over sys_util::EventFd
- replacing RawFd usage with RawDescriptor and derivatives

To keep the noise low, the patch
- aliases structs/traits (Event as EventFd)
- does not rename variables (say from fd to rd).

Note: With this patch the crate/files are not completely platform
independent.

Test: Built, clippy and fmt
Bug: b:213151429
Change-Id: Ib57528ef1a951c3d083cf345c878ec1417b7ce3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3460428
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-02-15 20:56:20 +00:00
Woody Chow
9415d71eb4 virtio_pci_device: Move device activation code to activate()
Increase readability by reducing nesting and function length.
Also, remove Option from VirtioPciDevice.mem as it cannot be
None.

BUG=b:215307964
TEST=cargo test

Change-Id: I66d57d5205a59a507433d71de71ca58a98cfeb6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3460790
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Woody Chow <woodychow@google.com>
2022-02-15 08:12:35 +00:00
Abhishek Bhardwaj
c39d402d84 crosvm: vvu: proxy: Add main process tube to keep_rds
This change adds the main process tube to the list of fds that need to
be kept open after the proxy device process forks.

BUG=b:194136484
TEST=Run device VM without --disable-sandbox.

Change-Id: I41be8ef68cf5925b2f677944998cf2ae1c20fdb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3435165
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
2022-02-15 06:41:02 +00:00
Abhishek Bhardwaj
4e3693fd2a crosvm: vvu: proxy: Add num_interrupts method to the VirtioDevice trait
This change adds a new num_interrupts API to the Virtio device trait.
This is because for the proxy device the number of interrupts is
different from the number of its own queues. It also includes the queues
of the device being proxied i.e. block, net, etc..

BUG=b:194136484
TEST=Run "head /dev/vdb;mount /dev/vdb /mnt;echo "1" >> /mnt/1.txt" in
the sibling VM.

Change-Id: I0c3b3a85772c1364660d5570ad86bbaecfb0faf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3309202
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
2022-02-15 06:29:59 +00:00
Abhishek Bhardwaj
2d9300370c crosvm: vvu: proxy: Implement Doorbell logic
This change implements the Doorbell bar logic for the VVU proxy device.
This includes writing to the call event corresponding to vring specified
by the doorbell write.

BUG=b:194136484
TEST=Test with sibling VM with Vhost master connecting to a device VM.

Change-Id: I1e97c171ca8336151facd19ebe8107b092db8d42
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3301861
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
2022-02-15 06:19:05 +00:00
Abhishek Bhardwaj
13d8745ce8 crosvm: vvu: proxy: Add set_mem_table size check
This change adds another metadata size check to the set_mem_table
function.

BUG=b:194136484
TEST=Test with sibling VM with Vhost master connecting to a device VM.

Change-Id: I561af017a35b2fa7ac81b9bcb1af9c6fcf63ba1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3462647
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
2022-02-15 05:54:55 +00:00
Abhishek Bhardwaj
b6a624edbf crosvm: vvu: proxy: Implement SET_VRING_KICK and SET_VRING_CALL
This change implements the SET_VRING_KICK and SET_VRING_CALL VVU
message. This involves storing both the call and kick events in the
proxy device. Furthermore, this change monitors the kick event and
injects the corresponding interrupt into the guest.

BUG=b:194136484
TEST=Test with sibling VM with Vhost master connecting to a device VM.

Change-Id: I8b400a01c1e82ff7d4fbdbc8a6d7926fef3511dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3301860
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
2022-02-15 05:41:52 +00:00
Junichi Uekawa
d2d66bc0a4 system_allocator: allow more than one region to be in the pool
Allows crosvm-direct to have 0-0xfff regions to be mapped.

limitations: Only the first regions gets reflected in the
pool_base/pool_size.

BUG=b:188011323
BUG=b:184815519
TEST=build

Change-Id: I9da3cb2b8d5611068f9323d6ebf62f44162838b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3450017
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-02-15 00:46:48 +00:00
Vikram Auradkar
15cc292b7e Prepare vmm_vhost to be milti-platform 1/2
The patch prepares backend.rs and connection.rs to be platform
independent by
- depending on base instead on sys_util
- using base::Event over sys_util::EventFd
- replacing RawFd usage with RawDescriptor and derivatives

To keep the noise low, the patch
- aliases structs/traits (Event as EventFd)
- does not rename variables (say from fd to rd).

Note: With this patch the crate/files are not completely platform
independent.

Test: Built, clippy and fmt
Bug: b:213151429

Change-Id: Id93d4a70db627578e6577017f8ca4d69f892d69a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3460427
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-02-14 19:43:17 +00:00
Keiichi Watanabe
9051c150d9 devices: vhost-user: net: Support VVU
BUG=b:213531892
TEST=todo

Change-Id: I0737b85f19295e05e1c0ed073205de0bd2e7e70b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3354273
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-14 07:13:47 +00:00
Chirantan Ekbote
6d97fd0bd7 devices: vhost-user: vsock: Support VVU
Support running the vsock device backend over vvu instead of a unix
doman socket.

BUG=b:213530766
TEST=Use nc-vsock to transfer data between device vm <-> sibling vm

Change-Id: I065ebf8d0bc306fe707d843cfabc2bf600b2e8f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3369506
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-14 07:13:46 +00:00
Daniel Verkamp
f04ba1a14b aarch64: limit PCI IRQ allocator to number of SPIs
The previous limit was incorrect, as we are using SPI (Shared Peripheral
Interrupt) type interrupt sources for PCI devices, but the limit was
based on the total number of SPI + PPI interrupts.

This fixes interrupt delivery when many PCI devices are used on arm
platforms.

BUG=b:218757314
TEST=Run crosvm with 32+ block devices on trogdor

Change-Id: Ie89bc5b7115117d8acaca30ff758b9342940b450
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3453119
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-12 00:07:05 +00:00
Daniel Verkamp
7a06e688f7 aarch64: enlarge low MMIO allocator region
The previous size was only 1 MiB, which can be exhausted when enough
virtio-pci devices or other users of low MMIO are added. Increase it to
32 MiB to allow the addition of more devices, and while we are at it,
change the base of the low MMIO region to a more nicely aligned offset.

BUG=b:218757314
TEST=Run crosvm with 28 block devices on trogdor

Change-Id: Iea30d02f5c529be133b0fcb3666bf2ca72d5a90c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3453117
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-12 00:07:04 +00:00