diff --git a/arch/x86/include/asm/icc.h b/arch/x86/include/asm/icc.h index 56e29ca2..b778e2f0 100644 --- a/arch/x86/include/asm/icc.h +++ b/arch/x86/include/asm/icc.h @@ -56,6 +56,7 @@ int icc_halt(void); int icc_send_irq(int ue); void icc_mail_check(void); int icc_mail_ping(void); +int icc_irq_ping(void); int icc_mail_ping_irq(void); int icc_mail_noise(void); diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 49602774..47d4d028 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -34,6 +34,7 @@ #include #include +#define FPGA_BASE 0xf9000000 /* * These are our own ISRs that point to our special IRQ handler * instead of the regular 'fault_handler' function @@ -236,8 +237,18 @@ void irq_handler(struct state *s) // at first, we check our work queues if( s->int_no == 124 ) { - check_workqueues(); + kprintf( "hello from rem_interrupt\n" ); } + int status_reg1 = FPGA_BASE + 0x0D008; + int cont1 = *((int*)status_reg1); + int comp = 1; + int core_num = -1; + + if( cont1 & comp ) { + kprintf( "Interrupt from core 1\n" ); + } + check_workqueues(); +// } /* * Find out if we have a custom handler to run for this * IRQ and then finally, run it diff --git a/arch/x86/kernel/timer.c b/arch/x86/kernel/timer.c index 995fb747..71af6a5e 100644 --- a/arch/x86/kernel/timer.c +++ b/arch/x86/kernel/timer.c @@ -81,7 +81,7 @@ void timer_wait(unsigned int ticks) uint64_t eticks = timer_ticks + ticks; while (timer_ticks < eticks) { - //check_workqueues(); +// check_workqueues(); // recheck break condition if (timer_ticks >= eticks) diff --git a/arch/x86/scc/iRCCE_mailbox.c b/arch/x86/scc/iRCCE_mailbox.c index d2d946e1..dbf58f78 100644 --- a/arch/x86/scc/iRCCE_mailbox.c +++ b/arch/x86/scc/iRCCE_mailbox.c @@ -350,6 +350,9 @@ int iRCCE_mail_send( RC_cache_invalidate(); } + /* disable interrupts */ + flags = irq_nested_disable(); + // check if mailbox is closed RCCE_acquire_lock( dest ); RC_cache_invalidate(); @@ -373,19 +376,17 @@ int iRCCE_mail_send( iRCCE_memcpy_put( (void*)iRCCE_mailbox_send[dest], (void*)&header, RCCE_LINE_SIZE ); - /* disable interrupts */ - flags = irq_nested_disable(); - // set senders flag RC_cache_invalidate(); iRCCE_mailbox_send[dest]->sent = RCCE_FLAG_SET; *(int *)RCCE_fool_write_combine_buffer = 1; RC_cache_invalidate(); + RCCE_release_lock( dest ); + /* enable interrupts */ irq_nested_enable(flags); - RCCE_release_lock( dest ); return iRCCE_SUCCESS; } diff --git a/arch/x86/scc/icc.c b/arch/x86/scc/icc.c index 58db46ab..71239ec9 100644 --- a/arch/x86/scc/icc.c +++ b/arch/x86/scc/icc.c @@ -195,9 +195,33 @@ int icc_halt(void) return 0; } -#define ROUNDS 300000 +#define ROUNDS 100000 #define CORE_A 1 // sender -#define CORE_B 9 // receiver +#define CORE_B 4 // receiver + + +int icc_send_spec_irq(int core_num) { + int addr = FPGA_BASE+0x0D608; + int tmp; + tmp=ReadConfigReg(addr); + + kprintf( "tmp = %x\n", tmp ); + tmp |= 1; + kprintf( "tmp = %x\n", tmp ); + SetConfigReg(addr, tmp); + return 0; +} + + +int icc_irq_ping() +{ + if( my_ue != 0 ) return -1; + + icc_send_spec_irq(1); + icc_send_irq(1); + kprintf( "sending irq to 1!\n"); + return 0; +} static inline void icc_mail_check_tag(iRCCE_MAIL_HEADER* mail) { char* recv_buffer; @@ -236,14 +260,6 @@ int icc_mail_ping( void ) kprintf( "rounds = %d\n", ROUNDS ); - /* wait 10 sec */ - timer = rdtsc(); - while( (rdtsc() - timer) < 533e8 ) { - kprintf( "waiting ...\n" ); - } - - kprintf( "waited ..\n" ); - // disable interrupts flags = irq_nested_disable(); @@ -276,7 +292,7 @@ int icc_mail_ping( void ) break; iRCCE_mail_release(&recv_header); } - } while( (!recv_header)); + } while( 1 ); /* send response */ iRCCE_mail_send(0, PING_RESP, 0, NULL, recv_header->source); @@ -330,6 +346,9 @@ int icc_mail_ping_irq( void ) iRCCE_mail_send(0, PING_REQ, 0, NULL, rem_rank); /* send interrupt */ + NOP8; + NOP8; + NOP8; icc_send_irq(rem_rank); /* wait for response */ @@ -376,7 +395,7 @@ int icc_mail_noise() { iRCCE_MAIL_HEADER* recv_mail = NULL; // leave function if not participating - if( (my_ue == CORE_A)/* || (my_ue == CORE_B)*/ ) { + if( (my_ue == CORE_A) || (my_ue == CORE_B) ) { return -1; } @@ -387,14 +406,14 @@ int icc_mail_noise() { for( j=0; j