From 3cdad6d173718beb949706210fd7cd91bfff12ff Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 11 Feb 2018 05:18:31 +0100 Subject: Support kernel 4.12 by Timo --- driver/rdma.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 #include #include +#include #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; -- cgit v1.2.1