From e1d3ac2ec5e43482f73648823fab67145caae42f Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Wed, 29 Jun 2011 12:31:32 -0700 Subject: [PATCH] remove obsolete code & minor optimizations --- arch/x86/include/asm/icc.h | 7 ++- arch/x86/scc/iRCCE_isend.c | 28 ++------- arch/x86/scc/icc.c | 122 +++---------------------------------- include/metalsvm/tasks.h | 1 - 4 files changed, 17 insertions(+), 141 deletions(-) diff --git a/arch/x86/include/asm/icc.h b/arch/x86/include/asm/icc.h index b02be40e..e2197326 100644 --- a/arch/x86/include/asm/icc.h +++ b/arch/x86/include/asm/icc.h @@ -45,16 +45,17 @@ typedef struct { uint32_t length; } icc_header_t; +/* #define ICC_TYPE_IP (1 << 0) #define ICC_TYPE_SVM (1 << 1) #define ICC_TYPE_PINGREQUEST (1 << 2) #define ICC_TYPE_PINGRESPONSE (1 << 3) +*/ int icc_init(void); -int icc_ping(int ue); -void icc_check(void); -void icc_mail_check(void); int icc_halt(void); +int icc_send_irq(int ue); +void icc_mail_check(void); int icc_mail_ping(void); #endif diff --git a/arch/x86/scc/iRCCE_isend.c b/arch/x86/scc/iRCCE_isend.c index 51cde3eb..042de0ce 100644 --- a/arch/x86/scc/iRCCE_isend.c +++ b/arch/x86/scc/iRCCE_isend.c @@ -34,6 +34,8 @@ // [2010-12-09] added cancel functions for non-blocking send/recv requests // by Carsten Clauss // +// [2011-06-29] added the support of using IPIs +// by Simon Pickartz, Stefan Lankes #include #include @@ -42,27 +44,7 @@ #include #include -static int send_irq(int ue) { - int tmp, x, y, z, addr; - - z = Z_PID(RC_COREID[ue]); - x = X_PID(RC_COREID[ue]); - y = Y_PID(RC_COREID[ue]); - addr = CRB_ADDR(x,y) + (z==0 ? GLCFG0 : GLCFG1); - - // send interrupt to ue - do { - NOP1; - tmp=ReadConfigReg(addr); - } while(tmp & 2); - tmp |= 2; - SetConfigReg(addr, tmp); - - return 0; - - -} - +#include static int iRCCE_push_send_request(iRCCE_SEND_REQUEST *request) { @@ -264,7 +246,7 @@ int iRCCE_isend( 0, privbuf, dest ); NOP8; NOP8; - send_irq( dest ); + icc_send_irq( dest ); return iRCCE_SUCCESS; } // we need an extra isend-call @@ -273,7 +255,7 @@ int iRCCE_isend( 0, NULL, dest ); NOP8; NOP8; - send_irq( dest ); + icc_send_irq( dest ); return iRCCE_isend_general( privbuf, send_size, dest, request ); } diff --git a/arch/x86/scc/icc.c b/arch/x86/scc/icc.c index ca2bd9b4..b2a517b9 100644 --- a/arch/x86/scc/icc.c +++ b/arch/x86/scc/icc.c @@ -160,14 +160,14 @@ int icc_init(void) SetConfigReg(CRB_OWN + (z==0 ? GLCFG0 : GLCFG1), tmp); // set interrupt handler (INTR/LINT0) - //irq_install_handler(124, intr_handler); + irq_install_handler(124, intr_handler); kputs("Now, the SCC is initialized!\n"); return 0; } -static inline int icc_send_irq(int ue) +int icc_send_irq(int ue) { int tmp, x, y, z, addr; @@ -196,60 +196,24 @@ int icc_halt(void) // iRCCE is not thread save => disable interrupts flags = irq_nested_disable(); - if (do_send) + if (do_send) { do_send = (iRCCE_isend_push() == iRCCE_PENDING); - icc_check(); + iRCCE_irecv_push(); + } + icc_mail_check(); irq_nested_enable(flags); } while(do_send); - iRCCE_finalize(); - HALT; return 0; } -static volatile uint64_t ping_start = 0; -static icc_header_t ping_request = {ICC_TYPE_PINGREQUEST, 0, 0}; -static icc_header_t ping_response = {ICC_TYPE_PINGRESPONSE, 0, 0}; - -int icc_ping(int ue) -{ - uint32_t flags; - - if (BUILTIN_EXPECT(ue == my_ue, 0)) - return -EINVAL; - if (BUILTIN_EXPECT((ue < 0) || (ue >= num_ues), 0)) - return -EINVAL; - - while(ping_start) { - NOP8; - } - - ping_start = rdtsc(); - - // iRCCE is not thread save => disable interrupts - flags = irq_nested_disable(); - - iRCCE_isend((char*) &ping_request, sizeof(icc_header_t), ue, NULL); - - // wait some time - NOP8; - - // wake up receiver - icc_send_irq(ue); - - irq_nested_enable(flags); - - return 0; -} - #define MAIL_MSG_SIZE 20 int icc_mail_ping( void ) -{ - +{ uint32_t flags; uint64_t timer; int remote_rank = (my_ue+1)%2; @@ -288,78 +252,9 @@ int icc_mail_ping( void ) kprintf( "Response didn't arrive!\n" ); } - - irq_nested_enable(flags); return 0; - -} - -static void interpret_header(icc_header_t* header, int recv_ue) -{ - //kprintf("Got ICC message %d from %d\n", header->type, recv_ue); - - switch(header->type) - { - case ICC_TYPE_PINGREQUEST: { - - iRCCE_isend((char*) &ping_response, sizeof(icc_header_t), recv_ue, NULL); - - // wait some time - NOP8; - - // wake up remote core - icc_send_irq(recv_ue); - } - break; - case ICC_TYPE_PINGRESPONSE: - kprintf("Receive ping response. Ticks: %d\n", rdtsc()-ping_start); - ping_start = 0; - break; - default: - kprintf("Receive unknown ICC message (%d)\n", header->type); - } -} - -/* - * By entering this function, interrupts are already disables - * => No race by using the static variables - */ -void icc_check(void) -{ - static icc_header_t header[MAX_SCC_CORES]; - static iRCCE_RECV_REQUEST request[MAX_SCC_CORES]; - static int8_t first_call = 1; - int i, ret; - - if (first_call) { - first_call = 0; - - for(i=0; i