Re: svn commit: r316033 - in head/sys/compat/linuxkpi/common: include/asm include/linux src

2017-04-09 Thread Hans Petter Selasky

On 04/08/17 20:08, Ed Maste wrote:

On 27 March 2017 at 13:04, Hans Petter Selasky  wrote:

Author: hselasky
Date: Mon Mar 27 17:04:11 2017
New Revision: 316033
URL: https://svnweb.freebsd.org/changeset/base/316033


powerpc.GENERIC is now failing with:

In file included from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/gfp.h:39,
 from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/slab.h:41,
 from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/sched.h:44,
 from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/kernel.h:49,
 from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/kobject.h:36,
 from
/scratch/tmp/emaste/freebsd/sys/modules/linuxkpi/../../compat/linuxkpi/common/src/linux_compat.c:58:
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/page.h:43:
error: conflicting types for 'pte_t'
./machine/pte.h:127: error: previous declaration of 'pte_t' was here
cc1: warnings being treated as errors
/scratch/tmp/emaste/freebsd/sys/modules/linuxkpi/../../compat/linuxkpi/common/src/linux_compat.c:
In function 'linux_cdev_pager_populate':
/scratch/tmp/emaste/freebsd/sys/modules/linuxkpi/../../compat/linuxkpi/common/src/linux_compat.c:414:
warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
*** [linux_compat.o] Error code 1




I'm on it. Thank you for the notice.

--HPS
___
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"


Re: svn commit: r316033 - in head/sys/compat/linuxkpi/common: include/asm include/linux src

2017-04-08 Thread Ed Maste
On 27 March 2017 at 13:04, Hans Petter Selasky  wrote:
> Author: hselasky
> Date: Mon Mar 27 17:04:11 2017
> New Revision: 316033
> URL: https://svnweb.freebsd.org/changeset/base/316033

powerpc.GENERIC is now failing with:

In file included from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/gfp.h:39,
 from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/slab.h:41,
 from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/sched.h:44,
 from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/kernel.h:49,
 from
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/kobject.h:36,
 from
/scratch/tmp/emaste/freebsd/sys/modules/linuxkpi/../../compat/linuxkpi/common/src/linux_compat.c:58:
/scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/page.h:43:
error: conflicting types for 'pte_t'
./machine/pte.h:127: error: previous declaration of 'pte_t' was here
cc1: warnings being treated as errors
/scratch/tmp/emaste/freebsd/sys/modules/linuxkpi/../../compat/linuxkpi/common/src/linux_compat.c:
In function 'linux_cdev_pager_populate':
/scratch/tmp/emaste/freebsd/sys/modules/linuxkpi/../../compat/linuxkpi/common/src/linux_compat.c:414:
warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
*** [linux_compat.o] Error code 1
___
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"


svn commit: r316033 - in head/sys/compat/linuxkpi/common: include/asm include/linux src

2017-03-27 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Mar 27 17:04:11 2017
New Revision: 316033
URL: https://svnweb.freebsd.org/changeset/base/316033

Log:
  Implement a series of physical page management related functions in
  the LinuxKPI for accessing user-space memory in the kernel.
  
  Add functions to hold and wire physical page(s) based on a given range
  of user-space virtual addresses.
  
  Add functions to get and put a reference on, wire, hold, mark
  accessed, copy and dirty a physical page.
  
  Add new VM related structures and defines as a preparation step for
  advancing the memory map capabilities of the LinuxKPI.
  
  Add function to figure out if a virtual address was allocated using
  malloc().
  
  Add function to convert a virtual kernel address into its physical
  page pointer.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Added:
  head/sys/compat/linuxkpi/common/include/linux/pfn.h   (contents, props 
changed)
  head/sys/compat/linuxkpi/common/include/linux/pfn_t.h   (contents, props 
changed)
  head/sys/compat/linuxkpi/common/include/linux/preempt.h   (contents, props 
changed)
Modified:
  head/sys/compat/linuxkpi/common/include/asm/pgtable.h
  head/sys/compat/linuxkpi/common/include/linux/mm.h
  head/sys/compat/linuxkpi/common/include/linux/page.h
  head/sys/compat/linuxkpi/common/include/linux/types.h
  head/sys/compat/linuxkpi/common/src/linux_page.c

