Author: hselasky
Date: Fri Feb 17 13:31:11 2017
New Revision: 313872
URL: https://svnweb.freebsd.org/changeset/base/313872

Log:
  Implement GFP_DMA32 flag in the LinuxKPI.
  Define all FreeBSD native GFP bits as GFP_NATIVE_MASK.
  
  Obtained from:                kmacy @
  MFC after:            1 week
  Sponsored by:         Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
  head/sys/compat/linuxkpi/common/include/linux/gfp.h

Modified: head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h Fri Feb 17 
12:47:51 2017        (r313871)
+++ head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h Fri Feb 17 
13:31:11 2017        (r313872)
@@ -129,8 +129,10 @@ dma_alloc_coherent(struct device *dev, s
 
        if (dev->dma_mask)
                high = *dev->dma_mask;
-       else
+       else if (flag & GFP_DMA32)
                high = BUS_SPACE_MAXADDR_32BIT;
+       else
+               high = BUS_SPACE_MAXADDR;
        align = PAGE_SIZE << get_order(size);
        mem = (void *)kmem_alloc_contig(kmem_arena, size, flag, 0, high, align,
            0, VM_MEMATTR_DEFAULT);

Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/gfp.h Fri Feb 17 12:47:51 
2017        (r313871)
+++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Fri Feb 17 13:31:11 
2017        (r313872)
@@ -53,7 +53,7 @@
 #define        __GFP_IO        0
 #define        __GFP_NO_KSWAPD 0
 #define        __GFP_WAIT      M_WAITOK
-#define        __GFP_DMA32     0
+#define        __GFP_DMA32     (1U << 24) /* LinuxKPI only */
 
 #define        GFP_NOWAIT      M_NOWAIT
 #define        GFP_ATOMIC      (M_NOWAIT | M_USE_RESERVE)
@@ -63,8 +63,9 @@
 #define        GFP_HIGHUSER_MOVABLE    M_WAITOK
 #define        GFP_IOFS        M_NOWAIT
 #define        GFP_NOIO        M_NOWAIT
-#define        GFP_DMA32       0
+#define        GFP_DMA32       __GFP_DMA32
 #define        GFP_TEMPORARY   M_NOWAIT
+#define        GFP_NATIVE_MASK (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_ZERO)
 
 static inline void *
 page_address(struct page *page)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to