Commit graph

3076 commits

Author SHA1 Message Date
Dennis Kempin
7a543caa2e clippy: fix disk crate
Just a few nit fixes and we can now enable clippy for this crate.

BUG=b:192373803
TEST=./tools/clippy

Change-Id: Ia6ab90fa33e979066d9eeae2372630d93cf4026a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3441343
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-07 22:22:38 +00:00
Xiong Zhang
4a356f670a pcie: Add PME support
When virtual pcie root port RTD3 is enabled, it will enter into suspend if child device
isn't exist. Pcie hp driver disable hotplug interrupt once it enters into suspend state,
so hotplug interrupt couldn't be injected into guest if pcie RP is in suspend state. In
such case a PME will be injected into CrOS to wakeup itself first, another hotplug event
will be injected after this PME.

BUG=b:185084350
TEST=Hotplug a vfio-pci device into CrOS with virtual RP RTD3 enabled

Change-Id: I96f8ac6ba27072f6cfbc01df00c0a48f2d92a7e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423463
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-07 21:30:01 +00:00
Xiong Zhang
5823da01d5 pcie: Add pci power control capability
In order to link virtual pcie root port's power status with physical
pcie root port, power control capability should be added to let guest
enable RTD3 for virtual pcie root port.

BUG=b:185084350
TEST=check virtual pcie root port's RTD3 status in CrOS

Change-Id: I25e36b845b7ec198f995e82dda7850e4a1af0d9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423462
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-07 21:30:00 +00:00
Xiong Zhang
4f6d228629 Pcie: Reserve the same bridge window size as host RP
When pcie-root-port parameter is used to link virtual pcie RP with
physical RP, they should have the same bridge window size.

BUG=b:185084350
TEST=Boot CrOS with pcie-root-port parameter in ManaTEE and check
bridge window size in CrOS

Change-Id: I7864b37ecd61af52b470701803e746080f3a9025
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423461
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-07 21:29:59 +00:00
Xiong Zhang
f787471913 Linux: Add parameter to pass host pcie root port into guest
Add pcie-root-port parameter, it specify host pcie root port's sysfs, then
it will have a virtual pcie root port in guest, as guest and host have
the same pci address, so virtual pcie root port creation should be prior
to build_vm().

BUG=b:185084350
TEST=boot CrOS with --pcie-root-port=sysfs_path in ManaTEE and check virtual
RP's function in CrOS

Change-Id: Id357e0de057d5387f135213e89702f27163faaee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423460
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-07 21:29:58 +00:00
Xiong Zhang
cf093620a8 pcie: Link virtual pcie root port to physical pcie root port
On ManaTEE, each physical pcie root port has a virtual pcie root port in
CrOS, this commit links virtual RP to physical RP. The following virtual
RP's config registers are from physical:
--devie ID
--device type
--bridge bus range

BUG=b:185084350
TEST=Check virtual pcie RP config registers in ManaTEE CrOS

Change-Id: Ia38a0f2417331d562dbb305433c68a3bee678bde
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423459
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-07 21:29:57 +00:00
Xiong Zhang
10e4637525 Pcie: let PcieRootPort determine bridge's PciAddress
Currently bridge's PciAddress is allocated from system bus allocator,
but when virtual pcie root port is linked to physical pcie root port,
its PciAddress should be same as physical pcie RP, so thid commit let
bridge get its PciAddress from the backend pcie RP device, this is
convenient for later pcie root port.

This commit doesn't change function.

BUG=b:185084350
TEST=tools/presubmit

Change-Id: I2b81f6447898bd76758569095aa48f3daa2b0dcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423458
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-07 21:29:56 +00:00
Xiong Zhang
d1f6ca1dc1 Pcie: let PcieRootPort determine bridge bus range
Currently pci bridge's bus range is managed in pci bridge structure, but
when virtual pcie root port is linked to physical pcie root port, the bus
range of virtual pcie RP should be same as physical pcie RP, so this commit
let bridge get its bus range from the backend pcie root port device, this
is convenient for later physcial pcie root port.

