From owner-svn-src-user@FreeBSD.ORG Sat Apr 17 22:38:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BE8D106566B; Sat, 17 Apr 2010 22:38:17 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B1148FC1F; Sat, 17 Apr 2010 22:38:17 +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 o3HMcHut091767; Sat, 17 Apr 2010 22:38:17 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3HMcHSX091764; Sat, 17 Apr 2010 22:38:17 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004172238.o3HMcHSX091764@svn.freebsd.org> From: Juli Mallett Date: Sat, 17 Apr 2010 22:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206772 - in user/jmallett/octeon/sys/mips: include mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Apr 2010 22:38:17 -0000 Author: jmallett Date: Sat Apr 17 22:38:16 2010 New Revision: 206772 URL: http://svn.freebsd.org/changeset/base/206772 Log: Use the direct map for sfbufs in the n64 ABI and note how we should do the same on n32 and o32. Modified: user/jmallett/octeon/sys/mips/include/sf_buf.h user/jmallett/octeon/sys/mips/mips/vm_machdep.c Modified: user/jmallett/octeon/sys/mips/include/sf_buf.h ============================================================================== --- user/jmallett/octeon/sys/mips/include/sf_buf.h Sat Apr 17 21:31:42 2010 (r206771) +++ user/jmallett/octeon/sys/mips/include/sf_buf.h Sat Apr 17 22:38:16 2010 (r206772) @@ -29,10 +29,17 @@ #ifndef _MACHINE_SF_BUF_H_ #define _MACHINE_SF_BUF_H_ +#if !defined(__mips_n64) #include +#else +#include +#include +#include +#endif struct vm_page; +#if !defined(__mips_n64) struct sf_buf { SLIST_ENTRY(sf_buf) free_list; /* list of free buffer slots */ struct vm_page *m; /* currently mapped page */ @@ -52,5 +59,28 @@ sf_buf_page(struct sf_buf *sf) return (sf->m); } +#else +/* + * On this machine, the only purpose for which sf_buf is used is to implement + * an opaque pointer required by the machine-independent parts of the kernel. + * That pointer references the vm_page that is "mapped" by the sf_buf. The + * actual mapping is provided by the direct virtual-to-physical mapping. + */ +struct sf_buf; + +static __inline vm_offset_t +sf_buf_kva(struct sf_buf *sf) +{ + + return (MIPS_PHYS_TO_XKPHYS(MIPS_XKPHYS_CCA_CNC, VM_PAGE_TO_PHYS((vm_page_t)sf))); +} + +static __inline vm_page_t +sf_buf_page(struct sf_buf *sf) +{ + + return ((vm_page_t)sf); +} +#endif #endif /* !_MACHINE_SF_BUF_H_ */ Modified: user/jmallett/octeon/sys/mips/mips/vm_machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/vm_machdep.c Sat Apr 17 21:31:42 2010 (r206771) +++ user/jmallett/octeon/sys/mips/mips/vm_machdep.c Sat Apr 17 22:38:16 2010 (r206772) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include +#if !defined(__mips_n64) #ifndef NSFBUFS #define NSFBUFS (512 + maxusers * 16) #endif @@ -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) #define ZIDLE_LO(v) ((v) * 2 / 3) #define ZIDLE_HI(v) ((v) * 4 / 5) +#if !defined(__mips_n64) /* * Allocate a pool of sf_bufs (sendfile(2) or "super-fast" if you prefer. :-)) */ @@ -485,6 +488,11 @@ sf_buf_init(void *arg) /* * Get an sf_buf from the freelist. Will block if none are available. + * + * XXX + * If the physical address of m is within range of KSEG0, we should not do the + * qenter, and we should make sf_buf_kva() check the physical address and give + * the direct-mapped virutal address instead. */ struct sf_buf * sf_buf_alloc(struct vm_page *m, int flags) @@ -534,6 +542,26 @@ sf_buf_free(struct sf_buf *sf) wakeup_one(&sf_freelist); mtx_unlock(&sf_freelist.sf_lock); } +#else +/* + * Allocate an sf_buf. We just return the vm_page and use XKPHYS. + */ +struct sf_buf * +sf_buf_alloc(struct vm_page *m, int flags) +{ + return ((struct sf_buf *)m); +} + +/* + * Release resources back to the system. + * + * XXX Invalidate dcache? + */ +void +sf_buf_free(struct sf_buf *sf) +{ +} +#endif /* * Software interrupt handler for queued VM system processing.