#define VMCI_CONTROL_INT_DISABLE 0x4
/* Capabilities register bits. */
-#define VMCI_CAPS_HYPERCALL 0x1
+#define VMCI_CAPS_HYPERCALL 0x1
#define VMCI_CAPS_GUESTCALL 0x2
#define VMCI_CAPS_DATAGRAM 0x4
#define VMCI_CAPS_NOTIFICATIONS 0x8
#define VMCI_IMR_DATAGRAM 0x1
#define VMCI_IMR_NOTIFICATION 0x2
-/*
- * We have a fixed set of resource IDs available in the VMX.
- * This allows us to have a very simple implementation since we statically
+/*
+ * We have a fixed set of resource IDs available in the VMX.
+ * This allows us to have a very simple implementation since we statically
* know how many will create datagram handles. If a new caller arrives and
* we have run out of slots we can manually increment the maximum size of
* available resource IDs.
} VMCIHandle;
static INLINE
-VMCIHandle VMCI_MAKE_HANDLE(VMCIId cid,
+VMCIHandle VMCI_MAKE_HANDLE(VMCIId cid,
VMCIId rid)
{
VMCIHandle h;
*
* Results:
* The uint64 value.
- *
- * Side effects:
+ *
+ * Side effects:
* None.
*
*----------------------------------------------------------------------
*
* Results:
* The VMCI handle value.
- *
- * Side effects:
+ *
+ * Side effects:
* None.
*
*----------------------------------------------------------------------
(_h1).resource == (_h2).resource)
#define VMCI_INVALID_ID 0xFFFFFFFF
-static const VMCIHandle VMCI_INVALID_HANDLE = {VMCI_INVALID_ID,
+static const VMCIHandle VMCI_INVALID_HANDLE = {VMCI_INVALID_ID,
VMCI_INVALID_ID};
#define VMCI_HANDLE_INVALID(_handle) \
/*
* Hypervisor context id, used for calling into hypervisor
- * supplied services from the VM.
+ * supplied services from the VM.
*/
#define VMCI_HYPERVISOR_CONTEXT_ID 0
-/*
- * Well-known context id, a logical context that contains
+/*
+ * Well-known context id, a logical context that contains
* a set of well-known services.
*/
#define VMCI_WELL_KNOWN_CONTEXT_ID 1
/* Todo: Change host context id to dynamic/random id. */
#define VMCI_HOST_CONTEXT_ID 2
-/*
- * The VMCI_CONTEXT_RESOURCE_ID is used together with VMCI_MAKE_HANDLE to make
+/*
+ * The VMCI_CONTEXT_RESOURCE_ID is used together with VMCI_MAKE_HANDLE to make
* handles that refer to a specific context.
*/
#define VMCI_CONTEXT_RESOURCE_ID 0
VMCI_PRIV_ASSIGN_CLIENT,
VMCI_PRIV_DG_CREATE,
VMCI_PRIV_DG_SEND,
- VMCI_PRIV_SM_CREATE,
- VMCI_PRIV_SM_ATTACH,
+ VMCI_PRIV_NOTIFY,
VMCI_NUM_PRIVILEGES,
} VMCIResourcePrivilegeType;
-/*
+/*
* VMCI coarse-grained privileges (per context or host
* process/endpoint. An entity with the restricted flag is only
* allowed to interact with the hypervisor and trusted entities.
#define VMCI_CONTROL_INT_DISABLE 0x4
/* Capabilities register bits. */
-#define VMCI_CAPS_HYPERCALL 0x1
+#define VMCI_CAPS_HYPERCALL 0x1
#define VMCI_CAPS_GUESTCALL 0x2
#define VMCI_CAPS_DATAGRAM 0x4
#define VMCI_CAPS_NOTIFICATIONS 0x8
#define VMCI_IMR_DATAGRAM 0x1
#define VMCI_IMR_NOTIFICATION 0x2
-/*
- * We have a fixed set of resource IDs available in the VMX.
- * This allows us to have a very simple implementation since we statically
+/*
+ * We have a fixed set of resource IDs available in the VMX.
+ * This allows us to have a very simple implementation since we statically
* know how many will create datagram handles. If a new caller arrives and
* we have run out of slots we can manually increment the maximum size of
* available resource IDs.
} VMCIHandle;
static INLINE
-VMCIHandle VMCI_MAKE_HANDLE(VMCIId cid,
+VMCIHandle VMCI_MAKE_HANDLE(VMCIId cid,
VMCIId rid)
{
VMCIHandle h;
*
* Results:
* The uint64 value.
- *
- * Side effects:
+ *
+ * Side effects:
* None.
*
*----------------------------------------------------------------------
*
* Results:
* The VMCI handle value.
- *
- * Side effects:
+ *
+ * Side effects:
* None.
*
*----------------------------------------------------------------------
(_h1).resource == (_h2).resource)
#define VMCI_INVALID_ID 0xFFFFFFFF
-static const VMCIHandle VMCI_INVALID_HANDLE = {VMCI_INVALID_ID,
+static const VMCIHandle VMCI_INVALID_HANDLE = {VMCI_INVALID_ID,
VMCI_INVALID_ID};
#define VMCI_HANDLE_INVALID(_handle) \
/*
* Hypervisor context id, used for calling into hypervisor
- * supplied services from the VM.
+ * supplied services from the VM.
*/
#define VMCI_HYPERVISOR_CONTEXT_ID 0
-/*
- * Well-known context id, a logical context that contains
+/*
+ * Well-known context id, a logical context that contains
* a set of well-known services.
*/
#define VMCI_WELL_KNOWN_CONTEXT_ID 1
/* Todo: Change host context id to dynamic/random id. */
#define VMCI_HOST_CONTEXT_ID 2
-/*
- * The VMCI_CONTEXT_RESOURCE_ID is used together with VMCI_MAKE_HANDLE to make
+/*
+ * The VMCI_CONTEXT_RESOURCE_ID is used together with VMCI_MAKE_HANDLE to make
* handles that refer to a specific context.
*/
#define VMCI_CONTEXT_RESOURCE_ID 0
VMCI_PRIV_ASSIGN_CLIENT,
VMCI_PRIV_DG_CREATE,
VMCI_PRIV_DG_SEND,
- VMCI_PRIV_SM_CREATE,
- VMCI_PRIV_SM_ATTACH,
+ VMCI_PRIV_NOTIFY,
VMCI_NUM_PRIVILEGES,
} VMCIResourcePrivilegeType;
-/*
+/*
* VMCI coarse-grained privileges (per context or host
* process/endpoint. An entity with the restricted flag is only
* allowed to interact with the hypervisor and trusted entities.
int VMCIContext_DoorbellCreate(VMCIId contextID, VMCIHandle handle);
int VMCIContext_DoorbellDestroy(VMCIId contextID, VMCIHandle handle);
int VMCIContext_DoorbellDestroyAll(VMCIId contextID);
-int VMCIContext_NotifyDoorbell(VMCIId cid, VMCIHandle handle);
+int VMCIContext_NotifyDoorbell(VMCIId cid, VMCIHandle handle,
+ VMCIPrivilegeFlags srcPrivFlags);
int VMCIContext_ReceiveNotificationsGet(VMCIId contextID,
VMCIHandleArray **dbHandleArray,
VMCIPrivilegeFlags VMCIContext_GetPrivFlags(VMCIId contextID);
+/* VMCI Doorbell API. */
+
+#define VMCI_FLAG_DELAYED_CB 0x01
+
+typedef void (*VMCICallback)(void *clientData);
+
+int VMCIDoorbell_Create(VMCIHandle *handle, uint32 flags,
+ VMCIPrivilegeFlags privFlags,
+ VMCICallback notifyCB, void *clientData);
+int VMCIDoorbell_Destroy(VMCIHandle handle);
+int VMCIDoorbell_Notify(VMCIHandle handle,
+ VMCIPrivilegeFlags privFlags);
#endif /* !__VMCI_HOSTKERNELAPI_H__ */