This commit doesn't change function.

BUG=b:185084350
TEST=tools/presubmit

Change-Id: I80c54365d6def455e32e7934e7216c677902450d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423457
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-07 21:29:56 +00:00
Xiong Zhang
760f8ba70a pcie: split pcie.rs into pcie directory
As more function are adding into pcie.rs, one file wil be larger. This commit
split pcie.rs into three files:
pci_bridge.rs: handle pci bridge device and implement PciDevice trait
pcie_device:rs: define PcieDevice trait and PcieCap
pcie_rp.rs: virtual pcie root port emulation, implement PcieDevice trait and
            HotPlugBus trait

This commit doesn't change function.

BUG=b:185084350
TEST=tools/presubmit

Change-Id: I4ab16f35e78a9d084a7a47d91a7fcf37e9f3e91d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423456
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-07 21:29:55 +00:00
Woody Chow
100d7a85c1 iommu: Switch to async
An async IPC translation request handler will be added for
b/215307964. This CL is preliminary.

BUG=b:215307964
TEST=cargo test/block device with VIRTIO_F_ACCESS_PLATFORM
     with crrev.com/c/3347309 (to be submitted)

Change-Id: I1ce7b1c53e8efb3ae8652caba02693fee77646b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3382499
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Woody Chow <woodychow@google.com>
2022-02-07 06:23:47 +00:00
Alexandre Courbot
1ee6783a57 devices: vhost-user: properly return device failures
The `run_until` method of the executor returns a Result<Result<..>>,
where the outer result signals errors within the async executor, and the
inner result is the actual result of the passed future.

The current error handling completely ignores this inner error, making
"crosvm device" exit silently if we e.g. specify a socket that already
exists.

Fix this by explicitly returning outer errors if they exist, and
returning the inner anyhow::Result as-is so both levels of errors are
properly reported.

BUG=None
TEST=cargo build
TEST=console device properly reports and error if its socket file
already exists.

Change-Id: I7d091bd7b0d66a07c6f340ebf9e395d0dab2c212
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439668
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-07 02:28:50 +00:00
Bartłomiej Grzesik
73072d6d16 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>
2022-02-04 21:52:46 +00:00
Bartłomiej Grzesik
2bbbe1184a virtio: video: encoder: store frame rate in input and output params
Prior to this change, frame rate wasn't modified in video encoder input
and output params. This resulted in hypervisor reporting to guest a frame
rate equal to zero at all time. This is inconsistent with actual frame rate.
Futhermore frame rate equal to zero causes v4l2-compliance to fail.

This CL ensures that frame rate is stored in input and output stream
params and that its value is reported correctly to the guest. With this
change we remove field_rate from Stream struct to avoid storing the same
value in 3 saperate places instead 2.

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: Iff76a923d5f337db86fe67bfc77b13cd6bf58edf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3417310
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Marcin Wojtas <mwojtas@google.com>
2022-02-04 21:52:45 +00:00
Bartłomiej Grzesik
b021c0b7c2 virtio: video: store frame size in both input and output params
Till this point, frame size was stored in either input params or output
params depending on the device. This caused to virtio-video to report
zerod width and height on one buffer end, which caused v4l2-compliance
to fail.

This CL makes encoder and decoder store frame sizes in both params.

BUG=b:160440787
BUG=b:161774071
TEST=v4l2-compliance -d /dev/video0
TEST=v4l2-compliance -d /dev/video1
TEST=tast run eve arc.Video*

Change-Id: I77d8ab4c0ed1d0a877ed090b169a922606dcee70
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3412775
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Marcin Wojtas <mwojtas@google.com>
2022-02-04 21:52:44 +00:00
Bartłomiej Grzesik
ca52033219 virtio: video: decoder: set default stream parameters
Previously most decoder initial parameters were set to zero due to use
of Default::default(). This caused decoder to start with incorrect values,
and led to v4l2-compliance failing.

