diff options
Diffstat (limited to 'src/occ_405/amec')
-rwxr-xr-x | src/occ_405/amec/amec_analytics.c | 33 | ||||
-rw-r--r-- | src/occ_405/amec/amec_init.c | 58 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_perfcount.c | 4 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_sensors_core.c | 383 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_sensors_core.h | 18 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_sensors_power.c | 6 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_slave_smh.c | 21 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_smh.h | 7 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_sys.h | 38 |
9 files changed, 248 insertions, 320 deletions
diff --git a/src/occ_405/amec/amec_analytics.c b/src/occ_405/amec/amec_analytics.c index d7dd1f8..9cbb654 100755 --- a/src/occ_405/amec/amec_analytics.c +++ b/src/occ_405/amec/amec_analytics.c @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/occ/amec/amec_analytics.c $ */ +/* $Source: src/occ_405/amec/amec_analytics.c $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -190,8 +190,8 @@ void amec_analytics_main(void) return; } - g_amec->packednapsleep[0] = (g_amec->proc[0].winkcnt2ms.sample<<8) + - g_amec->proc[0].sleepcnt2ms.sample; + g_amec->packednapsleep[0] = (g_amec->proc[0].winkcnt4ms.sample<<8) + + g_amec->proc[0].sleepcnt4ms.sample; // There are no other elements in proc[] array other than element 0 g_amec->packednapsleep[1] = 0; g_amec->packednapsleep[2] = 0; @@ -343,9 +343,9 @@ void amec_analytics_main(void) } g_amec->g44_avg[(i*MSA)+48] = g_amec->g44_avg[(i*MSA)+48] + - (UINT32)(g_amec->proc[i].winkcnt2ms.sample<<3); // counter of cores that entered winkle for at least part of the 2msec interval: 1/8th resolution + (UINT32)(g_amec->proc[i].winkcnt4ms.sample<<3); // counter of cores that entered winkle for at least part of the 2msec interval: 1/8th resolution g_amec->g44_avg[(i*MSA)+49] = g_amec->g44_avg[(i*MSA)+49] + - (UINT32)(g_amec->proc[i].sleepcnt2ms.sample<<3); // counter of cores that entered sleep for at least part of the 2msec interval: 1/8th resolution + (UINT32)(g_amec->proc[i].sleepcnt4ms.sample<<3); // counter of cores that entered sleep for at least part of the 2msec interval: 1/8th resolution m=0; // counter for actual configured # of cores - 1. @@ -354,7 +354,7 @@ void amec_analytics_main(void) if (CORE_PRESENT(j)) { //average frequency for this core (apply rounding for frequency for maximum 8 bit resolution): 20MHz resolution (Power8 is actually 33.25MHz steps) - temp32 = (UINT32)g_amec->proc[i].core[j].freqa2ms.sample/10; // 10MHz resolution + temp32 = (UINT32)g_amec->proc[i].core[j].freqa4ms.sample/10; // 10MHz resolution temp16 = (UINT16)temp32; temp32 = temp32 >>1; // convert to 20MHz resolution if (temp16 & 1) temp32 = temp32+1; // if LSBit of 10MHz resolution value is a 1, then round the 20MHz resolution value up by 1 @@ -376,21 +376,21 @@ void amec_analytics_main(void) temp16 = 0; // keeps track of non-zero threads for (k=0; k < g_amec->analytics_threadcountmax; k++) { - if (tempreg < g_amec->proc[i].core[j].thread[k].util2ms_thread) + if (tempreg < g_amec->proc[i].core[j].thread[k].util4ms_thread) { - tempreg = g_amec->proc[i].core[j].thread[k].util2ms_thread; + tempreg = g_amec->proc[i].core[j].thread[k].util4ms_thread; } - if ((0 < g_amec->proc[i].core[j].thread[k].util2ms_thread) || + if ((0 < g_amec->proc[i].core[j].thread[k].util4ms_thread) || (g_amec->analytics_threadmode != 0)) { // accumulate for computing average - temp32 = temp32 + g_amec->proc[i].core[j].thread[k].util2ms_thread; + temp32 = temp32 + g_amec->proc[i].core[j].thread[k].util4ms_thread; // increment counter of threads temp16 = temp16 + 1; } } g_amec->g44_avg[(i*MSA)+62+m] = g_amec->g44_avg[(i*MSA)+62+m] + - (UINT32)(g_amec->proc[i].core[j].util2ms.sample/50); // accumulate util sensor that feeds IPS and DPS algorithms for this core + (UINT32)(g_amec->proc[i].core[j].util4ms.sample/50); // accumulate util sensor that feeds IPS and DPS algorithms for this core if (g_amec->analytics_threadmode == 2) { @@ -406,7 +406,7 @@ void amec_analytics_main(void) if (g_amec->analytics_threadmode == 3) { // accumulate average finish latency counter for this core - temp16 = ((g_amec->proc[i].core[j].mcpifi2ms.sample) >>1); + temp16 = ((g_amec->proc[i].core[j].mcpifi4ms.sample) >>1); } temp32 = (UINT32)(temp16/25); // 0.25% utilization resolution @@ -415,12 +415,11 @@ void amec_analytics_main(void) g_amec->g44_avg[(i * MSA) + 74 + m] = g_amec->g44_avg[(i * MSA) + 74 + m] + (UINT32)(temp32); // accumulate average utilization or individual threads for this core or finish latency counter g_amec->g44_avg[(i * MSA) + 86 + m] = g_amec->g44_avg[(i * MSA) + 86 + m] + - (UINT32)(g_amec->proc[i].core[j].ips2ms.sample / 50); // accumulate average MIPS for this core + (UINT32)(g_amec->proc[i].core[j].ips4ms.sample / 50); // accumulate average MIPS for this core g_amec->g44_avg[(i * MSA) + 98 + m] = g_amec->g44_avg[(i * MSA) + 98 + m] + (UINT32)g_amec->proc[i].core[j].temp4ms.sample; // accumulate average temperature for this core - g_amec->g44_avg[(i * MSA) + 110 + m] = g_amec->g44_avg[(i * MSA) + 110 + m] + - (UINT32)((g_amec->proc[i].core[j].cmbw2ms.sample) / 156); // accumulate average memory bandwidth for this core //@mw713 /156, was /78 (overflow issues) - temp16 = ((g_amec->proc[i].core[j].mcpifd2ms.sample) / 100); // accumulate average busy latency counter for this core + g_amec->g44_avg[(i * MSA) + 110 + m] = 0; // No longer supported (was memory bandwidth) + temp16 = ((g_amec->proc[i].core[j].mcpifd4ms.sample) / 100); // accumulate average busy latency counter for this core g_amec->g44_avg[(i * MSA) + 122 + m] = g_amec->g44_avg[(i * MSA) + 122 + m] + (UINT32)temp16; m++; // increment configured core counter if (m > 11) j = 12; // safeguard in case more than 12 configured cores. diff --git a/src/occ_405/amec/amec_init.c b/src/occ_405/amec/amec_init.c index ba40fcc..138f7ff 100644 --- a/src/occ_405/amec/amec_init.c +++ b/src/occ_405/amec/amec_init.c @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/occ/amec/amec_init.c $ */ +/* $Source: src/occ_405/amec/amec_init.c $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -24,9 +24,9 @@ /* IBM_PROLOG_END_TAG */ -//************************************************************************* +//*************************************************************************/ // Includes -//************************************************************************* +//*************************************************************************/ #include <occ_common.h> #include <amec_sys.h> #include <ssx.h> @@ -41,25 +41,25 @@ #include <proc_data.h> #include <sensor.h> -//************************************************************************* +//*************************************************************************/ // Externs -//************************************************************************* +//*************************************************************************/ -//************************************************************************* +//*************************************************************************/ // Macros -//************************************************************************* +//*************************************************************************/ -//************************************************************************* +//*************************************************************************/ // Defines/Enums -//************************************************************************* +//*************************************************************************/ -//************************************************************************* +//*************************************************************************/ // Structures -//************************************************************************* +//*************************************************************************/ -//************************************************************************* +//*************************************************************************/ // Globals -//************************************************************************* +//*************************************************************************/ // We can initialize amec system structure to all zeros amec_sys_t g_amec_sys = {0}; @@ -75,13 +75,13 @@ GpeRequest G_gpe_nop_request[NUM_GPE_ENGINES]; extern void amec_slv_update_gpe_sensors(uint8_t i_gpe_engine); extern void amec_slv_update_gpe_sensors(uint8_t i_gpe_engine); -//************************************************************************* +//*************************************************************************/ // Function Prototypes -//************************************************************************* +//*************************************************************************/ -//************************************************************************* +//*************************************************************************/ // Functions -//************************************************************************* +//*************************************************************************/ void amec_vectorize_core_sensor(sensor_t * l_sensor, vectorSensor_t * l_vector, const VECTOR_SENSOR_OP l_op, @@ -185,20 +185,20 @@ void amec_init_vector_sensors(void) TEMP4MSP0C0); //----------------------------------------------------- - // FREQA2MSP0 Vector Sensor + // FREQA4MSP0 Vector Sensor //----------------------------------------------------- - amec_vectorize_core_sensor(AMECSENSOR_PTR(FREQA2MSP0), - &g_amec_sys.proc[0].freqa2ms_vector, + amec_vectorize_core_sensor(AMECSENSOR_PTR(FREQA4MSP0), + &g_amec_sys.proc[0].freqa4ms_vector, VECTOR_OP_AVG, - FREQA2MSP0C0); + FREQA4MSP0C0); //----------------------------------------------------- - // IPS2MSP0 Vector Sensor + // IPS4MSP0 Vector Sensor //----------------------------------------------------- - amec_vectorize_core_sensor(AMECSENSOR_PTR(IPS2MSP0), - &g_amec_sys.proc[0].ips2ms_vector, + amec_vectorize_core_sensor(AMECSENSOR_PTR(IPS4MSP0), + &g_amec_sys.proc[0].ips4ms_vector, VECTOR_OP_AVG, - IPS2MSP0C0); + IPS4MSP0C0); //----------------------------------------------------- // TEMP4MSP0PEAK Vector Sensor @@ -211,10 +211,10 @@ void amec_init_vector_sensors(void) //----------------------------------------------------- // UTIL2MSP0 Vector Sensor //----------------------------------------------------- - amec_vectorize_core_sensor(AMECSENSOR_PTR(UTIL2MSP0), - &g_amec_sys.proc[0].util2ms_vector, + amec_vectorize_core_sensor(AMECSENSOR_PTR(UTIL4MSP0), + &g_amec_sys.proc[0].util4ms_vector, VECTOR_OP_AVG, - UTIL2MSP0C0); + UTIL4MSP0C0); //TODO: Re-enable with error checking when centaur support is added #if 0 diff --git a/src/occ_405/amec/amec_perfcount.c b/src/occ_405/amec/amec_perfcount.c index da37d40..ec9f1cc 100755 --- a/src/occ_405/amec/amec_perfcount.c +++ b/src/occ_405/amec/amec_perfcount.c @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -71,7 +71,7 @@ void amec_calc_dps_util_counters(const uint8_t i_core_id) /*------------------------------------------------------------------------*/ l_perf = &g_amec->proc[0].core[i_core_id].core_perf; // Read sensor for this core - l_sensor = AMECSENSOR_ARRAY_PTR(UTIL2MSP0C0, i_core_id); + l_sensor = AMECSENSOR_ARRAY_PTR(UTIL4MSP0C0, i_core_id); l_utilization = l_sensor->sample; l_part = amec_part_find_by_core(&g_amec->part_config, i_core_id); diff --git a/src/occ_405/amec/amec_sensors_core.c b/src/occ_405/amec/amec_sensors_core.c index d330898..ff4f81e 100755 --- a/src/occ_405/amec/amec_sensors_core.c +++ b/src/occ_405/amec/amec_sensors_core.c @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/occ/amec/amec_sensors_core.c $ */ +/* $Source: src/occ_405/amec/amec_sensors_core.c $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -56,11 +56,10 @@ extern data_cnfg_t * G_data_cnfg; void amec_calc_dts_sensors(CoreData * i_core_data_ptr, uint8_t i_core); void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core); void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core); -void amec_calc_spurr(uint8_t i_core); -//************************************************************************* +//*************************************************************************/ // Code -//************************************************************************* +//*************************************************************************/ // Function Specification // @@ -73,9 +72,10 @@ void amec_calc_spurr(uint8_t i_core); // End Function Specification void amec_update_proc_core_sensors(uint8_t i_core) { - CoreData *l_core_data_ptr; - uint16_t l_temp16 = 0; - uint32_t l_temp32 = 0; + CoreData *l_core_data_ptr; + uint16_t l_temp16 = 0; + uint32_t l_temp32 = 0; + uint8_t i = 0; // Make sure the core is present, and that it has updated data. if(CORE_PRESENT(i_core) && CORE_UPDATED(i_core)) @@ -91,8 +91,6 @@ void amec_update_proc_core_sensors(uint8_t i_core) //------------------------------------------------------- amec_calc_dts_sensors(l_core_data_ptr, i_core); -// @TODO - TEMP: frequency and utilization sensors are not enabled yet. -/* //------------------------------------------------------- // Util / Freq //------------------------------------------------------- @@ -106,7 +104,7 @@ void amec_update_proc_core_sensors(uint8_t i_core) // Performance counter - This function should be called // after amec_calc_freq_and_util_sensors(). //------------------------------------------------------- - //amec_calc_dps_util_counters(i_core); + amec_calc_dps_util_counters(i_core); //------------------------------------------------------- // IPS @@ -117,33 +115,35 @@ void amec_update_proc_core_sensors(uint8_t i_core) amec_calc_ips_sensors(l_core_data_ptr,i_core); } - //------------------------------------------------------- - // SPURR - //------------------------------------------------------- - //amec_calc_spurr(i_core); - // ------------------------------------------------------ // Update PREVIOUS values for next time // ------------------------------------------------------ - g_amec->proc[0].core[i_core].prev_PC_RAW_Th_CYCLES = l_core_data_ptr->per_thread[0].raw_cycles; + + // Thread raw cycles are equivalent to core raw cycles. + g_amec->proc[0].core[i_core].prev_PC_RAW_Th_CYCLES = l_core_data_ptr->empath.raw_cycles; // Skip empath updates if there was an empath collection error on this core if (!CORE_EMPATH_ERROR(i_core)) { g_amec->proc[0].core[i_core].prev_PC_RAW_CYCLES = l_core_data_ptr->empath.raw_cycles; g_amec->proc[0].core[i_core].prev_PC_RUN_CYCLES = l_core_data_ptr->empath.run_cycles; - g_amec->proc[0].core[i_core].prev_PC_COMPLETED = l_core_data_ptr->empath.completion; - g_amec->proc[0].core[i_core].prev_PC_DISPATCH = l_core_data_ptr->empath.dispatch; g_amec->proc[0].core[i_core].prev_tod_2mhz = l_core_data_ptr->empath.tod_2mhz; g_amec->proc[0].core[i_core].prev_FREQ_SENS_BUSY = l_core_data_ptr->empath.freq_sens_busy; g_amec->proc[0].core[i_core].prev_FREQ_SENS_FINISH = l_core_data_ptr->empath.freq_sens_finish; } + // Need to sum up all thread data for full core data + g_amec->proc[0].core[i_core].prev_PC_COMPLETED = 0; + g_amec->proc[0].core[i_core].prev_PC_DISPATCH = 0; for(i=0; i<MAX_THREADS_PER_CORE; i++) { - g_amec->proc[0].core[i_core].thread[i].prev_PC_RUN_Th_CYCLES = l_core_data_ptr->per_thread[i].run_cycles; + g_amec->proc[0].core[i_core].prev_PC_COMPLETED += + l_core_data_ptr->per_thread[i].completion; + g_amec->proc[0].core[i_core].prev_PC_DISPATCH += + l_core_data_ptr->per_thread[i].dispatch; + g_amec->proc[0].core[i_core].thread[i].prev_PC_RUN_Th_CYCLES = l_core_data_ptr->per_thread[i].run_cycles; } -*/ + // Final step is to update TOD sensors // Extract 32 bits with 16usec resolution l_temp32 = (uint32_t)(G_dcom_slv_inbox_doorbell_rx.tod>>13); @@ -164,7 +164,7 @@ void amec_update_proc_core_sensors(uint8_t i_core) // Name: amec_calc_dts_sensors // // Description: Compute core temperature. This function is called every -// 2ms/core. +// 4ms/core. // // PreCondition: The core is present. // @@ -312,17 +312,15 @@ void amec_calc_dts_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // Name: amec_calc_freq_and_util_sensors // // Description: Compute the frequency and utilization sensors for a given core. -// This function is called every 2ms/core. +// This function is called every 4ms/core. // // Thread: RealTime Loop // // End Function Specification -// TEMP - Not supported yet. -#if 0 void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) { BOOLEAN l_core_sleep_winkle = FALSE; - uint32_t l_pm_state_hist_reg = 0; + uint32_t l_stop_state_hist_reg = 0; uint32_t temp32 = 0; uint32_t temp32a = 0; uint16_t temp16 = 0; @@ -330,15 +328,15 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) uint16_t l_core_util = 0; uint16_t l_core_freq = 0; uint16_t l_time_interval = 0; - uint32_t l_cycles2ms = 0; + uint32_t l_cycles4ms = 0; int i; - // Read the high-order bytes of PM State History register for this core - l_pm_state_hist_reg = i_core_data_ptr->pcb_slave.pm_history.words.high_order; + // Read the high-order bytes of OCC Stop State History Register + l_stop_state_hist_reg = (uint32_t) (i_core_data_ptr->stop_state_hist >> 32); // If core is in fast/deep sleep mode or fast/winkle mode, then set a flag // indicating this - if(l_pm_state_hist_reg & OCC_PAST_CORE_CLK_STOP) + if(l_stop_state_hist_reg & OCC_CORE_STOP_GATED) { l_core_sleep_winkle = TRUE; } @@ -348,36 +346,30 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // ------------------------------------------------------ // <amec_formula> // Result: Calculated Core Frequency - // Sensor: FREQA2MSP0C0 - // Timescale: 2ms + // Sensor: FREQA4MSP0C0 + // Timescale: 4ms // Units: MHz // Min/Max: 0/6000 (UPPER_LIMIT_PROC_FREQ_MHZ=6000) - // Formula: cyc_delta = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-2ms]) - // time_delta = (TOD[t=now] - TOD[t=-2ms]) + // Formula: cyc_delta(cycles) = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-4ms]) + // time_delta(TOD ticks) = (TOD[t=now] - TOD[t=-4ms]) // frequency(MHz) = (cyc_delta / time_delta) * (2M TOD ticks / 1 second) // = (2 * cyc_delta) / time_delta + // NOTE: cyc_delta is the total number of cycles in 4ms time for the core + // NOTE: In the HWP where we aquire the TOD count, we shift the counter by 8 + // which causes each TOD tick here to equate to 0.5us. This is why we + // are multiplying by 2 in the above equation. // </amec_formula> // Compute Delta in PC_RAW_CYCLES temp32 = i_core_data_ptr->empath.raw_cycles; temp32a = g_amec->proc[0].core[i_core].prev_PC_RAW_CYCLES; - temp32 = l_cycles2ms = temp32 - temp32a; + temp32 = l_cycles4ms = temp32 - temp32a; + temp32a = (i_core_data_ptr->empath.tod_2mhz - + g_amec->proc[0].core[i_core].prev_tod_2mhz); - if( (cfam_id() == CFAM_CHIP_ID_MURANO_10) - || (cfam_id() == CFAM_CHIP_ID_MURANO_11) - || (cfam_id() == CFAM_CHIP_ID_MURANO_12) ) - { - temp32a = AMEC_US_PER_SMH_PERIOD; // using fixed 2000us is showing 3% error. - temp32 = temp32 / temp32a; - } - else - { - temp32a = (i_core_data_ptr->empath.tod_2mhz - - g_amec->proc[0].core[i_core].prev_tod_2mhz); - temp32 = (2 * temp32) / temp32a; - } + if (0 == temp32a) temp32 = 0; + else temp32 = (2 * temp32) / temp32a; - // TODO: Remove this once we have the OHA Power Proxy legacy mode stuff working. if(temp32 < UPPER_LIMIT_PROC_FREQ_MHZ) { // Update Sensor for this core @@ -389,7 +381,7 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) { l_core_freq = (uint16_t) temp32; } - sensor_update( AMECSENSOR_ARRAY_PTR(FREQA2MSP0C0,i_core), l_core_freq); + sensor_update( AMECSENSOR_ARRAY_PTR(FREQA4MSP0C0,i_core), l_core_freq); } // ------------------------------------------------------ @@ -397,14 +389,16 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // ------------------------------------------------------ // <amec_formula> // Result: Calculated Core Utilization - // Sensor: UTIL2MSP0C0 - // Timescale: 2ms + // Sensor: UTIL4MSP0C0 + // Timescale: 4ms // Units: 0.01 % // Min/Max: 0/10000 (0/100%) - // Formula: cyc_delta = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-2ms]) - // run_delta = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-2ms]) - // + // Formula: cyc_delta = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-4ms]) + // run_delta = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-4ms]) // UTIL(in %) = run_delta / cyc_delta + // + // NOTE: cyc_delta is the total number of cycles in 4ms time for the core + // NOTE: run_delta is the total number of cycles utilized by a specific core in 4ms // </amec_formula> // Compute Delta in PC_RUN_CYCLES @@ -417,15 +411,12 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) temp16a = 10000; // Mult * 10000 to get finer resolution for 0.01% temp32 = ((uint32_t)temp16a)*((uint32_t)temp16); - temp32a = l_cycles2ms; // Get Raw cycles + temp32a = l_cycles4ms; // Get Raw cycles temp32a = temp32a >> 8; // Drop non-significant bits // Calculate Utilization - temp32 = temp32 / temp32a; - if(temp32a == 0) // Prevent a divide by zero - { - temp32 = 0; - } + if(0 == temp32a) temp32 = 0; // Prevent a divide by zero + else temp32 = temp32 / temp32a; // Update Sensor for this core if(l_core_sleep_winkle) @@ -436,8 +427,7 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) { l_core_util = (uint16_t) temp32; } - sensor_update(AMECSENSOR_ARRAY_PTR(UTIL2MSP0C0, i_core), l_core_util); - + sensor_update(AMECSENSOR_ARRAY_PTR(UTIL4MSP0C0, i_core), l_core_util); // ------------------------------------------------------ // Per Thread Utilization @@ -445,19 +435,22 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // <amec_formula> // Result: Calculated Core Utilization // Sensor: None - // Timescale: 2ms + // Timescale: 4ms // Units: 0.01 % // Min/Max: 0/10000 (0/100%) - // Formula: cyc_delta = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-2ms]) - // run_delta = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-2ms]) - // + // Formula: cyc_delta = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-4ms]) + // run_delta = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-4ms]) // UTIL(in %) = run_delta / cyc_delta + // + // NOTE: cyc_delta is the total number of cycles run by the core in 4ms + // NOTE: run_delta is the total number of cycles run by a specific thread in 4ms // </amec_formula> // Get RAW CYCLES for Thread - temp32 = i_core_data_ptr->per_thread[0].raw_cycles; + // Thread raw cycles are the same as core raw cycles + temp32 = i_core_data_ptr->empath.raw_cycles; temp32a = g_amec->proc[0].core[i_core].prev_PC_RAW_Th_CYCLES; - temp32 = l_cycles2ms = temp32 - temp32a; + l_cycles4ms = temp32 - temp32a; for(i=0; i<MAX_THREADS_PER_CORE; i++) { @@ -471,18 +464,19 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) temp16a = 10000; // Mult * 10000 to get finer resolution for 0.01% temp32 = ((uint32_t)temp16a)*((uint32_t)temp16); - temp32a = l_cycles2ms; + temp32a = l_cycles4ms; temp32a = temp32a >> 8; // Drop non-significant bits // Calculate Utilization - temp32 = temp32 / temp32a; + if (0 == temp32a) temp32 = 0; // Prevent divide by 0 + else temp32 = temp32 / temp32a; // Update per thread value for this core if(l_core_sleep_winkle) { temp32 = 0; } - g_amec->proc[0].core[i_core].thread[i].util2ms_thread = (uint16_t) temp32; + g_amec->proc[0].core[i_core].thread[i].util4ms_thread = (uint16_t) temp32; } // No sensors to update for perThread Util @@ -491,59 +485,38 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // Per Core Sleep/Winkle Count // ------------------------------------------------------ - // Get Current Idle State of Chiplet + // Get deepest idle state entered by the chiplet since the last read + // The SLEEPCNT and WINKLECNT sensors are updated in amec_slv_state_0() function - temp16 = CONVERT_UINT64_UINT16_UPPER(i_core_data_ptr->pcb_slave.pm_history.value); - temp16 = temp16 & 0xE000; - temp16 = temp16 >> 13; + temp16 = CONVERT_UINT64_UINT16_MIDUPPER(i_core_data_ptr->stop_state_hist); + temp16 = temp16 & 0xF000; + temp16 = temp16 >> 12; switch(temp16) { - case 0: break; // Run State - case 1: break; // Special Wakeup - case 2: break; // Nap - case 3: SETBIT(g_amec->proc[0].sleep_cnt,i_core); break; // Legacy Sleep - case 4: SETBIT(g_amec->proc[0].sleep_cnt,i_core); break; // Fast Sleep - case 5: SETBIT(g_amec->proc[0].sleep_cnt,i_core); break; // Deep Sleep - case 6: SETBIT(g_amec->proc[0].winkle_cnt,i_core); break; // Fast Winkle - case 7: SETBIT(g_amec->proc[0].winkle_cnt,i_core); break; // Deep Winkle + case 0: // Stop 0: Run State + case 1: // Stop 1: Nap + break; + case 2: // Stop 2: Fast Sleep + case 3: // Stop 3: Fast Sleep @ Vmin + case 4: // Stop 4: Deep Sleep "instant on" + case 5: // Stop 5-7: Higher Latency Deep Sleep + case 6: + case 7: + case 8: // Stop 8-10: Deep Sleep+ + case 9: + case 10: + SETBIT(g_amec->proc[0].sleep_cnt,i_core); + break; + case 11: // Stop 11-15: Quad Deep Winkle + case 12: + case 13: + case 14: + case 15: + SETBIT(g_amec->proc[0].winkle_cnt,i_core); + break; } // ------------------------------------------------------ - // Core Memory Hierarchy C LPARx Utilization counters - // ------------------------------------------------------ - for(i=0; i<4; i++) - { - // Extract the utilization counter - temp32 = i_core_data_ptr->per_partition_memory.count[i]; - - // Convert counter to 0.01 Mrps resolution. Since we access every 2 ms: - // ((2ms read * 500) / 10000) - temp32a = temp32 - g_amec->proc[0].core[i_core].prev_lpar_mem_cnt[i]; - g_amec->proc[0].core[i_core].prev_lpar_mem_cnt[i] = temp32; - temp32 = (temp32a * 5) / 100; - - // Store the bandwidth for this LPAR - g_amec->proc[0].core[i_core].membw[i] = (uint16_t)temp32; - } - - // Sum up all the memory bandwidth data from the LPARs - temp32 = g_amec->proc[0].core[i_core].membw[0] + - g_amec->proc[0].core[i_core].membw[1] + - g_amec->proc[0].core[i_core].membw[2] + - g_amec->proc[0].core[i_core].membw[3]; - - // Divide by two due to a bug in the hardware - temp32 = temp32/2; - - // See if core is sleeping/winkled - if(l_core_sleep_winkle) - { - temp32 = 0; - } - // Update Sensor for this core - sensor_update( AMECSENSOR_ARRAY_PTR(CMBW2MSP0C0,i_core), (uint16_t) temp32); - - // ------------------------------------------------------ // Core Stall counters // ------------------------------------------------------ temp32 = i_core_data_ptr->empath.freq_sens_busy; @@ -553,12 +526,12 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // See if core is sleeping/winkled if(l_core_sleep_winkle) - { - temp32 = 0; - } + { + temp32 = 0; + } // Update Sensor for this core - sensor_update( AMECSENSOR_ARRAY_PTR(NOTBZE2MSP0C0,i_core), (uint16_t) temp32); + sensor_update( AMECSENSOR_ARRAY_PTR(NOTBZE4MSP0C0,i_core), (uint16_t) temp32); temp32 = i_core_data_ptr->empath.freq_sens_finish; temp32a = g_amec->proc[0].core[i_core].prev_FREQ_SENS_FINISH; @@ -567,12 +540,12 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // See if core is sleeping/winkled if(l_core_sleep_winkle) - { - temp32 = 0; - } + { + temp32 = 0; + } // Update Sensor for this core - sensor_update( AMECSENSOR_ARRAY_PTR(NOTFIN2MSP0C0,i_core), (uint16_t) temp32); + sensor_update( AMECSENSOR_ARRAY_PTR(NOTFIN4MSP0C0,i_core), (uint16_t) temp32); // ------------------------------------------------------ // Per Core Normalized Average Utilization @@ -580,7 +553,7 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // <amec_formula> // Result: Calculated Normalized Average Core Utilization // Sensor: NUTIL3SP0C0 - // Timescale: 2ms (3s rolling average) + // Timescale: 4ms (3s rolling average) // Units: 0.01 % // Min/Max: 0/10000 (0/100%) // </amec_formula> @@ -597,13 +570,13 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) if(g_amec->proc[0].core[i_core].sample_count == l_time_interval) { // Increase resolution of the UTIL accumulator by two decimal places - temp32 = (uint32_t)AMECSENSOR_ARRAY_PTR(UTIL2MSP0C0,i_core)->accumulator * 100; + temp32 = (uint32_t)AMECSENSOR_ARRAY_PTR(UTIL4MSP0C0,i_core)->accumulator * 100; // Calculate average utilization of this core temp32 = temp32 / g_amec->proc[0].core[i_core].sample_count; g_amec->proc[0].core[i_core].avg_util = temp32; // Increase resolution of the FREQA accumulator by two decimal places - temp32 = (uint32_t)AMECSENSOR_ARRAY_PTR(FREQA2MSP0C0,i_core)->accumulator * 100; + temp32 = (uint32_t)AMECSENSOR_ARRAY_PTR(FREQA4MSP0C0,i_core)->accumulator * 100; // Calculate average frequency of this core temp32 = temp32 / g_amec->proc[0].core[i_core].sample_count; g_amec->proc[0].core[i_core].avg_freq = temp32; @@ -617,12 +590,6 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) temp32 = temp32 + l_core_util*100; g_amec->proc[0].core[i_core].avg_util = temp32 / l_time_interval; - // Could be needed for increase accuracy - //if(g_amec->proc[0].core[i_core].avg_util > 9000) - //{ This rounds up only! - //g_amec->proc[0].core[i_core].avg_util = (temp32+ (1500-1)) / 1500; - //} - // Calculate average frequency for this core temp32 = (uint32_t) g_amec->proc[0].core[i_core].avg_freq; temp32 = temp32 * (l_time_interval-1); @@ -655,7 +622,6 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core) } } - void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core) { #define TWO_PWR_24_MASK 0x00FFFFFF @@ -673,15 +639,15 @@ void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core) UINT32 temp32 = 0; UINT32 ticks_2mhz = 0; // IPS sensor interval in 2mhz ticks BOOLEAN l_core_sleep_winkle = FALSE; - uint32_t l_pm_state_hist_reg = 0; + uint32_t l_stop_state_hist_reg = 0; + uint8_t thread = 0; - - // Read the high-order bytes of PM State History register for this core - l_pm_state_hist_reg = i_core_data_ptr->pcb_slave.pm_history.words.high_order; + // Read the high-order bytes of OCC Stop State History Register + l_stop_state_hist_reg = (uint32_t) (i_core_data_ptr->stop_state_hist >> 32); // If core is in fast/deep sleep mode or fast/winkle mode, then set a flag // indicating this - if(l_pm_state_hist_reg & OCC_PAST_CORE_CLK_STOP) + if(l_stop_state_hist_reg & OCC_CORE_STOP_GATED) { l_core_sleep_winkle = TRUE; } @@ -690,58 +656,45 @@ void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core) /* Code */ /*------------------------------------------------------------------------*/ - // Get Run Cycles + // Get current and last run Cycles cyc1 = i_core_data_ptr->empath.run_cycles; cyc2 = g_amec->proc[0].core[i_core].prev_PC_RUN_CYCLES; cyc2 = cyc1 - cyc2; - // Following lines look bogus...the counters are supposed to be 32-bit - // since we are doing 24-bit unsigned math, we need to account for the - // overflow case. If this occurs, we mask off the "overflow" to make it behave - // like a 32-bit subtraction overflow would. Commenting them out. - //if ( cyc2 < 0 ) - //{ - // cyc2 &= TWO_PWR_24_MASK; - //} + // Calculate core completion and dispatch (sum of all threads) + for ( thread = 0; thread < MAX_THREADS_PER_CORE; thread++ ) + { + fin1 += i_core_data_ptr->per_thread[thread].completion; + disp1 += i_core_data_ptr->per_thread[thread].dispatch; + } - fin1 = i_core_data_ptr->empath.completion; + // Calculate delta of completed instructions fin2 = g_amec->proc[0].core[i_core].prev_PC_COMPLETED; fin2 = fin1 - fin2; - // Is this counting every completed instruction or 1 of every 16? - // Why are we masking 20 bits of a 32-bit counter? Commenting these lines out. - //if ( fin2 < 0 ) - //{ - // fin2 &= TWO_PWR_20_MASK; - //} - - disp1 = i_core_data_ptr->empath.dispatch; + // Calculate delta of dispatched instructions disp2 = g_amec->proc[0].core[i_core].prev_PC_DISPATCH; disp2 = disp1 - disp2; - if ( disp2 < 0 ) - { - disp2 &= TWO_PWR_20_MASK; - } - // ------------------------------------------------------ // Per Core IPC Calculation // ------------------------------------------------------ // <amec_formula> // Result: Calculated Instructions per Cycle // Sensor: None - // Timescale: 2ms + // Timescale: 4ms // Units: 0.01 IPC // Min/Max: ? - // Formula: ipc_delta = (INST_COMPLETE[t=now] - INST_COMPLETE[t=-2ms]) - // run_cycles = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-2ms]) - // 100 = Convert 0.01 DPC + // Formula: ipc_delta = (INST_COMPLETE[t=now] - INST_COMPLETE[t=-4ms]) + // run_cycles = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-4ms]) + // 100 = Convert 0.01 IPC // // IPC(in 0.01 IPC) = (ipc_delta * 100) / run_cycles // </amec_formula> - temp32 = (fin2 * 100); // In units of IPS - temp32 = temp32 / cyc2; // In units of 0.01 DPC - g_amec->proc[0].core[i_core].ipc = temp32; + temp32 = (fin2 * 100); // Number of instructions completed (x100) + if (0 == cyc2) temp32 = 0; // Prevent divide by zero + else temp32 = temp32 / cyc2; // In units of 0.01 IPC + g_amec->proc[0].core[i_core].ipc = temp32; // Currently unused // ------------------------------------------------------ @@ -750,18 +703,19 @@ void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // <amec_formula> // Result: Calculated dispatched Instructions per Cycle // Sensor: None - // Timescale: 2ms - // Units: 0.2Mips + // Timescale: 4ms + // Units: 0.01 DPC // Min/Max: ? - // Formula: dpc_delta = (INST_DISPATCH[t=now] - INST_DISPATCH[t=-2ms]) - // run_cycles = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-2ms]) - // 100 = Convert 0.01 DPC + // Formula: dpc_delta = (INST_DISPATCH[t=now] - INST_DISPATCH[t=-4ms]) + // run_cycles = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-4ms]) + // 100 = Convert 0.01 DPC // // DPC(in 0.01DPC) = (dpc_delta * 100) / run_cycles // </amec_formula> - temp32 = (disp2 * 100); // In units of IPS - temp32 = temp32 / cyc2; // In units of 0.01 DPC - g_amec->proc[0].core[i_core].dpc = temp32; + temp32 = (disp2 * 100); // Number of instructions dispatched (x100) + if (0 == cyc2) temp32 = 0; // Prevent divide by zero + else temp32 = temp32 / cyc2; // In units of 0.01 DPC + g_amec->proc[0].core[i_core].dpc = temp32; // Currently unused // ------------------------------------------------------ // Per Core DPS Calculation @@ -769,75 +723,52 @@ void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core) // <amec_formula> // Result: Calculated dispatched Instructions per Second // Sensor: None - // Timescale: 2ms + // Timescale: 4ms // Units: 0.2Mips // Min/Max: ? - // Formula: dps_delta = (INST_DISPATCH[t=now] - INST_DISPATCH[t=-2ms]) - // 500 = # of 2ms periods in 1 second - // 50,000 = Convert IPS to 0.2MIPS + // Formula: dps_delta = (INST_DISPATCH[t=now] - INST_DISPATCH[t=-4ms]) + // 250 = # of 4ms periods in 1 second + // 50,000 = Convert IPS to 0.2MIPS // - // DPS(in 0.2Mips) = (dps_delta * 500) / 50,000 + // DPS(in 0.2Mips) = (dps_delta * 250) / 50,000 // </amec_formula> - temp32 = (disp2 * AMEC_SMH_PERIODS_IN_1SEC); // In untis of IPS - temp32 = temp32 / 50000; // In units of 0.2Mips (max 327675 Mips for uint16_t) - g_amec->proc[0].core[i_core].dps = temp32; + + temp32 = (disp2 * AMEC_CORE_COLLECTION_1SEC); // Number of instructions dispatched extrapolated to 1s. + temp32 = temp32 / 50000; // In units of 0.2Mips (max 327675 Mips for uint16_t) + g_amec->proc[0].core[i_core].dps = temp32; // Currently unused // ------------------------------------------------------ // Per Core IPS Calculation // ------------------------------------------------------ // <amec_formula> // Result: Calculated Instructions per Second - // Sensor: IPS2MSP0C0 - // Timescale: 2ms + // Sensor: IPS4MSP0C0 + // Timescale: 4ms // Units: 0.2Mips // Min/Max: ? // Formula: - // comp_delta = (INST_COMPLETE[t=now] - INST_COMPLETE[t=-2ms]) - // ticks_delta = (TOD[t=now] - TOD[t=-2ms]) + // comp_delta = (INST_COMPLETE[t=now] - INST_COMPLETE[t=-4ms]) + // ticks_delta = (TOD[t=now] - TOD[t=-4ms]) // MIPS = comp_delta (insns/interval) * (1 interval per ticks_delta 2mhz ticks) * (2M 2mhz ticks / s) / 1M // = (2* fin2) / ticks_2mhz + // // Note: For best resolution do multiply first and division last. + // Note: For an explanation regarding the multiply by 2, see the note under FREQA4MSP0C0. // </amec_formula> ticks_2mhz = i_core_data_ptr->empath.tod_2mhz - g_amec->proc[0].core[i_core].prev_tod_2mhz; - temp32 = (fin2 << 1) / ticks_2mhz; - // See if core is sleeping/winkled - if(l_core_sleep_winkle) - { - temp32 = 0; - } - sensor_update( AMECSENSOR_ARRAY_PTR(IPS2MSP0C0,i_core), (uint16_t) temp32); -} - - -// Function Specification -// -// Name: amec_calc_spurr -// -// Description: Do SPURR calculation. Must run after FreqA is calculated. -// -// Thread: RealTime Loop -// -// End Function Specification -void amec_calc_spurr(uint8_t i_core) -{ - uint16_t l_actual_freq = AMECSENSOR_ARRAY_PTR(FREQA2MSP0C0, i_core)->sample; - uint16_t l_nominal = 2790; - uint32_t temp32; - - // Sanity Check on Freq - if(l_actual_freq < UPPER_LIMIT_PROC_FREQ_MHZ) - { - temp32 = ((uint32_t) (l_actual_freq * 1000) / l_nominal); - // Scale for SPURR Register (64 = Nominal, 32 = Nom-50%) - temp32 = (temp32 * 64) / 1000; + if (0 == ticks_2mhz) temp32 = 0; + else temp32 = (fin2 << 1) / ticks_2mhz; - sensor_update( AMECSENSOR_ARRAY_PTR(SPURR2MSP0C0,i_core), (uint16_t) temp32); - } + // See if core is sleeping/winkled + if(l_core_sleep_winkle) + { + temp32 = 0; + } + sensor_update( AMECSENSOR_ARRAY_PTR(IPS4MSP0C0,i_core), (uint16_t) temp32); } -#endif /*----------------------------------------------------------------------------*/ /* End */ diff --git a/src/occ_405/amec/amec_sensors_core.h b/src/occ_405/amec/amec_sensors_core.h index 90d6aef..4a58a89 100755 --- a/src/occ_405/amec/amec_sensors_core.h +++ b/src/occ_405/amec/amec_sensors_core.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -38,13 +38,15 @@ /*----------------------------------------------------------------------------*/ /* Defines/Constants */ /*----------------------------------------------------------------------------*/ -// See bit definition of PM State History Register for OCC -#define OCC_PM_STATE_MASK 0x1F000000 //Mask bits 0:2 of the register -#define OCC_PAST_FAST_SLEEP 0x18000000 //Core has been in fast sleep -#define OCC_PAST_DEEP_SLEEP 0x1C000000 //Core has been in deep sleep -#define OCC_PAST_FAST_WINKLE 0x1E000000 //Core has been in fast winkle -#define OCC_PAST_DEEP_WINKLE 0x1F000000 //Core has been in deep winkle -#define OCC_PAST_CORE_CLK_STOP 0x08000000 //Core has been in an idle state with core clocks stopped +// See bit definition of OCC Stop State History Register +#define OCC_CORE_STOP_GATED 0x80000000 // Set upon entry stop entry transition (or initial power on) + // Not cleared until core is fully accessible +#define OCC_CORE_SWUP_DONE 0x40000000 // Special wake-up done +#define OCC_CORE_ACT_STOP_LVL 0x00F00000 // Actual stop level (probably changes too fast to be useful) +// The following clear upon reading +#define OCC_DEEPEST_REQ_STOP_LVL 0x000F0000 // Deepest requestest stop level +#define OCC_DEEPEST_ACT_STOP_LVL 0x0000F000 // Deepest stop state fully entered +#define OCC_IVRM_ENABLED_HIST 0x00000800 // Bit indicating if IVRM has been enabled /*----------------------------------------------------------------------------*/ /* Structures */ diff --git a/src/occ_405/amec/amec_sensors_power.c b/src/occ_405/amec/amec_sensors_power.c index fd3e950..c1ed9d7 100755 --- a/src/occ_405/amec/amec_sensors_power.c +++ b/src/occ_405/amec/amec_sensors_power.c @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/occ/amec/amec_sensors_power.c $ */ +/* $Source: src/occ_405/amec/amec_sensors_power.c $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -354,7 +354,7 @@ void amec_update_apss_sensors(void) { if (G_sysConfigData.is_occ_present & (1<< l_occCount)) { - l_allOccAvgFreqOver250us += G_dcom_slv_outbox_rx[l_occCount].freqa2msp0; + l_allOccAvgFreqOver250us += G_dcom_slv_outbox_rx[l_occCount].freqa4msp0; l_presentOCCs++; } } diff --git a/src/occ_405/amec/amec_slave_smh.c b/src/occ_405/amec/amec_slave_smh.c index e12dca1..1ccef2b 100755 --- a/src/occ_405/amec/amec_slave_smh.c +++ b/src/occ_405/amec/amec_slave_smh.c @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/occ/amec/amec_slave_smh.c $ */ +/* $Source: src/occ_405/amec/amec_slave_smh.c $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -384,19 +384,20 @@ void amec_slv_state_0(void) // Update Proc Core sensors (for this tick) //------------------------------------------------------- +/* Not yet supported //------------------------------------------------------- // Update Centaur sensors (for this tick) //------------------------------------------------------- -// amec_update_centaur_sensors(CENTAUR_0); - + amec_update_centaur_sensors(CENTAUR_0); +*/ //------------------------------------------------------- // Update Sleep Count & Winkle Count Sensors //------------------------------------------------------- - sensor_update(AMECSENSOR_PTR(SLEEPCNT2MSP0), + sensor_update(AMECSENSOR_PTR(SLEEPCNT4MSP0), __builtin_popcount( g_amec->proc[0].sleep_cnt)); g_amec->proc[0].sleep_cnt = 0; - sensor_update(AMECSENSOR_PTR(WINKCNT2MSP0), + sensor_update(AMECSENSOR_PTR(WINKCNT4MSP0), __builtin_popcount(g_amec->proc[0].winkle_cnt)); g_amec->proc[0].winkle_cnt = 0; @@ -405,9 +406,9 @@ void amec_slv_state_0(void) //------------------------------------------------------- sensor_vector_update(AMECSENSOR_PTR(TEMP4MSP0), 1); sensor_vector_update(AMECSENSOR_PTR(TEMP4MSP0PEAK),1); - sensor_vector_update(AMECSENSOR_PTR(FREQA2MSP0), 1); - sensor_vector_update(AMECSENSOR_PTR(IPS2MSP0), 1); - sensor_vector_update(AMECSENSOR_PTR(UTIL2MSP0), 1); + sensor_vector_update(AMECSENSOR_PTR(FREQA4MSP0), 1); + sensor_vector_update(AMECSENSOR_PTR(IPS4MSP0), 1); + sensor_vector_update(AMECSENSOR_PTR(UTIL4MSP0), 1); // Call the trace function for 2ms tracing if it has been configured via // Amester. If not configured, this call will return immediately. @@ -488,10 +489,10 @@ void amec_slv_state_3(void) // Update Proc Core sensors (for this tick) //------------------------------------------------------- -/* Not yet supported //------------------------------------------------------- // Update Centaur sensors (for this tick) //------------------------------------------------------- +/* Not yet supported amec_update_centaur_sensors(CENTAUR_3); //------------------------------------------------------- diff --git a/src/occ_405/amec/amec_smh.h b/src/occ_405/amec/amec_smh.h index 9588aa7..9b01c2b 100755 --- a/src/occ_405/amec/amec_smh.h +++ b/src/occ_405/amec/amec_smh.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -65,8 +65,9 @@ // Number of uS in 1 full period of the AMEC State Machine #define AMEC_US_PER_SMH_PERIOD (AMEC_SMH_STATES_PER_LVL * MICS_PER_TICK) // Number of <AMEC_US_PER_SMH_PERIOD> that happen in 1 second -#define AMEC_SMH_PERIODS_IN_1SEC (10000000 / AMEC_US_PER_SMH_PERIOD) - +#define AMEC_SMH_PERIODS_IN_1SEC (1000000 / AMEC_US_PER_SMH_PERIOD) +// Number of times core data is processed. The AMEC SMH goes around twice per tick cycle. +#define AMEC_CORE_COLLECTION_1SEC (AMEC_SMH_PERIODS_IN_1SEC / 2) //************************************************************************* // Structures //************************************************************************* diff --git a/src/occ_405/amec/amec_sys.h b/src/occ_405/amec/amec_sys.h index f405fa7..a8582dd 100755 --- a/src/occ_405/amec/amec_sys.h +++ b/src/occ_405/amec/amec_sys.h @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/occ/amec/amec_sys.h $ */ +/* $Source: src/occ_405/amec/amec_sys.h $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -268,7 +268,7 @@ typedef struct //----------------------------------- // Calculations & Interim Data //----------------------------------- - uint16_t util2ms_thread; + uint16_t util4ms_thread; } amec_core_thread_t; @@ -281,19 +281,16 @@ typedef struct //----------------------------------- // Sensors //----------------------------------- -// sensor_t cpm2ms; //CPM - Commented out as requested by Malcolm sensor_t freq250us; - sensor_t freqa2ms; - sensor_t ips2ms; - sensor_t mcpifd2ms; - sensor_t mcpifi2ms; - sensor_t spurr2ms; + sensor_t freqa4ms; + sensor_t ips4ms; + sensor_t mcpifd4ms; + sensor_t mcpifi4ms; sensor_t temp4ms; - sensor_t util2ms; + sensor_t util4ms; sensor_t nutil3s; sensor_t mstl2ms; sensor_t cmt2ms; - sensor_t cmbw2ms; sensor_t ppic; sensor_t pwrpx250us; @@ -306,7 +303,6 @@ typedef struct uint32_t prev_PC_COMPLETED; uint32_t prev_PC_RAW_Th_CYCLES; uint32_t prev_tod_2mhz; - uint32_t prev_lpar_mem_cnt[4]; uint32_t prev_FREQ_SENS_BUSY; uint32_t prev_FREQ_SENS_FINISH; @@ -323,8 +319,6 @@ typedef struct uint16_t dts_hottest; // Counter of number of samples for calculating average utilization & frequency uint16_t sample_count; - // Array of memory bandwidth for each LPAR - uint16_t membw[4]; // Average utilization over a fixed time interval uint32_t avg_util; @@ -440,10 +434,10 @@ typedef struct amec_proc_pwr_votes_t pwr_votes; // Processor Sensors - sensor_t freqa2ms; - vectorSensor_t freqa2ms_vector; - sensor_t ips2ms; - vectorSensor_t ips2ms_vector; + sensor_t freqa4ms; + vectorSensor_t freqa4ms_vector; + sensor_t ips4ms; + vectorSensor_t ips4ms_vector; sensor_t memsp2ms; vectorSensor_t memsp2ms_vector; sensor_t pwr250us; @@ -451,15 +445,15 @@ typedef struct sensor_t cur250usvdd; sensor_t pwr250usvcs; sensor_t pwr250usmem; - sensor_t sleepcnt2ms; - sensor_t winkcnt2ms; + sensor_t sleepcnt4ms; + sensor_t winkcnt4ms; sensor_t sp250us; sensor_t temp4ms; vectorSensor_t temp4ms_vector; sensor_t temp4mspeak; vectorSensor_t temp4mspeak_vector; - sensor_t util2ms; - vectorSensor_t util2ms_vector; + sensor_t util4ms; + vectorSensor_t util4ms_vector; // Memory Summary Sensors sensor_t temp2mscent; |