Commit graph

3092 commits

Author SHA1 Message Date
Dennis Kempin
e204dda759 Kokoro: Allow manual merge targets in merge-into-chromeos
This allows us to manually specify the merge target when triggering
the Kokoro job to do partial merges.

BUG=b:209034086
TEST=None

Change-Id: If68231b46981dec679445dde50e1fb5ff66e57c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3340211
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>
2021-12-14 23:41:33 +00:00
Anton Romanov
c8970b7a76 Add continuous and presubmit-cr armhf job configs for kokoro
Change-Id: Ifb00dc70e8a2af690722a40cbdcd9836b950d929
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339182
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-12-14 19:45:21 +00:00
ameron Lutes
cde1b5416f crosvm: Rename libcrosvm_control to crosvm_control
The current inclusion of the 'lib' prefix is redundant and results
in 'liblibcrosvm_control' once built.

These changes remove the 'lib' prefix from the source files.

BUG=b:188858559
TEST=cros_run_unit_tests --board ${board} --packages chromeos-base/crosvm

Change-Id: Ic1bcdce9aa5d879f5867232ffec60f40fe57d3a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3321731
Reviewed-by: Hikaru Nishida <hikalium@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Christian Blichmann <cblichmann@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2021-12-14 18:38:42 +00:00
Anton Romanov
c20f783733 Enable some tests for armhf builds
TEST=./tools/dev_container --hermetic bash -c "./tools/run_tests --target=vm:aarch64 --arch armhf"
BUG=b/203152778

Change-Id: I76da1d029e9b11016b1ed9245c5b09095703fb63
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3328099
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2021-12-14 18:11:32 +00:00
Anton Romanov
19ea70b293 sys_util: fix CMSG_SPACE test on arm32
BUG=b/210015827
TEST=cd common/sys_util; cargo test sock_ctrl

Change-Id: I385719ee606279c7d6cbf9faed142fb51bcaef53
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3331736
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
2021-12-14 18:11:31 +00:00
Chia-I Wu
b86f7f6110 gpu: allow syslog from the render server
BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: I6fe2ce831eb671fedd1c0aa749066c41d181d152
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3335301
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-14 16:54:22 +00:00
Junichi Uekawa
670f9987cb crosvm: Wordsmith.
On Gerrit, fontifying is disabled when a line is > 500 chars. Try to
reduce the DAX description.

BUG=None
TEST=view in gerrit.

Change-Id: I96af91af5e546fc9d86f38ffaa56a7a4c11fd95a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3334325
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2021-12-14 04:44:45 +00:00
Junichi Uekawa
ec8ee49ada crosvm: use underscores for hex constants.
BUG=None
TEST=None

Change-Id: I1833862771baa922c58bc8be91c5bd0d898e9c35
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3329285
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2021-12-14 04:44:44 +00:00
Junichi Uekawa
4d3120526d crosvm: output the command-line parameter.
Instead of the error message, the user would want to know what caused
the error.

Original: invalid value "cannot parse integer from empty string":
invalid base range value

New: invalid value "/dev/mem@": invalid base range value

BUG=None
TEST=unit test.

Change-Id: Ia63a45fde2c47365062d7dfac9d61f242e95c209
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3325821
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2021-12-14 04:44:43 +00:00
Dmitry Torokhov
df1a2d1195 acpi: fix offset of the reset value in FADT.
The correct offset for the reset value in FADT is 128.

BUG=b:3169569
TEST=Build and boot.

Change-Id: If8bb9dc4218261464ce6100456c1386c3abb3936
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3336217
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
2021-12-14 00:25:53 +00:00
Junichi Uekawa
89ee18e135 crosvm: Remove _mem_size
Seems like it's not used anymore.

BUG=None
TEST=cargo test --features=direct  # has less warnings.

