blob: e802e02bbf6c74b9a49ea9e357cd533a5f9c61d8 [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _LINUX_VHOST_H
20#define _LINUX_VHOST_H
21#include <linux/types.h>
22#include <linux/compiler.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070023#include <linux/ioctl.h>
24#include <linux/virtio_config.h>
25#include <linux/virtio_ring.h>
26struct vhost_vring_state {
Tao Baod7db5942015-01-28 10:07:51 -080027 unsigned int index;
28 unsigned int num;
Ben Cheng655a7c02013-10-16 16:09:24 -070029};
30struct vhost_vring_file {
Tao Baod7db5942015-01-28 10:07:51 -080031 unsigned int index;
32 int fd;
Ben Cheng655a7c02013-10-16 16:09:24 -070033};
34struct vhost_vring_addr {
Tao Baod7db5942015-01-28 10:07:51 -080035 unsigned int index;
36 unsigned int flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070037#define VHOST_VRING_F_LOG 0
Tao Baod7db5942015-01-28 10:07:51 -080038 __u64 desc_user_addr;
Tao Baod7db5942015-01-28 10:07:51 -080039 __u64 used_user_addr;
40 __u64 avail_user_addr;
41 __u64 log_guest_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -070042};
Christopher Ferris49f525c2016-12-12 14:55:36 -080043struct vhost_iotlb_msg {
44 __u64 iova;
45 __u64 size;
46 __u64 uaddr;
Christopher Ferris49f525c2016-12-12 14:55:36 -080047#define VHOST_ACCESS_RO 0x1
48#define VHOST_ACCESS_WO 0x2
49#define VHOST_ACCESS_RW 0x3
50 __u8 perm;
Christopher Ferris49f525c2016-12-12 14:55:36 -080051#define VHOST_IOTLB_MISS 1
52#define VHOST_IOTLB_UPDATE 2
53#define VHOST_IOTLB_INVALIDATE 3
54#define VHOST_IOTLB_ACCESS_FAIL 4
Christopher Ferris49f525c2016-12-12 14:55:36 -080055 __u8 type;
56};
57#define VHOST_IOTLB_MSG 0x1
Christopher Ferris9ce28842018-10-25 12:11:39 -070058#define VHOST_IOTLB_MSG_V2 0x2
Christopher Ferris49f525c2016-12-12 14:55:36 -080059struct vhost_msg {
Christopher Ferris49f525c2016-12-12 14:55:36 -080060 int type;
61 union {
62 struct vhost_iotlb_msg iotlb;
63 __u8 padding[64];
Christopher Ferris49f525c2016-12-12 14:55:36 -080064 };
65};
Christopher Ferris9ce28842018-10-25 12:11:39 -070066struct vhost_msg_v2 {
67 __u32 type;
68 __u32 reserved;
69 union {
70 struct vhost_iotlb_msg iotlb;
71 __u8 padding[64];
72 };
73};
Ben Cheng655a7c02013-10-16 16:09:24 -070074struct vhost_memory_region {
Tao Baod7db5942015-01-28 10:07:51 -080075 __u64 guest_phys_addr;
76 __u64 memory_size;
77 __u64 userspace_addr;
Tao Baod7db5942015-01-28 10:07:51 -080078 __u64 flags_padding;
Ben Cheng655a7c02013-10-16 16:09:24 -070079};
80#define VHOST_PAGE_SIZE 0x1000
81struct vhost_memory {
Tao Baod7db5942015-01-28 10:07:51 -080082 __u32 nregions;
83 __u32 padding;
84 struct vhost_memory_region regions[0];
Ben Cheng655a7c02013-10-16 16:09:24 -070085};
Ben Cheng655a7c02013-10-16 16:09:24 -070086#define VHOST_VIRTIO 0xAF
87#define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64)
88#define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64)
89#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)
Ben Cheng655a7c02013-10-16 16:09:24 -070090#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)
91#define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)
92#define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64)
93#define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)
Ben Cheng655a7c02013-10-16 16:09:24 -070094#define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state)
95#define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr)
96#define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
97#define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
Christopher Ferris05d08e92016-02-04 13:16:38 -080098#define VHOST_VRING_LITTLE_ENDIAN 0
99#define VHOST_VRING_BIG_ENDIAN 1
100#define VHOST_SET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x13, struct vhost_vring_state)
101#define VHOST_GET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x14, struct vhost_vring_state)
Ben Cheng655a7c02013-10-16 16:09:24 -0700102#define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file)
103#define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file)
104#define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700105#define VHOST_SET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x23, struct vhost_vring_state)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700106#define VHOST_GET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x24, struct vhost_vring_state)
Christopher Ferris9ce28842018-10-25 12:11:39 -0700107#define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
108#define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
109#define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700110#define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
Ben Cheng655a7c02013-10-16 16:09:24 -0700111#define VHOST_F_LOG_ALL 26
112#define VHOST_NET_F_VIRTIO_NET_HDR 27
113#define VHOST_SCSI_ABI_VERSION 1
114struct vhost_scsi_target {
Tao Baod7db5942015-01-28 10:07:51 -0800115 int abi_version;
116 char vhost_wwpn[224];
117 unsigned short vhost_tpgt;
118 unsigned short reserved;
Ben Cheng655a7c02013-10-16 16:09:24 -0700119};
120#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target)
121#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)
122#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int)
Ben Cheng655a7c02013-10-16 16:09:24 -0700123#define VHOST_SCSI_SET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x43, __u32)
124#define VHOST_SCSI_GET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x44, __u32)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800125#define VHOST_VSOCK_SET_GUEST_CID _IOW(VHOST_VIRTIO, 0x60, __u64)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800126#define VHOST_VSOCK_SET_RUNNING _IOW(VHOST_VIRTIO, 0x61, int)
Ben Cheng655a7c02013-10-16 16:09:24 -0700127#endif