Skip to content

Commit c8b0ee9

Browse files
author
Heiko Engel
committed
Support for Kernel 4.5 and CentOS 7.3
1 parent 9f57609 commit c8b0ee9

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

patches/linux_uio/uio_pci_dma.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,10 +1067,14 @@ page_fault_handler
10671067
UIO_DEBUG_ENTER();
10681068

10691069
struct uio_pci_dma_private *priv = vma->vm_private_data;
1070-
int ret =
1071-
vm_insert_mixed
1072-
(vma, (unsigned long)vmf->virtual_address,
1073-
priv->pfn_list[vmf->pgoff % priv->pages]);
1070+
1071+
#ifdef PDA_PFN_T_PAGES
1072+
int ret = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address,
1073+
pfn_to_pfn_t(priv->pfn_list[vmf->pgoff % priv->pages]));
1074+
#else
1075+
int ret = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address,
1076+
priv->pfn_list[vmf->pgoff % priv->pages]);
1077+
#endif
10741078

10751079
switch(ret)
10761080
{

patches/linux_uio/uio_pci_dma.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,27 @@ BIN_ATTR_MAP_CALLBACK( map_sg );
291291
/** Version dependend definitions */
292292

293293

294+
/**
295+
* Kernel 4.5 introduces a different management of pages by PFN, see
296+
* https://lwn.net/Articles/654396/
297+
* https://lwn.net/Articles/656197/
298+
* https://lwn.net/Articles/672457/
299+
* These changes are back-ported at least into CentOS 7.3,
300+
* kernel 3.10.0-514.6.1.el7.x86_64
301+
**/
302+
#if defined(RHEL_RELEASE_CODE)
303+
#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 3)
304+
#define PDA_PFN_T_PAGES
305+
#endif
306+
#endif
307+
308+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
309+
#define PDA_PFN_T_PAGES
310+
#endif
311+
312+
#ifdef PDA_PFN_T_PAGES
313+
#include <linux/pfn_t.h>
314+
#endif
294315

295316
#endif /** __KERNEL__ */
296317

0 commit comments

Comments
 (0)