Change-Id: Id53f89a89c8e2aa8755394503aac8e773e785c54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3327806
Auto-Submit: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2021-12-14 00:07:34 +00:00
Abhishek Bhardwaj
8ca1345c02 crosvm: vvu: proxy: Implement activate and forwarding of master messages
This change caches the parameters received in the activate method. It
spawns a Worker thread to process Vhost master communication.
Furthermore, it forwards all non-action messages to the Vhost slave.

BUG=b:194136484
TEST=Compile.

Change-Id: Ie853add605ea4daa1c62ec9ce93cbac083e57de7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3288870
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
2021-12-13 21:57:50 +00:00
Dennis Kempin
47eccc1cfd tpm2-sys: Remove dependency on num_cpus
It's no longer used, and pulling in the crate hermit-abi
which does causes problems in Kokoro with the latest update.

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

Change-Id: I0344ea32dcc97923bb7b0010a6e5c33003598df0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3328943
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-12-13 21:53:40 +00:00
Daniel Verkamp
e4db26f1ca sys_util: add basic netlink generic recv wrapper
This only supports receiving messages for now; sending can be added
later if needed.

BUG=b:197247746
TEST=bin/clippy

Change-Id: I40c31d5def6f68da3b0f613695a4e18d2ed3e1f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3319403
Reviewed-by: Allen Webb <allenwebb@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-12-13 20:48:23 +00:00
Daniel Verkamp
a3c6e95bb5 sys_util: add LayoutAllocation as_(mut_)slice()
These functions allow access to the allocated memory as a slice of a
generic type T, rather than just a single element of T like the existing
as_mut() function.

BUG=b:197247746
TEST=tools/presubmit --quick

Change-Id: I09287407b6179066fc14c96539c3032be19736a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3327573
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-12-13 20:48:22 +00:00
Chia-I Wu
a946256c0b seccomp: allow waitid in gpu_renderer_server
virglrender changed from waitpid to waitid.

BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: If056776d934e0c2376d316dcfe37ff2c168933f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3331738
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-13 06:23:12 +00:00
Chia-I Wu
4b94a925df rutabaga: rename VIRGL_RENDERER_MULTI_PROCESS
It was renamed to VIRGL_RENDERER_RENDER_SERVER in virglrenderer.

BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: Ic00be726e720686023ab90e611df67b4e733beb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3331737
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-13 06:23:11 +00:00
Chih-Yang Hsia
ec65fbec1c devices: virtio: extract drain_desc_receiver
Changes:
- Extract drain_desc_receiver
- Wait future only in the last DescriptorChain.

BUG=b:210197743
TEST=alsa_conformance_test

Change-Id: I463517622404f72254e34911a3c296ca8ad45101
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3331978
Reviewed-by: Woody Chow <woodychow@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
2021-12-13 05:04:57 +00:00
Chih-Yang Hsia
9ec39843ed devices: virtio: snd: Add 4/6 channel playback support
ARCVM is using 4 ch with chmap {FL, FR, RL, RR}.
Borealis is using 6 ch with chmap {FL, FR, FC, LFE, RL, RR}.

From amixer we should see
```
localhost / # amixer -c0 cget numid=1
numid=1,iface=PCM,name='Playback Channel Map'
  ; type=INTEGER,access=r----R--,values=6,min=0,max=36,step=0
  : values=0,0,0,0,0,0
  | container
    | chmap-fixed=FL,FR
    | chmap-fixed=FL,FR,RL,RR
    | chmap-fixed=FL,FR,FC,LFE,RL,RR
```

BUG=b:199001477
BUG=b:201382814
TEST=`amixer -c0 cget numid=1`
TEST=alsa_conformance_test -Phw:0,0 -c 4
TEST=alsa_conformance_test -Phw:0,0 -c 6

