# define VMCI_DeviceShutdown() FALSE
#endif // !_WIN32
#if defined(_WIN32) || (defined(linux) && !defined(VMKERNEL))
- Bool VMCI_HasGuestDevice(void);
- Bool VMCI_HasHostDevice(void);
+ Bool VMCI_GuestPersonalityActive(void);
+ Bool VMCI_HostPersonalityActive(void);
#else
# if defined(VMX86_TOOLS)
-# define VMCI_HasGuestDevice() TRUE
-# define VMCI_HasHostDevice() FALSE
+# define VMCI_GuestPersonalityActive() TRUE
+# define VMCI_HostPersonalityActive() FALSE
# else // VMX86_TOOLS
-# define VMCI_HasGuestDevice() FALSE
-# define VMCI_HasHostDevice() TRUE
+# define VMCI_GuestPersonalityActive() FALSE
+# define VMCI_HostPersonalityActive() TRUE
# endif // !VMX86_TOOLS
#endif // !(_WIN32 || (linux && !VMKERNEL))
#include "vmciContext.h"
#include "vmciDatagram.h"
#include "vmciDoorbell.h"
+#include "vmciDriver.h"
#include "vmciEvent.h"
#include "vmciKernelAPI.h"
#include "vmciQueuePair.h"
# include "vmciVmkInt.h"
# include "vm_libc.h"
# include "helper_ext.h"
-# include "vmciDriver.h"
-#else
-# include "vmciDriver.h"
#endif
#define LGPFX "VMCIContext: "
VMCIPrivilegeFlags
VMCIContext_GetPrivFlags(VMCIId contextID) // IN
{
- if (VMCI_HasHostDevice()) {
+ if (VMCI_HostPersonalityActive()) {
VMCIPrivilegeFlags flags;
VMCIContext *context;
VMCI_IsContextOwner(VMCIId contextID, // IN
void *hostUser) // IN
{
- if (VMCI_HasHostDevice()) {
+ if (VMCI_HostPersonalityActive()) {
VMCIContext *context;
VMCIHostUser *user = (VMCIHostUser *)hostUser;
int retval;
#include "vmciCommonInt.h"
#include "vmciContext.h"
#include "vmciDatagram.h"
+#include "vmciDriver.h"
#include "vmciEvent.h"
#include "vmciHashtable.h"
#include "vmciKernelAPI.h"
# include "vmciVmkInt.h"
# include "vm_libc.h"
# include "helper_ext.h"
-# include "vmciDriver.h"
-#else
-# include "vmciDriver.h"
#endif
#define LGPFX "VMCIDatagram: "
char dstDomain[VMCI_DOMAIN_NAME_MAXLEN]; /* Not used on hosted. */
ASSERT(dg);
- ASSERT(VMCI_HasHostDevice());
+ ASSERT(VMCI_HostPersonalityActive());
dgSize = VMCI_DG_SIZE(dg);
int retval;
VMCIResource *resource;
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
resource = VMCIResource_Get(dg->src, VMCI_RESOURCE_TYPE_DATAGRAM);
if (NULL == resource) {
DatagramEntry *dstEntry;
ASSERT(dg);
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
resource = VMCIResource_Get(dg->dst, VMCI_RESOURCE_TYPE_DATAGRAM);
if (NULL == resource) {
#include "vmciCommonInt.h"
#include "vmciDatagram.h"
#include "vmciDoorbell.h"
+#include "vmciDriver.h"
#include "vmciKernelAPI.h"
#include "vmciResource.h"
#include "vmciRoute.h"
# include "vmciVmkInt.h"
# include "vm_libc.h"
# include "helper_ext.h"
-# include "vmciDriver.h"
-#else
-# include "vmciDriver.h"
#endif
#define LGPFX "VMCIDoorbell: "
uint32 bucket = VMCI_DOORBELL_HASH(idx);
VMCIListItem *iter;
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
VMCIList_Scan(iter, &vmciDoorbellIT.entries[bucket]) {
VMCIDoorbellEntry *cur =
VMCILockFlags flags;
ASSERT(entry);
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
VMCIResource_Hold(&entry->resource);
VMCILockFlags flags;
ASSERT(entry);
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
VMCIDoorbellGrabLock(&vmciDoorbellIT.lock, &flags);
VMCIDoorbellLinkMsg linkMsg;
ASSERT(!VMCI_HANDLE_INVALID(handle));
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
if (isDoorbell) {
resourceID = VMCI_DOORBELL_LINK;
VMCIDoorbellUnlinkMsg unlinkMsg;
ASSERT(!VMCI_HANDLE_INVALID(handle));
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
if (isDoorbell) {
resourceID = VMCI_DOORBELL_UNLINK;
if (VMCI_HOST_CONTEXT_ID == handle->context) {
validContext = TRUE;
}
- if (VMCI_HasGuestDevice() && VMCI_GetContextID() == handle->context) {
+ if (VMCI_GuestPersonalityActive() && VMCI_GetContextID() == handle->context) {
validContext = TRUE;
}
goto destroy;
}
- if (VMCI_HasGuestDevice()) {
+ if (VMCI_GuestPersonalityActive()) {
result = VMCIDoorbellLink(newHandle, entry->isDoorbell, entry->idx);
if (VMCI_SUCCESS != result) {
goto destroyResource;
}
entry = RESOURCE_CONTAINER(resource, VMCIDoorbellEntry, resource);
- if (VMCI_HasGuestDevice()) {
+ if (VMCI_GuestPersonalityActive()) {
int result;
VMCIDoorbellIndexTableRemove(entry);
#else // VMKERNEL
VMCIDoorbellNotifyMsg notifyMsg;
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
notifyMsg.hdr.dst = VMCI_MAKE_HANDLE(VMCI_HYPERVISOR_CONTEXT_ID,
VMCI_DOORBELL_NOTIFY);
VMCIResource *resource;
int result;
- ASSERT(VMCI_HasHostDevice());
+ ASSERT(VMCI_HostPersonalityActive());
resource = VMCIResource_Get(handle, VMCI_RESOURCE_TYPE_DOORBELL);
if (resource == NULL) {
VMCIListItem *iter;
VMCILockFlags flags;
- if (!VMCI_HasGuestDevice() || enterHibernate) {
+ if (!VMCI_GuestPersonalityActive() || enterHibernate) {
return;
}
VMCIListItem *iter;
VMCILockFlags flags;
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
VMCIDoorbellGrabLock(&vmciDoorbellIT.lock, &flags);
uint32 idx;
ASSERT(bitmap);
- ASSERT(VMCI_HasGuestDevice());
+ ASSERT(VMCI_GuestPersonalityActive());
for (idx = 0; idx < maxNotifyIdx; idx++) {
if (bitmap[idx] & 0x1) {
VMCIId
VMCI_GetContextID(void)
{
- if (VMCI_HasGuestDevice()) {
+ if (VMCI_GuestPersonalityActive()) {
if (Atomic_Read(&vmContextID) == VMCI_INVALID_ID) {
uint32 result;
VMCIDatagram getCidMsg;
Atomic_Write(&vmContextID, result);
}
return Atomic_Read(&vmContextID);
- } else if (VMCI_HasHostDevice()) {
+ } else if (VMCI_HostPersonalityActive()) {
return VMCI_HOST_CONTEXT_ID;
}
return VMCI_INVALID_ID;
#include "vmci_defs.h"
#include "vmci_infrastructure.h"
#include "vmciCommonInt.h"
+#include "vmciDriver.h"
#include "vmciHashtable.h"
#if defined(VMKERNEL)
# include "vmciVmkInt.h"
# include "vm_libc.h"
# include "helper_ext.h"
-# include "vmciDriver.h"
-#else
-# include "vmciDriver.h"
#endif
#define LGPFX "VMCIHashTable: "
retval = VMCI_Route(&src, &dst, FALSE, &route);
if (retval < VMCI_SUCCESS) {
- if (VMCI_HasGuestDevice()) {
+ if (VMCI_GuestPersonalityActive()) {
route = VMCI_ROUTE_AS_GUEST;
} else {
route = VMCI_ROUTE_AS_HOST;
#include "vmciCommonInt.h"
#include "vmciContext.h"
#include "vmciDatagram.h"
+#include "vmciDriver.h"
#include "vmciEvent.h"
#include "vmciHashtable.h"
#include "vmciKernelAPI.h"
# include "vmciVmkInt.h"
# include "vm_libc.h"
# include "helper_ext.h"
-# include "vmciDriver.h"
-#else
-# include "vmciDriver.h"
#endif
#define LGPFX "VMCIQueuePair: "
#include "vmci_infrastructure.h"
#include "vmciCommonInt.h"
#include "vmciContext.h"
+#include "vmciDriver.h"
#include "vmciKernelAPI.h"
#include "vmciRoute.h"
#if defined(VMKERNEL)
# include "vmciVmkInt.h"
# include "vm_libc.h"
# include "helper_ext.h"
-# include "vmciDriver.h"
-#else
-# include "vmciDriver.h"
#endif
#define LGPFX "VMCIRoute: "
* device.
*/
- hasHostDevice = VMCI_HasHostDevice();
- hasGuestDevice = VMCI_HasGuestDevice();
+ hasHostDevice = VMCI_HostPersonalityActive();
+ hasGuestDevice = VMCI_GuestPersonalityActive();
/* Must have a valid destination context. */
if (VMCI_INVALID_ID == dst->context) {
Bool
VMCI_DeviceEnabled(void)
{
- return VMCI_HasGuestDevice() || VMCI_HasHostDevice();
+ return VMCI_GuestPersonalityActive() || VMCI_HostPersonalityActive();
}
/*
*-----------------------------------------------------------------------------
*
- * VMCI_HasGuestDevice --
+ * VMCI_GuestPersonalityActive --
*
* Determines whether the VMCI PCI device has been successfully
* initialized.
*/
Bool
-VMCI_HasGuestDevice(void)
+VMCI_GuestPersonalityActive(void)
{
return guestDeviceInit && atomic_read(&guestDeviceActive) > 0;
}
/*
*-----------------------------------------------------------------------------
*
- * VMCI_HasHostDevice --
+ * VMCI_HostPersonalityActive --
*
- * Determines whether the VMCI host device is available. Since
- * the core functionality of the host driver is always present,
- * all guests could possibly use the host personality. However,
- * to minimize the deviation from the pre-unified driver state of
- * affairs, we only consider the host device active, if there is
- * no active guest device, or if there are VMX'en with active
- * VMCI contexts using the host device.
+ * Determines whether the VMCI host personality is
+ * available. Since the core functionality of the host driver is
+ * always present, all guests could possibly use the host
+ * personality. However, to minimize the deviation from the
+ * pre-unified driver state of affairs, we only consider the host
+ * device active, if there is no active guest device, or if there
+ * are VMX'en with active VMCI contexts using the host device.
*
* Results:
* TRUE, if VMCI host driver is operational, FALSE otherwise.
*/
Bool
-VMCI_HasHostDevice(void)
+VMCI_HostPersonalityActive(void)
{
return hostDeviceInit &&
- (!VMCI_HasGuestDevice() || atomic_read(&linuxState.activeContexts) > 0);
+ (!VMCI_GuestPersonalityActive() ||
+ atomic_read(&linuxState.activeContexts) > 0);
}
Warning(LGPFX"VMCI PCI device not initialized (err=%d).\n", retval);
}
guestDeviceInit = (retval == 0);
- if (VMCI_HasGuestDevice()) {
+ if (VMCI_GuestPersonalityActive()) {
Log(LGPFX"Using guest personality\n");
}
}