Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Mar 2017 17:09:11 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316034 - head/sys/compat/linuxkpi/common/src
Message-ID:  <201703271709.v2RH9Bb9084488@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Mon Mar 27 17:09:11 2017
New Revision: 316034
URL: https://svnweb.freebsd.org/changeset/base/316034

Log:
  Add more platforms supporting the direct map feature in the LinuxKPI.
  
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_page.c

Modified: head/sys/compat/linuxkpi/common/src/linux_page.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_page.c	Mon Mar 27 17:04:11 2017	(r316033)
+++ head/sys/compat/linuxkpi/common/src/linux_page.c	Mon Mar 27 17:09:11 2017	(r316034)
@@ -63,10 +63,16 @@ __FBSDID("$FreeBSD$");
 #include <linux/mm.h>
 #include <linux/preempt.h>
 
+#if defined(__amd64__) || defined(__aarch64__) || defined(__riscv__)
+#define	LINUXKPI_HAVE_DMAP
+#else
+#undef	LINUXKPI_HAVE_DMAP
+#endif
+
 void *
 linux_page_address(struct page *page)
 {
-#ifdef __amd64__
+#ifdef LINUXKPI_HAVE_DMAP
 	return ((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(page)));
 #else
 	if (page->object != kmem_object && page->object != kernel_object)
@@ -79,7 +85,7 @@ linux_page_address(struct page *page)
 vm_page_t
 linux_alloc_pages(gfp_t flags, unsigned int order)
 {
-#ifdef __amd64__
+#ifdef LINUXKPI_HAVE_DMAP
 	unsigned long npages = 1UL << order;
 	int req = (flags & M_ZERO) ? (VM_ALLOC_ZERO | VM_ALLOC_NOOBJ |
 	    VM_ALLOC_NORMAL) : (VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL);
@@ -137,7 +143,7 @@ retry:
 void
 linux_free_pages(vm_page_t page, unsigned int order)
 {
-#ifdef __amd64__
+#ifdef LINUXKPI_HAVE_DMAP
 	unsigned long npages = 1UL << order;
 	unsigned long x;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703271709.v2RH9Bb9084488>