Skip to content

Commit

Permalink
Add Droop counter sensors
Browse files Browse the repository at this point in the history
Change-Id: If4c367eaeaaf746619d537d4d8424cf018591563
RTC: 155684
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45574
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Andres A. Lugo-Reyes <aalugore@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
  • Loading branch information
dgilbert999 authored and marthabroyles committed Sep 21, 2017
1 parent f92b6d2 commit 2fe9ab3
Show file tree
Hide file tree
Showing 11 changed files with 219 additions and 90 deletions.
20 changes: 16 additions & 4 deletions src/include/core_data.h
Expand Up @@ -68,6 +68,13 @@

#define EMPATH_CORE_THREADS 4

// Droop events cache=bit37, cores = bits 42,46,50,54
#define CACHE_VDM_LARGE_DROOP 0x0000000004000000ull
#define CORE0_VDM_SMALL_DROOP 0x0000000000200000ull
#define CORE1_VDM_SMALL_DROOP 0x0000000000020000ull
#define CORE2_VDM_SMALL_DROOP 0x0000000000002000ull
#define CORE3_VDM_SMALL_DROOP 0x0000000000000200ull


typedef struct
{
Expand All @@ -85,7 +92,6 @@ typedef struct
typedef struct
{
uint32_t ifu_throttle;
//uint32_t isu_throttle; // No longer exists
uint32_t ifu_active;
uint32_t undefined;
uint32_t v_droop; // new for p9
Expand All @@ -106,17 +112,23 @@ typedef struct
sensor_result_t cache[2];
} CoreDataDts;

typedef struct
{
uint32_t cache_large_event;
uint32_t core_small_event;
} DroopEvents;

//
// The instance of this data object must be 8 byte aligned
//
typedef struct // 128
typedef struct // 136 bytes
{
CoreDataEmpath empath; //32
CoreDataThrottle throttle; //16
CoreDataPerThread per_thread[EMPATH_CORE_THREADS]; // 64
CoreDataDts dts; //8
uint64_t stop_state_hist;
CoreDataDts dts; // 8
uint64_t stop_state_hist; // 8
DroopEvents droop; // 8
} CoreData;

#ifdef __cplusplus
Expand Down
4 changes: 4 additions & 0 deletions src/include/p9_config.h
Expand Up @@ -34,6 +34,10 @@

#define THERM_DTS_RESULT 0x00050000

#define MAX_NUM_CORES 24
#define CORES_PER_QUAD 4
#define MAX_NUM_QUADS (MAX_NUM_CORES/CORES_PER_QUAD)

typedef union dts_sensor_result_reg
{
uint64_t value;
Expand Down
100 changes: 57 additions & 43 deletions src/include/registers/cme_register_addresses.h
Expand Up @@ -28,7 +28,8 @@
/// \file cme_register_addresses.h
/// \brief Symbolic addresses for the CME unit

// *** WARNING *** - This file is generated automatically, do not edit.
// Copied from
// ekb/chips/p9/common/pmlib/include/registers/cme_register_addresses.h


#define CME_FIRPIB_BASE 0x10012000
Expand All @@ -47,21 +48,22 @@
#define CME_SCOM_CSAR 0x1001200d
#define CME_SCOM_CSDR 0x1001200e
#define CME_SCOM_BCECSR 0x1001200f
#define CME_SCOM_BCEBAR0 0x10012010
#define CME_SCOM_BCEBAR1 0x10012011
#define CME_SCOM_QFMR 0x10012012
#define CME_SCOM_AFSR 0x10012013
#define CME_SCOM_AFTR 0x10012014
#define CME_SCOM_VTSR0 0x10012015
#define CME_SCOM_VTSR1 0x10012016
#define CME_SCOM_VDSR 0x10012017
#define CME_SCOM_EIIR 0x10012019
#define CME_SCOM_FWMR 0x1001201a
#define CME_SCOM_FWMR_CLR 0x1001201b
#define CME_SCOM_FWMR_OR 0x1001201c
#define CME_SCOM_SICR 0x1001201d
#define CME_SCOM_SICR_CLR 0x1001201e
#define CME_SCOM_SICR_OR 0x1001201f
#define CME_SCOM_XIXCR 0x10012010
#define CME_SCOM_XIRAMRA 0x10012011
#define CME_SCOM_XIRAMGA 0x10012012
#define CME_SCOM_XIRAMDBG 0x10012013
#define CME_SCOM_XIRAMEDR 0x10012014
#define CME_SCOM_XIDBGPRO 0x10012015
#define CME_SCOM_XISIB 0x10012016
#define CME_SCOM_XIMEM 0x10012017
#define CME_SCOM_CMEXISGB 0x10012018
#define CME_SCOM_XIICAC 0x10012019
#define CME_SCOM_XIPCBQ0 0x1001201a
#define CME_SCOM_XIPCBQ1 0x1001201b
#define CME_SCOM_XIPCBMD0 0x1001201c
#define CME_SCOM_XIPCBMD1 0x1001201d
#define CME_SCOM_XIPCBMI0 0x1001201e
#define CME_SCOM_XIPCBMI1 0x1001201f
#define CME_SCOM_FLAGS 0x10012020
#define CME_SCOM_FLAGS_CLR 0x10012021
#define CME_SCOM_FLAGS_OR 0x10012022
Expand All @@ -73,36 +75,41 @@
#define CME_SCOM_EITR 0x10012028
#define CME_SCOM_EISTR 0x10012029
#define CME_SCOM_EINR 0x1001202a
#define CME_SCOM_SISR 0x1001202b
#define CME_SCOM_ICRR 0x1001202c
#define CME_SCOM_XIXCR 0x10012030
#define CME_SCOM_XIRAMRA 0x10012031
#define CME_SCOM_XIRAMGA 0x10012032
#define CME_SCOM_XIRAMDBG 0x10012033
#define CME_SCOM_XIRAMEDR 0x10012034
#define CME_SCOM_XIDBGPRO 0x10012035
#define CME_SCOM_XISIB 0x10012036
#define CME_SCOM_XIMEM 0x10012037
#define CME_SCOM_CMEXISGB 0x10012038
#define CME_SCOM_XIICAC 0x10012039
#define CME_SCOM_XIPCBQ0 0x1001203a
#define CME_SCOM_XIPCBQ1 0x1001203b
#define CME_SCOM_XIPCBMD0 0x1001203c
#define CME_SCOM_XIPCBMD1 0x1001203d
#define CME_SCOM_XIPCBMI0 0x1001203e
#define CME_SCOM_XIPCBMI1 0x1001203f
#define CME_SCOM_EIIR 0x1001202b
#define CME_SCOM_VCCR 0x1001202c
#define CME_SCOM_IDCR 0x1001202d
#define CME_SCOM_CIDSR 0x1001202e
#define CME_SCOM_QIDSR 0x1001202f
#define CME_SCOM_BCEBAR0 0x10012030
#define CME_SCOM_BCEBAR1 0x10012031
#define CME_SCOM_QFMR 0x10012032
#define CME_SCOM_AFSR 0x10012033
#define CME_SCOM_AFTR 0x10012034
#define CME_SCOM_VDCR 0x10012035
#define CME_SCOM_VNCR 0x10012036
#define CME_SCOM_VDSR 0x10012037
#define CME_SCOM_VECR 0x10012038
#define CME_SCOM_VCTR 0x10012039
#define CME_SCOM_LMCR 0x1001203a
#define CME_SCOM_LMCR_CLR 0x1001203b
#define CME_SCOM_LMCR_OR 0x1001203c
#define CME_SCOM_SICR 0x1001203d
#define CME_SCOM_SICR_CLR 0x1001203e
#define CME_SCOM_SICR_OR 0x1001203f
#define CME_SCOM_PMSRS0 0x10012040
#define CME_SCOM_PMSRS1 0x10012041
#define CME_SCOM_PMCRS0 0x10012042
#define CME_SCOM_PMCRS1 0x10012043
#define CME_SCOM_PSCRS00 0x10012044
#define CME_SCOM_PSCRS10 0x10012045
#define CME_SCOM_PSCRS01 0x10012048
#define CME_SCOM_PSCRS01 0x10012045
#define CME_SCOM_PSCRS02 0x10012046
#define CME_SCOM_PSCRS03 0x10012047
#define CME_SCOM_PSCRS10 0x10012048
#define CME_SCOM_PSCRS11 0x10012049
#define CME_SCOM_PSCRS02 0x1001204c
#define CME_SCOM_PSCRS12 0x1001204d
#define CME_SCOM_PSCRS03 0x10012050
#define CME_SCOM_PSCRS13 0x10012051
#define CME_SCOM_PSCRS12 0x1001204a
#define CME_SCOM_PSCRS13 0x1001204b
#define CME_SCOM_SISR 0x1001204c
#define CME_SCOM_ICRR 0x1001204d
#define CME_LOCAL_BASE 0xC0000000
#define CME_LCL_EISR 0xc0000000
#define CME_LCL_EISR_OR 0xc0000010
Expand All @@ -126,7 +133,9 @@
#define CME_LCL_AFSR 0xc0000160
#define CME_LCL_AFTR 0xc0000180
#define CME_LCL_LMCR 0xc00001a0
#define CME_LCL_BCECSR 0xc00001f0
#define CME_LCL_LMCR_OR 0xc00001b0
#define CME_LCL_LMCR_CLR 0xc00001b8
#define CME_LCL_BCECSR 0xc00001e0
#define CME_LCL_PMSRS0 0xc0000200
#define CME_LCL_PMSRS1 0xc0000220
#define CME_LCL_PMCRS0 0xc0000240
Expand Down Expand Up @@ -154,9 +163,14 @@
#define CME_LCL_XIPCBMD1 0xc00005a0
#define CME_LCL_XIPCBMI0 0xc00005c0
#define CME_LCL_XIPCBMI1 0xc00005e0
#define CME_LCL_VTSR0 0xc0000600
#define CME_LCL_VTSR1 0xc0000620
#define CME_LCL_VDCR 0xc0000600
#define CME_LCL_VNCR 0xc0000620
#define CME_LCL_VDSR 0xc0000640
#define CME_LCL_VECR 0xc0000660
#define CME_LCL_VCCR 0xc0000680
#define CME_LCL_IDCR 0xc00006a0
#define CME_LCL_CIDSR 0xc00006c0
#define CME_LCL_QIDSR 0xc00006e0
#define CME_LCL_ICCR 0xc0000700
#define CME_LCL_ICCR_OR 0xc0000710
#define CME_LCL_ICCR_CLR 0xc0000718
Expand Down
22 changes: 22 additions & 0 deletions src/occ_405/amec/amec_sensors_core.c
Expand Up @@ -56,6 +56,7 @@ 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_droop_sensors(CoreData * i_core_data_ptr, uint8_t i_core);

//*************************************************************************/
// Code
Expand Down Expand Up @@ -115,6 +116,11 @@ void amec_update_proc_core_sensors(uint8_t i_core)
amec_calc_ips_sensors(l_core_data_ptr,i_core);
}

//-------------------------------------------------------
// Update voltage droop counters
//-------------------------------------------------------
amec_calc_droop_sensors(l_core_data_ptr, i_core);

// ------------------------------------------------------
// Update PREVIOUS values for next time
// ------------------------------------------------------
Expand Down Expand Up @@ -768,6 +774,22 @@ void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
sensor_update( AMECSENSOR_ARRAY_PTR(IPSC0,i_core), (uint16_t) temp32);
}

