remove obsolete code & minor optimizations

This commit is contained in:
Stefan Lankes 2011-06-29 12:31:32 -07:00
parent de216756d1
commit e1d3ac2ec5
4 changed files with 17 additions and 141 deletions

View file

@ -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

View file

@ -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 <metalsvm/stdlib.h>
#include <metalsvm/string.h>
@ -42,27 +44,7 @@
#include <asm/iRCCE_lib.h>
#include <asm/SCC_API.h>
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 <asm/icc.h>
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 );
}

View file

@ -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<num_ues; i++) {
if (i == my_ue)
continue;
iRCCE_irecv((char*) (header+i), sizeof(icc_header_t), i, request+i);
}
}
// pushes the progress of non-blocking communication requests
iRCCE_irecv_push();
for(i=0; i<num_ues; i++) {
if (i == my_ue)
continue;
ret = iRCCE_irecv_test(request+i, NULL);
if (ret == iRCCE_SUCCESS) {
interpret_header(header+i, i);
iRCCE_irecv((char*) (header+i), sizeof(icc_header_t), i, request+i);
}
}
// pushes the progress of non-blocking communication requests
iRCCE_isend_push();
}
void icc_mail_check(void)
@ -383,8 +278,7 @@ void icc_mail_check(void)
}
iRCCE_mail_release( &header );
}
}
}
#endif

View file

@ -143,7 +143,6 @@ static inline void check_workqueues(void)
uint32_t flags = irq_nested_disable();
#ifdef CONFIG_ROCKCREEK
// icc_check();
icc_mail_check();
#endif