summarylogtreecommitdiffstats
path: root/vmci.patch
diff options
context:
space:
mode:
Diffstat (limited to 'vmci.patch')
-rw-r--r--vmci.patch142
1 files changed, 142 insertions, 0 deletions
diff --git a/vmci.patch b/vmci.patch
new file mode 100644
index 000000000000..2398f839bc19
--- /dev/null
+++ b/vmci.patch
@@ -0,0 +1,142 @@
+ vmci/linux/{ => }/driver.c | 15 ++++++++++++++-
+ vmci/linux/{ => }/vmciKernelIf.c | 17 +++++++++++++++++
+ vmci/shared/{ => }/vm_device_version.h | 2 ++
+ vmci/shared/{ => }/vmci_kernel_if.h | 2 +-
+ 4 files changed, 34 insertions(+), 2 deletions(-)
+
+diff --git a/vmci/linux/driver.c b/vmci/linux/driver.c
+index 64a3cca..4bde0cc 100644
+--- a/vmci/linux/driver.c
++++ b/vmci/linux/driver.c
+@@ -26,6 +26,7 @@
+
+ #include <linux/file.h>
+ #include <linux/fs.h>
++#include <linux/vmalloc.h>
+ #include <linux/init.h>
+ #if defined(__x86_64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
+ # include <linux/ioctl32.h>
+@@ -713,7 +714,7 @@ LinuxDriver_Ioctl(struct inode *inode,
+
+ case IOCTL_VMCI_INIT_CONTEXT: {
+ VMCIInitBlock initBlock;
+- VMCIHostUser user;
++ uid_t user;
+
+ retval = copy_from_user(&initBlock, (void *)ioarg, sizeof initBlock);
+ if (retval != 0) {
+@@ -735,7 +736,11 @@ LinuxDriver_Ioctl(struct inode *inode,
+ goto init_release;
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ user = current_uid();
++#else
++ user = from_kuid(&init_user_ns, current_uid());
++#endif
+ retval = VMCIContext_InitContext(initBlock.cid, initBlock.flags,
+ 0 /* Unused */, vmciLinux->userVersion,
+ &user, &vmciLinux->context);
+@@ -1683,7 +1688,11 @@ vmci_guest_init(void)
+ /* This should be last to make sure we are done initializing. */
+ retval = pci_register_driver(&vmci_driver);
+ if (retval < 0) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
+ vfree(data_buffer);
++#else
++ kvfree(data_buffer);
++#endif
+ data_buffer = NULL;
+ return retval;
+ }
+@@ -2470,7 +2479,11 @@ vmci_exit(void)
+
+ if (guestDeviceInit) {
+ pci_unregister_driver(&vmci_driver);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
+ vfree(data_buffer);
++#else
++ kvfree(data_buffer);
++#endif
+ guestDeviceInit = FALSE;
+ }
+
+diff --git a/vmci/linux/vmciKernelIf.c b/vmci/linux/vmciKernelIf.c
+index 8b1788f..15766bf 100644
+--- a/vmci/linux/vmciKernelIf.c
++++ b/vmci/linux/vmciKernelIf.c
+@@ -40,6 +40,7 @@
+ #include <linux/socket.h> /* For memcpy_{to,from}iovec(). */
+ #include <linux/vmalloc.h>
+ #include <linux/wait.h>
++#include <linux/skbuff.h>
+
+ #include "compat_highmem.h"
+ #include "compat_interrupt.h"
+@@ -1198,11 +1199,19 @@ __VMCIMemcpyToQueue(VMCIQueue *queue, // OUT:
+ }
+
+ if (isIovec) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
+ struct iovec *iov = (struct iovec *)src;
++#else
++ struct msghdr *msg = (struct msghdr *)src;
++#endif
+ int err;
+
+ /* The iovec will track bytesCopied internally. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
+ err = memcpy_fromiovec((uint8 *)va + pageOffset, iov, toCopy);
++#else
++ err = memcpy_from_msg((u8 *)va + pageOffset, msg, toCopy);
++#endif
+ if (err != 0) {
+ if (kernelIf->host) {
+ kunmap(kernelIf->u.h.page[pageIndex]);
+@@ -1273,11 +1282,19 @@ __VMCIMemcpyFromQueue(void *dest, // OUT:
+ }
+
+ if (isIovec) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
+ struct iovec *iov = (struct iovec *)dest;
++#else
++ struct msghdr *msg = (struct msghdr *)dest;
++#endif
+ int err;
+
+ /* The iovec will track bytesCopied internally. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
+ err = memcpy_toiovec(iov, (uint8 *)va + pageOffset, toCopy);
++#else
++ err = memcpy_to_msg(msg, (uint8 *)va + pageOffset, toCopy);
++#endif
+ if (err != 0) {
+ if (kernelIf->host) {
+ kunmap(kernelIf->u.h.page[pageIndex]);
+diff --git a/vmci/shared/vm_device_version.h b/vmci/shared/vm_device_version.h
+index e2cb477..3dd7097 100644
+--- a/vmci/shared/vm_device_version.h
++++ b/vmci/shared/vm_device_version.h
+@@ -53,7 +53,9 @@
+ * VMware HD Audio codec
+ * VMware HD Audio controller
+ */
++#ifndef PCI_VENDOR_ID_VMWARE
+ #define PCI_VENDOR_ID_VMWARE 0x15AD
++#endif
+ #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
+ #define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
+ #define PCI_DEVICE_ID_VMWARE_VGA 0x0711
+diff --git a/vmci/shared/vmci_kernel_if.h b/vmci/shared/vmci_kernel_if.h
+index 9def671..082fe59 100644
+--- a/vmci/shared/vmci_kernel_if.h
++++ b/vmci/shared/vmci_kernel_if.h
+@@ -93,7 +93,7 @@
+ typedef Semaphore VMCIEvent;
+ typedef Semaphore VMCIMutex;
+ typedef World_ID VMCIHostVmID;
+- typedef uint32 VMCIHostUser;
++ typedef uint32_t VMCIHostUser;
+ typedef PPN *VMCIQPGuestMem;
+ #elif defined(linux)
+ typedef spinlock_t VMCILock;