This CL sets initial decoder parameters to artificially chosen values in
order to comply with v4l2-compliance.

BUG=b:160440787
TEST=v4l2-compliance -d /dev/video0
TEST=tast run eve arc.Video*

Change-Id: I283473d856e94087f039bc8f60c978c384f7f22c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3402215
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Marcin Wojtas <mwojtas@google.com>
2022-02-04 21:52:43 +00:00
Bartłomiej Grzesik
12e0d6417f virtio: video: introduce PlaneFormat::get_plane_layout function
Before this CL, both encoder and decoder had separate code which
computed plane formats for given format.

This CL removes code duplication, by introducing PlaneFormat::get_plane_layout,
which returns vector of plane formats if given format is supported. At
this point only NV12 is supported.

BUG=b:160440787
BUG=b:161774071
TEST=v4l2-compliance -d /dev/video0
TEST=v4l2-compliance -d /dev/video1
TEST=tast run eve arc.Video*

Change-Id: I427346d7e286a2e52aa4cbdc6e042a996812f3b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3425360
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Marcin Wojtas <mwojtas@google.com>
2022-02-04 21:52:42 +00:00
Daniel Verkamp
995c91af7d ci/kokoro: add a no-default-features build
To help find missing feature cfg checks, add a build with all features
disabled to the CI scripts.

BUG=None
TEST=tools/presubmit

Change-Id: I98f38ecc3bf90cbeb081a1fafe4f2f540e4fc348
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3437362
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-04 21:19:33 +00:00
Dennis Kempin
d9af9d6a58 clippy: Fix aarch64 and crosvm-fuzz
Add proper conditional compilation flags. This will largely still skip
most of those crates, but at least the syntax will be checked.

BUG=b:192373803
TEST=./tools/clippy

Change-Id: I66d29ccdfec01f3a83b682a9cc135188fdc830cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3438705
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-04 19:16:05 +00:00
Richard Fung
08289b1a83 Move GPU initialization earlier
Moving the GPU initialization earlier makes it so that the addition of
block devices does alter PCI slot of the GPU. This makes it so that
SELinux rules won't need to be changed any time we add a new device.
Without this patch, adding another disk breaks ARCVM for this reason.

BUG=b:199685490
TEST=local_test_runner arc.Boot.vm

Change-Id: I55e2a4c95cd5783108b0458e6cb2fc5f554e1847
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3433227
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Richard Fung <richardfung@google.com>
2022-02-04 17:27:27 +00:00
Alexandre Courbot
5d12163091 devices: vhost-user: console: always restore terminal capabilities
We used to bail early if an error happened while we run the console
device, leaving the terminal in raw mode.

BUG=None
TEST=cargo build

Change-Id: I3dc4a681f736246548d1cc7b7eab0bfd429587be
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439667
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-02-04 12:12:20 +00:00
Woody Chow
ffa04d7a5e iommu: Move protocol to protocol.rs
New iommu backend to handle virtio devices will be added.
This CL makes organizing the code in the future easier.

BUG=b:202151642
TEST=cargo test/block device with VIRTIO_F_ACCESS_PLATFORM
     with crrev.com/c/3347309 (to be submitted)

Change-Id: Ib6ac9687298b1d75f151aea7c07963757f8dad87
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3305966
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Woody Chow <woodychow@google.com>
2022-02-04 07:04:18 +00:00
Anton Romanov
cb3cabe3ba Upgrade rust toolchain version to 1.58.1
Pre 1.58.1 have CVE-2022-21658
Cros toolchain got upgraded to 1.58.1

BUG=None
TEST=cq

Change-Id: I2ce5a08b40bcc4895c4f2ecef83efd4162d67494
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3435385
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-02-04 02:20:36 +00:00
Keiichi Watanabe
cb3d88edc6 devices: virtio: Add virtqueue struct for VFIO driver
Implement UserQueue struct which represents a virtqueue for a VFIO
driver.
Unlike the existing `virtio::Queue` which provides methods for devices
to handle virtqueues, this struct provides methods for drivers.
This will be used by virtio-vhost-user VFIO driver which run in the
guest userspace.

