void interrupt_nsptimer(int irq, void *pregs, void *pdata ) { uint32_t ctl; struct arch_regs *regs = pregs; uart_print( "=======================================\n\r" ); HVMM_TRACE_ENTER(); /* Disable NS Physical Timer Interrupt */ ctl = read_cntp_ctl(); ctl &= ~(0x1); write_cntp_ctl(ctl); /* Trigger another interrupt */ test_start_timer(); /* Test guest context switch */ if ( (regs->cpsr & 0x1F) != 0x1A ) { /* Not from Hyp, switch the guest context */ context_dump_regs( regs ); context_switchto(sched_policy_determ_next()); } HVMM_TRACE_EXIT(); uart_print( "=======================================\n\r" ); }
static void bmk9_execute(void) { uint32_t n; static uint8_t ib[16]; static InputQueue iq; chIQInit(&iq, ib, sizeof(ib), NULL); n = 0; test_wait_tick(); test_start_timer(1000); do { chIQPutI(&iq, 0); chIQPutI(&iq, 1); chIQPutI(&iq, 2); chIQPutI(&iq, 3); (void)chIQGet(&iq); (void)chIQGet(&iq); (void)chIQGet(&iq); (void)chIQGet(&iq); n++; #if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); test_print("--- Score : "); test_printn(n * 4); test_println(" bytes/S"); }
static void bmk7_execute(void) { uint32_t n; threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread3, NULL); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+4, thread3, NULL); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()+3, thread3, NULL); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+2, thread3, NULL); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+1, thread3, NULL); n = 0; test_wait_tick(); test_start_timer(1000); do { chSemReset(&sem1, 0); n++; #if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); test_terminate_threads(); chSemReset(&sem1, 0); test_wait_threads(); test_print("--- Score : "); test_printn(n); test_print(" reschedules/S, "); test_printn(n * 6); test_println(" ctxswc/S"); }
static void bmk4_execute(void) { Thread *tp; uint32_t n; tp = threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread4, NULL); n = 0; test_wait_tick(); test_start_timer(1000); do { chSysLock(); chSchWakeupS(tp, RDY_OK); chSchWakeupS(tp, RDY_OK); chSchWakeupS(tp, RDY_OK); chSchWakeupS(tp, RDY_OK); chSysUnlock(); n += 4; #if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); chSysLock(); chSchWakeupS(tp, RDY_TIMEOUT); chSysUnlock(); test_wait_threads(); test_print("--- Score : "); test_printn(n * 2); test_println(" ctxswc/S"); }
static unsigned int msg_loop_test(Thread *tp) { uint32_t n = 0; test_wait_tick(); test_start_timer(1000); do { (void)chMsgSend(tp, 1); n++; #if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); (void)chMsgSend(tp, 0); return n; }
hvmm_status_t hvmm_tests_gic_timer(void) { /* Testing Non-secure Physical Timer Event * (PPI2, Interrupt ID:30), Cortex-A15 * - Periodically triggers timer interrupt * - switches guest context at every timer interrupt */ HVMM_TRACE_ENTER(); /* handler */ interrupt_request(30, &interrupt_nsptimer); /* configure and enable interrupt */ interrupt_host_configure(30); /* start timer */ test_start_timer(); HVMM_TRACE_EXIT(); return HVMM_STATUS_SUCCESS; }
static void bmk6_execute(void) { uint32_t n = 0; void *wap = wa[0]; tprio_t prio = chThdGetPriority() + 1; test_wait_tick(); test_start_timer(1000); do { chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL); n++; #if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); test_print("--- Score : "); test_printn(n); test_println(" threads/S"); }
static void bmk10_execute(void) { static VirtualTimer vt1, vt2; uint32_t n = 0; test_wait_tick(); test_start_timer(1000); do { chSysLock(); chVTSetI(&vt1, 1, tmo, NULL); chVTSetI(&vt2, 10000, tmo, NULL); chVTResetI(&vt1); chVTResetI(&vt2); chSysUnlock(); n++; #if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); test_print("--- Score : "); test_printn(n * 2); test_println(" timers/S"); }
hvmm_status_t hvmm_tests_gic_timer(void) { /* Testing Non-secure Physical Timer Event (PPI2, Interrupt ID:30), Cortex-A15 * - Periodically triggers timer interrupt * - switches guest context at every timer interrupt */ HVMM_TRACE_ENTER(); /* handler */ gic_test_set_irq_handler( 30, &interrupt_nsptimer, 0 ); /* configure and enable interrupt */ gic_test_configure_irq(30, GIC_INT_POLARITY_LEVEL, gic_cpumask_current(), GIC_INT_PRIORITY_DEFAULT ); /* start timer */ test_start_timer(); HVMM_TRACE_EXIT(); return HVMM_STATUS_SUCCESS; }
static void bmk12_execute(void) { uint32_t n = 0; test_wait_tick(); test_start_timer(1000); do { chMtxLock(&mtx1); chMtxUnlock(); chMtxLock(&mtx1); chMtxUnlock(); chMtxLock(&mtx1); chMtxUnlock(); chMtxLock(&mtx1); chMtxUnlock(); n++; #if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); test_print("--- Score : "); test_printn(n * 4); test_println(" lock+unlock/S"); }
static void bmk11_execute(void) { uint32_t n = 0; test_wait_tick(); test_start_timer(1000); do { chSemWait(&sem1); chSemSignal(&sem1); chSemWait(&sem1); chSemSignal(&sem1); chSemWait(&sem1); chSemSignal(&sem1); chSemWait(&sem1); chSemSignal(&sem1); n++; #if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); test_print("--- Score : "); test_printn(n * 4); test_println(" wait+signal/S"); }