From owner-freebsd-mips@FreeBSD.ORG Tue Jan 13 19:06:35 2015 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E7DF5141 for ; Tue, 13 Jan 2015 19:06:35 +0000 (UTC) Received: from mwork.nabble.com (mwork.nabble.com [162.253.133.43]) by mx1.freebsd.org (Postfix) with ESMTP id D2CCCC75 for ; Tue, 13 Jan 2015 19:06:35 +0000 (UTC) Received: from msam.nabble.com (unknown [162.253.133.85]) by mwork.nabble.com (Postfix) with ESMTP id A60F710682C3 for ; Tue, 13 Jan 2015 11:06:36 -0800 (PST) Date: Tue, 13 Jan 2015 12:06:34 -0700 (MST) From: sson To: freebsd-mips@freebsd.org Message-ID: <1421175994697-5980362.post@n5.nabble.com> Subject: [RFC] Cache control from user land (patch) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jan 2015 19:06:36 -0000 Hi all: Below is a link to a patch that provides a sysarch() so that cache lines may be invalidated from userspace (via the sysarch() system call). For convenience mips_cacheflush() is provided in the machine/cachectl.h header file: int mips_cacheflush(void *addr, size_t nbytes, int whichcache); mips_cacheflush() flushes the content of the selected cache for the user addresses in the range from addr to (addr+nbytes-1). whichcache may be: MIPS_CF_ICACHE: Flush the instruction cache lines for a given user address range. MIPS_CF_DCACHE: Write back to memory and invalidate the cache lines for a given user address range. MIPS_CF_BCACHE: Write back and invalidate both types of caches for a given user address range. MIPS_CF_ICACHE_ALL, MIPS_CF_DCACHE, or MIPS_CF_BCACHE: Full the entire given cache(s). mips_cacheflush() may return the errno EFAULT or EINVAL (whichcache is not valid). In short, it is similar to the cacheflush() that netbsd provides for mips. The diff: https://people.freebsd.org/~sson/mips/cacheflush/mips_cacheflush.diff Comments, concerns, questions, suggestions, etc. are welcome. Regards, -stacey. -- View this message in context: http://freebsd.1045724.n5.nabble.com/RFC-Cache-control-from-user-land-patch-tp5980362.html Sent from the freebsd-mips mailing list archive at Nabble.com.