This implementation is hidden behind the "vvu" feature.

BUG=b:194137301
TEST=cargo test --features=vvu in devices

Change-Id: I3813448279b2f6576c0eb295a742728cef28a9b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3206630
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-04 01:57:53 +00:00
Daniel Verkamp
0615347ede crosvm: guard GPU import with the gpu feature flag
Fixes build when the gpu feature is disabled.

BUG=None
TEST=cargo build --no-default-features

Fixes: e464a7a6c0 ("gpu: prepare to start render server separately from GPU device")
Change-Id: I61185328c92ec1582b4f8bee8bad321207504ff5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3438145
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-02-03 22:16:26 +00:00
Gurchetan Singh
dca095864f rutabaga_gfx: stream_renderer_create_blob and related functions
This CL adds stream_renderer_create_blob and export_blob
support.

BUG=b:208516032
TEST=run gfxstream

Change-Id: I312e266df04e0291ecefce05d3a63c527e6d87af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3429702
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2022-02-03 03:23:58 +00:00
Chirantan Ekbote
59c5ea8258 cros_asyncv2: Enable support for io_uring
Benchmark data for vm.Fio.block_stress_rw on my hatch_helios:
 * without uring: read bw = 92047, write bw = 214790
 * with uring: read bw = 114332, write bw = 266586

BUG=b:195468578
TEST=unit tests

Change-Id: If02e4a8c7555d6a26f9b204d97bfb9533db55973
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3366173
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-02-03 03:05:30 +00:00
Dmitry Torokhov
e464a7a6c0 gpu: prepare to start render server separately from GPU device
Separating the render server from virtio GPU code will allow us to start
it when starting plugin-based VMs.

BUG=None
TEST=./tools/presubmit

Change-Id: If31780effddfd2b3f21b6b6cbc0c9630931a3c9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3418733
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2022-02-02 21:27:23 +00:00
Grzegorz Jaszczyk
1f4e67e324 sys_util: add acpi event support
The acpi events are netlink generic based messages, used by kernel to
notify about various ACPI related events (in fact, the "acpi_event" is
one of registered by the kernel generic netlink family). This commit
adds support for de-capsulating and parsing acpi events from the netlink
generic message.

BUG=b:197247746
TEST=Build crosvm-direct and listen on acpi events, parse and use them
[above done with additional WIP patches but without acpi_event.rs modification]

Change-Id: I1671d95b1bca1fbd31ba042eac49f5d2d99cb92a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3407320
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
2022-02-02 20:03:35 +00:00
Gurchetan Singh
7d7fb7c567 rutabaga_gfx: get component from context type
The component type information is useful from time to time.

BUG=b:208516032
TEST=run gfxstream

Change-Id: I16be012064f2c764f021ae52c09c2371f2a29ccc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3429701
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-02 18:14:06 +00:00
Abhishek Bhardwaj
90fd164992 crosvm: vvu: proxy: Implement SET_MEM_TABLE and SET_VRING_CALL message
This change implements the SET_MEM_TABLE and lays the foundation of the
SET_VRING_CALL VVU message. It mmaps memory based on the the parameters
sent over the message.

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

Change-Id: I34398e6bad633ac9f72c5c1859c43c7c90c9ea25
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3301859
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
Auto-Submit: Abhishek Bhardwaj <abhishekbh@chromium.org>
2022-02-02 11:13:45 +00:00
Keiichi Watanabe
3e7fa6ab51 github: Specify mdbook's target path
As crrev.com/c/3423291 added `linkcheck` target to book.toml, the
directory structure was changed and we need to specify the path to
publish the documentation.

BUG=none
TEST=check on personal github account

Change-Id: Ic30e26d07d98eb21b0132cc4e792b6a054f98427
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3428606
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-02 06:14:27 +00:00
Keiichi Watanabe
eb5207aa29 docs: Enable mdbook-linkcheck
Use https://github.com/Michael-F-Bryan/mdbook-linkcheck to check broken
links. Since this is added as a target in book.toml, the check will run
while `mdbook build`.