// -------------------------------------------------
// Droop count sum for core and quad
// ------------------------------------------------
void amec_calc_droop_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
{
//CoreData only has any new droop events since the last time CoreData was read
uint32_t l_quad_droops = i_core_data_ptr->droop.cache_large_event;
uint32_t l_core_droops = i_core_data_ptr->droop.core_small_event;
int l_quad = i_core / 4;
sensor_t * l_quad_sensor = AMECSENSOR_ARRAY_PTR(VOLTDROOPCNTQ0, l_quad);
sensor_t * l_core_sensor = AMECSENSOR_ARRAY_PTR(VOLTDROOPCNTC0, i_core);

sensor_update( l_core_sensor, l_core_droops);
sensor_update( l_quad_sensor, l_quad_droops);
}

/*----------------------------------------------------------------------------*/
/* End */
/*----------------------------------------------------------------------------*/
2 changes: 2 additions & 0 deletions src/occ_405/amec/amec_sys.h
Expand Up @@ -295,6 +295,7 @@ typedef struct
sensor_t tempc;
sensor_t stopdeepreqc;
sensor_t stopdeepactc;
sensor_t voltdroopcntc;

//-----------------------------------
// Previous Tick Data
Expand Down Expand Up @@ -427,6 +428,7 @@ typedef struct
typedef struct
{
sensor_t tempq;
sensor_t voltdroopcntq;
} amec_quad_t;

