From owner-svn-src-head@FreeBSD.ORG Thu Jan 27 14:49:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68EED1065693; Thu, 27 Jan 2011 14:49:22 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 579B78FC14; Thu, 27 Jan 2011 14:49:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0REnM4r020517; Thu, 27 Jan 2011 14:49:22 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0REnMWV020513; Thu, 27 Jan 2011 14:49:22 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201101271449.p0REnMWV020513@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 27 Jan 2011 14:49:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r217944 - in head/sys/mips: include mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2011 14:49:22 -0000 Author: jchandra Date: Thu Jan 27 14:49:22 2011 New Revision: 217944 URL: http://svn.freebsd.org/changeset/base/217944 Log: Implement sf_buf using direct map (XKPHYS) in MIPS n64. - Provide trivial implementation of sf_buf_alloc(), sf_buf_free(), sf_buf_kva() and sf_buf_page() using direct map for n64. - uio_machdep.c - use macros so that the direct map will be used in case of n64. Reviewed by: imp (earlier version) Obtained from: jmallett (user/jmallett/octeon) Modified: head/sys/mips/include/sf_buf.h head/sys/mips/mips/uio_machdep.c head/sys/mips/mips/vm_machdep.c Modified: head/sys/mips/include/sf_buf.h ============================================================================== --- head/sys/mips/include/sf_buf.h Thu Jan 27 14:46:01 2011 (r217943) +++ head/sys/mips/include/sf_buf.h Thu Jan 27 14:49:22 2011 (r217944) @@ -29,8 +29,35 @@ #ifndef _MACHINE_SF_BUF_H_ #define _MACHINE_SF_BUF_H_ +#ifdef __mips_n64 +#include +#include +#include +#else #include +#endif +#ifdef __mips_n64 +/* In 64 bit the whole memory is directly mapped */ +struct sf_buf; + +static __inline vm_offset_t +sf_buf_kva(struct sf_buf *sf) +{ + vm_page_t m; + + m = (vm_page_t)sf; + return (MIPS_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(m))); +} + +static __inline struct vm_page * +sf_buf_page(struct sf_buf *sf) +{ + + return ((vm_page_t)sf); +} + +#else /* ! __mips_n64 */ struct vm_page; struct sf_buf { @@ -52,5 +79,6 @@ sf_buf_page(struct sf_buf *sf) return (sf->m); } +#endif /* __mips_n64 */ #endif /* !_MACHINE_SF_BUF_H_ */ Modified: head/sys/mips/mips/uio_machdep.c ============================================================================== --- head/sys/mips/mips/uio_machdep.c Thu Jan 27 14:46:01 2011 (r217943) +++ head/sys/mips/mips/uio_machdep.c Thu Jan 27 14:49:22 2011 (r217944) @@ -92,9 +92,9 @@ uiomove_fromphys(vm_page_t ma[], vm_offs cnt = ulmin(cnt, PAGE_SIZE - page_offset); m = ma[offset >> PAGE_SHIFT]; pa = VM_PAGE_TO_PHYS(m); - if (pa < MIPS_KSEG0_LARGEST_PHYS) { + if (MIPS_DIRECT_MAPPABLE(pa)) { sf = NULL; - cp = (char *)MIPS_PHYS_TO_KSEG0(pa) + page_offset; + cp = (char *)MIPS_PHYS_TO_DIRECT(pa) + page_offset; /* * flush all mappings to this page, KSEG0 address first * in order to get it overwritten by correct data Modified: head/sys/mips/mips/vm_machdep.c ============================================================================== --- head/sys/mips/mips/vm_machdep.c Thu Jan 27 14:46:01 2011 (r217943) +++ head/sys/mips/mips/vm_machdep.c Thu Jan 27 14:49:22 2011 (r217944) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #define NSFBUFS (512 + maxusers * 16) #endif +#ifndef __mips_n64 static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL); @@ -95,6 +96,7 @@ static struct { } sf_freelist; static u_int sf_buf_alloc_want; +#endif /* * Finish a fork operation, with process p2 nearly set up. @@ -458,6 +460,7 @@ kvtop(void *addr) /* * Allocate a pool of sf_bufs (sendfile(2) or "super-fast" if you prefer. :-)) */ +#ifndef __mips_n64 static void sf_buf_init(void *arg) { @@ -479,6 +482,7 @@ sf_buf_init(void *arg) } sf_buf_alloc_want = 0; } +#endif /* * Get an sf_buf from the freelist. Will block if none are available. @@ -486,6 +490,7 @@ sf_buf_init(void *arg) struct sf_buf * sf_buf_alloc(struct vm_page *m, int flags) { +#ifndef __mips_n64 struct sf_buf *sf; int error; @@ -514,6 +519,9 @@ sf_buf_alloc(struct vm_page *m, int flag } mtx_unlock(&sf_freelist.sf_lock); return (sf); +#else + return ((struct sf_buf *)m); +#endif } /* @@ -522,7 +530,7 @@ sf_buf_alloc(struct vm_page *m, int flag void sf_buf_free(struct sf_buf *sf) { - +#ifndef __mips_n64 pmap_qremove(sf->kva, 1); mtx_lock(&sf_freelist.sf_lock); SLIST_INSERT_HEAD(&sf_freelist.sf_head, sf, free_list); @@ -530,6 +538,7 @@ sf_buf_free(struct sf_buf *sf) if (sf_buf_alloc_want > 0) wakeup(&sf_freelist); mtx_unlock(&sf_freelist.sf_lock); +#endif } /*