summaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-02-11 05:18:31 +0100
committerSuren A. Chilingaryan <csa@suren.me>2018-02-11 05:18:31 +0100
commit3cdad6d173718beb949706210fd7cd91bfff12ff (patch)
tree88c4f1ac2216181f357b5c05632fa4107cbc2fe6 /driver
parent92da72774b070ddec0562e05d81ceed340c8efad (diff)
downloadpcitool-3cdad6d173718beb949706210fd7cd91bfff12ff.tar.gz
pcitool-3cdad6d173718beb949706210fd7cd91bfff12ff.tar.bz2
pcitool-3cdad6d173718beb949706210fd7cd91bfff12ff.tar.xz
pcitool-3cdad6d173718beb949706210fd7cd91bfff12ff.zip
Support kernel 4.12 by Timo
Diffstat (limited to 'driver')
-rw-r--r--driver/rdma.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/driver/rdma.c b/driver/rdma.c
index 4cbd8c4..3670ddf 100644
--- a/driver/rdma.c
+++ b/driver/rdma.c
@@ -8,6 +8,7 @@
#include <linux/pagemap.h>
#include <linux/hugetlb.h>
#include <linux/cdev.h>
+#include <linux/version.h>
#include "base.h"
@@ -18,6 +19,7 @@ static unsigned long pcidriver_follow_pte(struct mm_struct *mm, unsigned long ad
pmd_t *pmd;
pte_t *pte;
+
spinlock_t *ptl;
unsigned long pfn = 0;
@@ -26,7 +28,15 @@ static unsigned long pcidriver_follow_pte(struct mm_struct *mm, unsigned long ad
if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
return 0;
+ // pud_offset compatibility with pgd_t* broken from Kernel Version 4.12 onwards. See: https://github.com/torvalds/linux/commit/048456dcf2c56ad6f6248e2899dda92fb6a613f6
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
+ p4d_t *p4d;
+ p4d = p4d_offset(pgd, address);
+ pud = pud_offset(p4d, address);
+#elif
pud = pud_offset(pgd, address);
+#endif
+
if (pud_none(*pud) || unlikely(pud_bad(*pud)))
return 0;