1*bb4ee6a4SAndroid Build Coastguard Worker // Copyright 2023 The ChromiumOS Authors 2*bb4ee6a4SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 3*bb4ee6a4SAndroid Build Coastguard Worker // found in the LICENSE file. 4*bb4ee6a4SAndroid Build Coastguard Worker 5*bb4ee6a4SAndroid Build Coastguard Worker //! Linux vhost kernel bindings. 6*bb4ee6a4SAndroid Build Coastguard Worker 7*bb4ee6a4SAndroid Build Coastguard Worker use base::ioctl_io_nr; 8*bb4ee6a4SAndroid Build Coastguard Worker use base::ioctl_ior_nr; 9*bb4ee6a4SAndroid Build Coastguard Worker use base::ioctl_iow_nr; 10*bb4ee6a4SAndroid Build Coastguard Worker use base::ioctl_iowr_nr; 11*bb4ee6a4SAndroid Build Coastguard Worker 12*bb4ee6a4SAndroid Build Coastguard Worker use crate::vhost; 13*bb4ee6a4SAndroid Build Coastguard Worker 14*bb4ee6a4SAndroid Build Coastguard Worker pub const VHOST: ::std::os::raw::c_uint = 0xaf; 15*bb4ee6a4SAndroid Build Coastguard Worker 16*bb4ee6a4SAndroid Build Coastguard Worker ioctl_ior_nr!(VHOST_GET_FEATURES, VHOST, 0x00, ::std::os::raw::c_ulonglong); 17*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_FEATURES, VHOST, 0x00, ::std::os::raw::c_ulonglong); 18*bb4ee6a4SAndroid Build Coastguard Worker ioctl_io_nr!(VHOST_SET_OWNER, VHOST, 0x01); 19*bb4ee6a4SAndroid Build Coastguard Worker ioctl_io_nr!(VHOST_RESET_OWNER, VHOST, 0x02); 20*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_MEM_TABLE, VHOST, 0x03, vhost::vhost_memory); 21*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_LOG_BASE, VHOST, 0x04, ::std::os::raw::c_ulonglong); 22*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_LOG_FD, VHOST, 0x07, ::std::os::raw::c_int); 23*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_VRING_NUM, VHOST, 0x10, vhost::vhost_vring_state); 24*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_VRING_ADDR, VHOST, 0x11, vhost::vhost_vring_addr); 25*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_VRING_BASE, VHOST, 0x12, vhost::vhost_vring_state); 26*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iowr_nr!(VHOST_GET_VRING_BASE, VHOST, 0x12, vhost::vhost_vring_state); 27*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_VRING_KICK, VHOST, 0x20, vhost::vhost_vring_file); 28*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_VRING_CALL, VHOST, 0x21, vhost::vhost_vring_file); 29*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_SET_VRING_ERR, VHOST, 0x22, vhost::vhost_vring_file); 30*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_NET_SET_BACKEND, VHOST, 0x30, vhost::vhost_vring_file); 31*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!( 32*bb4ee6a4SAndroid Build Coastguard Worker VHOST_SCSI_SET_ENDPOINT, 33*bb4ee6a4SAndroid Build Coastguard Worker VHOST, 34*bb4ee6a4SAndroid Build Coastguard Worker 0x40, 35*bb4ee6a4SAndroid Build Coastguard Worker vhost::vhost_scsi_target 36*bb4ee6a4SAndroid Build Coastguard Worker ); 37*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!( 38*bb4ee6a4SAndroid Build Coastguard Worker VHOST_SCSI_CLEAR_ENDPOINT, 39*bb4ee6a4SAndroid Build Coastguard Worker VHOST, 40*bb4ee6a4SAndroid Build Coastguard Worker 0x41, 41*bb4ee6a4SAndroid Build Coastguard Worker vhost::vhost_scsi_target 42*bb4ee6a4SAndroid Build Coastguard Worker ); 43*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!( 44*bb4ee6a4SAndroid Build Coastguard Worker VHOST_SCSI_GET_ABI_VERSION, 45*bb4ee6a4SAndroid Build Coastguard Worker VHOST, 46*bb4ee6a4SAndroid Build Coastguard Worker 0x42, 47*bb4ee6a4SAndroid Build Coastguard Worker ::std::os::raw::c_int 48*bb4ee6a4SAndroid Build Coastguard Worker ); 49*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!( 50*bb4ee6a4SAndroid Build Coastguard Worker VHOST_SCSI_SET_EVENTS_MISSED, 51*bb4ee6a4SAndroid Build Coastguard Worker VHOST, 52*bb4ee6a4SAndroid Build Coastguard Worker 0x43, 53*bb4ee6a4SAndroid Build Coastguard Worker ::std::os::raw::c_uint 54*bb4ee6a4SAndroid Build Coastguard Worker ); 55*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!( 56*bb4ee6a4SAndroid Build Coastguard Worker VHOST_SCSI_GET_EVENTS_MISSED, 57*bb4ee6a4SAndroid Build Coastguard Worker VHOST, 58*bb4ee6a4SAndroid Build Coastguard Worker 0x44, 59*bb4ee6a4SAndroid Build Coastguard Worker ::std::os::raw::c_uint 60*bb4ee6a4SAndroid Build Coastguard Worker ); 61*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!( 62*bb4ee6a4SAndroid Build Coastguard Worker VHOST_VSOCK_SET_GUEST_CID, 63*bb4ee6a4SAndroid Build Coastguard Worker VHOST, 64*bb4ee6a4SAndroid Build Coastguard Worker 0x60, 65*bb4ee6a4SAndroid Build Coastguard Worker ::std::os::raw::c_ulonglong 66*bb4ee6a4SAndroid Build Coastguard Worker ); 67*bb4ee6a4SAndroid Build Coastguard Worker ioctl_iow_nr!(VHOST_VSOCK_SET_RUNNING, VHOST, 0x61, ::std::os::raw::c_int); 68