kvm_sys: regenerate x86 and aarch64 bindings

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

Change-Id: Iac652e043575f5c16acf4da5101dd89a15220f33
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339809
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2021-12-07 16:46:21 -08:00 committed by Commit Bot
parent 67dc513aa1
commit 4da1409c03
5 changed files with 1628 additions and 16877 deletions

46
kvm_sys/bindgen.sh Executable file
View file

@ -0,0 +1,46 @@
#!/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 kvm_sys bindgen bindings.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
source tools/impl/bindgen-common.sh
KVM_EXTRAS="// Added by kvm_sys/bindgen.sh
pub const KVM_SYSTEM_EVENT_S2IDLE: u32 = 4;
pub const KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2: u64 = 0x1;
// 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

File diff suppressed because it is too large Load diff

View file

@ -32,8 +32,8 @@ pub mod x86 {
ioctl_iow_nr!(KVM_SET_LAPIC, KVMIO, 0x8f, kvm_lapic_state);
ioctl_iow_nr!(KVM_SET_CPUID2, KVMIO, 0x90, kvm_cpuid2);
ioctl_iowr_nr!(KVM_GET_CPUID2, KVMIO, 0x91, kvm_cpuid2);
ioctl_iow_nr!(KVM_X86_SETUP_MCE, KVMIO, 0x9c, __u64);
ioctl_ior_nr!(KVM_X86_GET_MCE_CAP_SUPPORTED, KVMIO, 0x9d, __u64);
ioctl_iow_nr!(KVM_X86_SETUP_MCE, KVMIO, 0x9c, u64);
ioctl_ior_nr!(KVM_X86_GET_MCE_CAP_SUPPORTED, KVMIO, 0x9d, u64);
ioctl_iow_nr!(KVM_X86_SET_MCE, KVMIO, 0x9e, kvm_x86_mce);
ioctl_ior_nr!(KVM_GET_VCPU_EVENTS, KVMIO, 0x9f, kvm_vcpu_events);
ioctl_iow_nr!(KVM_SET_VCPU_EVENTS, KVMIO, 0xa0, kvm_vcpu_events);
@ -75,7 +75,7 @@ ioctl_iow_nr!(
kvm_userspace_memory_region
);
ioctl_io_nr!(KVM_SET_TSS_ADDR, KVMIO, 0x47);
ioctl_iow_nr!(KVM_SET_IDENTITY_MAP_ADDR, KVMIO, 0x48, __u64);
ioctl_iow_nr!(KVM_SET_IDENTITY_MAP_ADDR, KVMIO, 0x48, u64);
ioctl_io_nr!(KVM_CREATE_IRQCHIP, KVMIO, 0x60);
ioctl_iow_nr!(KVM_IRQ_LINE, KVMIO, 0x61, kvm_irq_level);
ioctl_iowr_nr!(KVM_GET_IRQCHIP, KVMIO, 0x62, kvm_irqchip);

File diff suppressed because it is too large Load diff

View file

@ -22,6 +22,7 @@ dirs=(
common/io_uring
devices/src/virtio/gpu
kernel_loader
kvm_sys
)
for d in "${dirs[@]}"; do