File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed
Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -1068,10 +1068,14 @@ page_fault_handler
10681068 UIO_DEBUG_ENTER ();
10691069
10701070 struct uio_pci_dma_private * priv = vma -> vm_private_data ;
1071- int ret =
1072- vm_insert_mixed
1073- (vma , (unsigned long )vmf -> virtual_address ,
1074- priv -> pfn_list [vmf -> pgoff % priv -> pages ]);
1071+
1072+ #ifdef PDA_PFN_T_PAGES
1073+ int ret = vm_insert_mixed (vma , (unsigned long )vmf -> virtual_address ,
1074+ pfn_to_pfn_t (priv -> pfn_list [vmf -> pgoff % priv -> pages ]));
1075+ #else
1076+ int ret = vm_insert_mixed (vma , (unsigned long )vmf -> virtual_address ,
1077+ priv -> pfn_list [vmf -> pgoff % priv -> pages ]);
1078+ #endif
10751079
10761080 switch (ret )
10771081 {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments