Skip to content

Commit ee412f1

Browse files
committed
tools include uapi: Sync linux/vhost.h with the kernel sources
To get the changes in: 4b86713 ("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>
1 parent fdc42ca commit ee412f1

1 file changed

Lines changed: 2 additions & 111 deletions

File tree

‎tools/include/uapi/linux/vhost.h‎

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -11,94 +11,9 @@
1111
* device configuration.
1212
*/
1313

14+
#include <linux/vhost_types.h>
1415
#include <linux/types.h>
15-
#include <linux/compiler.h>
1616
#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-
};
10217

10318
/* ioctls */
10419

@@ -186,31 +101,7 @@ struct vhost_memory {
186101
* device. This can be used to stop the ring (e.g. for migration). */
187102
#define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
188103

189-
/* Feature bits */
190-
/* Log all write descriptors. Can be changed while device is active. */
191-
#define VHOST_F_LOG_ALL 26
192-
/* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
193-
#define VHOST_NET_F_VIRTIO_NET_HDR 27
194-
195-
/* VHOST_SCSI specific definitions */
196-
197-
/*
198-
* Used by QEMU userspace to ensure a consistent vhost-scsi ABI.
199-
*
200-
* ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate +
201-
* RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage
202-
* ABI Rev 1: January 2013. Ignore vhost_tpgt filed in struct vhost_scsi_target.
203-
* All the targets under vhost_wwpn can be seen and used by guset.
204-
*/
205-
206-
#define VHOST_SCSI_ABI_VERSION 1
207-
208-
struct vhost_scsi_target {
209-
int abi_version;
210-
char vhost_wwpn[224]; /* TRANSPORT_IQN_LEN */
211-
unsigned short vhost_tpgt;
212-
unsigned short reserved;
213-
};
104+
/* VHOST_SCSI specific defines */
214105

215106
#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target)
216107
#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)

0 commit comments

Comments
 (0)