2021-12-08 00:46:21 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-09-13 17:55:17 +00:00
|
|
|
# Copyright 2022 The ChromiumOS Authors
|
2021-12-08 00:46:21 +00:00
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
2022-09-13 19:37:28 +00:00
|
|
|
|
2021-12-08 00:46:21 +00:00
|
|
|
# Regenerate kvm_sys bindgen bindings.
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
|
|
|
|
|
|
source tools/impl/bindgen-common.sh
|
|
|
|
|
2022-09-13 22:17:56 +00:00
|
|
|
KVM_EXTRAS="// Added by kvm_sys/bindgen.sh
|
2021-12-08 00:46:21 +00:00
|
|
|
pub const KVM_SYSTEM_EVENT_S2IDLE: u32 = 4;
|
|
|
|
// TODO(tjeznach): Remove this when reporting KVM_IOAPIC_NUM_PINS is no longer required.
|
|
|
|
pub const KVM_CAP_IOAPIC_NUM_PINS: u32 = 8191;
|
|
|
|
// TODO(qwandor): Update this once the pKVM patches are merged upstream with a stable capability ID.
|
|
|
|
pub const KVM_CAP_ARM_PROTECTED_VM: u32 = 0xffbadab1;
|
|
|
|
pub const KVM_CAP_ARM_PROTECTED_VM_FLAGS_SET_FW_IPA: u32 = 0;
|
|
|
|
pub const KVM_CAP_ARM_PROTECTED_VM_FLAGS_INFO: u32 = 1;
|
|
|
|
pub const KVM_VM_TYPE_ARM_PROTECTED: u32 = 0x80000000;"
|
|
|
|
|
|
|
|
bindgen_generate \
|
|
|
|
--raw-line "${KVM_EXTRAS}" \
|
|
|
|
--blocklist-item='__kernel.*' \
|
|
|
|
--blocklist-item='__BITS_PER_LONG' \
|
|
|
|
--blocklist-item='__FD_SETSIZE' \
|
|
|
|
--blocklist-item='_?IOC.*' \
|
|
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/kvm.h" \
|
|
|
|
-- \
|
|
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
|
|
| replace_linux_int_types \
|
|
|
|
> kvm_sys/src/x86/bindings.rs
|
|
|
|
|
|
|
|
bindgen_generate \
|
|
|
|
--raw-line "${KVM_EXTRAS}" \
|
|
|
|
--blocklist-item='__kernel.*' \
|
|
|
|
--blocklist-item='__BITS_PER_LONG' \
|
|
|
|
--blocklist-item='__FD_SETSIZE' \
|
|
|
|
--blocklist-item='_?IOC.*' \
|
|
|
|
"${BINDGEN_LINUX_ARM64_HEADERS}/include/linux/kvm.h" \
|
|
|
|
-- \
|
|
|
|
-isystem "${BINDGEN_LINUX_ARM64_HEADERS}/include" \
|
|
|
|
| replace_linux_int_types \
|
|
|
|
> kvm_sys/src/aarch64/bindings.rs
|