Change-Id: I6b8a6e4a637fe0413ba9b8d91727bf5c4ee8cd26
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3331977
Reviewed-by: Woody Chow <woodychow@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
2021-12-13 05:04:56 +00:00
Chih-Yang Hsia
34b48775ab audio_streams: Fix incorrect write impl in AudioBuffer
If frame_size is not "power of 2" (e.g. 12 bytes in 6channel/S16_LE),
current write implementation will trigger io::copy error since
- io::copy will split reader into multiple buffers with len() = "power of 2"
  if writer.capacity() >= DEFAULT_BUF_SIZE (which is 8192) and
- trigger early return since current write don't support incomplete frames
  writing.

Changes:
- Remove redundant write impl
- Fix write implementation in AudioBuffer
- Add io_copy_audio_buffer unit test

BUG=b:199001477
BUG=b:201382814
TEST=`cargo test`
TEST=`cargo clippy --all-targets --all-features -- -D warnings`
TEST=`aplay -Dhw:0,0 -f dat /dev/zeros -c 6` with virtio-snd

Change-Id: Ia6b587ab20f474d8c620b69940ca0cc7095da6db
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3331976
Reviewed-by: Woody Chow <woodychow@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
2021-12-13 05:04:55 +00:00
Chih-Yang Hsia
a2b4fc07ff devices: virtio: snd: Set capture to false by default
When running cras-snd without "capture=true" parameter,
Parameters.capture could be false.

BUG=b:201382814
BUG=b:210197743
TEST=./tools/chromeos/setup_cargo && \
       cargo test -p devices --features=audio_cras
TEST=Launch VMs without microphone toggle turned on

Change-Id: Iac54d7985f5b07c39e23516df10641601ab9cca6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3331982
Reviewed-by: Woody Chow <woodychow@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
2021-12-13 05:04:54 +00:00
Alexandre Courbot
3abfaa540f crosvm: display error chain when device fails
Use the '{:#}' formatter to display the complete error chain, similarly
to what we already do for VM failures.

BUG=None
TEST=cargo build

Change-Id: I6cc23c71f4441361ee42fa261dd80c7fe0982009
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3329288
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
2021-12-12 13:03:37 +00:00
Chirantan Ekbote
520ad43e5b Add scudo as an optional feature
BUG=none
TEST=`cargo build --features scudo`

Change-Id: If670ba1644ff508dfd15d7dd3846672904e0125a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3314441
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-12-10 09:09:17 +00:00
Alexandre Courbot
993aa7fd49 crosvm: add option to use persistent TAP interface as network device
Currently we have two ways to enable networking on crosvm:

1) Pass all 3 of `--host_ip`, `--netmask` and `--mac` to have crosvm
create and configure a TAP device. This requires crosvm to either be run
as root, or to have the CAP_NET_ADMIN capability,

2) Have another process with the above privileges create and configure
the TAP device before exec'ing crosvm with the TAP FD still open and
passing it to crosvm with the `--tap-fd` argument.

None of these ways are very convenient for development as they either
require to get some privilege every time crosvm is invoked, or to use
another program (not distributed with crosvm) to do the setup.

This patch adds the `tap-name` command-line option which allows to
create a network device from a configured persistent TAP interface,
which doesn't require any kind of privilege.

A persistent TAP interface can be configured on the host as follows:

    # ip tuntap add mode tap user $USER vnet_hdr crosvm_tap
    # ip addr add 10.0.2.1/24 dev crosvm_tap
    # ip link set crosvm_tap up

Then after this one-time setup, $USER will be able to use the
`crosvm_tap` interface by simply passing `--tap-name crosvm_tap` to
crosvm, without any extra option or tool.

This is convenient for development setups as one just needs to
permanently configure the TAP interface using standard Linux tools on
the host once.

BUG=None
TEST=Check that networking works after passing `--tap-name` to crosvm.

Change-Id: Id053a97d69e47a6fefdbe7f3134841d2bfa1757b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3325827
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2021-12-10 07:31:03 +00:00
Alexandre Courbot
911773a667 crosvm: factorize net device creation code
Some of the network creation device is copy/pasted across functions.
Since we are going to add one more of these functions, make sure we stop
repeating it by consolidating it into a single function that takes a
device creation closure as parameter.

