Author: kib
Date: Sun Jan  6 00:45:41 2019
New Revision: 342800
URL: https://svnweb.freebsd.org/changeset/base/342800

Log:
  MFC r342627:
  Implement zap_vma_ptes() for managed device objects.

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/mm.h
  stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/mm.h
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/include/linux/mm.h     Sun Jan  6 
00:44:32 2019        (r342799)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/mm.h     Sun Jan  6 
00:45:41 2019        (r342800)
@@ -180,12 +180,8 @@ apply_to_page_range(struct mm_struct *mm, unsigned lon
        return (-ENOTSUP);
 }
 
-static inline int
-zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
-    unsigned long size)
-{
-       return (-ENOTSUP);
-}
+int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+    unsigned long size);
 
 static inline int
 remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,

Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c     Sun Jan  6 
00:44:32 2019        (r342799)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c     Sun Jan  6 
00:45:41 2019        (r342800)
@@ -672,6 +672,25 @@ static struct cdev_pager_ops linux_cdev_pager_ops[2] =
   },
 };
 
+int
+zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+    unsigned long size)
+{
+       vm_object_t obj;
+       vm_page_t m;
+
+       obj = vma->vm_obj;
+       if (obj == NULL || (obj->flags & OBJ_UNMANAGED) != 0)
+               return (-ENOTSUP);
+       VM_OBJECT_RLOCK(obj);
+       for (m = vm_page_find_least(obj, OFF_TO_IDX(address));
+           m != NULL && m->pindex < OFF_TO_IDX(address + size);
+           m = TAILQ_NEXT(m, listq))
+               pmap_remove_all(m);
+       VM_OBJECT_RUNLOCK(obj);
+       return (0);
+}
+
 #define        OPW(fp,td,code) ({                      \
        struct file *__fpop;                    \
        __typeof(code) __retval;                \
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to