88
88
#define VMCI_INTR_DATAGRAM 0
89
89
#define VMCI_INTR_NOTIFICATION 1
93
* A single VMCI device has an upper limit of 128MB on the amount of
94
* memory that can be used for queue pairs.
96
#define VMCI_MAX_GUEST_QP_MEMORY (128 * 1024 * 1024)
92
99
* We have a fixed set of resource IDs available in the VMX.
93
100
* This allows us to have a very simple implementation since we statically
248
256
#define VMCI_SUCCESS_LAST_DETACH 3
249
257
#define VMCI_SUCCESS_ACCESS_GRANTED 2
250
258
#define VMCI_SUCCESS_ENTRY_DEAD 1
251
#define VMCI_SUCCESS 0
259
#define VMCI_SUCCESS 0LL
252
260
#define VMCI_ERROR_INVALID_RESOURCE (-1)
253
261
#define VMCI_ERROR_INVALID_ARGS (-2)
254
262
#define VMCI_ERROR_NO_MEM (-3)
301
309
/* VMCI reserved events. */
302
310
typedef uint32 VMCI_Event;
304
#define VMCI_EVENT_CTX_ID_UPDATE 0
305
#define VMCI_EVENT_CTX_REMOVED 1
306
#define VMCI_EVENT_QP_RESUMED 2
307
#define VMCI_EVENT_QP_PEER_ATTACH 3
308
#define VMCI_EVENT_QP_PEER_DETACH 4
309
#define VMCI_EVENT_MAX 5
312
#define VMCI_EVENT_CTX_ID_UPDATE 0 // Only applicable to guest endpoints
313
#define VMCI_EVENT_CTX_REMOVED 1 // Applicable to guest and host
314
#define VMCI_EVENT_QP_RESUMED 2 // Only applicable to guest endpoints
315
#define VMCI_EVENT_QP_PEER_ATTACH 3 // Applicable to guest and host
316
#define VMCI_EVENT_QP_PEER_DETACH 4 // Applicable to guest and host
317
#define VMCI_EVENT_MEM_ACCESS_ON 5 // Only applicable to VMX endpoints
318
#define VMCI_EVENT_MEM_ACCESS_OFF 6 // Only applicable to VMX endpoints
319
#define VMCI_EVENT_MAX 7
322
* Of the above events, a few are reserved for use in the VMX, and
323
* other endpoints (guest and host kernel) should not use them. For
324
* the rest of the events, we allow both host and guest endpoints to
325
* subscribe to them, to maintain the same API for host and guest
329
#define VMCI_EVENT_VALID_VMX(_event) (_event == VMCI_EVENT_MEM_ACCESS_ON || \
330
_event == VMCI_EVENT_MEM_ACCESS_OFF)
332
#define VMCI_EVENT_VALID(_event) (_event < VMCI_EVENT_MAX && \
333
!VMCI_EVENT_VALID_VMX(_event))
311
335
/* Reserved guest datagram resource ids. */
312
336
#define VMCI_EVENT_HANDLER 0
338
362
#define VMCI_LEAST_PRIVILEGE_FLAGS VMCI_PRIVILEGE_FLAG_RESTRICTED
339
363
#define VMCI_MAX_PRIVILEGE_FLAGS VMCI_PRIVILEGE_FLAG_TRUSTED
341
/* VMCI Discovery Service. */
343
/* Well-known handle to the discovery service. */
344
#define VMCI_DS_RESOURCE_ID 1 /* Reserved resource ID for discovery service. */
345
#define VMCI_DS_HANDLE VMCI_MAKE_HANDLE(VMCI_WELL_KNOWN_CONTEXT_ID, \
347
#define VMCI_DS_CONTEXT VMCI_MAKE_HANDLE(VMCI_WELL_KNOWN_CONTEXT_ID, \
348
VMCI_CONTEXT_RESOURCE_ID)
350
/* Maximum length of a DS message. */
351
#define VMCI_DS_MAX_MSG_SIZE 300
353
/* Command actions. */
354
#define VMCI_DS_ACTION_LOOKUP 0
355
#define VMCI_DS_ACTION_REGISTER 1
356
#define VMCI_DS_ACTION_UNREGISTER 2
358
/* Defines wire-protocol format for a request send to the DS from a context. */
359
typedef struct VMCIDsRequestHeader {
365
} VMCIDsRequestHeader;
368
/* Defines the wire-protocol format for a request send from the DS to a context. */
369
typedef struct VMCIDsReplyHeader {
377
365
#define VMCI_PUBLIC_GROUP_NAME "vmci public group"
378
366
/* 0 through VMCI_RESERVED_RESOURCE_ID_MAX are reserved. */
379
367
#define VMCI_RESERVED_RESOURCE_ID_MAX 1023