1 // Copyright 2023 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 //! Bindings for the GZVM (Geniezone Hypervisor) API. 6 7 #![cfg(any(target_os = "android", target_os = "linux"))] 8 #![allow(non_upper_case_globals)] 9 #![allow(non_camel_case_types)] 10 #![allow(non_snake_case)] 11 12 #[cfg(target_arch = "aarch64")] 13 pub mod aarch64 { 14 pub mod bindings; 15 use base::ioctl_io_nr; 16 use base::ioctl_iow_nr; 17 use base::ioctl_iowr_nr; 18 pub use bindings::*; 19 20 ioctl_io_nr!(GZVM_CREATE_VM, GZVM_IOC_MAGIC, 0x01); 21 ioctl_io_nr!(GZVM_CHECK_EXTENSION, GZVM_IOC_MAGIC, 0x03); 22 ioctl_io_nr!(GZVM_CREATE_VCPU, GZVM_IOC_MAGIC, 0x41); 23 ioctl_io_nr!(GZVM_CREATE_IRQCHIP, GZVM_IOC_MAGIC, 0x60); 24 ioctl_io_nr!(GZVM_RUN, GZVM_IOC_MAGIC, 0x80); 25 26 ioctl_iow_nr!( 27 GZVM_SET_MEMORY_REGION, 28 GZVM_IOC_MAGIC, 29 0x40, 30 gzvm_memory_region 31 ); 32 33 ioctl_iow_nr!( 34 GZVM_SET_USER_MEMORY_REGION, 35 GZVM_IOC_MAGIC, 36 0x46, 37 gzvm_userspace_memory_region 38 ); 39 40 ioctl_iow_nr!(GZVM_IRQ_LINE, GZVM_IOC_MAGIC, 0x61, gzvm_irq_level); 41 ioctl_iow_nr!(GZVM_IRQFD, GZVM_IOC_MAGIC, 0x76, gzvm_irqfd); 42 ioctl_iow_nr!(GZVM_IOEVENTFD, GZVM_IOC_MAGIC, 0x79, gzvm_ioeventfd); 43 ioctl_iow_nr!(GZVM_ENABLE_CAP, GZVM_IOC_MAGIC, 0xa3, gzvm_enable_cap); 44 ioctl_iow_nr!(GZVM_GET_ONE_REG, GZVM_IOC_MAGIC, 0xab, gzvm_one_reg); 45 ioctl_iow_nr!(GZVM_SET_ONE_REG, GZVM_IOC_MAGIC, 0xac, gzvm_one_reg); 46 ioctl_iowr_nr!(GZVM_CREATE_DEVICE, GZVM_IOC_MAGIC, 0xe0, gzvm_create_device); 47 ioctl_iow_nr!(GZVM_SET_DTB_CONFIG, GZVM_IOC_MAGIC, 0xff, gzvm_dtb_config); 48 } 49 50 #[cfg(target_arch = "aarch64")] 51 pub use aarch64::*; 52