BUG=None
TEST=Successfully created a network interface using `--host_ip`,
`--netmask` and `--mac`.

Change-Id: Id0d01ffd14f2b827fb54cf68878b015682f39df2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3327803
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2021-12-10 07:31:02 +00:00
Dmitry Torokhov
dacf10487c Add option to control whether crosvm reports extended status
Allow callers to control whether they want crosvm return basic
completion status (0 - success, 1 - failure), or additional statuses are
allowed (if available).

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

Change-Id: I44f3ae5f6d2b5ddff93cd12f3871c97755c93467
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3328410
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-12-10 07:27:31 +00:00
Dennis Kempin
0fcc7ace5a Uprev rust toolchain to 1.56.1
Two new clippy fixes are affecting us, but will be easy to fix in
a follow-up.
Fixed the dev-container so we can create a new version with the new
toolchain.

BUG=b:210037151
TEST=Kokoro

Change-Id: I9ac4d84aff72b1ee5219d6dab0a88667ca6c5951
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3328954
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-12-10 02:34:50 +00:00
Chia-I Wu
cba95dba9c rutabaga_gfx: fix gfxstream build
Fix

error[E0560]: struct `renderer_utils::VirglCookie` has no field named `None`
   --> rutabaga_gfx/src/gfxstream.rs:213:13
    |
213 |             None,
    |             ^^^^ `renderer_utils::VirglCookie` does not have this field
    |
    = note: available fields are: `fence_state`, `render_server_fd`

Also silience all warnings related to render server.

Change-Id: I19ef8746b63379a5517ba9abd3faf4e9da0abfc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3328098
Auto-Submit: Chia-I Wu <olv@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2021-12-10 01:54:35 +00:00
Chia-I Wu
16fb659272 devices: gpu: add render server support
When "--gpu-render-server path=<path>" is specified, start the render
server shipped with virglrenderer and initialize virglrenderer with
VIRGLRENDERER_MULTI_PROCESS flag.

The flag makes virgl_renderer_context_create_with_flags create proxy
contexts instead of venus contexts.  Each proxy context requests the
render server to fork a subprocess and executes GPU commands in the
subprocess.

BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: If5e2dc3353572cadb60b0c25a3e0ad14f633db91
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3283508
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-09 20:16:13 +00:00
Chia-I Wu
2bcec5c3d9 sys_util: impl From<UnixSeqpacket> for SafeDescriptor
BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: Icfd3994ef62f0c27b817a3824da18977a943cc00
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3315233
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-09 20:16:12 +00:00
Chia-I Wu
64ba89ac84 seccomp: add gpu_common.policy
Let gpu_device.policy include gpu_common.policy.  No functional change.

BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: Ic83c29b5713c95374562ee6eba35002142e00357
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3311904
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-09 20:16:10 +00:00
Chia-I Wu
fffb569137 gpu: refactor create_gpu_device
Add gpu_jail to create a simple jail and customize the jail.  No
functional change.

BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: I63df5f4009e83cfdfa122edac1788eab56a2dfa0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3311903
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-09 20:16:09 +00:00
Chia-I Wu
11e32f6ece rutabaga_gfx: prepare for VIRGL_RENDERER_MULTI_PROCESS
When the flag is set, virglrenderer can use the get_server_fd callback
to get the socket to the render server.

BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: I692b5068a04e841b0a0ed2344a77908e720e19eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3283506
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-09 20:16:07 +00:00
Chia-I Wu
e39bbbd025 rutabaga_gfx: add RUTABAGA_MEM_HANDLE_TYPE_SHM
virglrenderer can return an fd of type VIRGL_RENDERER_BLOB_FD_TYPE_SHM.

BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: Ie8def22f3dc6dc13a4972955aadabb91be838493
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3283505
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-09 20:16:06 +00:00
Chia-I Wu
844160daf1 rutabaga_gfx: re-generate virglrenderer bindings
BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: Ife4ef9ef3db4ad421ed0b24e902dd0d06915273f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3283504
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-09 20:16:03 +00:00
Chia-I Wu
39ad06d10a rutabaga_gfx: impl Drop for VirglRenderer
We should clean up virglrenderer.

BUG=b:177267762
TEST=run vk and gl apps on volteer

Change-Id: I6fb0075f28a7c1fb35ff977e98652326e1297da4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3315232
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chia-I Wu <olv@google.com>
2021-12-09 20:16:02 +00:00
Keiichi Watanabe
9d7887049d tools: Stop generating API docs for libvda
This should fix the GitHub Action as well.

BUG=none
TEST=kokoro
TEST=Run GitHub Action on my crosvm fork

Change-Id: Iff00d7d68c8dc38cda8222850bcc06ba2b558d01
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3327801
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>
2021-12-09 18:01:34 +00:00
Keiichi Watanabe
879868ad0f Fix cargo-doc warnings
BUG=none
TEST=./tools/cargo-doc

Change-Id: If2a89761d47464eb139f1f32c8cb3cb10fad3f81
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3305959
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2021-12-09 14:34:33 +00:00
Keiichi Watanabe
3e7c388efa tools: Add cargo-doc script
BUG=none
TEST=Run GitHub Action on my personal GitHub repository

Change-Id: I62de2693f3a654e0bbd327eff5931380a153395d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3305958
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2021-12-09 14:34:31 +00:00
Chirantan Ekbote
48ee10414c asyncv2: Split fallocate into separate functions
Rather than exposing fallocate directly, add separate functions for each
of the high level operations.  This should make it easier to add
cross-platform support as well as avoid the need to force callers to
deal with libc flags.

BUG=b:195468578
TEST=unit tests

Change-Id: I2aa6affa5cd87b299065b83bfc9bd400565308b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276119
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-12-09 12:33:09 +00:00
Chirantan Ekbote
0e81fd02dd data_model: Add advance() truncate() to VolatileSlice
BUG=b:195468578
TEST=unit tests

Change-Id: I0f17cb13867fdc7681e3d2124e53adb1e5354b03
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276118
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-12-09 12:33:08 +00:00
Chirantan Ekbote
0bf7cd0f2c data_model: Change VolatileSlice::as_iobuf() to return IoBufMut
This is more cross-platform and makes it easier to integrate with the
new async framework.

BUG=b:195468578
TEST=unit tests

Change-Id: Ia49413f35d71aaf3c1f9af86922372b96b69483d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276117
Reviewed-by: Michael Hoyle <mikehoyle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-12-09 12:33:06 +00:00
Chirantan Ekbote
be39e5eff0 cros_asyncv2: Add support for timers
BUG=b:195468578
TEST=unit tests

Change-Id: I61f6bca1cfb5b0fe020e2fd5af33aa915c24ec54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3225746
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-12-09 12:33:05 +00:00
Chirantan Ekbote
7b13ef3ea6 cros_asyncv2: Add crate
Based on the previous proposal in [1].

* The Executor is now completely platform-agnostic and only relies on
  the platform to provide a type that implements the `PlatformState`
  trait.
* The crate provides concrete high-level types rather than forcing users
  to deal with trait objects and async-trait.  Currently, only File and
  Event are supported.  Support for timers, sockets, and pipes will be
  added in subsequent changes.
* Each high-level type delegates the implementation to a
  platform-specific type and exists mainly as a place to hold
  documentation and tests.
* On Unix the io_driver module provides async versions of various
  IO-related syscalls, which are used by the platform-specific File and
  Event types to implement the required behavior.