Modified: head/sys/compat/linuxkpi/common/include/asm/pgtable.h
==
--- head/sys/compat/linuxkpi/common/include/asm/pgtable.h   Mon Mar 27 
16:25:58 2017(r316032)
+++ head/sys/compat/linuxkpi/common/include/asm/pgtable.h   Mon Mar 27 
17:04:11 2017(r316033)
@@ -33,4 +33,11 @@
 
 #include 
 
+typedef unsigned long  pteval_t;
+typedef unsigned long  pmdval_t;
+typedef unsigned long  pudval_t;
+typedef unsigned long  pgdval_t;
+typedef unsigned long  pgprotval_t;
+typedef struct page *pgtable_t;
+
 #endif /* _ASM_PGTABLE_H_ */

Modified: head/sys/compat/linuxkpi/common/include/linux/mm.h
==
--- head/sys/compat/linuxkpi/common/include/linux/mm.h  Mon Mar 27 16:25:58 
2017(r316032)
+++ head/sys/compat/linuxkpi/common/include/linux/mm.h  Mon Mar 27 17:04:11 
2017(r316033)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2017 Mellanox Technologies, Ltd.
  * Copyright (c) 2015 François Tigeot
  * Copyright (c) 2015 Matthew Dillon 
  * All rights reserved.
@@ -37,9 +37,57 @@
 #include 
 #include 
 #include 
+#include 
+
+#include 
 
 #definePAGE_ALIGN(x)   ALIGN(x, PAGE_SIZE)
 
+/*
+ * Make sure our LinuxKPI defined virtual memory flags don't conflict
+ * with the ones defined by FreeBSD:
+ */
+CTASSERT((VM_PROT_ALL & -(1 << 8)) == 0);
+
+#defineVM_PFNINTERNAL  (1 << 8)/* FreeBSD private flag 
to vm_insert_pfn() */
+#defineVM_MIXEDMAP (1 << 9)
+#defineVM_NORESERVE(1 << 10)
+#defineVM_PFNMAP   (1 << 11)
+#defineVM_IO   (1 << 12)
+#defineVM_MAYWRITE (1 << 13)
+#defineVM_DONTCOPY (1 << 14)
+#defineVM_DONTEXPAND   (1 << 15)
+#defineVM_DONTDUMP (1 << 16)
+
+#defineVMA_MAX_PREFAULT_RECORD 1
+
+#defineFOLL_WRITE  (1 << 0)
+#defineFOLL_FORCE  (1 << 1)
+
+#defineVM_FAULT_OOM(1 << 0)
+#defineVM_FAULT_SIGBUS (1 << 1)
+#defineVM_FAULT_MAJOR  (1 << 2)
+#defineVM_FAULT_WRITE  (1 << 3)
+#defineVM_FAULT_HWPOISON   (1 << 4)
+#defineVM_FAULT_HWPOISON_LARGE (1 << 5)
+#defineVM_FAULT_SIGSEGV(1 << 6)
+#defineVM_FAULT_NOPAGE (1 << 7)
+#defineVM_FAULT_LOCKED (1 << 8)
+#defineVM_FAULT_RETRY  (1 << 9)
+#defineVM_FAULT_FALLBACK   (1 << 10)
+
+#defineFAULT_FLAG_WRITE(1 << 0)
+#defineFAULT_FLAG_MKWRITE  (1 << 1)
+#defineFAULT_FLAG_ALLOW_RETRY  (1 << 2)
+#defineFAULT_FLAG_RETRY_NOWAIT (1 << 3)
+#defineFAULT_FLAG_KILLABLE (1 << 4)
+#defineFAULT_FLAG_TRIED(1 << 5)
+#defineFAULT_FLAG_USER (1 << 6)
+#defineFAULT_FLAG_REMOTE   (1 << 7)
+#defineFAULT_FLAG_INSTRUCTION  (1 << 8)
+
+typedef int (*pte_fn_t)(pte_t *, pgtable_t, unsigned long addr, void *data);
+
 struct vm_area_struct {
vm_offset_t vm_start;
vm_offset_t vm_end;
@@ -49,6 +97,19 @@ struct vm_area_struct {
vm_memattr_tvm_page_prot;
 };
 
+struct vm_fault {