From owner-freebsd-mips@FreeBSD.ORG Tue Jan 13 19:52:03 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 44018F11 for ; Tue, 13 Jan 2015 19:52:03 +0000 (UTC) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22F0D235 for ; Tue, 13 Jan 2015 19:52:02 +0000 (UTC) Received: from [192.168.200.212] (unknown [50.136.155.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 61294192A3B for ; Tue, 13 Jan 2015 19:52:01 +0000 (UTC) Message-ID: <54B57760.3090508@ignoranthack.me> Date: Tue, 13 Jan 2015 11:52:00 -0800 From: Sean Bruno Reply-To: sbruno@freebsd.org User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: freebsd-mips@freebsd.org Subject: Re: [RFC] Cache control from user land (patch) References: <1421175994697-5980362.post@n5.nabble.com> In-Reply-To: <1421175994697-5980362.post@n5.nabble.com> Content-Type: text/plain; charset=windows-1252 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:52:03 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 01/13/15 11:06, sson wrote: > 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. > > > > I've tried applying this to head. I get a reject from the last bits to sys/mips/mips/sys_machdep.c % cat sys/mips/mips/sys_machdep.c.rej.orig @@ -39,6 +39,8 @@ #include #include +#include +#include #include #include #include @@ -63,9 +115,6 @@ * update it as well. Add the TLS and TCB offsets so the * value in this register is adjusted like in the case of the * rdhwr trap() instruction handler. - - * - - * XXXSS For more information why this offset is required see: - - * 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317' */ if (cpuinfo.userlocal_reg == true) { #if defined(__mips_n64) && defined(COMPAT_FREEBSD32) @@ -94,6 +143,8 @@ case CHERI_SET_STACK: return (cheri_sysarch_setstack(td, uap)); #endif + case MIPS_CACHEFLUSH: + return (mips_sysarch_cacheflush(td, uap)); default: break; -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAEBCgBmBQJUtXddXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRCQUFENDYzMkU3MTIxREU4RDIwOTk3REQx MjAxRUZDQTFFNzI3RTY0AAoJEBIB78oecn5kzVEH/jpRQeaRNybEv5C7PFiHU0pd NgT6ebfEddNd61P9HqxC3NVQ4US8h5uFRewQWJ/hiXXUsfj3iGvNS2QgaX1SgU16 lXgTEu6IrgfIImtn87cMjXUblGySF1yhh/vMdBkdF4WWqgcUcaWrbr8vibGj6DD9 k4dRKDTci2c6eHNWQbA6pwyqdtDoQit4jMwT+ayjxckkGCx37DLZy7VrzhzmE5YB EO+QcUqjGRNHxmhtkil5eNBlrXeJT+FetlY/l4/4G2OATTYGbsdK78s91dhSlwZ2 umma95WWs+wfi23wZf4xm96DpV7dhh8PvaNJhw4MKldyll4lDIWwuYI+LaqjSPo= =b/5h -----END PGP SIGNATURE-----