mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 12:09:31 +00:00
Virtual environments without PCI support (a common situation in embedded devices models) might use simple memory mapped device instead of the PCI device. The memory mapped Virtio device behavior is based on the PCI device specification. Therefore most operations including device initialization, queues configuration and buffer transfers are nearly identical. For more details and existing differences please see: http://docs.oasis-open.org/virtio/virtio/v1.0/cs04/virtio-v1.0-cs04.html#x1-1090002 BUG=b:189182339 TEST=boot manatee and verify that Virtio PCI devices work properly Change-Id: If7aeb03b96137a672438f85ba2b86296deeef9ca Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3855006 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: Tomasz Nowicki <tnowicki@google.com> Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
86 lines
2.7 KiB
Bash
Executable file
86 lines
2.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Copyright 2022 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
#
|
|
# Regenerate virtio_sys bindgen bindings.
|
|
|
|
set -euo pipefail
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
|
|
source tools/impl/bindgen-common.sh
|
|
|
|
|
|
VIRTIO_NET_EXTRA="// Added by virtio_sys/bindgen.sh
|
|
use data_model::DataInit;
|
|
|
|
// Safe because virtio_net_hdr_mrg_rxbuf has no implicit padding.
|
|
unsafe impl DataInit for virtio_net_hdr_mrg_rxbuf {}"
|
|
|
|
bindgen_generate \
|
|
--allowlist-type='vhost_.*' \
|
|
--allowlist-var='VHOST_.*' \
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/vhost.h" \
|
|
-- \
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
| replace_linux_int_types \
|
|
> virtio_sys/src/vhost.rs
|
|
|
|
bindgen_generate \
|
|
--allowlist-var='VIRTIO_.*' \
|
|
--allowlist-type='virtio_.*' \
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/virtio_config.h" \
|
|
-- \
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
| replace_linux_int_types \
|
|
> virtio_sys/src/virtio_config.rs
|
|
|
|
VIRTIO_IDS_EXTRAS="
|
|
//! This file defines virtio device IDs. IDs with large values (counting down
|
|
//! from 63) are nonstandard and not defined by the virtio specification.
|
|
|
|
// Added by virtio_sys/bindgen.sh - do not edit the generated file.
|
|
// TODO(abhishekbh): Fix this after this device is accepted upstream.
|
|
pub const VIRTIO_ID_VHOST_USER: u32 = 61;
|
|
"
|
|
|
|
bindgen_generate \
|
|
--raw-line "${VIRTIO_IDS_EXTRAS}" \
|
|
--allowlist-var='VIRTIO_.*' \
|
|
--allowlist-type='virtio_.*' \
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/virtio_ids.h" \
|
|
-- \
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
| replace_linux_int_types \
|
|
| rustfmt \
|
|
> virtio_sys/src/virtio_ids.rs
|
|
|
|
bindgen_generate \
|
|
--raw-line "${VIRTIO_NET_EXTRA}" \
|
|
--allowlist-var='VIRTIO_NET_.*' \
|
|
--allowlist-type='virtio_net_.*' \
|
|
--blocklist-type='virtio_net_ctrl_mac' \
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/virtio_net.h" \
|
|
-- \
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
| replace_linux_int_types \
|
|
> virtio_sys/src/virtio_net.rs
|
|
|
|
bindgen_generate \
|
|
--allowlist-var='VRING_.*' \
|
|
--allowlist-var='VIRTIO_RING_.*' \
|
|
--allowlist-type='vring.*' \
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/virtio_ring.h" \
|
|
-- \
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
| replace_linux_int_types \
|
|
> virtio_sys/src/virtio_ring.rs
|
|
|
|
bindgen_generate \
|
|
--allowlist-var='VIRTIO_.*' \
|
|
--allowlist-type='virtio_.*' \
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/virtio_mmio.h" \
|
|
-- \
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
| replace_linux_int_types \
|
|
> virtio_sys/src/virtio_mmio.rs
|