~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/um/drivers/vhost_user.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /* Vhost-user protocol */
  3 
  4 #ifndef __VHOST_USER_H__
  5 #define __VHOST_USER_H__
  6 
  7 /* Message flags */
  8 #define VHOST_USER_FLAG_REPLY           BIT(2)
  9 #define VHOST_USER_FLAG_NEED_REPLY      BIT(3)
 10 /* Feature bits */
 11 #define VHOST_USER_F_PROTOCOL_FEATURES  30
 12 /* Protocol feature bits */
 13 #define VHOST_USER_PROTOCOL_F_REPLY_ACK                 3
 14 #define VHOST_USER_PROTOCOL_F_SLAVE_REQ                 5
 15 #define VHOST_USER_PROTOCOL_F_CONFIG                    9
 16 #define VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS      14
 17 /* Vring state index masks */
 18 #define VHOST_USER_VRING_INDEX_MASK     0xff
 19 #define VHOST_USER_VRING_POLL_MASK      BIT(8)
 20 
 21 /* Supported version */
 22 #define VHOST_USER_VERSION              1
 23 /* Supported transport features */
 24 #define VHOST_USER_SUPPORTED_F          BIT_ULL(VHOST_USER_F_PROTOCOL_FEATURES)
 25 /* Supported protocol features */
 26 #define VHOST_USER_SUPPORTED_PROTOCOL_F (BIT_ULL(VHOST_USER_PROTOCOL_F_REPLY_ACK) | \
 27                                          BIT_ULL(VHOST_USER_PROTOCOL_F_SLAVE_REQ) | \
 28                                          BIT_ULL(VHOST_USER_PROTOCOL_F_CONFIG) | \
 29                                          BIT_ULL(VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS))
 30 
 31 enum vhost_user_request {
 32         VHOST_USER_GET_FEATURES = 1,
 33         VHOST_USER_SET_FEATURES = 2,
 34         VHOST_USER_SET_OWNER = 3,
 35         VHOST_USER_RESET_OWNER = 4,
 36         VHOST_USER_SET_MEM_TABLE = 5,
 37         VHOST_USER_SET_LOG_BASE = 6,
 38         VHOST_USER_SET_LOG_FD = 7,
 39         VHOST_USER_SET_VRING_NUM = 8,
 40         VHOST_USER_SET_VRING_ADDR = 9,
 41         VHOST_USER_SET_VRING_BASE = 10,
 42         VHOST_USER_GET_VRING_BASE = 11,
 43         VHOST_USER_SET_VRING_KICK = 12,
 44         VHOST_USER_SET_VRING_CALL = 13,
 45         VHOST_USER_SET_VRING_ERR = 14,
 46         VHOST_USER_GET_PROTOCOL_FEATURES = 15,
 47         VHOST_USER_SET_PROTOCOL_FEATURES = 16,
 48         VHOST_USER_GET_QUEUE_NUM = 17,
 49         VHOST_USER_SET_VRING_ENABLE = 18,
 50         VHOST_USER_SEND_RARP = 19,
 51         VHOST_USER_NET_SEND_MTU = 20,
 52         VHOST_USER_SET_SLAVE_REQ_FD = 21,
 53         VHOST_USER_IOTLB_MSG = 22,
 54         VHOST_USER_SET_VRING_ENDIAN = 23,
 55         VHOST_USER_GET_CONFIG = 24,
 56         VHOST_USER_SET_CONFIG = 25,
 57         VHOST_USER_VRING_KICK = 35,
 58 };
 59 
 60 enum vhost_user_slave_request {
 61         VHOST_USER_SLAVE_IOTLB_MSG = 1,
 62         VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
 63         VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
 64         VHOST_USER_SLAVE_VRING_CALL = 4,
 65 };
 66 
 67 struct vhost_user_header {
 68         /*
 69          * Use enum vhost_user_request for outgoing messages,
 70          * uses enum vhost_user_slave_request for incoming ones.
 71          */
 72         u32 request;
 73         u32 flags;
 74         u32 size;
 75 } __packed;
 76 
 77 struct vhost_user_config {
 78         u32 offset;
 79         u32 size;
 80         u32 flags;
 81         u8 payload[]; /* Variable length */
 82 } __packed;
 83 
 84 struct vhost_user_vring_state {
 85         u32 index;
 86         u32 num;
 87 } __packed;
 88 
 89 struct vhost_user_vring_addr {
 90         u32 index;
 91         u32 flags;
 92         u64 desc, used, avail, log;
 93 } __packed;
 94 
 95 struct vhost_user_mem_region {
 96         u64 guest_addr;
 97         u64 size;
 98         u64 user_addr;
 99         u64 mmap_offset;
100 } __packed;
101 
102 struct vhost_user_mem_regions {
103         u32 num;
104         u32 padding;
105         struct vhost_user_mem_region regions[2]; /* Currently supporting 2 */
106 } __packed;
107 
108 union vhost_user_payload {
109         u64 integer;
110         struct vhost_user_config config;
111         struct vhost_user_vring_state vring_state;
112         struct vhost_user_vring_addr vring_addr;
113         struct vhost_user_mem_regions mem_regions;
114 };
115 
116 struct vhost_user_msg {
117         struct vhost_user_header header;
118         union vhost_user_payload payload;
119 } __packed;
120 
121 #endif
122 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php