//-------------------------------------------------------------
Expand Down
31 changes: 31 additions & 0 deletions src/occ_405/sensor/sensor_enum.h
Expand Up @@ -130,6 +130,12 @@ enum e_gsid
TEMPQ3,
TEMPQ4,
TEMPQ5,
VOLTDROOPCNTQ0,
VOLTDROOPCNTQ1,
VOLTDROOPCNTQ2,
VOLTDROOPCNTQ3,
VOLTDROOPCNTQ4,
VOLTDROOPCNTQ5,

// ------------------------------------------------------
// Regulator Sensors
Expand Down Expand Up @@ -444,6 +450,31 @@ enum e_gsid
STOPDEEPACTC22,
STOPDEEPACTC23,

VOLTDROOPCNTC0,
VOLTDROOPCNTC1,
VOLTDROOPCNTC2,
VOLTDROOPCNTC3,
VOLTDROOPCNTC4,
VOLTDROOPCNTC5,
VOLTDROOPCNTC6,
VOLTDROOPCNTC7,
VOLTDROOPCNTC8,
VOLTDROOPCNTC9,
VOLTDROOPCNTC10,
VOLTDROOPCNTC11,
VOLTDROOPCNTC12,
VOLTDROOPCNTC13,
VOLTDROOPCNTC14,
VOLTDROOPCNTC15,
VOLTDROOPCNTC16,
VOLTDROOPCNTC17,
VOLTDROOPCNTC18,
VOLTDROOPCNTC19,
VOLTDROOPCNTC20,
VOLTDROOPCNTC21,
VOLTDROOPCNTC22,
VOLTDROOPCNTC23,

