From owner-p4-projects@FreeBSD.ORG Mon May 20 22:47:11 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1C33DE6B; Mon, 20 May 2013 22:47:11 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D1A35E69 for ; Mon, 20 May 2013 22:47:10 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id A8DD1E6E for ; Mon, 20 May 2013 22:47:10 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4KMlAf6006677 for ; Mon, 20 May 2013 22:47:10 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4KMlAUq006674 for perforce@freebsd.org; Mon, 20 May 2013 22:47:10 GMT (envelope-from prw35@FreeBSD.org) Date: Mon, 20 May 2013 22:47:10 GMT Message-Id: <201305202247.r4KMlAUq006674@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 228881 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2013 22:47:11 -0000 http://p4web.freebsd.org/@@228881?ac=10 Change 228881 by prw35@pwithnall_zenith on 2013/05/20 22:47:01 Add a driver for the CHERI compositor This has been in use fairly extensively for several weeks now, and is solid enough to commit. It still needs post-hoc code review, and there are a number of FIXME comments in the code which can be addressed at a later date. These cover things such as using interrupt-based I/O rather than polled I/O, cleanly fixing some endianness issues, improving the efficiency of a few operations, and implementing a few missing ioctl()s. The code is fully commented, with overall documentation at the top of cheri_compositor.h. This commit does not add the driver to the hardware configuration, because the device is disabled in Qsys by default. A subsequent commit will enable the device in the configuration, so it can be reverted independently. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor.c#1 add .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor.h#1 add .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_cfb.c#1 add .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_fdt.c#1 add .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_internal.h#1 add .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_nexus.c#1 add .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_reg.c#1 add .. //depot/projects/ctsrd/cheribsd/src/sys/mips/beri/files.beri#15 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/beri/files.beri#15 (text+ko) ==== @@ -6,6 +6,11 @@ dev/altera/jtag_uart/altera_jtag_uart_tty.c optional altera_jtag_uart dev/altera/jtag_uart/altera_jtag_uart_fdt.c optional altera_jtag_uart fdt dev/altera/jtag_uart/altera_jtag_uart_nexus.c optional altera_jtag_uart +dev/cheri/compositor/cheri_compositor.c optional cheri_compositor +dev/cheri/compositor/cheri_compositor_cfb.c optional cheri_compositor +dev/cheri/compositor/cheri_compositor_fdt.c optional cheri_compositor fdt +dev/cheri/compositor/cheri_compositor_nexus.c optional cheri_compositor +dev/cheri/compositor/cheri_compositor_reg.c optional cheri_compositor dev/terasic/de4led/terasic_de4led.c optional terasic_de4led dev/terasic/de4led/terasic_de4led_fdt.c optional terasic_de4led fdt dev/terasic/de4led/terasic_de4led_nexus.c optional terasic_de4led From owner-p4-projects@FreeBSD.ORG Mon May 20 22:57:22 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 577561FE; Mon, 20 May 2013 22:57:22 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1B3821FC for ; Mon, 20 May 2013 22:57:22 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 059DAF8D for ; Mon, 20 May 2013 22:57:22 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4KMvL7D008381 for ; Mon, 20 May 2013 22:57:21 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4KMvL9u008378 for perforce@freebsd.org; Mon, 20 May 2013 22:57:21 GMT (envelope-from prw35@FreeBSD.org) Date: Mon, 20 May 2013 22:57:21 GMT Message-Id: <201305202257.r4KMvL9u008378@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 228884 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2013 22:57:22 -0000 http://p4web.freebsd.org/@@228884?ac=10 Change 228884 by prw35@pwithnall_zenith on 2013/05/20 22:57:15 Add CHERI compositor to BERI DE4 hardware configuration This follows on from changeset #228881, enabling the CHERI compositor driver by default. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/boot/fdt/dts/beripad-de4.dts#10 edit .. //depot/projects/ctsrd/cheribsd/src/sys/mips/conf/BERI_DE4_BASE#6 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/boot/fdt/dts/beripad-de4.dts#10 (text+ko) ==== @@ -201,6 +201,13 @@ 0x70177000 0x2000>; }; + compositor@7f80d000 { + compatible = "sri-cambridge,compositor"; + reg = <0x7f80d000 0x1000 + 0x20000000 0x10000000 + 0x7f006100 0x007f>; + }; + /* usb@0x7f100000 { compatible = "philips,isp1761"; ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/conf/BERI_DE4_BASE#6 (text+ko) ==== @@ -25,6 +25,7 @@ device altera_avgen device altera_jtag_uart device altera_sdcard +device cheri_compositor device terasic_de4led device terasic_mtl From owner-p4-projects@FreeBSD.ORG Mon May 20 23:16:45 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4493C72A; Mon, 20 May 2013 23:16:45 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0368E728 for ; Mon, 20 May 2013 23:16:45 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id E89DDA8 for ; Mon, 20 May 2013 23:16:44 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4KNGio9012271 for ; Mon, 20 May 2013 23:16:44 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4KNGi9l012268 for perforce@freebsd.org; Mon, 20 May 2013 23:16:44 GMT (envelope-from prw35@FreeBSD.org) Date: Mon, 20 May 2013 23:16:44 GMT Message-Id: <201305202316.r4KNGi9l012268@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 228885 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2013 23:16:45 -0000 http://p4web.freebsd.org/@@228885?ac=10 Change 228885 by prw35@pwithnall_zenith on 2013/05/20 23:15:58 Add CHERI_CSEALDATA and CHERI_CUNSEAL macros to cheri.h This is needed by the compositor driver. They wrap the CSealData and CUnseal instructions, respectively. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cheri.h#18 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cheri.h#18 (text+ko) ==== @@ -38,6 +38,7 @@ #endif #include +#include /* * Canonical C-language representation of a capability. @@ -151,6 +152,19 @@ } while (0) /* + * Instructions to seal and unseal capabilities. + */ +#define CHERI_CSEALDATA(cd, cs, ct) do { \ + __asm__ __volatile__ ("csealdata $c%0, $c%1, $c%2" : : \ + "i" (cd), "i" (cs), "i" (ct)); \ +} while (0) + +#define CHERI_CUNSEAL(cd, cs, ct) do { \ + __asm__ __volatile__ ("cunseal $c%0, $c%1, $c%2" : : \ + "i" (cd), "i" (cs), "i" (ct)); \ +} while (0) + +/* * Capability store; while this doesn't muck with c0, it does require a memory * clobber. */ From owner-p4-projects@FreeBSD.ORG Mon May 20 23:18:47 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4790785F; Mon, 20 May 2013 23:18:47 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 08FA985D for ; Mon, 20 May 2013 23:18:47 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id DF2BCBA for ; Mon, 20 May 2013 23:18:46 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4KNIk1a012485 for ; Mon, 20 May 2013 23:18:46 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4KNIkBe012482 for perforce@freebsd.org; Mon, 20 May 2013 23:18:46 GMT (envelope-from prw35@FreeBSD.org) Date: Mon, 20 May 2013 23:18:46 GMT Message-Id: <201305202318.r4KNIkBe012482@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 228886 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2013 23:18:47 -0000 http://p4web.freebsd.org/@@228886?ac=10 Change 228886 by prw35@pwithnall_zenith on 2013/05/20 23:18:42 Add copyincap() and copyoutcap() system support functions These function like the copyin() and copyout() functions, except copy capabilities. Their implementation is simple at the moment, performing few security checks, and only copying a single capability (i.e. the length argument is ignored). Some supporting register/instruction macros have been added to asm.h. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/mips/include/asm.h#4 edit .. //depot/projects/ctsrd/cheribsd/src/sys/mips/mips/support.S#5 edit .. //depot/projects/ctsrd/cheribsd/src/sys/sys/systm.h#6 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/include/asm.h#4 (text+ko) ==== @@ -370,37 +370,61 @@ */ #if _BYTE_ORDER == _LITTLE_ENDIAN # define LWHI lwr +# define CLWHI clwr # define LWLO lwl +# define CLWLO clwl # define SWHI swr +# define CSWHI cswr # define SWLO swl +# define CSWLO cswl # if SZREG == 4 # define REG_LHI lwr +# define REG_CLHI clwr # define REG_LLO lwl +# define REG_CLLO clwl # define REG_SHI swr +# define REG_CSHI cswr # define REG_SLO swl +# define REG_CSLO cswl # else # define REG_LHI ldr +# define REG_CLHI cldr # define REG_LLO ldl +# define REG_CLLO cldl # define REG_SHI sdr +# define REG_CSHI csdr # define REG_SLO sdl +# define REG_CSLO csdl # endif #endif #if _BYTE_ORDER == _BIG_ENDIAN # define LWHI lwl +# define CLWHI clwl # define LWLO lwr +# define CLWLO clwr # define SWHI swl +# define CSWHI cswl # define SWLO swr +# define CSWLO cswr # if SZREG == 4 # define REG_LHI lwl +# define REG_CLHI clwl # define REG_LLO lwr +# define REG_CLLO clwr # define REG_SHI swl +# define REG_CSHI cswl # define REG_SLO swr +# define REG_CSLO cswr # else # define REG_LHI ldl +# define REG_CLHI cldl # define REG_LLO ldr +# define REG_CLLO cldr # define REG_SHI sdl +# define REG_CSHI csdl # define REG_SLO sdr +# define REG_CSLO csdr # endif #endif ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/mips/support.S#5 (text+ko) ==== @@ -93,9 +93,13 @@ #include #include #include +#include #include "assym.s" +/* Build the kernel data capability (KDC) register identifier. */ +#define KDC $c30 + .set noreorder # Noreorder is default style! /* @@ -248,6 +252,35 @@ END(copyin) /* + * Copy specified amount of data from user space into the kernel, preserving + * capability tags + * copyincap(from, to, len) + * caddr_t *from; (user source address) + * caddr_t *to; (kernel destination address) + * unsigned len; + */ +NON_LEAF(copyincap, CALLFRAME_SIZ, ra) + PTR_SUBU sp, sp, CALLFRAME_SIZ + .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ) + PTR_LA v0, copyerr + blt a0, zero, _C_LABEL(copyerr) # make sure address is in user space + REG_S ra, CALLFRAME_RA(sp) + GET_CPU_PCPU(v1) + PTR_L v1, PC_CURPCB(v1) + # TODO: Implement a loop, perform more checking, etc. + clc $c1, a0, 0(KDC) # load the source + csc $c1, a1, 0(KDC) # store to the destination + PTR_S v0, U_PCB_ONFAULT(v1) + REG_L ra, CALLFRAME_RA(sp) + GET_CPU_PCPU(v1) + PTR_L v1, PC_CURPCB(v1) # bcopycap modified v1, so reload + PTR_S zero, U_PCB_ONFAULT(v1) + PTR_ADDU sp, sp, CALLFRAME_SIZ + j ra + move v0, zero +END(copyincap) + +/* * Copy specified amount of data from kernel to the user space * copyout(from, to, len) * caddr_t *from; (kernel source address) @@ -273,6 +306,35 @@ move v0, zero END(copyout) +/* + * Copy specified amount of data from kernel to the user space, preserving + * capability tags + * copyoutcap(from, to, len) + * caddr_t *from; (kernel source address) + * caddr_t *to; (user destination address) + * unsigned len; + */ +NON_LEAF(copyoutcap, CALLFRAME_SIZ, ra) + PTR_SUBU sp, sp, CALLFRAME_SIZ + .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ) + PTR_LA v0, copyerr + blt a1, zero, _C_LABEL(copyerr) # make sure address is in user space + REG_S ra, CALLFRAME_RA(sp) + GET_CPU_PCPU(v1) + PTR_L v1, PC_CURPCB(v1) + # TODO: Implement a loop, perform more checking, etc. + clc $c1, a0, 0(KDC) # load the source + csc $c1, a1, 0(KDC) # store to the destination + PTR_S v0, U_PCB_ONFAULT(v1) + REG_L ra, CALLFRAME_RA(sp) + GET_CPU_PCPU(v1) + PTR_L v1, PC_CURPCB(v1) # bcopycap modified v1, so reload + PTR_S zero, U_PCB_ONFAULT(v1) + PTR_ADDU sp, sp, CALLFRAME_SIZ + j ra + move v0, zero +END(copyoutcap) + LEAF(copyerr) REG_L ra, CALLFRAME_RA(sp) PTR_ADDU sp, sp, CALLFRAME_SIZ ==== //depot/projects/ctsrd/cheribsd/src/sys/sys/systm.h#6 (text+ko) ==== @@ -234,10 +234,14 @@ __nonnull(1) __nonnull(2); int copyin(const void * __restrict udaddr, void * __restrict kaddr, size_t len) __nonnull(1) __nonnull(2); +int copyincap(const void * __restrict udaddr, void * __restrict kaddr, + size_t len) __nonnull(1) __nonnull(2); int copyin_nofault(const void * __restrict udaddr, void * __restrict kaddr, size_t len) __nonnull(1) __nonnull(2); int copyout(const void * __restrict kaddr, void * __restrict udaddr, size_t len) __nonnull(1) __nonnull(2); +int copyoutcap(const void * __restrict kaddr, void * __restrict udaddr, + size_t len) __nonnull(1) __nonnull(2); int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr, size_t len) __nonnull(1) __nonnull(2); From owner-p4-projects@FreeBSD.ORG Mon May 20 23:24:54 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0D777992; Mon, 20 May 2013 23:24:54 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C24EC990 for ; Mon, 20 May 2013 23:24:53 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 97E2DDD for ; Mon, 20 May 2013 23:24:53 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4KNOr00013621 for ; Mon, 20 May 2013 23:24:53 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4KNOr89013618 for perforce@freebsd.org; Mon, 20 May 2013 23:24:53 GMT (envelope-from prw35@FreeBSD.org) Date: Mon, 20 May 2013 23:24:53 GMT Message-Id: <201305202324.r4KNOr89013618@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 228887 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2013 23:24:54 -0000 http://p4web.freebsd.org/@@228887?ac=10 Change 228887 by prw35@pwithnall_zenith on 2013/05/20 23:24:43 Fix printing of capability register tags in cheri_log_exception() The tag for $c0 was being printed for all registers. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cheri.c#13 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cheri.c#13 (text+ko) ==== @@ -288,7 +288,7 @@ intr_disable(); CHERI_CLC(CHERI_CR_KR1C, CHERI_CR_KDC, &cheriframe->cf_c0, 0); CHERI_GETCAPREG(CHERI_CR_KR1C, c); - CHERI_CGETTAG(ctag, 0); + CHERI_CGETTAG(ctag, CHERI_CR_KR1C); intr_enable(); CHERI_REG_PRINT(c, ctag, 0); @@ -296,7 +296,7 @@ intr_disable(); CHERI_CLC(CHERI_CR_KR1C, CHERI_CR_KDC, &cheriframe->cf_c1, 0); CHERI_GETCAPREG(CHERI_CR_KR1C, c); - CHERI_CGETTAG(ctag, 0); + CHERI_CGETTAG(ctag, CHERI_CR_KR1C); intr_enable(); CHERI_REG_PRINT(c, ctag, 1); @@ -304,7 +304,7 @@ intr_disable(); CHERI_CLC(CHERI_CR_KR1C, CHERI_CR_KDC, &cheriframe->cf_c2, 0); CHERI_GETCAPREG(CHERI_CR_KR1C, c); - CHERI_CGETTAG(ctag, 0); + CHERI_CGETTAG(ctag, CHERI_CR_KR1C); intr_enable(); CHERI_REG_PRINT(c, ctag, 2); @@ -312,7 +312,7 @@ intr_disable(); CHERI_CLC(CHERI_CR_KR1C, CHERI_CR_KDC, &cheriframe->cf_c3, 0); CHERI_GETCAPREG(CHERI_CR_KR1C, c); - CHERI_CGETTAG(ctag, 0); + CHERI_CGETTAG(ctag, CHERI_CR_KR1C); intr_enable(); CHERI_REG_PRINT(c, ctag, 3); @@ -320,7 +320,7 @@ intr_disable(); CHERI_CLC(CHERI_CR_KR1C, CHERI_CR_KDC, &cheriframe->cf_c24, 0); CHERI_GETCAPREG(CHERI_CR_KR1C, c); - CHERI_CGETTAG(ctag, 0); + CHERI_CGETTAG(ctag, CHERI_CR_KR1C); intr_enable(); CHERI_REG_PRINT(c, ctag, 24); @@ -328,7 +328,7 @@ intr_disable(); CHERI_CLC(CHERI_CR_KR1C, CHERI_CR_KDC, &cheriframe->cf_c26, 0); CHERI_GETCAPREG(CHERI_CR_KR1C, c); - CHERI_CGETTAG(ctag, 0); + CHERI_CGETTAG(ctag, CHERI_CR_KR1C); intr_enable(); CHERI_REG_PRINT(c, ctag, 26); @@ -336,7 +336,7 @@ intr_disable(); CHERI_CLC(CHERI_CR_KR1C, CHERI_CR_KDC, &cheriframe->cf_pcc, 0); CHERI_GETCAPREG(CHERI_CR_KR1C, c); - CHERI_CGETTAG(ctag, 31); + CHERI_CGETTAG(ctag, CHERI_CR_KR1C); intr_enable(); CHERI_REG_PRINT(c, ctag, 31); From owner-p4-projects@FreeBSD.ORG Mon May 20 23:27:57 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 77FC0C10; Mon, 20 May 2013 23:27:57 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 38810C0E for ; Mon, 20 May 2013 23:27:57 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 29C58FB for ; Mon, 20 May 2013 23:27:57 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4KNRvqt013955 for ; Mon, 20 May 2013 23:27:57 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4KNRvaY013952 for perforce@freebsd.org; Mon, 20 May 2013 23:27:57 GMT (envelope-from prw35@FreeBSD.org) Date: Mon, 20 May 2013 23:27:57 GMT Message-Id: <201305202327.r4KNRvaY013952@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 228888 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2013 23:27:57 -0000 http://p4web.freebsd.org/@@228888?ac=10 Change 228888 by prw35@pwithnall_zenith on 2013/05/20 23:27:26 Allow umtx syscalls from processes without full ambient authority This allows sandboxed user processes to use threading primitives without needing gated calls to their parent. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cheri.c#14 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cheri.c#14 (text+ko) ==== @@ -361,6 +361,14 @@ */ if (code == SYS_sysarch && args[0] == MIPS_GET_COUNT) return (0); + + /* + * Allow threading primitives to be used. + */ + if (code == SYS__umtx_lock || code == SYS__umtx_unlock || + code == SYS__umtx_op) + return (0); + /* * Check whether userspace holds the rights defined in * cheri_capability_set_user() in $C0. Note that object type is From owner-p4-projects@FreeBSD.ORG Tue May 21 00:32:07 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C512B3B8; Tue, 21 May 2013 00:32:07 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8152C3B6 for ; Tue, 21 May 2013 00:32:07 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 57D8328C for ; Tue, 21 May 2013 00:32:07 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4L0W6lh024979 for ; Tue, 21 May 2013 00:32:06 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4L0W6NZ024974 for perforce@freebsd.org; Tue, 21 May 2013 00:32:06 GMT (envelope-from prw35@FreeBSD.org) Date: Tue, 21 May 2013 00:32:06 GMT Message-Id: <201305210032.r4L0W6NZ024974@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 228890 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2013 00:32:08 -0000 http://p4web.freebsd.org/@@228890?ac=10 Change 228890 by prw35@pwithnall_zenith on 2013/05/21 00:31:12 Fix merge/build failures in CHERI compositor driver The kernel now builds again. This hasn't been tested on real hardware yet, but should work. The changes are pretty trivial. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_cfb.c#2 edit .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_reg.c#2 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_cfb.c#2 (text+ko) ==== @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -149,7 +150,7 @@ pidx = OFF_TO_IDX(offset); - VM_OBJECT_UNLOCK(vm_obj); + VM_OBJECT_WUNLOCK(vm_obj); cfb_vm_obj = vm_obj->handle; dev = cfb_vm_obj->dev; @@ -164,7 +165,7 @@ if (csw == NULL) { retval = VM_PAGER_FAIL; - goto done; + goto done_unlocked; } /* Traditional d_mmap() call. */ @@ -197,7 +198,7 @@ * free up the all of the original pages. */ page = vm_page_getfake(paddr, memattr); - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); vm_page_lock(*mres); vm_page_free(*mres); vm_page_unlock(*mres); @@ -211,7 +212,7 @@ goto done; done_unlocked: - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); done: CHERI_COMPOSITOR_DEBUG(sc, "Finished with mres: %p (retval: %i)", *mres, retval); ==== //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_reg.c#2 (text+ko) ==== @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -91,7 +92,7 @@ /* Permissions mask giving the maximum set of permissions a CFB ID or token can * have. */ -#define CFB_PERMS_MASK (CHERI_Permit_Store | CHERI_Permit_Load) +#define CFB_PERMS_MASK (CHERI_PERM_STORE | CHERI_PERM_LOAD) /* Register offsets (in bytes). */ #define CHERI_COMPOSITOR_COMMAND_HEADER 0 @@ -1304,8 +1305,8 @@ /* Check the permissions. */ CHERI_CGETPERM(perms, 1); - if ((perms & CHERI_Permit_Load) == 0 || - (perms & CHERI_Permit_Store) == 0) { + if ((perms & CHERI_PERM_LOAD) == 0 || + (perms & CHERI_PERM_STORE) == 0) { goto done; } @@ -1348,7 +1349,7 @@ CHERI_CINCBASE(1, CHERI_CR_KDC, 0); CHERI_CSETLEN(1, 1, 0); CHERI_CSETTYPE(1, CHERI_CR_KCC, get_kernel_seal_capability); - CHERI_CANDPERM(1, 1, CHERI_Permit_Seal); + CHERI_CANDPERM(1, 1, CHERI_PERM_SEAL); cheri_capability_store(1, cap_out); CHERI_CCLEARTAG(1); From owner-p4-projects@FreeBSD.ORG Fri May 24 09:33:16 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E663C8CB; Fri, 24 May 2013 09:33:15 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A78EC8C9 for ; Fri, 24 May 2013 09:33:15 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98B38E13 for ; Fri, 24 May 2013 09:33:15 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4O9XFL4045143 for ; Fri, 24 May 2013 09:33:15 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4O9XFnr045140 for perforce@freebsd.org; Fri, 24 May 2013 09:33:15 GMT (envelope-from prw35@FreeBSD.org) Date: Fri, 24 May 2013 09:33:15 GMT Message-Id: <201305240933.r4O9XFnr045140@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 228998 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2013 09:33:16 -0000 http://p4web.freebsd.org/@@228998?ac=10 Change 228998 by prw35@pwithnall_zenith on 2013/05/24 09:32:34 Remove a failing check from the CHERI compositor driver Recent changes to the VM code in FreeBSD seem to have caused this check to start failing, which I didn't notice when merging before. The check wasn't really necessary, so just drop it. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_cfb.c#3 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/dev/cheri/compositor/cheri_compositor_cfb.c#3 (text+ko) ==== @@ -139,7 +139,7 @@ { vm_pindex_t pidx; vm_paddr_t paddr; - vm_page_t m_paddr, page; + vm_page_t page; struct cfb_vm_object *cfb_vm_obj; struct cdev *dev; struct cheri_compositor_softc *sc; @@ -186,10 +186,6 @@ dev_relthread(dev, ref); /* Sanity checks. */ - m_paddr = vm_phys_paddr_to_vm_page(paddr); - KASSERT((m_paddr == NULL || - pmap_page_get_memattr(m_paddr) == VM_MEMATTR_UNCACHEABLE), - ("Expected uncacheable page.")); KASSERT((((*mres)->flags & PG_FICTITIOUS) == 0), ("Expected non-fictitious page.")); From owner-p4-projects@FreeBSD.ORG Fri May 24 09:38:21 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B8825C9A; Fri, 24 May 2013 09:38:21 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7BB41C98 for ; Fri, 24 May 2013 09:38:21 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6C307E64 for ; Fri, 24 May 2013 09:38:21 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4O9cLfv045730 for ; Fri, 24 May 2013 09:38:21 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4O9cLiw045727 for perforce@freebsd.org; Fri, 24 May 2013 09:38:21 GMT (envelope-from prw35@FreeBSD.org) Date: Fri, 24 May 2013 09:38:21 GMT Message-Id: <201305240938.r4O9cLiw045727@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 229000 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2013 09:38:22 -0000 http://p4web.freebsd.org/@@229000?ac=10 Change 229000 by prw35@pwithnall_zenith on 2013/05/24 09:37:55 Add CHERI compositor user-space library This provides a handy user-space interface for the driver's various ioctl()s. It's a very thin interface layer, which leaves all error checking to the kernel. It provides a few helper functions for writing pixel data to the compositor, but they are not meant to be the basis for any kind of serious graphics work (just for demo applications). For anything more serious, use pixman. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/Makefile#5 edit .. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libcompositor/Makefile#1 add .. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libcompositor/cheri_compositor.h#1 add .. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libcompositor/compositor.c#1 add .. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libcompositor/compositor.h#1 add Differences ... ==== //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/Makefile#5 (text+ko) ==== @@ -6,6 +6,7 @@ SUBDIR= libde4tc \ libvuln_magic \ libvuln_png \ - libimagebox + libimagebox \ + libcompositor .include From owner-p4-projects@FreeBSD.ORG Fri May 24 12:45:47 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 15D66741; Fri, 24 May 2013 12:45:47 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C93F073F for ; Fri, 24 May 2013 12:45:46 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id BA895B3F for ; Fri, 24 May 2013 12:45:46 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r4OCjktj077127 for ; Fri, 24 May 2013 12:45:46 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r4OCjkQU077124 for perforce@freebsd.org; Fri, 24 May 2013 12:45:46 GMT (envelope-from prw35@FreeBSD.org) Date: Fri, 24 May 2013 12:45:46 GMT Message-Id: <201305241245.r4OCjkQU077124@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 229003 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2013 12:45:47 -0000 http://p4web.freebsd.org/@@229003?ac=10 Change 229003 by prw35@pwithnall_zenith on 2013/05/24 12:45:29 Add compositorctl control program for the CHERI compositor This is a fairly thin layer over the compositor driver, allowing for low-level setup and testing. It also contains one demo program, run as `compositorctl animate`. Note that this must be compiled with LOCAL_DIRS=ctsrd LOCAL_LIB_DIRS=ctsrd-lib passed to buildworld and friends, as compositorctl depends on libcompositor being built first. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/ctsrd/Makefile#13 edit .. //depot/projects/ctsrd/cheribsd/src/ctsrd/compositorctl/Makefile#1 add .. //depot/projects/ctsrd/cheribsd/src/ctsrd/compositorctl/compositorctl.c#1 add .. //depot/projects/ctsrd/cheribsd/src/ctsrd/compositorctl/crest.png#1 add .. //depot/projects/ctsrd/cheribsd/src/ctsrd/compositorctl/crest.png.c#1 add Differences ... ==== //depot/projects/ctsrd/cheribsd/src/ctsrd/Makefile#13 (text+ko) ==== @@ -3,6 +3,7 @@ SUBDIR= atsectl \ browser \ cheripoint \ + compositorctl \ cycle_led \ de4ctl \ flashit \