From: VMware, Inc <> Date: Wed, 24 Feb 2010 22:07:05 +0000 (-0800) Subject: Internal branch sync. Included in this change: X-Git-Tag: 2010.02.23-236320~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc5dc505dee2447da0d7f741250ed516ef1eefb5;p=thirdparty%2Fopen-vm-tools.git Internal branch sync. Included in this change: . Patch backdoorGcc64.c to trick Apple's GCC into not thinking we clobber the PIC register. This allows us to build lib/backdoor on mac64. . Do not use new NAPI poll in Linux kernel < 2.6.24. . Avoid tx hangs while running NDIStest. . Changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/backdoor/backdoorGcc64.c b/open-vm-tools/lib/backdoor/backdoorGcc64.c index 28acfb062..48cd5b7c7 100644 --- a/open-vm-tools/lib/backdoor/backdoorGcc64.c +++ b/open-vm-tools/lib/backdoor/backdoorGcc64.c @@ -76,6 +76,14 @@ Backdoor_InOut(Backdoor_proto *myBp) // IN/OUT uint64 dummy; __asm__ __volatile__( +#ifdef __APPLE__ + /* + * Save %rbx on the stack because the Mac OS GCC doesn't want us to + * clobber it - it erroneously thinks %rbx is the PIC register. + * (Radar bug 7304232) + */ + "pushq %%rbx" "\n\t" +#endif "pushq %%rax" "\n\t" "movq 40(%%rax), %%rdi" "\n\t" "movq 32(%%rax), %%rsi" "\n\t" @@ -90,14 +98,22 @@ Backdoor_InOut(Backdoor_proto *myBp) // IN/OUT "movq %%rdx, 24(%%rax)" "\n\t" "movq %%rcx, 16(%%rax)" "\n\t" "movq %%rbx, 8(%%rax)" "\n\t" - "popq (%%rax)" + "popq (%%rax)" "\n\t" +#ifdef __APPLE__ + "popq %%rbx" "\n\t" +#endif : "=a" (dummy) : "0" (myBp) /* * vmware can modify the whole VM state without the compiler knowing * it. So far it does not modify EFLAGS. --hpreg */ - : "rbx", "rcx", "rdx", "rsi", "rdi", "memory" + : +#ifndef __APPLE__ + /* %rbx is unchanged at the end of the function on Mac OS. */ + "rbx", +#endif + "rcx", "rdx", "rsi", "rdi", "memory" ); } @@ -127,7 +143,14 @@ BackdoorHbIn(Backdoor_proto_hb *myBp) // IN/OUT __asm__ __volatile__( "pushq %%rbp" "\n\t" - +#ifdef __APPLE__ + /* + * Save %rbx on the stack because the Mac OS GCC doesn't want us to + * clobber it - it erroneously thinks %rbx is the PIC register. + * (Radar bug 7304232) + */ + "pushq %%rbx" "\n\t" +#endif "pushq %%rax" "\n\t" "movq 48(%%rax), %%rbp" "\n\t" "movq 40(%%rax), %%rdi" "\n\t" @@ -146,7 +169,9 @@ BackdoorHbIn(Backdoor_proto_hb *myBp) // IN/OUT "movq %%rcx, 16(%%rax)" "\n\t" "movq %%rbx, 8(%%rax)" "\n\t" "popq (%%rax)" "\n\t" - +#ifdef __APPLE__ + "popq %%rbx" "\n\t" +#endif "popq %%rbp" : "=a" (dummy) : "0" (myBp) @@ -154,7 +179,12 @@ BackdoorHbIn(Backdoor_proto_hb *myBp) // IN/OUT * vmware can modify the whole VM state without the compiler knowing * it. --hpreg */ - : "rbx", "rcx", "rdx", "rsi", "rdi", "memory", "cc" + : +#ifndef __APPLE__ + /* %rbx is unchanged at the end of the function on Mac OS. */ + "rbx", +#endif + "rcx", "rdx", "rsi", "rdi", "memory", "cc" ); } @@ -166,7 +196,14 @@ BackdoorHbOut(Backdoor_proto_hb *myBp) // IN/OUT __asm__ __volatile__( "pushq %%rbp" "\n\t" - +#ifdef __APPLE__ + /* + * Save %rbx on the stack because the Mac OS GCC doesn't want us to + * clobber it - it erroneously thinks %rbx is the PIC register. + * (Radar bug 7304232) + */ + "pushq %%rbx" "\n\t" +#endif "pushq %%rax" "\n\t" "movq 48(%%rax), %%rbp" "\n\t" "movq 40(%%rax), %%rdi" "\n\t" @@ -185,11 +222,18 @@ BackdoorHbOut(Backdoor_proto_hb *myBp) // IN/OUT "movq %%rcx, 16(%%rax)" "\n\t" "movq %%rbx, 8(%%rax)" "\n\t" "popq (%%rax)" "\n\t" - +#ifdef __APPLE__ + "popq %%rbx" "\n\t" +#endif "popq %%rbp" : "=a" (dummy) : "0" (myBp) - : "rbx", "rcx", "rdx", "rsi", "rdi", "memory", "cc" + : +#ifndef __APPLE__ + /* %rbx is unchanged at the end of the function on Mac OS. */ + "rbx", +#endif + "rcx", "rdx", "rsi", "rdi", "memory", "cc" ); } diff --git a/open-vm-tools/lib/file/filePosix.c b/open-vm-tools/lib/file/filePosix.c index 17aab8881..019565213 100644 --- a/open-vm-tools/lib/file/filePosix.c +++ b/open-vm-tools/lib/file/filePosix.c @@ -1293,7 +1293,67 @@ done: } return ret; } -#endif + + +/* + *---------------------------------------------------------------------- + * + * File_GetVMFSMountInfo -- + * + * Acquire the FS mount point info such as fsType, major version, + * local mount point (/vmfs/volumes/xyz), and for NFS, + * remote IP and remote mount point for a given file. + * + * Results: + * Integer return value and allocated data + * + * Side effects: + * Only implemented on ESX. Will fail on other platforms. + * remoteIP and remoteMountPoint are only populated for files on NFS. + * + *---------------------------------------------------------------------- + */ + +int +File_GetVMFSMountInfo(ConstUnicode pathName, + char **fsType, + uint32 *version, + char **remoteIP, + char **remoteMountPoint, + char **localMountPoint) +{ + int ret; + int len; + FS_PartitionListResult *fsAttrs; + + *localMountPoint = File_GetUniqueFileSystemID(pathName); + + if (*localMountPoint == NULL) { + return -1; + } + + // Get file IP and mount point + ret = File_GetVMFSAttributes(pathName, &fsAttrs); + if (ret >= 0 && fsAttrs) { + *version = fsAttrs->versionNumber; + *fsType = Util_SafeStrdup(fsAttrs->fsType); + + if (strncmp(fsAttrs->fsType, "NFS", sizeof("NFS")) == 0) { + len = strlen(fsAttrs->logicalDevice); + *remoteIP = Util_SafeMalloc(len); + *remoteMountPoint = Util_SafeMalloc(len); + sscanf(fsAttrs->logicalDevice, "%s %s", *remoteIP, *remoteMountPoint); + } else { + *remoteIP = NULL; + *remoteMountPoint = NULL; + } + } + + free(fsAttrs); + return ret; +} + +#endif /* diff --git a/open-vm-tools/lib/include/file.h b/open-vm-tools/lib/include/file.h index 34b80b4f3..7b1ae3ca9 100644 --- a/open-vm-tools/lib/include/file.h +++ b/open-vm-tools/lib/include/file.h @@ -88,6 +88,12 @@ EXTERN char *FileMacos_SliceUUIDToSliceDev(char const *uuid); #elif defined VMX86_SERVER EXTERN int File_GetVMFSBlockSize(ConstUnicode pathName, uint32 *blockSize); EXTERN int File_GetVMFSfsType(ConstUnicode pathName, char **fsType); +EXTERN int File_GetVMFSMountInfo(ConstUnicode pathName, + char **fsType, + uint32 *version, + char **remoteIP, + char **remoteMountPoint, + char **localMountPoint); #endif EXTERN Bool File_Exists(ConstUnicode pathName); diff --git a/open-vm-tools/lib/include/win32util.h b/open-vm-tools/lib/include/win32util.h index 2d6dea002..43fcc4ef0 100644 --- a/open-vm-tools/lib/include/win32util.h +++ b/open-vm-tools/lib/include/win32util.h @@ -214,5 +214,7 @@ HMODULE W32Util_GetModuleByAddress(const void *addr); Bool W32Util_VerifyXPModeHostLicense(void); +Unicode W32Util_GetPipeNameFromFilePath(ConstUnicode fileName); + #endif // _WIN32 #endif // WIN32UTIL_H_ diff --git a/open-vm-tools/modules/linux/pvscsi/scsi_defs.h b/open-vm-tools/modules/linux/pvscsi/scsi_defs.h index eebb6b08b..6b886ede4 100644 --- a/open-vm-tools/modules/linux/pvscsi/scsi_defs.h +++ b/open-vm-tools/modules/linux/pvscsi/scsi_defs.h @@ -1423,6 +1423,24 @@ struct { #include "vmware_pack_end.h" SCSIVerify10Cmd; +typedef +#include "vmware_pack_begin.h" +struct { + uint8 opcode; + uint8 relAdr :1, // relative address + bytChk :1, // byte + blkvfy :1, // blank blocks verification, scsi-2 rev 8. + :1, + dpo :1, // cache control bit + resvd :3; // reserved + uint64 lbn; // logical block address + uint32 length; // verification length + uint8 reserved; + uint8 control; // control byte +} +#include "vmware_pack_end.h" +SCSIVerify16Cmd; + typedef #include "vmware_pack_begin.h" struct { diff --git a/open-vm-tools/modules/linux/shared/compat_netdevice.h b/open-vm-tools/modules/linux/shared/compat_netdevice.h index 5af03ced4..f77f3cb4d 100644 --- a/open-vm-tools/modules/linux/shared/compat_netdevice.h +++ b/open-vm-tools/modules/linux/shared/compat_netdevice.h @@ -299,11 +299,6 @@ static inline int compat_unregister_netdevice_notifier(struct notifier_block *nb #else -# define compat_netif_napi_add(dev, napi, pollcb, quota) \ - do { \ - (dev)->poll = (pollcb); \ - (dev)->weight = (quota);\ - } while (0) # define compat_napi_schedule(dev, napi) netif_rx_schedule(dev) # define compat_napi_enable(dev, napi) netif_poll_enable(dev) # define compat_napi_disable(dev, napi) netif_poll_disable(dev) @@ -311,11 +306,24 @@ static inline int compat_unregister_netdevice_notifier(struct notifier_block *nb /* RedHat ported GRO to 2.6.18 bringing new napi_struct with it */ # if defined NETIF_F_GRO # define compat_napi_complete(dev, napi) napi_complete(napi) +# define compat_netif_napi_add(netdev, napi, pollcb, quota) \ + do { \ + (netdev)->poll = (pollcb); \ + (netdev)->weight = (quota);\ + (napi)->dev = (netdev); \ + } while (0) + # else # define compat_napi_complete(dev, napi) netif_rx_complete(dev) struct napi_struct { int dummy; }; +# define compat_netif_napi_add(dev, napi, pollcb, quota) \ + do { \ + (dev)->poll = (pollcb); \ + (dev)->weight = (quota);\ + } while (0) + # endif #endif diff --git a/open-vm-tools/modules/shared/vmxnet/npa_defs.h b/open-vm-tools/modules/shared/vmxnet/shared/npa_defs.h similarity index 93% rename from open-vm-tools/modules/shared/vmxnet/npa_defs.h rename to open-vm-tools/modules/shared/vmxnet/shared/npa_defs.h index aa531c608..22881110a 100644 --- a/open-vm-tools/modules/shared/vmxnet/npa_defs.h +++ b/open-vm-tools/modules/shared/vmxnet/shared/npa_defs.h @@ -35,6 +35,7 @@ #define NPA_PLUGIN_NUMPAGES 64 #define NPA_MEMIO_NUMPAGES 32 +#define NPA_SHARED_NUMPAGES 6 #define VMXNET3_NPA_CMD_SUCCESS 0 #define VMXNET3_NPA_CMD_FAILURE 1 #define VMXNET3_PLUGIN_INFO_LEN 32 @@ -65,11 +66,21 @@ struct NPA_MemioPages { #include "vmware_pack_end.h" NPA_MemioPages; +typedef +#include "vmware_pack_begin.h" +struct NPA_SharedPages { + PPN64 startPPN; + uint32 numPages; +} +#include "vmware_pack_end.h" +NPA_SharedPages; + typedef #include "vmware_pack_begin.h" struct NPA_PluginConf { NPA_PluginPages pluginPages; NPA_MemioPages memioPages; + NPA_SharedPages sharedPages; uint64 entryVA; // address of entry function in the plugin uint32 deviceInfo[VMXNET3_PLUGIN_INFO_LEN]; // opaque data returned by PF driver } diff --git a/open-vm-tools/modules/solaris/vmxnet3/vmxnet3_tx.c b/open-vm-tools/modules/solaris/vmxnet3/vmxnet3_tx.c index a0e4c5bb8..f77f13b0b 100644 --- a/open-vm-tools/modules/solaris/vmxnet3/vmxnet3_tx.c +++ b/open-vm-tools/modules/solaris/vmxnet3/vmxnet3_tx.c @@ -441,8 +441,8 @@ vmxnet3_tx(void *data, mblk_t *mps) /* Notify the device */ mutex_enter(&dp->txLock); if (txqCtrl->txNumDeferred >= txqCtrl->txThreshold) { - VMXNET3_BAR0_PUT32(dp, VMXNET3_REG_TXPROD, cmdRing->next2fill); txqCtrl->txNumDeferred = 0; + VMXNET3_BAR0_PUT32(dp, VMXNET3_REG_TXPROD, cmdRing->next2fill); } mutex_exit(&dp->txLock);