// ------------------------------------------------------
// Memory Sensors
// ------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/occ_405/sensor/sensor_info.c
Expand Up @@ -328,6 +328,7 @@ const sensor_info_t G_sensor_info[] =
SENSOR_INFO_T_ENTRY( PROCOTTHROT, "#\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_EVERY_64TH_TICK_HZ, AMEFP( 1, 0) ),

SENS_QUAD_ENTRY_SET( TEMPQ, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_EVERY_16TH_TICK_HZ, AMEFP( 1, 0) ),
SENS_QUAD_ENTRY_SET( VOLTDROOPCNTQ, "#\0", AMEC_SENSOR_TYPE_VOLTAGE, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_EVERY_16TH_TICK_HZ, AMEFP( 1, 0) ),

/* ==ReguSensors== NameString Units Type Location Number Freq ScaleFactor */
SENSOR_INFO_T_ENTRY( VOLTVDD, "mV\0", AMEC_SENSOR_TYPE_VOLTAGE, AMEC_SENSOR_LOC_VRM, AMEC_SENSOR_NONUM, AMEEFP_EVERY_2ND_TICK_HZ, AMEFP( 1, -1) ),
Expand All @@ -349,6 +350,7 @@ const sensor_info_t G_sensor_info[] =
SENS_CORE_ENTRY_SET( TEMPC, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_EVERY_16TH_TICK_HZ, AMEFP( 1, 0) ),
SENS_CORE_ENTRY_SET( STOPDEEPREQC, "ss\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_EVERY_16TH_TICK_HZ, AMEFP( 1, 0) ),
SENS_CORE_ENTRY_SET( STOPDEEPACTC, "ss\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_EVERY_16TH_TICK_HZ, AMEFP( 1, 0) ),
SENS_CORE_ENTRY_SET( VOLTDROOPCNTC, "#\0",AMEC_SENSOR_TYPE_VOLTAGE, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_EVERY_16TH_TICK_HZ, AMEFP( 1, 0) ),

/* ==MemSensors== NameString Units Type Location Number Freq ScaleFactor */
SENS_MEMC_ENTRY_SET( MRDM, "GBs\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP( 128, -5) ),
Expand Down
13 changes: 13 additions & 0 deletions src/occ_405/sensor/sensor_main_memory.c
Expand Up @@ -101,6 +101,17 @@ typedef struct __attribute__ ((packed))
MAIN_MEM_SENSOR(gsid_prefix##22 , smf_mode, master_only) , \
MAIN_MEM_SENSOR(gsid_prefix##23 , smf_mode, master_only)

/**
* Macro to build main_mem_sensor_t instance for all quads
*/
#define MAIN_MEM_QUAD_SENSORS(gsid_prefix, smf_mode, master_only) \
MAIN_MEM_SENSOR(gsid_prefix##0 , smf_mode, master_only) , \
MAIN_MEM_SENSOR(gsid_prefix##1 , smf_mode, master_only) , \
MAIN_MEM_SENSOR(gsid_prefix##2 , smf_mode, master_only) , \
MAIN_MEM_SENSOR(gsid_prefix##3 , smf_mode, master_only) , \
MAIN_MEM_SENSOR(gsid_prefix##4 , smf_mode, master_only) , \
MAIN_MEM_SENSOR(gsid_prefix##5 , smf_mode, master_only)

/**
* Macro to build main_mem_sensor_t instances for all memory DIMMs.
*/
Expand Down Expand Up @@ -168,6 +179,8 @@ main_mem_sensor_t G_main_mem_sensors[] =
MAIN_MEM_SENSOR (VOLTVDDSENSE, true, false),
MAIN_MEM_SENSOR (VOLTVDN, true, false),
MAIN_MEM_SENSOR (VOLTVDNSENSE, true, false),
MAIN_MEM_CORE_SENSORS (VOLTDROOPCNTC, true, false),
MAIN_MEM_QUAD_SENSORS (VOLTDROOPCNTQ, true, false),

// AMEC_SENSOR_TYPE_TEMP: gsid smf_mode master_only
MAIN_MEM_SENSOR (TEMPNEST, false, false),
Expand Down
6 changes: 5 additions & 1 deletion src/occ_405/sensor/sensor_table.c
Expand Up @@ -366,7 +366,8 @@ const sensor_ptr_t G_amec_sensor_list[] =
// ------------------------------------------------------
// Quad Sensors (6 each)
// ------------------------------------------------------
QUAD_SENSOR_PTRS( TEMPQ, &g_amec_sys.proc[0].quad, tempq),
QUAD_SENSOR_PTRS( TEMPQ, &g_amec_sys.proc[0].quad, tempq),
QUAD_SENSOR_PTRS( VOLTDROOPCNTQ, &g_amec_sys.proc[0].quad, voltdroopcntq),

// ------------------------------------------------------
// Regulator Sensors
Expand All @@ -393,6 +394,7 @@ const sensor_ptr_t G_amec_sensor_list[] =
CORE_SENSOR_PTRS( TEMPC, &g_amec_sys.proc[0].core, tempc),
CORE_SENSOR_PTRS( STOPDEEPREQC, &g_amec_sys.proc[0].core, stopdeepreqc),
CORE_SENSOR_PTRS( STOPDEEPACTC, &g_amec_sys.proc[0].core, stopdeepactc),
CORE_SENSOR_PTRS( VOLTDROOPCNTC, &g_amec_sys.proc[0].core, voltdroopcntc),

// ------------------------------------------------------
// Memory Sensors
Expand Down Expand Up @@ -546,6 +548,7 @@ const minisensor_ptr_t G_amec_mini_sensor_list[] INIT_SECTION =
// Quad Sensors (6 each)
// ------------------------------------------------------
QUAD_MINI_SENSOR_PTRS_NULL( TEMPQ ),
QUAD_MINI_SENSOR_PTRS_NULL( VOLTDROOPCNTQ),

// ------------------------------------------------------
// Regulator Sensors
Expand All @@ -571,6 +574,7 @@ const minisensor_ptr_t G_amec_mini_sensor_list[] INIT_SECTION =
CORE_MINI_SENSOR_PTRS_NULL( TEMPC ),
CORE_MINI_SENSOR_PTRS_NULL( STOPDEEPREQC ),
CORE_MINI_SENSOR_PTRS_NULL( STOPDEEPACTC ),
CORE_MINI_SENSOR_PTRS_NULL( VOLTDROOPCNTC),

// ------------------------------------------------------
// Memory Sensors
Expand Down

0 comments on commit 2fe9ab3

Please sign in to comment.