static int __init mon_kernel_init(void) { int emi_dcm_disable; BM_Init(); disable_infra_dcm(); emi_dcm_disable = BM_GetEmiDcm(); //printk("[MT_MEM_BW]emi_dcm_disable = %d\n", emi_dcm_disable); BM_SetEmiDcm(0xff); //disable EMI dcm BM_SetReadWriteType(BM_BOTH_READ_WRITE); BM_SetMonitorCounter(1, BM_MASTER_MM1 | BM_MASTER_MM1, BM_TRANS_TYPE_4BEAT | BM_TRANS_TYPE_8Byte | BM_TRANS_TYPE_BURST_WRAP); BM_SetMonitorCounter(2, BM_MASTER_AP_MCU1 | BM_MASTER_AP_MCU2, BM_TRANS_TYPE_4BEAT | BM_TRANS_TYPE_8Byte | BM_TRANS_TYPE_BURST_WRAP); BM_SetMonitorCounter(3, BM_MASTER_MD_MCU | BM_MASTER_2G_3G_MDDMA, BM_TRANS_TYPE_4BEAT | BM_TRANS_TYPE_8Byte | BM_TRANS_TYPE_BURST_WRAP); BM_SetMonitorCounter(4, BM_MASTER_GPU1 | BM_MASTER_GPU1, BM_TRANS_TYPE_4BEAT | BM_TRANS_TYPE_8Byte | BM_TRANS_TYPE_BURST_WRAP); BM_SetLatencyCounter(); // stopping EMI monitors will reset all counters BM_Enable(0); // start EMI monitor counting BM_Enable(1); last_time_ns = sched_clock(); restore_infra_dcm(); BM_SetEmiDcm(emi_dcm_disable); //enable EMI dcm return 0; }
static void emi_stop(void) { /* Disable Bandwidth Monitor */ BM_Enable(0); /* Disable Latency Monitor */ LM_Enable(0); }
static void emi_start(void) { /* Enable Bandwidth Monitor */ BM_Enable(1); /* Enable Latency Monitor */ LM_Enable(1); }
static unsigned int emi_polling(unsigned int *emi_value) { int i; int j = -1; BM_Pause(); // Get Bus Cycle Count emi_value[++j] = BM_GetBusCycCount(); /* To derive the bandwidth % usage (BSCT / BACT) */ // Get Word Count for (i=0; i<EMI_NCOUNTER; i++) { emi_value[++j] = BM_GetWordCount(i+1); } // Get Word Count for all masters emi_value[++j] = BM_GetWordAllCount(); // Get Bus Busy Count for (i=0; i<EMI_NCOUNTER; i++) { emi_value[++j] = BM_GetBusBusyCount(i+1); } // Get Bus Busy Count for all masters emi_value[++j] = BM_GetBusBusyAllCount(); // Get Transaction Count emi_value[++j] = BM_GetEMIClockCount(); // Get Latency and Transaction emi_value[++j] = LM_GetWTransCount(); emi_value[++j] = LM_GetWLatCount(); emi_value[++j] = LM_GetRTransCount(); emi_value[++j] = LM_GetRLatCount(); // Disable BM_Enable(0); LM_Enable(0); // Enable BM_Enable(1); LM_Enable(1); return j+1; }
/* * mt65xx_mon_enable: Enable hardware monitors. * Return 0. */ int mt65xx_mon_enable(void) { // reset all ARM monitor counters to 0 armV7_perf_mon_reset(); // enable ARM performance monitors armV7_perf_mon_enable(1); // reset and enable L2C event counters mt65xx_reg_sync_writel(7, PL310_BASE + L2X0_EVENT_CNT_CTRL); // stopping EMI monitors will reset all counters BM_Enable(0); // start EMI monitor counting BM_Enable(1); return 0; }
/* * mt65xx_mon_enable: Enable hardware monitors. * Return 0. */ int mt65xx_mon_enable(void) { p_pmu->reset(); // enable & start ARM performance monitors p_pmu->enable(); p_pmu->start(); // reset and enable L2C event counters mt65xx_reg_sync_writel(7, PL310_BASE + L2X0_EVENT_CNT_CTRL); // stopping EMI monitors will reset all counters BM_Enable(0); // start EMI monitor counting BM_Enable(1); return 0; }
/* * mt65xx_mon_enable: Enable hardware monitors. * Return 0. */ int mt65xx_mon_enable(void) { unsigned long flags; p_pmu->reset(); // enable & start ARM performance monitors p_pmu->enable(); p_pmu->start(); // reset and enable L2C event counters raw_spin_lock_irqsave(&l2x0_lock, flags); __raw_writel(7, PL310_BASE + L2X0_EVENT_CNT_CTRL); dsb(); raw_spin_unlock_irqrestore(&l2x0_lock, flags); // stopping EMI monitors will reset all counters BM_Enable(0); // start EMI monitor counting BM_Enable(1); return 0; }
int mt65xx_mon_enable(void) { set_arm11_perf_mon_cyc_cnt(0); set_arm11_perf_mon_cnt0(0); set_arm11_perf_mon_cnt1(0); reset_arm11_perf_mon_cnt(); enable_arm11_perf_mon(); mt65xx_reg_sync_writel(7, PL310_BASE + L2X0_EVENT_CNT_CTRL); BM_Disable(); BM_Enable(); return 0; }
unsigned long long get_mem_bw(void) { unsigned long long throughput; unsigned long long WordAllCount; unsigned long long current_time_ns, time_period_ns; int count, value; int emi_dcm_disable = BM_GetEmiDcm(); #if DISABLE_FLIPPER_FUNC return 0; #endif //printk("[get_mem_bw]emi_dcm_disable = %d\n", emi_dcm_disable); current_time_ns = sched_clock(); time_period_ns = current_time_ns - last_time_ns; //printk("[get_mem_bw]last_time=%llu, current_time=%llu, period=%llu\n", last_time_ns, current_time_ns, time_period_ns); //disable_infra_dcm(); BM_SetEmiDcm(0xff); //disable EMI dcm BM_Pause(); WordAllCount = BM_GetWordAllCount(); if(WordAllCount == 0) LastWordAllCount = 0; WordAllCount -= LastWordAllCount; throughput = (WordAllCount * 8 * 1000); do_div(throughput,time_period_ns); //printk("[get_mem_bw]Total MEMORY THROUGHPUT =%llu(MB/s), WordAllCount_delta = 0x%llx, LastWordAllCount = 0x%llx\n",throughput, WordAllCount, LastWordAllCount); // stopping EMI monitors will reset all counters BM_Enable(0); value = BM_GetWordAllCount(); count = 100; if((value != 0) && (value > 0xB0000000)) { do { if((value = BM_GetWordAllCount()) != 0) { count--; BM_Enable(1); BM_Enable(0); } else { break; } }while(count > 0); } LastWordAllCount = value; //printk("[get_mem_bw]loop count = %d, last_word_all_count = 0x%x\n", count, LastWordAllCount); // start EMI monitor counting BM_Enable(1); last_time_ns = sched_clock(); //restore_infra_dcm(); BM_SetEmiDcm(emi_dcm_disable); //printk("[get_mem_bw]throughput = %llx\n", throughput); return throughput; }