BUG=none
TEST=Run `mdbook build`

Change-Id: I7615953f9428c2f8a7a4ec456bb6ae92ede55c68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423291
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-02 02:52:54 +00:00
Keiichi Watanabe
f46226d65a tools: dev_container: Install mdbook-linkcheck
Install https://github.com/Michael-F-Bryan/mdbook-linkcheck and bump up
the container version.

BUG=none
TEST=make -C tools/impl/dev_container crosvm_dev

Change-Id: I6ce95ddb66f93e23b5abac5ee1350ff8e3106073
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3428603
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-02 02:52:53 +00:00
Vikram Auradkar
f7da4929c1 Rename files to match job config files
TEST=none

Change-Id: I6c1c54ab2960c09a02c10a02359fbdd176423319
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3429623
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-02-02 00:00:38 +00:00
Chia-I Wu
3d27a4b747 rutabaga_gfx: enable debug callback on arm
v2: add va_list and share code between x86/arm debug_callback.

BUG=b:209647747
TEST=cargo fmt
TEST=tail -f /var/log/messages

Change-Id: I0a8ac703aacb95ac0b4df069aa6e2b48401d8c3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3320959
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chia-I Wu <olv@google.com>
2022-02-01 22:17:27 +00:00
Chia-I Wu
bdd15ba5e7 rutabaga_gfx: fix virgl_renderer_bindings generator
There are three fixes

 - rustfmt the generated code
 - define VIRGL_RENDERER_UNSTABLE_APIS
 - use ${sysroot}/usr/include/virglrenderer.h by default, and use the
   checked out repo only when --virglrenderer is specified

BUG=b:209647747
TEST=tail -f /var/log/messages

Change-Id: Iabd337be140b8b82ffc9e3488b812ed30ef28027
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3429700
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chia-I Wu <olv@google.com>
2022-02-01 22:17:26 +00:00
Chia-I Wu
198320c1c5 rutabaga_gfx: simplify debug_callback
The va_list can be consumed.  There is no need to simulate a va_copy
before calling vsnprintf.

BUG=b:209647747
TEST=tail -f /var/log/messages

Change-Id: Ib61f22bd55b013d2ebdb7e2c983f530b86ea1ab3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3429699
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Phillip Pearson <philpearson@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chia-I Wu <olv@google.com>
2022-02-01 22:17:25 +00:00
Keiichi Watanabe
72982f57e2 CONTRIBUTING: Add links to mdbook
BUG=none
TEST=none

Change-Id: I4191ed589d9f3887a0d84ed8d70ad135c0b89507
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3255196
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-01 10:39:32 +00:00
Keiichi Watanabe
292b50cd64 docs: Cosmetic changes for code blocks
* Remove leading `$`s so that readers can copy and pastes commands more
easily.
* Use `sh` instead of `bash` because `bash` is for scripts rather than
command line interfaces.

These rules are ones used in mdBook's instruction.
https://github.com/rust-lang/mdBook/tree/master/guide/src/guide

BUG=none
TEST=mdbook build

Change-Id: I3b35fa2c7b20ef10e3da78a47f41a1603744daf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423292
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
2022-02-01 10:39:31 +00:00
Vikram Auradkar
71e74b0a64 Add kokoro build config file and helper script
Build config sets timeout to 40 minutes.
helper script relies on choco to install rustup, which is used
to install rust toolchain.

Bug: 213603713
Test: Tested the toolchain setup part of the script in a
      codelab repo.
Change-Id: Ibf139bbc4ff6fe6c811652767dd885584414dda6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3421515
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Amiosci <brandonamiosci@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-02-01 07:56:02 +00:00
Woody Chow
8b2c7b995b virtqueue: DescriptorChain::checked_new returns anyhow::Error
checked_new fails when guest gives invalid descriptor entries.
The error makes debugging easier.

