Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools include uapi: Sync linux/vhost.h with the kernel sources

To get the changes in:

4b86713236e4 ("vhost: split structs into a separate header file")

Silencing this perf build warning:

Warning: Kernel ABI header at 'tools/include/uapi/linux/vhost.h' differs from latest version at 'include/uapi/linux/vhost.h'
diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h

Those didn't touch things used in tools, i.e. the following continues
working:

$ tools/perf/trace/beauty/vhost_virtio_ioctl.sh
static const char *vhost_virtio_ioctl_cmds[] = {
[0x00] = "SET_FEATURES",
[0x01] = "SET_OWNER",
[0x02] = "RESET_OWNER",
[0x03] = "SET_MEM_TABLE",
[0x04] = "SET_LOG_BASE",
[0x07] = "SET_LOG_FD",
[0x10] = "SET_VRING_NUM",
[0x11] = "SET_VRING_ADDR",
[0x12] = "SET_VRING_BASE",
[0x13] = "SET_VRING_ENDIAN",
[0x14] = "GET_VRING_ENDIAN",
[0x20] = "SET_VRING_KICK",
[0x21] = "SET_VRING_CALL",
[0x22] = "SET_VRING_ERR",
[0x23] = "SET_VRING_BUSYLOOP_TIMEOUT",
[0x24] = "GET_VRING_BUSYLOOP_TIMEOUT",
[0x25] = "SET_BACKEND_FEATURES",
[0x30] = "NET_SET_BACKEND",
[0x40] = "SCSI_SET_ENDPOINT",
[0x41] = "SCSI_CLEAR_ENDPOINT",
[0x42] = "SCSI_GET_ABI_VERSION",
[0x43] = "SCSI_SET_EVENTS_MISSED",
[0x44] = "SCSI_GET_EVENTS_MISSED",
[0x60] = "VSOCK_SET_GUEST_CID",
[0x61] = "VSOCK_SET_RUNNING",
};
static const char *vhost_virtio_ioctl_read_cmds[] = {
[0x00] = "GET_FEATURES",
[0x12] = "GET_VRING_BASE",
[0x26] = "GET_BACKEND_FEATURES",
};
$

At some point in the eBPFication of perf, using something like:

# perf trace -e ioctl(cmd=VHOST_VRING*)

Will setup a BPF filter right at the raw_syscalls:sys_enter tracepoint,
i.e. filtering at the origin.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-g28usrt7l59lwq3wuh8vzbig@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+2 -111
+2 -111
tools/include/uapi/linux/vhost.h
··· 11 11 * device configuration. 12 12 */ 13 13 14 + #include <linux/vhost_types.h> 14 15 #include <linux/types.h> 15 - #include <linux/compiler.h> 16 16 #include <linux/ioctl.h> 17 - #include <linux/virtio_config.h> 18 - #include <linux/virtio_ring.h> 19 - 20 - struct vhost_vring_state { 21 - unsigned int index; 22 - unsigned int num; 23 - }; 24 - 25 - struct vhost_vring_file { 26 - unsigned int index; 27 - int fd; /* Pass -1 to unbind from file. */ 28 - 29 - }; 30 - 31 - struct vhost_vring_addr { 32 - unsigned int index; 33 - /* Option flags. */ 34 - unsigned int flags; 35 - /* Flag values: */ 36 - /* Whether log address is valid. If set enables logging. */ 37 - #define VHOST_VRING_F_LOG 0 38 - 39 - /* Start of array of descriptors (virtually contiguous) */ 40 - __u64 desc_user_addr; 41 - /* Used structure address. Must be 32 bit aligned */ 42 - __u64 used_user_addr; 43 - /* Available structure address. Must be 16 bit aligned */ 44 - __u64 avail_user_addr; 45 - /* Logging support. */ 46 - /* Log writes to used structure, at offset calculated from specified 47 - * address. Address must be 32 bit aligned. */ 48 - __u64 log_guest_addr; 49 - }; 50 - 51 - /* no alignment requirement */ 52 - struct vhost_iotlb_msg { 53 - __u64 iova; 54 - __u64 size; 55 - __u64 uaddr; 56 - #define VHOST_ACCESS_RO 0x1 57 - #define VHOST_ACCESS_WO 0x2 58 - #define VHOST_ACCESS_RW 0x3 59 - __u8 perm; 60 - #define VHOST_IOTLB_MISS 1 61 - #define VHOST_IOTLB_UPDATE 2 62 - #define VHOST_IOTLB_INVALIDATE 3 63 - #define VHOST_IOTLB_ACCESS_FAIL 4 64 - __u8 type; 65 - }; 66 - 67 - #define VHOST_IOTLB_MSG 0x1 68 - #define VHOST_IOTLB_MSG_V2 0x2 69 - 70 - struct vhost_msg { 71 - int type; 72 - union { 73 - struct vhost_iotlb_msg iotlb; 74 - __u8 padding[64]; 75 - }; 76 - }; 77 - 78 - struct vhost_msg_v2 { 79 - __u32 type; 80 - __u32 reserved; 81 - union { 82 - struct vhost_iotlb_msg iotlb; 83 - __u8 padding[64]; 84 - }; 85 - }; 86 - 87 - struct vhost_memory_region { 88 - __u64 guest_phys_addr; 89 - __u64 memory_size; /* bytes */ 90 - __u64 userspace_addr; 91 - __u64 flags_padding; /* No flags are currently specified. */ 92 - }; 93 - 94 - /* All region addresses and sizes must be 4K aligned. */ 95 - #define VHOST_PAGE_SIZE 0x1000 96 - 97 - struct vhost_memory { 98 - __u32 nregions; 99 - __u32 padding; 100 - struct vhost_memory_region regions[0]; 101 - }; 102 17 103 18 /* ioctls */ 104 19 ··· 101 186 * device. This can be used to stop the ring (e.g. for migration). */ 102 187 #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file) 103 188 104 - /* Feature bits */ 105 - /* Log all write descriptors. Can be changed while device is active. */ 106 - #define VHOST_F_LOG_ALL 26 107 - /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */ 108 - #define VHOST_NET_F_VIRTIO_NET_HDR 27 109 - 110 - /* VHOST_SCSI specific definitions */ 111 - 112 - /* 113 - * Used by QEMU userspace to ensure a consistent vhost-scsi ABI. 114 - * 115 - * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate + 116 - * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage 117 - * ABI Rev 1: January 2013. Ignore vhost_tpgt filed in struct vhost_scsi_target. 118 - * All the targets under vhost_wwpn can be seen and used by guset. 119 - */ 120 - 121 - #define VHOST_SCSI_ABI_VERSION 1 122 - 123 - struct vhost_scsi_target { 124 - int abi_version; 125 - char vhost_wwpn[224]; /* TRANSPORT_IQN_LEN */ 126 - unsigned short vhost_tpgt; 127 - unsigned short reserved; 128 - }; 189 + /* VHOST_SCSI specific defines */ 129 190 130 191 #define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target) 131 192 #define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)