nix-phi/mpss-modules-4.4.patch

40 lines
1.5 KiB
Diff

diff -ur mpss-modules-3.8.6/host/tools_support.c mpss-modules-3.8.6.patched.4.4/host/tools_support.c
--- mpss-modules-3.8.6/host/tools_support.c 2019-07-01 22:45:06.000000000 +0200
+++ mpss-modules-3.8.6.patched.4.4/host/tools_support.c 2021-01-20 23:36:28.705203711 +0100
@@ -89,8 +89,13 @@
// pin the user pages; use semaphores on linux for doing the same
down_read(&current->mm->mmap_sem);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,168)
+ *nf_pages = (int32_t)get_user_pages(current, current->mm, (uint64_t)data,
+ nr_pages, FOLL_WRITE|FOLL_FORCE, pages, NULL);
+#else
*nf_pages = (int32_t)get_user_pages(current, current->mm, (uint64_t)data,
nr_pages, PROT_WRITE, 1, pages, NULL);
+#endif
up_read(&current->mm->mmap_sem);
// compare if the no of final pages is equal to no of requested pages
diff -ur mpss-modules-3.8.6/micscif/micscif_api.c mpss-modules-3.8.6.patched.4.4/micscif/micscif_api.c
--- mpss-modules-3.8.6/micscif/micscif_api.c 2019-07-01 22:45:06.000000000 +0200
+++ mpss-modules-3.8.6.patched.4.4/micscif/micscif_api.c 2021-01-20 23:36:28.702203741 +0100
@@ -1980,14 +1980,17 @@
goto error_unmap;
}
}
-
pinned_pages->nr_pages = get_user_pages(
current,
mm,
(uint64_t)addr,
nr_pages,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,168)
+ (prot & SCIF_PROT_WRITE) ? FOLL_WRITE : 0,
+#else
!!(prot & SCIF_PROT_WRITE),
0,
+#endif
pinned_pages->pages,
pinned_pages->vma);
up_write(&mm->mmap_sem);