diff options
author | William Bryan <wilbryan@us.ibm.com> | 2017-04-28 09:34:16 -0500 |
---|---|---|
committer | William A. Bryan <wilbryan@us.ibm.com> | 2017-04-28 15:14:00 -0400 |
commit | eb9cdf57261295ee7c4c745acce6e15653bfa857 (patch) | |
tree | fdd1c2cd5345ab6dee224cf3b99c80efabf7cc44 | |
parent | 6bc1827d25df20ea4dbb40129897110b2cc251a8 (diff) | |
download | talos-occ-eb9cdf57261295ee7c4c745acce6e15653bfa857.tar.gz talos-occ-eb9cdf57261295ee7c4c745acce6e15653bfa857.zip |
Don't log an error within PGPE callback
Change-Id: I619513860541b7a98664b42894be5b9dd5f7ed30
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39811
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Andres A. Lugo-Reyes <aalugore@us.ibm.com>
Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
-rwxr-xr-x | src/occ_405/main.c | 34 | ||||
-rw-r--r-- | src/occ_405/pgpe/pgpe_interface.c | 32 | ||||
-rwxr-xr-x | src/occ_405/proc/proc_pstate.h | 3 | ||||
-rwxr-xr-x | src/occ_405/state.c | 131 | ||||
-rw-r--r-- | src/occ_405/wof/wof.c | 51 |
5 files changed, 79 insertions, 172 deletions
diff --git a/src/occ_405/main.c b/src/occ_405/main.c index 3169fc8..2b8affc 100755 --- a/src/occ_405/main.c +++ b/src/occ_405/main.c @@ -61,12 +61,14 @@ #include <gpe_register_addresses.h> #include <p9_pstates_occ.h> #include <wof.h> +#include "pgpe_service_codes.h" extern uint32_t __ssx_boot; // Function address is 32 bits extern uint32_t G_occ_phantom_critical_count; extern uint32_t G_occ_phantom_noncritical_count; extern uint8_t G_occ_interrupt_type; extern uint8_t G_occ_role; +extern pstateStatus G_proc_pstate_status; extern GpeRequest G_meas_start_request; extern GpeRequest G_meas_cont_request; @@ -90,7 +92,7 @@ ppmr_header_t G_ppmr_header; // PPMR Header layout format pgpe_header_data_t G_pgpe_header; // Selected fields from PGPE Header OCCPstateParmBlock G_oppb; // OCC Pstate Parameters Block Structure extern uint16_t G_proc_fmax_mhz; // max(turbo,uturbo) frequencies - +extern int G_ss_pgpe_rc; // Set main thread timer for one second #define MAIN_THRD_TIMER_SLICE ((SsxInterval) SSX_SECONDS(1)) @@ -1776,6 +1778,36 @@ void Main_thread_routine(void *private) REQUEST_RESET(l_err); } + + // Check to make sure that the start_suspend PGPE job did not fail + if( (G_proc_pstate_status == PSTATES_FAILED) && + (FALSE == isSafeStateRequested()) && + (CURRENT_STATE() != OCC_STATE_SAFE) && + (CURRENT_STATE() != OCC_STATE_STANDBY) ) + { + /* @ + * @errortype + * @moduleid MAIN_THRD_ROUTINE_MID + * @reasoncode PGPE_FAILURE + * @userdata1 start_suspend rc + * @userdata2 0 + * @userdata4 ERC_PGPE_UNSUCCESSFULL + * @devdesc PGPE returned an error in response to start_suspend + */ + errlHndl_t l_err = createErrl( + MAIN_THRD_ROUTINE_MID, // modId + PGPE_FAILURE, // reasoncode + ERC_PGPE_UNSUCCESSFULL, // Extended reason code + ERRL_SEV_UNRECOVERABLE, // Severity + NULL, // Trace Buf + DEFAULT_TRACE_SIZE, // Trace Size + G_ss_pgpe_rc, // userdata1 + 0 // userdata2 + ); + + REQUEST_RESET(l_err); + } + } // while loop } diff --git a/src/occ_405/pgpe/pgpe_interface.c b/src/occ_405/pgpe/pgpe_interface.c index e664e9d..5dfb830 100644 --- a/src/occ_405/pgpe/pgpe_interface.c +++ b/src/occ_405/pgpe/pgpe_interface.c @@ -62,6 +62,9 @@ GPE_BUFFER(ipcmsg_start_stop_t G_start_suspend_parms); GPE_BUFFER(ipcmsg_wof_control_t G_wof_control_parms); GPE_BUFFER(ipcmsg_wof_vfrt_t G_wof_vfrt_parms); +// Used to track failure of start_suspend callback +int G_ss_pgpe_rc; // pgpe return codes + // Function Specification // @@ -671,38 +674,15 @@ int pgpe_clip_update(void) // End Function Specification void pgpe_start_suspend_callback(void) { - int pgpe_rc; // pgpe return codes - errlHndl_t err = NULL; // Error handler - - pgpe_rc = G_start_suspend_parms.msg_cb.rc; + G_ss_pgpe_rc = G_start_suspend_parms.msg_cb.rc; do { // Confirm Successfull completion of PGPE start suspend task - if(pgpe_rc != PGPE_RC_SUCCESS) + if(G_ss_pgpe_rc != PGPE_RC_SUCCESS) { //Error in scheduling pgpe start suspend task - - /* @ - * @errortype - * @moduleid PGPE_START_SUSPEND_CALLBACK_MOD - * @reasoncode GPE_REQUEST_SCHEDULE_FAILURE - * @userdata1 pgpe_rc - PGPE return code - * @userdata4 OCC_NO_EXTENDED_RC - * @devdesc OCC Failed to schedule a GPE job for start_suspend - */ - err = createErrl( - PGPE_START_SUSPEND_CALLBACK_MOD, // modId - PGPE_FAILURE, // reasoncode - ERC_PGPE_UNSUCCESSFULL, // Extended reason code - ERRL_SEV_UNRECOVERABLE, // Severity - NULL, // Trace Buf - DEFAULT_TRACE_SIZE, // Trace Size - pgpe_rc, // userdata1 - 0 // userdata2 - ); - - REQUEST_RESET(err); //This will add a firmware callout for us + G_proc_pstate_status = PSTATES_FAILED; break; } // task completed successfully diff --git a/src/occ_405/proc/proc_pstate.h b/src/occ_405/proc/proc_pstate.h index 4c63faa..ac7de35 100755 --- a/src/occ_405/proc/proc_pstate.h +++ b/src/occ_405/proc/proc_pstate.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -48,6 +48,7 @@ typedef enum PSTATES_IN_TRANSITION = -1, PSTATES_DISABLED = 0, PSTATES_ENABLED = 1, + PSTATES_FAILED = 2, } pstateStatus; diff --git a/src/occ_405/state.c b/src/occ_405/state.c index b38b18e..d263053 100755 --- a/src/occ_405/state.c +++ b/src/occ_405/state.c @@ -42,6 +42,11 @@ #include "pstate_pgpe_occ_api.h" #include "amec_sys.h" +// Maximum time to wait for a PGPE task before timeout +#define WAIT_PGPE_TASK_TIMEOUT 200 +// Maximum time to wait for a PGPE task before timeout when transitioning to standby +#define WAIT_PGPE_TASK_TIMEOUT_STDBY 50 + extern bool G_mem_monitoring_allowed; extern task_t G_task_table[TASK_END]; // Global task table extern bool G_simics_environment; @@ -292,115 +297,51 @@ errlHndl_t SMGR_standby_to_characterization() // Description: Switch from any state to standby state // // End Function Specification - -#define WAIT_PGPE_TASK_TIMEOUT 200 // maximum time to wait for a PGPE task before timeout errlHndl_t SMGR_all_to_standby() { - errlHndl_t l_errlHndl = NULL; uint8_t wait_time = 0; int rc; - TRAC_IMP("SMGR: Transition from State (%d) to Standby Started", - CURRENT_STATE()); + TRAC_IMP("SMGR: Transition from State (%d) to Standby Started", CURRENT_STATE()); - do + // if Psates in transition (a pgpe_start_suspend IPC call still running), + // wait until it is settled up to WAIT_PGPE_TASK_TIMEOUT usec + while( (G_proc_pstate_status == PSTATES_IN_TRANSITION) && + (wait_time < WAIT_PGPE_TASK_TIMEOUT_STDBY) ) { + // wait until pgpe_start_suspend call is completed. Sleep enables context switching. + ssx_sleep(SSX_MICROSECONDS(10)); + wait_time += 10; + } - // if Psates in transition (a pgpe_start_suspend IPC call still running), - // wait until it is settled up to WAIT_PGPE_TASK_TIMEOUT usec - while(G_proc_pstate_status == PSTATES_IN_TRANSITION && - wait_time < WAIT_PGPE_TASK_TIMEOUT) - { - // wait until pgpe_start_suspend call is completed. Sleep enables context switching. - ssx_sleep(SSX_MICROSECONDS(10)); - wait_time += 10; - } - - // check for timeout while waiting for pgpe_start_suspend() IPC completion - if(wait_time >= WAIT_PGPE_TASK_TIMEOUT) - { - TRAC_ERR("SMGR: Timeout waiting for Pstates start/suspend IPC task"); - - /* @ - * @errortype - * @moduleid MAIN_STATE_TRANSITION_MID - * @reasoncode GPE_REQUEST_TASK_TIMEOUT - * @userdata1 wait_time - * @userdata4 OCC_NO_EXTENDED_RC - * @devdesc timeout waiting for pstates start/suspend task - */ - l_errlHndl = createErrl(MAIN_STATE_TRANSITION_MID, //modId - GPE_REQUEST_TASK_TIMEOUT, //reasoncode - OCC_NO_EXTENDED_RC, //Extended reason code - ERRL_SEV_UNRECOVERABLE, //Severity - NULL, //Trace Buf - DEFAULT_TRACE_SIZE, //Trace Size - wait_time, //userdata1 - 0); //userdata2 - - // Callout firmware - addCalloutToErrl(l_errlHndl, - ERRL_CALLOUT_TYPE_COMPONENT_ID, - ERRL_COMPONENT_ID_FIRMWARE, - ERRL_CALLOUT_PRIORITY_HIGH); - break; - } - - // Stop Pstates if enabled - if(G_proc_pstate_status == PSTATES_ENABLED) + // check for timeout while waiting for pgpe_start_suspend() IPC completion + if(wait_time >= WAIT_PGPE_TASK_TIMEOUT) + { + TRAC_ERR("SMGR: Timeout waiting for Pstates start/suspend IPC task"); + } + // Stop Pstates if enabled + else if(G_proc_pstate_status == PSTATES_ENABLED) + { + rc = pgpe_start_suspend(PGPE_ACTION_PSTATE_STOP, G_proc_pmcr_owner); + if(rc) { - rc = pgpe_start_suspend(PGPE_ACTION_PSTATE_STOP, G_proc_pmcr_owner); - if(rc) - { - TRAC_ERR("SMGR: Failed to stop the pstate protocol on PGPE."); - break; - } + TRAC_ERR("SMGR: Failed to stop the pstate protocol on PGPE. rc[%08X]", rc); } + } - // Pstates Disabled, ready to safely transition to standby - - // Set the RTL Flags to indicate which tasks can run - // - Clear ACTIVE b/c not in ACTIVE State - // - Clear OBSERVATION b/c not in CHARACTERIZATION State - rtl_clr_run_mask_deferred(RTL_FLAG_ACTIVE | RTL_FLAG_OBS ); - rtl_set_run_mask_deferred(RTL_FLAG_STANDBY); - - // Set the actual STATE now that we have finished everything else - CURRENT_STATE() = OCC_STATE_STANDBY; - - TRAC_IMP("SMGR: Transition to Standby Completed"); - - } while (0); - - if(l_errlHndl) - { - TRAC_ERR("SMGR: Transition to Standby Failed"); + // Pstates should be disabled, ready to safely transition to standby + // Set the RTL Flags to indicate which tasks can run + // - Clear ACTIVE b/c not in ACTIVE State + // - Clear OBSERVATION b/c not in CHARACTERIZATION State + rtl_clr_run_mask_deferred(RTL_FLAG_ACTIVE | RTL_FLAG_OBS ); + rtl_set_run_mask_deferred(RTL_FLAG_STANDBY); - /* @ - * @errortype - * @moduleid MAIN_STATE_TRANSITION_MID - * @reasoncode INTERNAL_FAILURE - * @userdata1 starting state - * @userdata4 ERC_STATE_FROM_ALL_TO_STB_FAILURE - * @devdesc Failed changing from observation to characterization - */ - l_errlHndl = createErrl(MAIN_STATE_TRANSITION_MID, //modId - INTERNAL_FAILURE, //reasoncode - ERC_STATE_FROM_ALL_TO_STB_FAILURE, //Extended reason code - ERRL_SEV_UNRECOVERABLE, //Severity - NULL, //Trace Buf - DEFAULT_TRACE_SIZE, //Trace Size - CURRENT_STATE(), //userdata1 - 0); //userdata2 + // Set the actual STATE now that we have finished everything else + CURRENT_STATE() = OCC_STATE_STANDBY; - // Callout firmware - addCalloutToErrl(l_errlHndl, - ERRL_CALLOUT_TYPE_COMPONENT_ID, - ERRL_COMPONENT_ID_FIRMWARE, - ERRL_CALLOUT_PRIORITY_HIGH); - } + TRAC_IMP("SMGR: Transition to Standby Completed"); - return l_errlHndl; + return NULL; } // Function Specification diff --git a/src/occ_405/wof/wof.c b/src/occ_405/wof/wof.c index 14b4bab..3050c52 100644 --- a/src/occ_405/wof/wof.c +++ b/src/occ_405/wof/wof.c @@ -508,35 +508,7 @@ void copy_vfrt_to_sram( copy_vfrt_to_sram_parms_t * i_parms) // Confirm Successful scheduling of WOF VFRT task if(l_gperc != 0) { - //Error in scheduling wof_vfrt task - /* @ - * @errortype - * @moduleid COPY_VFRT_TO_SRAM - * @reasoncode GPE_REQUEST_SCHEDULE_FAILURE - * @userdata1 rc - gpe_request_schedule return code - * @userdata2 0 - * @userdata4 OCC_NO_EXTENDED_RC - * @devdesc OCC Failed to schedule a GPE job for wof vfrt - */ - errlHndl_t l_errl = createErrl( - COPY_VFRT_TO_SRAM, // modId - GPE_REQUEST_SCHEDULE_FAILURE, // reasoncode - OCC_NO_EXTENDED_RC, // Extended reason code - ERRL_SEV_UNRECOVERABLE, // Severity - NULL, // Trace Buf - DEFAULT_TRACE_SIZE, // Trace Size - l_gperc, // userdata1 - 0 // userdata2 - ); - - // Callout firmware - addCalloutToErrl(l_errl, - ERRL_CALLOUT_TYPE_COMPONENT_ID, - ERRL_COMPONENT_ID_FIRMWARE, - ERRL_CALLOUT_PRIORITY_HIGH); - - // Commit error log - commitErrl(&l_errl); + // TODO: Cannot create an error log within a callback function. Need to handle. } } @@ -1610,26 +1582,7 @@ void wof_control_callback( void ) { if( G_wof_control_parms.action == PGPE_ACTION_WOF_OFF ) { - // Got some other unsuccessful RC. Create error and request reset - /* - * @errortype - * @moduleid WOF_CONTROL_CALLBACK - * @reasoncode GPE_REQUEST_RC_FAILURE - * @userdata1 Return code - * @userdata4 ERC_WOF_CONTROL_ERROR - * @devdesc Invalid RC from wof control command - */ - errlHndl_t l_errl = createErrl( - WOF_CONTROL_CALLBACK, - GPE_REQUEST_RC_FAILURE, - ERC_WOF_CONTROL_ERROR, - ERRL_SEV_PREDICTIVE, // Correct Severity??? - NULL, - DEFAULT_TRACE_SIZE, - G_wof_control_parms.msg_cb.rc, - 0 ); - - REQUEST_RESET(l_errl); + // TODO: Cannot log an error here, so need to figure out what to do. } else { |