BUG=None
TEST=cargo test

Change-Id: I6c6f5b04e7f39a685d95ca738b9cb01be643fa21
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3418620
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Woody Chow <woodychow@google.com>
2022-02-01 05:53:07 +00:00
Anton Romanov
d43ae3c13c Fix building without gpu feature.
Guard gpu-related imports

BUG=None
TEST=cargo check --no-default-features; cargo check

Change-Id: Iaec2d7a6896a55e9450dd29c9168a27059684491
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3426379
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-01-31 19:08:16 +00:00
Junichi Uekawa
d7cbca27e3 system_allocator: Fix comments.
While reading code, some of the comments need fixing.

BUG=None
TEST=None

Change-Id: Iff9cd639f5e14512680475bcf9240c07551690a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3418634
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-01-31 06:41:58 +00:00
Dennis Kempin
0520a95161 ci/kokoro: Pythonify the simulate script
Does the same thing, but in python. This should allow us to make
this work on windows as well.

BUG=b:216833094
TEST=./simulate.py build-x86_64.sh

Change-Id: If6eb214c2a3185fbb60a636b89cd03ecf28b42e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3425651
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-29 16:49:32 +00:00
Keiichi Watanabe
6b7a9923ae docs: Fix broken links
BUG=none
TEST=mdbook build

Change-Id: I77bde44d5614ecab28c0b3c23e1c5f67c52235f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3423290
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-01-29 03:48:23 +00:00
Anton Romanov
195724b002 async: remove misplaced must_use attribute
must_use attribute clearly was meant to be set on future struct type
since futures need to be polled to do anything. It was never meant to
apply to invocation of paste macro
Also, today any implementor of `Future` trait gets that attribute by
default anyway

BUG=n/a
TEST=cargo check

Change-Id: I60db1aa2bc7c8d6130cc1579641ae815c9cb738e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3425184
Reviewed-by: Anton Romanov <romanton@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-01-29 03:26:09 +00:00
Long Cheng
7ea795dc56 Apply usb configuration even configuration is not changed.
Apply usb configuration even when configuration is not changed. When
Android sets usb configuration, it expects the device connection gets reset.
This change will pass CTS verifer  USB devices tests which try to
observe device connection and reconnection after set unchanged usb
configuration.

BUG=b:123374026
TEST= Run cts verifer USB device tests in ARCVM.
TEST=lsusb in crostini. device shows.

Change-Id: I5856d1173a3ea1a65c6fa205cb9facd407706a6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3413815
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Long Cheng <lgcheng@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Long Cheng <lgcheng@google.com>
2022-01-29 01:11:41 +00:00
Anton Romanov
5acc0f52f5 linux: split out linux mod into multiple
At nearly 4k loc its harder to maintain. This change only moves some
things around without changing any code. Input on symbol visibility is
welcome - in reality it doesn't really matter if symb is
pub/pub(super)/pub(crate) as mods themselves are private to linux mod.
I plan to invest more into splitting things apart if possible
(especially the main loop) but its a start

TEST=./tools/presubmit
BUG=n/a

Change-Id: I2792dd0acdb5627f1c9b5d0fb998c976c6fe5e15
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3422266
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
2022-01-28 23:07:01 +00:00
Anton Romanov
6afc5a7f10 Rename linux.rs into linux/mod.rs to preserve at least some history after refactoring
BUG=n/a
TEST=cargo check

Change-Id: Id2de1980b4e63f7f50e72223f4240fb079c14570
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3425697
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Anton Romanov <romanton@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-01-28 23:06:38 +00:00
Allen Webb
da4bad999f sys_util: Add support for F_SEAL_FUTURE_WRITE.
BUG=b:210847494
TEST=cargo build

Change-Id: I8bb714cafba994afed42cbf0c9e6d9adee799dd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3408094
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Allen Webb <allenwebb@google.com>
Auto-Submit: Allen Webb <allenwebb@google.com>
2022-01-28 18:45:49 +00:00