Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/uebayasi-xip]: src/sys Make XIP pager use cdev_mmap() instead of struct ...
details: https://anonhg.NetBSD.org/src/rev/36e7ccd175a7
branches: uebayasi-xip
changeset: 751864:36e7ccd175a7
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Thu Nov 18 16:16:36 2010 +0000
description:
Make XIP pager use cdev_mmap() instead of struct vm_physseg.
diffstat:
sys/miscfs/genfs/genfs_io.c | 6 +++---
sys/uvm/uvm_extern.h | 5 +++--
sys/uvm/uvm_vnode.c | 43 +++++++++++++++++++++++++++++++++++++++----
3 files changed, 45 insertions(+), 9 deletions(-)
diffs (125 lines):
diff -r 6be3c3458857 -r 36e7ccd175a7 sys/miscfs/genfs/genfs_io.c
--- a/sys/miscfs/genfs/genfs_io.c Thu Nov 18 16:09:46 2010 +0000
+++ b/sys/miscfs/genfs/genfs_io.c Thu Nov 18 16:16:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_io.c,v 1.36.2.33 2010/11/18 01:53:04 uebayasi Exp $ */
+/* $NetBSD: genfs_io.c,v 1.36.2.34 2010/11/18 16:16:36 uebayasi Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.33 2010/11/18 01:53:04 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.34 2010/11/18 16:16:36 uebayasi Exp $");
#include "opt_xip.h"
@@ -880,7 +880,7 @@
blk_off = blkno << dev_bshift;
fs_off = off - (lbn << fs_bshift);
- pps[i] = uvn_findpage_xip(&devvp->v_uobj,
+ pps[i] = uvn_findpage_xip(devvp, &vp->v_uobj,
blk_off + fs_off);
KASSERT(pps[i] != NULL);
}
diff -r 6be3c3458857 -r 36e7ccd175a7 sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h Thu Nov 18 16:09:46 2010 +0000
+++ b/sys/uvm/uvm_extern.h Thu Nov 18 16:16:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_extern.h,v 1.161.2.12 2010/11/16 07:44:24 uebayasi Exp $ */
+/* $NetBSD: uvm_extern.h,v 1.161.2.13 2010/11/18 16:16:36 uebayasi Exp $ */
/*
*
@@ -763,7 +763,8 @@
bool uvn_text_p(struct uvm_object *);
bool uvn_clean_p(struct uvm_object *);
bool uvn_needs_writefault_p(struct uvm_object *);
-struct vm_page *uvn_findpage_xip(struct uvm_object *, off_t);
+struct vm_page *uvn_findpage_xip(struct vnode *,
+ struct uvm_object *, off_t);
/* kern_malloc.c */
void kmeminit_nkmempages(void);
diff -r 6be3c3458857 -r 36e7ccd175a7 sys/uvm/uvm_vnode.c
--- a/sys/uvm/uvm_vnode.c Thu Nov 18 16:09:46 2010 +0000
+++ b/sys/uvm/uvm_vnode.c Thu Nov 18 16:16:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_vnode.c,v 1.93.2.3 2010/11/16 07:44:25 uebayasi Exp $ */
+/* $NetBSD: uvm_vnode.c,v 1.93.2.4 2010/11/18 16:16:36 uebayasi Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.93.2.3 2010/11/16 07:44:25 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.93.2.4 2010/11/18 16:16:36 uebayasi Exp $");
#include "opt_uvmhist.h"
#include "opt_xip.h"
@@ -412,12 +412,16 @@
* given offset.
*/
struct vm_page *
-uvn_findpage_xip(struct uvm_object *uobj, off_t off)
+uvn_findpage_xip(struct vnode *devvp, struct uvm_object *uobj, off_t off)
{
+#if defined(DIAGNOSTIC)
struct vnode *vp = (struct vnode *)uobj;
+#endif
struct vm_physseg *seg;
struct vm_page *pg;
+#if defined(XIP)
+#if !defined(XIP_CDEV_MMAP)
KASSERT((vp->v_vflag & VV_XIP) != 0);
KASSERT((off & PAGE_MASK) == 0);
@@ -431,10 +435,41 @@
* uvm_object *, and this will call cdev_page(uobj, off).
*/
- seg = vp->v_physseg;
+ seg = devvp->v_physseg;
KASSERT(seg != NULL);
pg = seg->pgs + (off >> PAGE_SHIFT);
+#else
+ dev_t dev;
+ paddr_t mdpgno, pa, pfn;
+ int segno, segidx;
+
+ KASSERT(vp != NULL);
+ KASSERT((vp->v_vflag & VV_XIP) != 0);
+ KASSERT((off & PAGE_MASK) == 0);
+
+ /*
+ * Get an "mmap cookie" from device.
+ */
+ dev = devsw_blk2chr(devvp->v_rdev);
+ mdpgno = cdev_mmap(dev, off, 0);
+ KASSERT(mdpgno != -1);
+
+ /*
+ * Index the matching vm_page and return it the vnode pager
+ * (genfs_getpages).
+ */
+ pa = pmap_phys_address(mdpgno);
+ pfn = atop(pa);
+ segno = vm_physseg_find_device(pfn, &segidx);
+ seg = VM_PHYSDEV_PTR(segno);
+ KASSERT(seg != NULL);
+ KASSERT(segidx == pfn - seg->start);
+ KASSERT(seg->pgs != NULL);
+
+ pg = seg->pgs + segidx;
+#endif
+#endif
KASSERT(pg->phys_addr == (seg->start << PAGE_SHIFT) + off);
Home |
Main Index |
Thread Index |
Old Index