From 7b2dfe4497013f4d3dd4ab9615c2bd4855369224 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Mon, 27 Jun 2011 15:12:58 -0700 Subject: [PATCH] map off-die shared memory in the kernel address space - plus example code --- arch/x86/scc/RCCE_admin.c | 5 +++-- arch/x86/scc/icc.c | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/scc/RCCE_admin.c b/arch/x86/scc/RCCE_admin.c index 2ad87e18..dc7db27d 100644 --- a/arch/x86/scc/RCCE_admin.c +++ b/arch/x86/scc/RCCE_admin.c @@ -26,6 +26,7 @@ // #include +#include #ifdef CONFIG_ROCKCREEK @@ -335,13 +336,13 @@ int RCCE_init( RCCE_malloc_init(RCCE_comm_buffer[RCCE_IAM],RCCE_BUFF_SIZE); #ifdef SHMADD - RCCE_shmalloc_init(RC_SHM_BUFFER_START()+RCCE_SHM_BUFFER_offset ,RCCE_SHM_SIZE_MAX); + RCCE_shmalloc_init(map_region(NULL, RC_SHM_BUFFER_START()+RCCE_SHM_BUFFER_offset, RCCE_SHM_SIZE_MAX/PAGE_SIZE, MAP_KERNEL_SPACE|MAP_NO_CACHE), RCCE_SHM_SIZE_MAX); #ifdef SHMDBG kprintf("\n%d:%s:%d: RCCE_SHM_BUFFER_offset, RCCE_SHM_SIZE_MAX: %x %x\n", RCCE_IAM, __FILE__,__LINE__,RCCE_SHM_BUFFER_offset ,RCCE_SHM_SIZE_MAX); #endif #else - RCCE_shmalloc_init(RC_SHM_BUFFER_START(),RCCE_SHM_SIZE_MAX); + RCCE_shmalloc_init(map_region(NULL, RC_SHM_BUFFER_START(), RCCE_SHM_SIZE_MAX/PAGE_SIZE, MAP_KERNEL_SPACE|MAP_NO_CACHE), RCCE_SHM_SIZE_MAX); #endif // initialize the (global) flag bookkeeping data structure diff --git a/arch/x86/scc/icc.c b/arch/x86/scc/icc.c index 730add0b..4e77fb79 100644 --- a/arch/x86/scc/icc.c +++ b/arch/x86/scc/icc.c @@ -142,6 +142,17 @@ int icc_init(void) kprintf("failed! (0x%x)\n", msg); #endif +#if 0 + char* str = RCCE_shmalloc(128); + if (my_ue == 1) { + memset(str, 0x00, 128); + strcpy(str, "Hello RCCE_shmalloc\n"); + } + RCCE_barrier(&RCCE_COMM_WORLD); + kprintf("RCCE_shmalloc test: %s\n", str); + RCCE_shfree(str); +#endif + // reset INTR/LINT0 flag z = Z_PID(RC_COREID[my_ue]); tmp=ReadConfigReg(CRB_OWN + (z==0 ? GLCFG0 : GLCFG1));