* io-uring support can be disabled at compile time.  When uring support
  is enabled, we make a runtime check to decide whether or not to use
  it.  The actual io-uring driver is currently unimplemented and will be
  added in a subsequent change.

One non-trivial downside of this change is that the futures returned by
the various async methods are !Send and !Sync, which means that they can
only be awaited from the same thread on which they were started.  In
practice this should be fine since current crosvm (and Chrome OS) code
doesn't really make use of sending futures to different threads. This
can also be mitigated by using `Executor::spawn_local` and a
`oneshot::channel` to isolate the !Send future from the outer async
fn (as long as the output of the future is Send). See the crate
documentation and the `outer_future_is_send` test in `src/executor.rs`
for more details.

[1]: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3062166

BUG=b:195468578
TEST=unit tests

Change-Id: I1aad0885e67a957149e2ec3b4d9df215d9b20d81
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3222223
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-12-09 12:33:02 +00:00
Chih-Yang Hsia
99829b3e17 devices: virtio: snd: Support num_{output,input}_streams
Since Android needs separated PCM devices for different use
cases, we add multiple PCM streams support in virtio-snd
for both input and output direction.

Changes:
- Add num_{output, input}_streams support in ChromeOS's backend
- Remove todos since hardcoded_snd_data and
  hardcoded_virtio_snd_config are used in cras_backend
  implementation only.
- Update help message

BUG=b:199001477
TEST=`cargo test` for Parameters parsing
TEST=`crosvm run --cras-snd=num_output_streams=<num> ...`
     and check with `aplay -l`
TEST=`crosvm run --cras-snd=num_input_streams=<num> ...`
     and check with `arecord -l`

Change-Id: I59b2fd547b101d099f837f85c0b739f720795990
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3322796
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Woody Chow <woodychow@google.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
2021-12-09 02:05:09 +00:00
Anton Romanov
14e024ae4e Make aarch64 vm usable for running armhf binaries.
BUG: b/203152778
TEST: ./tools/run_tests --target vm:aarch64; ./tools/run_tests vm:aarch64 --arch armhf
Change-Id: I5b774ebf66f1a0a71e025dc364a6e85d43d3b6cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3324410
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2021-12-09 01:08:45 +00:00
Xiong Zhang
91a56fe9da x86_64: Change E820Type from constants to enum
In order to comply with kernel E820Type definition and make code more
readable, this commit changes E820Type from constants to enum.

BUG=None
TEST=tools/presubmit

Change-Id: I514a3f71c734305c19cebbca6844f09d1fb16dab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3314866
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-12-09 00:19:44 +00:00
Xiong Zhang
65700032fb x86_64: remove "pcie_ports=native" command line
Since _OSC is added, OS could negotiate any pcie features with firmware
through _OSC, so remove "pcie_ports=native" parameter from command line.

BUG=b:197877871
TEST=check pcie native hotplug compability in VM

Change-Id: Iba363aa0d5c6acaf61d72ed9cc4697677f9ace6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3305946
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-12-09 00:19:43 +00:00
Xiong Zhang
b5fa790d53 x86_64: Add _OSC for pcie hotplug
OS call acpi _OSC method to request control for PCIE natvie features like
pcie hotplug, pcie advanced error report, pcie PME. But currently crosvm
lack of _OSC method, so OS couldn't enable these pcie features.

This commit add _OSC method, enable pcie hotplug and pcie cap structure
control, but disable SHPC hotplug, pcie PME and pcie AER.

BUG=b:197877871
TEST=Check pcie hotplug capability in VM

Change-Id: If4b6c8026c312ebfdeb18df7c0673571e3e9b631
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3305945
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-12-09 00:19:42 +00:00
Dennis Kempin
f4d5d32970 Add documentation for ChromeOS integration
BUG=b:209034086
TEST=None

Change-Id: Ia26a1fdd110dd72e3801a189d2854fd876469030
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3321735
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
2021-12-08 18:50:50 +00:00