From c970dd44f461ea55cca257539a43d4cc7e07e594 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 8 Jan 2024 13:53:22 -0800 Subject: [PATCH] bindgen: update to Linux 6.6 headers The obsolete KVM_SET_MEMORY_ALIAS ioctl was removed from the kernel; it was already unused in crosvm, so remove the corresponding ioctl macro. Change-Id: I1ecfce4b8df886680154c567f82ab7f006fbfd1f Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5178535 Commit-Queue: Daniel Verkamp Reviewed-by: Dennis Kempin --- io_uring/src/bindings.rs | 50 +++++++------- kernel_loader/src/elf.rs | 8 +++ kvm_sys/src/aarch64/bindings.rs | 97 +++++++++++++++++++++++---- kvm_sys/src/lib.rs | 1 - kvm_sys/src/x86/bindings.rs | 112 +++++++++++++++++++++++++------- net_sys/src/if_tun.rs | 2 + tools/impl/bindgen-common.sh | 2 +- vfio_sys/src/vfio.rs | 97 ++++++++++++++++++++++++++- virtio_sys/src/vhost.rs | 13 ++++ virtio_sys/src/virtio_config.rs | 1 + virtio_sys/src/virtio_net.rs | 21 ++++++ 11 files changed, 340 insertions(+), 64 deletions(-) diff --git a/io_uring/src/bindings.rs b/io_uring/src/bindings.rs index 25007412d3..5801a26737 100644 --- a/io_uring/src/bindings.rs +++ b/io_uring/src/bindings.rs @@ -96,7 +96,11 @@ pub const IORING_SETUP_SQE128: u32 = 1024; pub const IORING_SETUP_CQE32: u32 = 2048; pub const IORING_SETUP_SINGLE_ISSUER: u32 = 4096; pub const IORING_SETUP_DEFER_TASKRUN: u32 = 8192; +pub const IORING_SETUP_NO_MMAP: u32 = 16384; +pub const IORING_SETUP_REGISTERED_FD_ONLY: u32 = 32768; +pub const IORING_SETUP_NO_SQARRAY: u32 = 65536; pub const IORING_URING_CMD_FIXED: u32 = 1; +pub const IORING_URING_CMD_POLLED: u32 = 2147483648; pub const IORING_FSYNC_DATASYNC: u32 = 1; pub const IORING_TIMEOUT_ABS: u32 = 1; pub const IORING_TIMEOUT_UPDATE: u32 = 2; @@ -104,6 +108,7 @@ pub const IORING_TIMEOUT_BOOTTIME: u32 = 4; pub const IORING_TIMEOUT_REALTIME: u32 = 8; pub const IORING_LINK_TIMEOUT_UPDATE: u32 = 16; pub const IORING_TIMEOUT_ETIME_SUCCESS: u32 = 32; +pub const IORING_TIMEOUT_MULTISHOT: u32 = 64; pub const IORING_TIMEOUT_CLOCK_MASK: u32 = 12; pub const IORING_TIMEOUT_UPDATE_MASK: u32 = 18; pub const IORING_POLL_ADD_MULTI: u32 = 1; @@ -114,6 +119,8 @@ pub const IORING_ASYNC_CANCEL_ALL: u32 = 1; pub const IORING_ASYNC_CANCEL_FD: u32 = 2; pub const IORING_ASYNC_CANCEL_ANY: u32 = 4; pub const IORING_ASYNC_CANCEL_FD_FIXED: u32 = 8; +pub const IORING_ASYNC_CANCEL_USERDATA: u32 = 16; +pub const IORING_ASYNC_CANCEL_OP: u32 = 32; pub const IORING_RECVSEND_POLL_FIRST: u32 = 1; pub const IORING_RECV_MULTISHOT: u32 = 2; pub const IORING_RECVSEND_FIXED_BUF: u32 = 4; @@ -121,6 +128,7 @@ pub const IORING_SEND_ZC_REPORT_USAGE: u32 = 8; pub const IORING_NOTIF_USAGE_ZC_COPIED: u32 = 2147483648; pub const IORING_ACCEPT_MULTISHOT: u32 = 1; pub const IORING_MSG_RING_CQE_SKIP: u32 = 1; +pub const IORING_MSG_RING_FLAGS_PASS: u32 = 2; pub const IORING_CQE_F_BUFFER: u32 = 1; pub const IORING_CQE_F_MORE: u32 = 2; pub const IORING_CQE_F_SOCK_NONEMPTY: u32 = 4; @@ -128,6 +136,9 @@ pub const IORING_CQE_F_NOTIF: u32 = 8; pub const IORING_OFF_SQ_RING: u32 = 0; pub const IORING_OFF_CQ_RING: u32 = 134217728; pub const IORING_OFF_SQES: u32 = 268435456; +pub const IORING_OFF_PBUF_RING: u32 = 2147483648; +pub const IORING_OFF_PBUF_SHIFT: u32 = 16; +pub const IORING_OFF_MMAP_MASK: u32 = 4160749568; pub const IORING_SQ_NEED_WAKEUP: u32 = 1; pub const IORING_SQ_CQ_OVERFLOW: u32 = 2; pub const IORING_SQ_TASKRUN: u32 = 4; @@ -150,6 +161,7 @@ pub const IORING_FEAT_NATIVE_WORKERS: u32 = 512; pub const IORING_FEAT_RSRC_TAGS: u32 = 1024; pub const IORING_FEAT_CQE_SKIP: u32 = 2048; pub const IORING_FEAT_LINKED_FILE: u32 = 4096; +pub const IORING_FEAT_REG_REG_RING: u32 = 8192; pub const IORING_RSRC_REGISTER_SPARSE: u32 = 1; pub const IORING_REGISTER_FILES_SKIP: i32 = -2; pub const IO_URING_OP_SUPPORTED: u32 = 1; @@ -388,7 +400,7 @@ pub struct io_sqring_offsets { pub dropped: u32, pub array: u32, pub resv1: u32, - pub resv2: u64, + pub user_addr: u64, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -401,7 +413,7 @@ pub struct io_cqring_offsets { pub cqes: u32, pub flags: u32, pub resv1: u32, - pub resv2: u64, + pub user_addr: u64, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -444,6 +456,7 @@ pub const IORING_UNREGISTER_PBUF_RING: _bindgen_ty_4 = 23; pub const IORING_REGISTER_SYNC_CANCEL: _bindgen_ty_4 = 24; pub const IORING_REGISTER_FILE_ALLOC_RANGE: _bindgen_ty_4 = 25; pub const IORING_REGISTER_LAST: _bindgen_ty_4 = 26; +pub const IORING_REGISTER_USE_REGISTERED_RING: _bindgen_ty_4 = 2147483648; pub type _bindgen_ty_4 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -480,21 +493,6 @@ pub struct io_uring_rsrc_update2 { } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] -pub struct io_uring_notification_slot { - pub tag: u64, - pub resv: [u64; 3usize], -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct io_uring_notification_register { - pub nr_slots: u32, - pub resv: u32, - pub resv2: u64, - pub data: u64, - pub resv3: u64, -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] pub struct io_uring_probe_op { pub op: u8, pub resv: u8, @@ -602,15 +600,15 @@ pub struct io_uring_buf_reg { pub ring_addr: u64, pub ring_entries: u32, pub bgid: u16, - pub pad: u16, + pub flags: u16, pub resv: [u64; 3usize], } -pub const IORING_RESTRICTION_REGISTER_OP: _bindgen_ty_6 = 0; -pub const IORING_RESTRICTION_SQE_OP: _bindgen_ty_6 = 1; -pub const IORING_RESTRICTION_SQE_FLAGS_ALLOWED: _bindgen_ty_6 = 2; -pub const IORING_RESTRICTION_SQE_FLAGS_REQUIRED: _bindgen_ty_6 = 3; -pub const IORING_RESTRICTION_LAST: _bindgen_ty_6 = 4; -pub type _bindgen_ty_6 = ::std::os::raw::c_uint; +pub const IORING_RESTRICTION_REGISTER_OP: _bindgen_ty_7 = 0; +pub const IORING_RESTRICTION_SQE_OP: _bindgen_ty_7 = 1; +pub const IORING_RESTRICTION_SQE_FLAGS_ALLOWED: _bindgen_ty_7 = 2; +pub const IORING_RESTRICTION_SQE_FLAGS_REQUIRED: _bindgen_ty_7 = 3; +pub const IORING_RESTRICTION_LAST: _bindgen_ty_7 = 4; +pub type _bindgen_ty_7 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct io_uring_getevents_arg { @@ -626,7 +624,9 @@ pub struct io_uring_sync_cancel_reg { pub fd: i32, pub flags: u32, pub timeout: __kernel_timespec, - pub pad: [u64; 4usize], + pub opcode: u8, + pub pad: [u8; 7usize], + pub pad2: [u64; 3usize], } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/kernel_loader/src/elf.rs b/kernel_loader/src/elf.rs index a66d513822..d616d04de7 100644 --- a/kernel_loader/src/elf.rs +++ b/kernel_loader/src/elf.rs @@ -232,9 +232,12 @@ pub const NT_PPC_TM_CTAR: u32 = 269; pub const NT_PPC_TM_CPPR: u32 = 270; pub const NT_PPC_TM_CDSCR: u32 = 271; pub const NT_PPC_PKEY: u32 = 272; +pub const NT_PPC_DEXCR: u32 = 273; +pub const NT_PPC_HASHKEYR: u32 = 274; pub const NT_386_TLS: u32 = 512; pub const NT_386_IOPERM: u32 = 513; pub const NT_X86_XSTATE: u32 = 514; +pub const NT_X86_SHSTK: u32 = 516; pub const NT_S390_HIGH_GPRS: u32 = 768; pub const NT_S390_TIMER: u32 = 769; pub const NT_S390_TODCMP: u32 = 770; @@ -263,16 +266,21 @@ pub const NT_ARM_TAGGED_ADDR_CTRL: u32 = 1033; pub const NT_ARM_PAC_ENABLED_KEYS: u32 = 1034; pub const NT_ARM_SSVE: u32 = 1035; pub const NT_ARM_ZA: u32 = 1036; +pub const NT_ARM_ZT: u32 = 1037; pub const NT_ARC_V2: u32 = 1536; pub const NT_VMCOREDD: u32 = 1792; pub const NT_MIPS_DSP: u32 = 2048; pub const NT_MIPS_FP_MODE: u32 = 2049; pub const NT_MIPS_MSA: u32 = 2050; +pub const NT_RISCV_CSR: u32 = 2304; +pub const NT_RISCV_VECTOR: u32 = 2305; pub const NT_LOONGARCH_CPUCFG: u32 = 2560; pub const NT_LOONGARCH_CSR: u32 = 2561; pub const NT_LOONGARCH_LSX: u32 = 2562; pub const NT_LOONGARCH_LASX: u32 = 2563; pub const NT_LOONGARCH_LBT: u32 = 2564; +pub const NT_LOONGARCH_HW_BREAK: u32 = 2565; +pub const NT_LOONGARCH_HW_WATCH: u32 = 2566; pub const NT_GNU_PROPERTY_TYPE_0: u32 = 5; pub const GNU_PROPERTY_AARCH64_FEATURE_1_AND: u32 = 3221225472; pub const GNU_PROPERTY_AARCH64_FEATURE_1_BTI: u32 = 1; diff --git a/kvm_sys/src/aarch64/bindings.rs b/kvm_sys/src/aarch64/bindings.rs index c79b66210c..5b05df2264 100644 --- a/kvm_sys/src/aarch64/bindings.rs +++ b/kvm_sys/src/aarch64/bindings.rs @@ -177,6 +177,17 @@ pub const HWCAP2_SME_FA64: u32 = 1073741824; pub const HWCAP2_WFXT: u32 = 2147483648; pub const HWCAP2_EBF16: u64 = 4294967296; pub const HWCAP2_SVE_EBF16: u64 = 8589934592; +pub const HWCAP2_CSSC: u64 = 17179869184; +pub const HWCAP2_RPRFM: u64 = 34359738368; +pub const HWCAP2_SVE2P1: u64 = 68719476736; +pub const HWCAP2_SME2: u64 = 137438953472; +pub const HWCAP2_SME2P1: u64 = 274877906944; +pub const HWCAP2_SME_I16I32: u64 = 549755813888; +pub const HWCAP2_SME_BI32I32: u64 = 1099511627776; +pub const HWCAP2_SME_B16B16: u64 = 2199023255552; +pub const HWCAP2_SME_F16F16: u64 = 4398046511104; +pub const HWCAP2_MOPS: u64 = 8796093022208; +pub const HWCAP2_HBC: u64 = 17592186044416; pub const __SVE_VQ_BYTES: u32 = 16; pub const __SVE_VQ_MIN: u32 = 1; pub const __SVE_VQ_MAX: u32 = 512; @@ -229,6 +240,7 @@ pub const SVE_PT_VL_ONEXEC: u32 = 4; pub const ZA_PT_VL_INHERIT: u32 = 2; pub const ZA_PT_VL_ONEXEC: u32 = 4; pub const KVM_COALESCED_MMIO_PAGE_OFFSET: u32 = 1; +pub const KVM_DIRTY_LOG_PAGE_OFFSET: u32 = 64; pub const KVM_ARM_TARGET_AEM_V8: u32 = 0; pub const KVM_ARM_TARGET_FOUNDATION_V8: u32 = 1; pub const KVM_ARM_TARGET_CORTEX_A57: u32 = 2; @@ -254,6 +266,7 @@ pub const KVM_ARM_VCPU_PMU_V3: u32 = 3; pub const KVM_ARM_VCPU_SVE: u32 = 4; pub const KVM_ARM_VCPU_PTRAUTH_ADDRESS: u32 = 5; pub const KVM_ARM_VCPU_PTRAUTH_GENERIC: u32 = 6; +pub const KVM_ARM_VCPU_HAS_EL2: u32 = 7; pub const KVM_ARM_MAX_DBG_REGS: u32 = 16; pub const KVM_DEBUG_ARCH_HSR_HIGH_VALID: u32 = 1; pub const KVM_GUESTDBG_USE_SW_BP: u32 = 65536; @@ -305,6 +318,8 @@ pub const KVM_ARM64_SVE_VQ_MIN: u32 = 1; pub const KVM_ARM64_SVE_VQ_MAX: u32 = 512; pub const KVM_ARM64_SVE_VLS_WORDS: u32 = 8; pub const KVM_REG_ARM_FW_FEAT_BMAP: u32 = 1441792; +pub const KVM_ARM_VM_SMCCC_CTRL: u32 = 0; +pub const KVM_ARM_VM_SMCCC_FILTER: u32 = 0; pub const KVM_DEV_ARM_VGIC_GRP_ADDR: u32 = 0; pub const KVM_DEV_ARM_VGIC_GRP_DIST_REGS: u32 = 1; pub const KVM_DEV_ARM_VGIC_GRP_CPU_REGS: u32 = 2; @@ -338,6 +353,8 @@ pub const KVM_ARM_VCPU_PMU_V3_SET_PMU: u32 = 3; pub const KVM_ARM_VCPU_TIMER_CTRL: u32 = 1; pub const KVM_ARM_VCPU_TIMER_IRQ_VTIMER: u32 = 0; pub const KVM_ARM_VCPU_TIMER_IRQ_PTIMER: u32 = 1; +pub const KVM_ARM_VCPU_TIMER_IRQ_HVTIMER: u32 = 2; +pub const KVM_ARM_VCPU_TIMER_IRQ_HPTIMER: u32 = 3; pub const KVM_ARM_VCPU_PVTIME_CTRL: u32 = 2; pub const KVM_ARM_VCPU_PVTIME_IPA: u32 = 0; pub const KVM_ARM_IRQ_VCPU2_SHIFT: u32 = 28; @@ -362,6 +379,8 @@ pub const KVM_PSCI_RET_INVAL: i32 = -2; pub const KVM_PSCI_RET_DENIED: i32 = -3; pub const KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2: u32 = 1; pub const KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED: u32 = 1; +pub const KVM_HYPERCALL_EXIT_SMC: u32 = 1; +pub const KVM_HYPERCALL_EXIT_16BIT: u32 = 2; pub const KVM_API_VERSION: u32 = 12; pub const KVM_TRC_SHIFT: u32 = 16; pub const KVM_TRC_ENTRYEXIT: u32 = 65536; @@ -465,6 +484,7 @@ pub const KVM_SYSTEM_EVENT_SEV_TERM: u32 = 6; pub const KVM_MSR_EXIT_REASON_INVAL: u32 = 1; pub const KVM_MSR_EXIT_REASON_UNKNOWN: u32 = 2; pub const KVM_MSR_EXIT_REASON_FILTER: u32 = 4; +pub const KVM_MSR_EXIT_REASON_VALID_MASK: u32 = 7; pub const KVM_NOTIFY_CONTEXT_INVALID: u32 = 1; pub const SYNC_REGS_SIZE_BYTES: u32 = 2048; pub const KVM_S390_MEMOP_LOGICAL_READ: u32 = 0; @@ -473,9 +493,12 @@ pub const KVM_S390_MEMOP_SIDA_READ: u32 = 2; pub const KVM_S390_MEMOP_SIDA_WRITE: u32 = 3; pub const KVM_S390_MEMOP_ABSOLUTE_READ: u32 = 4; pub const KVM_S390_MEMOP_ABSOLUTE_WRITE: u32 = 5; +pub const KVM_S390_MEMOP_ABSOLUTE_CMPXCHG: u32 = 6; pub const KVM_S390_MEMOP_F_CHECK_ONLY: u32 = 1; pub const KVM_S390_MEMOP_F_INJECT_EXCEPTION: u32 = 2; pub const KVM_S390_MEMOP_F_SKEY_PROTECTION: u32 = 4; +pub const KVM_S390_MEMOP_EXTENSION_CAP_BASE: u32 = 1; +pub const KVM_S390_MEMOP_EXTENSION_CAP_CMPXCHG: u32 = 2; pub const KVM_MP_STATE_RUNNABLE: u32 = 0; pub const KVM_MP_STATE_UNINITIALIZED: u32 = 1; pub const KVM_MP_STATE_INIT_RECEIVED: u32 = 2; @@ -740,6 +763,12 @@ pub const KVM_CAP_VM_DISABLE_NX_HUGE_PAGES: u32 = 220; pub const KVM_CAP_S390_ZPCI_OP: u32 = 221; pub const KVM_CAP_S390_CPU_TOPOLOGY: u32 = 222; pub const KVM_CAP_DIRTY_LOG_RING_ACQ_REL: u32 = 223; +pub const KVM_CAP_S390_PROTECTED_ASYNC_DISABLE: u32 = 224; +pub const KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP: u32 = 225; +pub const KVM_CAP_PMU_EVENT_MASKED_EVENTS: u32 = 226; +pub const KVM_CAP_COUNTER_OFFSET: u32 = 227; +pub const KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE: u32 = 228; +pub const KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES: u32 = 229; pub const KVM_CAP_GET_CUR_CPUFREQ: u32 = 512; pub const KVM_CAP_UTIL_HINT: u32 = 513; pub const KVM_CAP_GET_CPUFREQ_TBL: u32 = 514; @@ -778,6 +807,9 @@ pub const KVM_REG_SIZE_U1024: u64 = 31525197391593472; pub const KVM_REG_SIZE_U2048: u64 = 36028797018963968; pub const KVM_MSI_VALID_DEVID: u32 = 1; pub const KVM_CREATE_DEVICE_TEST: u32 = 1; +pub const KVM_DEV_VFIO_FILE: u32 = 1; +pub const KVM_DEV_VFIO_FILE_ADD: u32 = 1; +pub const KVM_DEV_VFIO_FILE_DEL: u32 = 2; pub const KVM_DEV_VFIO_GROUP: u32 = 1; pub const KVM_DEV_VFIO_GROUP_ADD: u32 = 1; pub const KVM_DEV_VFIO_GROUP_DEL: u32 = 2; @@ -792,6 +824,7 @@ pub const KVM_XEN_ATTR_TYPE_SHARED_INFO: u32 = 1; pub const KVM_XEN_ATTR_TYPE_UPCALL_VECTOR: u32 = 2; pub const KVM_XEN_ATTR_TYPE_EVTCHN: u32 = 3; pub const KVM_XEN_ATTR_TYPE_XEN_VERSION: u32 = 4; +pub const KVM_XEN_ATTR_TYPE_RUNSTATE_UPDATE_FLAG: u32 = 5; pub const KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO: u32 = 0; pub const KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO: u32 = 1; pub const KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR: u32 = 2; @@ -822,7 +855,6 @@ pub const KVM_HYPERV_CONN_ID_MASK: u32 = 16777215; pub const KVM_HYPERV_EVENTFD_DEASSIGN: u32 = 1; pub const KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE: u32 = 1; pub const KVM_DIRTY_LOG_INITIALLY_SET: u32 = 2; -pub const KVM_DIRTY_LOG_PAGE_OFFSET: u32 = 0; pub const KVM_DIRTY_GFN_F_MASK: u32 = 3; pub const KVM_BUS_LOCK_DETECTION_OFF: u32 = 1; pub const KVM_BUS_LOCK_DETECTION_EXIT: u32 = 2; @@ -853,6 +885,8 @@ pub const KVM_X86_NOTIFY_VMEXIT_USER: u32 = 2; pub const KVM_S390_ZPCIOP_REG_AEN: u32 = 0; pub const KVM_S390_ZPCIOP_DEREG_AEN: u32 = 1; pub const KVM_S390_ZPCIOP_REGAEN_HOST: u32 = 1; +pub type __s128 = i128; +pub type __u128 = u128; pub type __le16 = u16; pub type __be16 = u16; pub type __le32 = u32; @@ -1018,6 +1052,12 @@ impl Default for kvm_arm_copy_mte_tags { } } } +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct kvm_arm_counter_offset { + pub counter_offset: u64, + pub reserved: u64, +} pub const KVM_REG_ARM_STD_BIT_TRNG_V1_0: _bindgen_ty_1 = 0; pub type _bindgen_ty_1 = ::std::os::raw::c_uint; pub const KVM_REG_ARM_STD_HYP_BIT_PV_TIME: _bindgen_ty_2 = 0; @@ -1025,6 +1065,18 @@ pub type _bindgen_ty_2 = ::std::os::raw::c_uint; pub const KVM_REG_ARM_VENDOR_HYP_BIT_FUNC_FEAT: _bindgen_ty_3 = 0; pub const KVM_REG_ARM_VENDOR_HYP_BIT_PTP: _bindgen_ty_3 = 1; pub type _bindgen_ty_3 = ::std::os::raw::c_uint; +pub const kvm_smccc_filter_action_KVM_SMCCC_FILTER_HANDLE: kvm_smccc_filter_action = 0; +pub const kvm_smccc_filter_action_KVM_SMCCC_FILTER_DENY: kvm_smccc_filter_action = 1; +pub const kvm_smccc_filter_action_KVM_SMCCC_FILTER_FWD_TO_USER: kvm_smccc_filter_action = 2; +pub type kvm_smccc_filter_action = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct kvm_smccc_filter { + pub base: u32, + pub nr_functions: u32, + pub action: u8, + pub pad: [u8; 15usize], +} #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct kvm_user_trace_setup { @@ -1048,14 +1100,6 @@ pub struct kvm_debug_guest { } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] -pub struct kvm_memory_region { - pub slot: u32, - pub flags: u32, - pub guest_phys_addr: u64, - pub memory_size: u64, -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] pub struct kvm_userspace_memory_region { pub slot: u32, pub flags: u32, @@ -1358,13 +1402,36 @@ pub struct kvm_run__bindgen_ty_1__bindgen_ty_6 { pub is_write: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Copy, Clone)] pub struct kvm_run__bindgen_ty_1__bindgen_ty_7 { pub nr: u64, pub args: [u64; 6usize], pub ret: u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1__bindgen_ty_7__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1__bindgen_ty_7__bindgen_ty_1 { pub longmode: u32, - pub pad: u32, + pub flags: u64, +} +impl Default for kvm_run__bindgen_ty_1__bindgen_ty_7__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for kvm_run__bindgen_ty_1__bindgen_ty_7 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -1689,6 +1756,8 @@ pub union kvm_s390_mem_op__bindgen_ty_1 { pub struct kvm_s390_mem_op__bindgen_ty_1__bindgen_ty_1 { pub ar: u8, pub key: u8, + pub pad1: [u8; 6usize], + pub old_addr: u64, } impl Default for kvm_s390_mem_op__bindgen_ty_1 { fn default() -> Self { @@ -2212,7 +2281,8 @@ pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3: kvm_device_type = 7; pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8; pub const kvm_device_type_KVM_DEV_TYPE_XIVE: kvm_device_type = 9; pub const kvm_device_type_KVM_DEV_TYPE_ARM_PV_TIME: kvm_device_type = 10; -pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 11; +pub const kvm_device_type_KVM_DEV_TYPE_RISCV_AIA: kvm_device_type = 11; +pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 12; pub type kvm_device_type = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -2326,6 +2396,8 @@ pub const pv_cmd_id_KVM_PV_PREP_RESET: pv_cmd_id = 5; pub const pv_cmd_id_KVM_PV_UNSHARE_ALL: pv_cmd_id = 6; pub const pv_cmd_id_KVM_PV_INFO: pv_cmd_id = 7; pub const pv_cmd_id_KVM_PV_DUMP: pv_cmd_id = 8; +pub const pv_cmd_id_KVM_PV_ASYNC_CLEANUP_PREPARE: pv_cmd_id = 9; +pub const pv_cmd_id_KVM_PV_ASYNC_CLEANUP_PERFORM: pv_cmd_id = 10; pub type pv_cmd_id = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -2349,6 +2421,7 @@ pub struct kvm_xen_hvm_attr { pub union kvm_xen_hvm_attr__bindgen_ty_1 { pub long_mode: u8, pub vector: u8, + pub runstate_update_flag: u8, pub shared_info: kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_1, pub evtchn: kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_2, pub xen_version: u32, diff --git a/kvm_sys/src/lib.rs b/kvm_sys/src/lib.rs index 3b4a848363..721fa19cbb 100644 --- a/kvm_sys/src/lib.rs +++ b/kvm_sys/src/lib.rs @@ -36,7 +36,6 @@ pub mod x86 { ioctl_iowr_nr!(KVM_GET_MSR_INDEX_LIST, KVMIO, 0x02, kvm_msr_list); ioctl_iowr_nr!(KVM_GET_SUPPORTED_CPUID, KVMIO, 0x05, kvm_cpuid2); ioctl_iowr_nr!(KVM_GET_EMULATED_CPUID, KVMIO, 0x09, kvm_cpuid2); - ioctl_iow_nr!(KVM_SET_MEMORY_ALIAS, KVMIO, 0x43, kvm_memory_alias); ioctl_iow_nr!(KVM_XEN_HVM_CONFIG, KVMIO, 0x7a, kvm_xen_hvm_config); ioctl_ior_nr!(KVM_GET_PIT2, KVMIO, 0x9f, kvm_pit_state2); ioctl_iow_nr!(KVM_SET_PIT2, KVMIO, 0xa0, kvm_pit_state2); diff --git a/kvm_sys/src/x86/bindings.rs b/kvm_sys/src/x86/bindings.rs index e3496d7bdc..6a87173385 100644 --- a/kvm_sys/src/x86/bindings.rs +++ b/kvm_sys/src/x86/bindings.rs @@ -246,9 +246,11 @@ pub const KVM_SREGS2_FLAGS_PDPTRS_VALID: u32 = 1; pub const KVM_MSR_FILTER_MAX_BITMAP_SIZE: u32 = 1536; pub const KVM_MSR_FILTER_READ: u32 = 1; pub const KVM_MSR_FILTER_WRITE: u32 = 2; +pub const KVM_MSR_FILTER_RANGE_VALID_MASK: u32 = 3; pub const KVM_MSR_FILTER_MAX_RANGES: u32 = 16; pub const KVM_MSR_FILTER_DEFAULT_ALLOW: u32 = 0; pub const KVM_MSR_FILTER_DEFAULT_DENY: u32 = 1; +pub const KVM_MSR_FILTER_VALID_MASK: u32 = 1; pub const KVM_CPUID_FLAG_SIGNIFCANT_INDEX: u32 = 1; pub const KVM_CPUID_FLAG_STATEFUL_FUNC: u32 = 2; pub const KVM_CPUID_FLAG_STATE_READ_NEXT: u32 = 4; @@ -294,6 +296,7 @@ pub const KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE: u32 = 1; pub const KVM_X86_XCOMP_GUEST_SUPP: u32 = 0; pub const KVM_PMU_EVENT_ALLOW: u32 = 0; pub const KVM_PMU_EVENT_DENY: u32 = 1; +pub const KVM_PMU_MASKED_ENTRY_UMASK_MASK_SHIFT: u32 = 56; pub const KVM_VCPU_TSC_CTRL: u32 = 0; pub const KVM_VCPU_TSC_OFFSET: u32 = 0; pub const KVM_API_VERSION: u32 = 12; @@ -399,6 +402,7 @@ pub const KVM_SYSTEM_EVENT_SEV_TERM: u32 = 6; pub const KVM_MSR_EXIT_REASON_INVAL: u32 = 1; pub const KVM_MSR_EXIT_REASON_UNKNOWN: u32 = 2; pub const KVM_MSR_EXIT_REASON_FILTER: u32 = 4; +pub const KVM_MSR_EXIT_REASON_VALID_MASK: u32 = 7; pub const KVM_NOTIFY_CONTEXT_INVALID: u32 = 1; pub const SYNC_REGS_SIZE_BYTES: u32 = 2048; pub const KVM_S390_MEMOP_LOGICAL_READ: u32 = 0; @@ -407,9 +411,12 @@ pub const KVM_S390_MEMOP_SIDA_READ: u32 = 2; pub const KVM_S390_MEMOP_SIDA_WRITE: u32 = 3; pub const KVM_S390_MEMOP_ABSOLUTE_READ: u32 = 4; pub const KVM_S390_MEMOP_ABSOLUTE_WRITE: u32 = 5; +pub const KVM_S390_MEMOP_ABSOLUTE_CMPXCHG: u32 = 6; pub const KVM_S390_MEMOP_F_CHECK_ONLY: u32 = 1; pub const KVM_S390_MEMOP_F_INJECT_EXCEPTION: u32 = 2; pub const KVM_S390_MEMOP_F_SKEY_PROTECTION: u32 = 4; +pub const KVM_S390_MEMOP_EXTENSION_CAP_BASE: u32 = 1; +pub const KVM_S390_MEMOP_EXTENSION_CAP_CMPXCHG: u32 = 2; pub const KVM_MP_STATE_RUNNABLE: u32 = 0; pub const KVM_MP_STATE_UNINITIALIZED: u32 = 1; pub const KVM_MP_STATE_INIT_RECEIVED: u32 = 2; @@ -682,6 +689,12 @@ pub const KVM_CAP_VM_DISABLE_NX_HUGE_PAGES: u32 = 220; pub const KVM_CAP_S390_ZPCI_OP: u32 = 221; pub const KVM_CAP_S390_CPU_TOPOLOGY: u32 = 222; pub const KVM_CAP_DIRTY_LOG_RING_ACQ_REL: u32 = 223; +pub const KVM_CAP_S390_PROTECTED_ASYNC_DISABLE: u32 = 224; +pub const KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP: u32 = 225; +pub const KVM_CAP_PMU_EVENT_MASKED_EVENTS: u32 = 226; +pub const KVM_CAP_COUNTER_OFFSET: u32 = 227; +pub const KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE: u32 = 228; +pub const KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES: u32 = 229; pub const KVM_CAP_GET_CUR_CPUFREQ: u32 = 512; pub const KVM_CAP_UTIL_HINT: u32 = 513; pub const KVM_CAP_GET_CPUFREQ_TBL: u32 = 514; @@ -696,6 +709,7 @@ pub const KVM_XEN_HVM_CONFIG_SHARED_INFO: u32 = 4; pub const KVM_XEN_HVM_CONFIG_RUNSTATE: u32 = 8; pub const KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL: u32 = 16; pub const KVM_XEN_HVM_CONFIG_EVTCHN_SEND: u32 = 32; +pub const KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG: u32 = 64; pub const KVM_IRQFD_FLAG_DEASSIGN: u32 = 1; pub const KVM_IRQFD_FLAG_RESAMPLE: u32 = 2; pub const KVM_CLOCK_TSC_STABLE: u32 = 2; @@ -726,6 +740,9 @@ pub const KVM_REG_SIZE_U1024: u64 = 31525197391593472; pub const KVM_REG_SIZE_U2048: u64 = 36028797018963968; pub const KVM_MSI_VALID_DEVID: u32 = 1; pub const KVM_CREATE_DEVICE_TEST: u32 = 1; +pub const KVM_DEV_VFIO_FILE: u32 = 1; +pub const KVM_DEV_VFIO_FILE_ADD: u32 = 1; +pub const KVM_DEV_VFIO_FILE_DEL: u32 = 2; pub const KVM_DEV_VFIO_GROUP: u32 = 1; pub const KVM_DEV_VFIO_GROUP_ADD: u32 = 1; pub const KVM_DEV_VFIO_GROUP_DEL: u32 = 2; @@ -740,6 +757,7 @@ pub const KVM_XEN_ATTR_TYPE_SHARED_INFO: u32 = 1; pub const KVM_XEN_ATTR_TYPE_UPCALL_VECTOR: u32 = 2; pub const KVM_XEN_ATTR_TYPE_EVTCHN: u32 = 3; pub const KVM_XEN_ATTR_TYPE_XEN_VERSION: u32 = 4; +pub const KVM_XEN_ATTR_TYPE_RUNSTATE_UPDATE_FLAG: u32 = 5; pub const KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO: u32 = 0; pub const KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO: u32 = 1; pub const KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR: u32 = 2; @@ -800,6 +818,8 @@ pub const KVM_X86_NOTIFY_VMEXIT_USER: u32 = 2; pub const KVM_S390_ZPCIOP_REG_AEN: u32 = 0; pub const KVM_S390_ZPCIOP_DEREG_AEN: u32 = 1; pub const KVM_S390_ZPCIOP_REGAEN_HOST: u32 = 1; +pub type __s128 = i128; +pub type __u128 = u128; pub type __le16 = u16; pub type __be16 = u16; pub type __le32 = u32; @@ -810,15 +830,6 @@ pub type __sum16 = u16; pub type __wsum = u32; pub type __poll_t = ::std::os::raw::c_uint; #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct kvm_memory_alias { - pub slot: u32, - pub flags: u32, - pub guest_phys_addr: u64, - pub memory_size: u64, - pub target_phys_addr: u64, -} -#[repr(C)] #[derive(Debug, Default, Copy, Clone, FromZeroes, FromBytes, AsBytes)] pub struct kvm_pic_state { pub last_irr: u8, @@ -1447,10 +1458,46 @@ impl Default for kvm_nested_state__bindgen_ty_1 { } #[repr(C)] pub struct kvm_nested_state__bindgen_ty_2 { - pub vmx: __BindgenUnionField<[kvm_vmx_nested_state_data; 0usize]>, - pub svm: __BindgenUnionField<[kvm_svm_nested_state_data; 0usize]>, + pub __bindgen_anon_1: __BindgenUnionField, + pub __bindgen_anon_2: __BindgenUnionField, pub bindgen_union_field: [u8; 0usize], } +#[repr(C)] +#[derive(Debug)] +pub struct kvm_nested_state__bindgen_ty_2__bindgen_ty_1 { + pub __empty_vmx: kvm_nested_state__bindgen_ty_2__bindgen_ty_1__bindgen_ty_1, + pub vmx: __IncompleteArrayField, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct kvm_nested_state__bindgen_ty_2__bindgen_ty_1__bindgen_ty_1 {} +impl Default for kvm_nested_state__bindgen_ty_2__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Debug)] +pub struct kvm_nested_state__bindgen_ty_2__bindgen_ty_2 { + pub __empty_svm: kvm_nested_state__bindgen_ty_2__bindgen_ty_2__bindgen_ty_1, + pub svm: __IncompleteArrayField, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct kvm_nested_state__bindgen_ty_2__bindgen_ty_2__bindgen_ty_1 {} +impl Default for kvm_nested_state__bindgen_ty_2__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} impl Default for kvm_nested_state__bindgen_ty_2 { fn default() -> Self { let mut s = ::std::mem::MaybeUninit::::uninit(); @@ -1502,14 +1549,6 @@ pub struct kvm_debug_guest { } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] -pub struct kvm_memory_region { - pub slot: u32, - pub flags: u32, - pub guest_phys_addr: u64, - pub memory_size: u64, -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] pub struct kvm_userspace_memory_region { pub slot: u32, pub flags: u32, @@ -1814,13 +1853,36 @@ pub struct kvm_run__bindgen_ty_1__bindgen_ty_6 { pub is_write: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Copy, Clone)] pub struct kvm_run__bindgen_ty_1__bindgen_ty_7 { pub nr: u64, pub args: [u64; 6usize], pub ret: u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1__bindgen_ty_7__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1__bindgen_ty_7__bindgen_ty_1 { pub longmode: u32, - pub pad: u32, + pub flags: u64, +} +impl Default for kvm_run__bindgen_ty_1__bindgen_ty_7__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for kvm_run__bindgen_ty_1__bindgen_ty_7 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -2145,6 +2207,8 @@ pub union kvm_s390_mem_op__bindgen_ty_1 { pub struct kvm_s390_mem_op__bindgen_ty_1__bindgen_ty_1 { pub ar: u8, pub key: u8, + pub pad1: [u8; 6usize], + pub old_addr: u64, } impl Default for kvm_s390_mem_op__bindgen_ty_1 { fn default() -> Self { @@ -2690,7 +2754,8 @@ pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3: kvm_device_type = 7; pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8; pub const kvm_device_type_KVM_DEV_TYPE_XIVE: kvm_device_type = 9; pub const kvm_device_type_KVM_DEV_TYPE_ARM_PV_TIME: kvm_device_type = 10; -pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 11; +pub const kvm_device_type_KVM_DEV_TYPE_RISCV_AIA: kvm_device_type = 11; +pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 12; pub type kvm_device_type = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -2804,6 +2869,8 @@ pub const pv_cmd_id_KVM_PV_PREP_RESET: pv_cmd_id = 5; pub const pv_cmd_id_KVM_PV_UNSHARE_ALL: pv_cmd_id = 6; pub const pv_cmd_id_KVM_PV_INFO: pv_cmd_id = 7; pub const pv_cmd_id_KVM_PV_DUMP: pv_cmd_id = 8; +pub const pv_cmd_id_KVM_PV_ASYNC_CLEANUP_PREPARE: pv_cmd_id = 9; +pub const pv_cmd_id_KVM_PV_ASYNC_CLEANUP_PERFORM: pv_cmd_id = 10; pub type pv_cmd_id = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -2827,6 +2894,7 @@ pub struct kvm_xen_hvm_attr { pub union kvm_xen_hvm_attr__bindgen_ty_1 { pub long_mode: u8, pub vector: u8, + pub runstate_update_flag: u8, pub shared_info: kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_1, pub evtchn: kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_2, pub xen_version: u32, diff --git a/net_sys/src/if_tun.rs b/net_sys/src/if_tun.rs index e52edae7cc..f9e780dd9b 100644 --- a/net_sys/src/if_tun.rs +++ b/net_sys/src/if_tun.rs @@ -20,6 +20,8 @@ pub const TUN_F_TSO4: u32 = 2; pub const TUN_F_TSO6: u32 = 4; pub const TUN_F_TSO_ECN: u32 = 8; pub const TUN_F_UFO: u32 = 16; +pub const TUN_F_USO4: u32 = 32; +pub const TUN_F_USO6: u32 = 64; pub const TUN_PKT_STRIP: u32 = 1; pub const TUN_FLT_ALLMULTI: u32 = 1; #[repr(C)] diff --git a/tools/impl/bindgen-common.sh b/tools/impl/bindgen-common.sh index fbc2e36b25..1308250ec1 100755 --- a/tools/impl/bindgen-common.sh +++ b/tools/impl/bindgen-common.sh @@ -4,7 +4,7 @@ # Helper functions for bindgen scripts sourced by tools/bindgen-all-the-things. -export BINDGEN_LINUX="${PWD}/../../third_party/kernel/v6.1" +export BINDGEN_LINUX="${PWD}/../../third_party/kernel/v6.6" export BINDGEN_PLATFORM2="${PWD}/../../platform2" diff --git a/vfio_sys/src/vfio.rs b/vfio_sys/src/vfio.rs index df0827129a..a8e270e238 100644 --- a/vfio_sys/src/vfio.rs +++ b/vfio_sys/src/vfio.rs @@ -104,10 +104,15 @@ pub const VFIO_DEVICE_FLAGS_CCW: u32 = 16; pub const VFIO_DEVICE_FLAGS_AP: u32 = 32; pub const VFIO_DEVICE_FLAGS_FSL_MC: u32 = 64; pub const VFIO_DEVICE_FLAGS_CAPS: u32 = 128; +pub const VFIO_DEVICE_FLAGS_CDX: u32 = 256; pub const VFIO_DEVICE_INFO_CAP_ZPCI_BASE: u32 = 1; pub const VFIO_DEVICE_INFO_CAP_ZPCI_GROUP: u32 = 2; pub const VFIO_DEVICE_INFO_CAP_ZPCI_UTIL: u32 = 3; pub const VFIO_DEVICE_INFO_CAP_ZPCI_PFIP: u32 = 4; +pub const VFIO_DEVICE_INFO_CAP_PCI_ATOMIC_COMP: u32 = 5; +pub const VFIO_PCI_ATOMIC_COMP32: u32 = 1; +pub const VFIO_PCI_ATOMIC_COMP64: u32 = 2; +pub const VFIO_PCI_ATOMIC_COMP128: u32 = 4; pub const VFIO_REGION_INFO_FLAG_READ: u32 = 1; pub const VFIO_REGION_INFO_FLAG_WRITE: u32 = 2; pub const VFIO_REGION_INFO_FLAG_MMAP: u32 = 4; @@ -151,6 +156,10 @@ pub const VFIO_IRQ_SET_ACTION_UNMASK: u32 = 16; pub const VFIO_IRQ_SET_ACTION_TRIGGER: u32 = 32; pub const VFIO_IRQ_SET_DATA_TYPE_MASK: u32 = 7; pub const VFIO_IRQ_SET_ACTION_TYPE_MASK: u32 = 56; +pub const VFIO_PCI_DEVID_OWNED: u32 = 0; +pub const VFIO_PCI_DEVID_NOT_OWNED: i32 = -1; +pub const VFIO_PCI_HOT_RESET_FLAG_DEV_ID: u32 = 1; +pub const VFIO_PCI_HOT_RESET_FLAG_DEV_ID_OWNED: u32 = 2; pub const VFIO_GFX_PLANE_TYPE_PROBE: u32 = 1; pub const VFIO_GFX_PLANE_TYPE_DMABUF: u32 = 2; pub const VFIO_GFX_PLANE_TYPE_REGION: u32 = 4; @@ -166,6 +175,7 @@ pub const VFIO_DEVICE_FEATURE_PROBE: u32 = 262144; pub const VFIO_DEVICE_FEATURE_PCI_VF_TOKEN: u32 = 0; pub const VFIO_MIGRATION_STOP_COPY: u32 = 1; pub const VFIO_MIGRATION_P2P: u32 = 2; +pub const VFIO_MIGRATION_PRE_COPY: u32 = 4; pub const VFIO_DEVICE_FEATURE_MIGRATION: u32 = 1; pub const VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE: u32 = 2; pub const VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY: u32 = 3; @@ -174,6 +184,7 @@ pub const VFIO_DEVICE_FEATURE_LOW_POWER_EXIT: u32 = 5; pub const VFIO_DEVICE_FEATURE_DMA_LOGGING_START: u32 = 6; pub const VFIO_DEVICE_FEATURE_DMA_LOGGING_STOP: u32 = 7; pub const VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT: u32 = 8; +pub const VFIO_DEVICE_FEATURE_MIG_DATA_SIZE: u32 = 9; pub const VFIO_IOMMU_INFO_PGSIZES: u32 = 1; pub const VFIO_IOMMU_INFO_CAPS: u32 = 2; pub const VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE: u32 = 1; @@ -225,6 +236,14 @@ pub struct vfio_device_info { pub num_regions: u32, pub num_irqs: u32, pub cap_offset: u32, + pub pad: u32, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct vfio_device_info_cap_pci_atomic_comp { + pub header: vfio_info_cap_header, + pub flags: u32, + pub reserved: u32, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -333,22 +352,57 @@ pub const VFIO_CCW_CRW_IRQ_INDEX: _bindgen_ty_4 = 1; pub const VFIO_CCW_REQ_IRQ_INDEX: _bindgen_ty_4 = 2; pub const VFIO_CCW_NUM_IRQS: _bindgen_ty_4 = 3; pub type _bindgen_ty_4 = ::std::os::raw::c_uint; +pub const VFIO_AP_REQ_IRQ_INDEX: _bindgen_ty_5 = 0; +pub const VFIO_AP_NUM_IRQS: _bindgen_ty_5 = 1; +pub type _bindgen_ty_5 = ::std::os::raw::c_uint; #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Copy, Clone)] pub struct vfio_pci_dependent_device { - pub group_id: u32, + pub __bindgen_anon_1: vfio_pci_dependent_device__bindgen_ty_1, pub segment: u16, pub bus: u8, pub devfn: u8, } #[repr(C)] -#[derive(Debug, Default)] +#[derive(Copy, Clone)] +pub union vfio_pci_dependent_device__bindgen_ty_1 { + pub group_id: u32, + pub devid: u32, +} +impl Default for vfio_pci_dependent_device__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for vfio_pci_dependent_device { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] pub struct vfio_pci_hot_reset_info { pub argsz: u32, pub flags: u32, pub count: u32, pub devices: __IncompleteArrayField, } +impl Default for vfio_pci_hot_reset_info { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} #[repr(C)] #[derive(Debug, Default)] pub struct vfio_pci_hot_reset { @@ -417,6 +471,27 @@ pub struct vfio_device_feature { } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] +pub struct vfio_device_bind_iommufd { + pub argsz: u32, + pub flags: u32, + pub iommufd: i32, + pub out_devid: u32, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct vfio_device_attach_iommufd_pt { + pub argsz: u32, + pub flags: u32, + pub pt_id: u32, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct vfio_device_detach_iommufd_pt { + pub argsz: u32, + pub flags: u32, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] pub struct vfio_device_feature_migration { pub flags: u64, } @@ -432,9 +507,19 @@ pub const vfio_device_mig_state_VFIO_DEVICE_STATE_RUNNING: vfio_device_mig_state pub const vfio_device_mig_state_VFIO_DEVICE_STATE_STOP_COPY: vfio_device_mig_state = 3; pub const vfio_device_mig_state_VFIO_DEVICE_STATE_RESUMING: vfio_device_mig_state = 4; pub const vfio_device_mig_state_VFIO_DEVICE_STATE_RUNNING_P2P: vfio_device_mig_state = 5; +pub const vfio_device_mig_state_VFIO_DEVICE_STATE_PRE_COPY: vfio_device_mig_state = 6; +pub const vfio_device_mig_state_VFIO_DEVICE_STATE_PRE_COPY_P2P: vfio_device_mig_state = 7; pub type vfio_device_mig_state = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] +pub struct vfio_precopy_info { + pub argsz: u32, + pub flags: u32, + pub initial_bytes: u64, + pub dirty_bytes: u64, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] pub struct vfio_device_low_power_entry_with_wakeup { pub wakeup_eventfd: i32, pub reserved: u32, @@ -463,11 +548,17 @@ pub struct vfio_device_feature_dma_logging_report { } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] +pub struct vfio_device_feature_mig_data_size { + pub stop_copy_length: u64, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] pub struct vfio_iommu_type1_info { pub argsz: u32, pub flags: u32, pub iova_pgsizes: u64, pub cap_offset: u32, + pub pad: u32, } #[repr(C)] #[derive(Debug, Default, Copy, Clone, FromZeroes, FromBytes, AsBytes)] diff --git a/virtio_sys/src/vhost.rs b/virtio_sys/src/vhost.rs index 22e26a0f52..afc518b3fc 100644 --- a/virtio_sys/src/vhost.rs +++ b/virtio_sys/src/vhost.rs @@ -58,6 +58,8 @@ pub const VHOST_BACKEND_F_IOTLB_MSG_V2: u32 = 1; pub const VHOST_BACKEND_F_IOTLB_BATCH: u32 = 2; pub const VHOST_BACKEND_F_IOTLB_ASID: u32 = 3; pub const VHOST_BACKEND_F_SUSPEND: u32 = 4; +pub const VHOST_BACKEND_F_RESUME: u32 = 5; +pub const VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK: u32 = 6; pub const VHOST_FILE_UNBIND: i32 = -1; pub const VHOST_VIRTIO: u32 = 175; pub const VHOST_VRING_LITTLE_ENDIAN: u32 = 0; @@ -86,6 +88,17 @@ pub struct vhost_vring_addr { } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] +pub struct vhost_worker_state { + pub worker_id: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct vhost_vring_worker { + pub index: ::std::os::raw::c_uint, + pub worker_id: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] pub struct vhost_iotlb_msg { pub iova: u64, pub size: u64, diff --git a/virtio_sys/src/virtio_config.rs b/virtio_sys/src/virtio_config.rs index 4c69095131..3f97df3f21 100644 --- a/virtio_sys/src/virtio_config.rs +++ b/virtio_sys/src/virtio_config.rs @@ -25,4 +25,5 @@ pub const VIRTIO_F_RING_PACKED: u32 = 34; pub const VIRTIO_F_IN_ORDER: u32 = 35; pub const VIRTIO_F_ORDER_PLATFORM: u32 = 36; pub const VIRTIO_F_SR_IOV: u32 = 37; +pub const VIRTIO_F_NOTIFICATION_DATA: u32 = 38; pub const VIRTIO_F_RING_RESET: u32 = 40; diff --git a/virtio_sys/src/virtio_net.rs b/virtio_sys/src/virtio_net.rs index fcafcb7560..c0feeedae7 100644 --- a/virtio_sys/src/virtio_net.rs +++ b/virtio_sys/src/virtio_net.rs @@ -65,8 +65,13 @@ pub const VIRTIO_NET_F_CTRL_RX_EXTRA: u32 = 20; pub const VIRTIO_NET_F_GUEST_ANNOUNCE: u32 = 21; pub const VIRTIO_NET_F_MQ: u32 = 22; pub const VIRTIO_NET_F_CTRL_MAC_ADDR: u32 = 23; +pub const VIRTIO_NET_F_VQ_NOTF_COAL: u32 = 52; pub const VIRTIO_NET_F_NOTF_COAL: u32 = 53; +pub const VIRTIO_NET_F_GUEST_USO4: u32 = 54; +pub const VIRTIO_NET_F_GUEST_USO6: u32 = 55; +pub const VIRTIO_NET_F_HOST_USO: u32 = 56; pub const VIRTIO_NET_F_HASH_REPORT: u32 = 57; +pub const VIRTIO_NET_F_GUEST_HDRLEN: u32 = 59; pub const VIRTIO_NET_F_RSS: u32 = 60; pub const VIRTIO_NET_F_RSC_EXT: u32 = 61; pub const VIRTIO_NET_F_STANDBY: u32 = 62; @@ -90,6 +95,7 @@ pub const VIRTIO_NET_HDR_GSO_NONE: u32 = 0; pub const VIRTIO_NET_HDR_GSO_TCPV4: u32 = 1; pub const VIRTIO_NET_HDR_GSO_UDP: u32 = 3; pub const VIRTIO_NET_HDR_GSO_TCPV6: u32 = 4; +pub const VIRTIO_NET_HDR_GSO_UDP_L4: u32 = 5; pub const VIRTIO_NET_HDR_GSO_ECN: u32 = 128; pub const VIRTIO_NET_HASH_REPORT_NONE: u32 = 0; pub const VIRTIO_NET_HASH_REPORT_IPv4: u32 = 1; @@ -129,6 +135,8 @@ pub const VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET: u32 = 0; pub const VIRTIO_NET_CTRL_NOTF_COAL: u32 = 6; pub const VIRTIO_NET_CTRL_NOTF_COAL_TX_SET: u32 = 0; pub const VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: u32 = 1; +pub const VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: u32 = 2; +pub const VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: u32 = 3; pub type __le16 = u16; pub type __le32 = u32; pub type __virtio16 = u16; @@ -275,3 +283,16 @@ pub struct virtio_net_ctrl_coal_rx { pub rx_max_packets: __le32, pub rx_usecs: __le32, } +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct virtio_net_ctrl_coal { + pub max_packets: __le32, + pub max_usecs: __le32, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct virtio_net_ctrl_coal_vq { + pub vqn: __le16, + pub reserved: __le16, + pub coal: virtio_net_ctrl_coal, +}