Skip to content

Commit

Permalink
PGPE: WOV Hcode Updates (3/3)
Browse files Browse the repository at this point in the history
    3rd commit in the series of 3 commits for Workload Optimized
    Voltage(WOV)

    Commit 1. Adds WOV attributes
    Commit 2(Hostboot). WOV HW procedures changes and global parm updates
    Commit 3(Hcode). PGPE Hcode changes for WOV(undervolting only) feature

        Key_Cronus_Test=PM_REGRESS

HW-Image-Prereq: I9833e8713d362684c1537b08478a9c9934e5012e
CMVC-Prereq: 1074650
Change-Id: I9833e8713d362684c1537b08478a9c9934e5012e
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69465
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Cronus HW CI <cronushw-ci+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: RANGANATHPRASAD G. BRAHMASAMUDRA <prasadbgr@in.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
  • Loading branch information
rbatraAustinIBM authored and op-jenkins committed Jan 26, 2019
1 parent 9b0e0c7 commit e5e2761
Show file tree
Hide file tree
Showing 11 changed files with 487 additions and 141 deletions.
101 changes: 62 additions & 39 deletions import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_fit.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HCODE Project */
/* */
/* COPYRIGHT 2016,2018 */
/* COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -50,6 +50,8 @@ uint32_t G_tb_sync_count;

uint32_t G_quad_hb_value;

uint32_t G_wov_count;

extern GlobalPstateParmBlock* G_gppb;
extern PgpeHeader_t* G_pgpe_header_data;
extern PgpePstateRecord G_pgpe_pstate_record;
Expand Down Expand Up @@ -129,7 +131,7 @@ void p9_pgpe_fit_init()
G_throttleCount = 0;
G_beacon_count = 0;
G_tb_sync_count = 0;

G_wov_count = 0;
//Set FIT handler which is called on every FIT interrupt tick
ppe42_fit_setup(p9_pgpe_fit_handler, NULL);
}
Expand All @@ -146,52 +148,55 @@ __attribute__((always_inline)) inline void handle_core_throttle()
uint32_t config = in32(G_OCB_OCCS2); //bits 16-18 in OCC Scratch Register 2
uint32_t run = (config >> 14) & 0x3; //this looks at the inject and enable bits, if either are high we run

if(run) //Currently running
if (!(in32(G_OCB_OCCFLG) & BIT32(PGPE_PROLONGED_DROOP_WORKAROUND_ACTIVE)))
{
uint32_t throttleData = G_orig_throttle;
uint32_t inject = run & 0x1; //Inject is bit 17, if this is high we run one throttle burst then turn off
uint32_t type = (config >> 13) & 0x1; //type is bit 18, this determines which kind of throttling we do
uint32_t mask = type ? CORE_SLOWDOWN : CORE_IFU_THROTTLE;
uint32_t pgpe_throttle_assert = G_pgpe_header_data->g_pgpe_core_throttle_assert_cnt;
uint32_t pgpe_throttle_deassert = G_pgpe_header_data->g_pgpe_core_throttle_deassert_cnt;

//if currently off, we don't desire always off, this is the first evaluation since become enabled, we are in always on,
//or we (re enabled and have reached the count, then we turn throttling on (if both assert and deassert are 0 this statement fails)
if(!G_throttleOn && pgpe_throttle_assert != 0 &&
(G_throttleCount == 0 || pgpe_throttle_deassert == 0 || pgpe_throttle_deassert == G_throttleCount))
if(run) //Currently running
{
G_throttleOn = 1;
G_throttleCount = 0;
throttleData |= mask; //data for start throttle
uint32_t throttleData = G_orig_throttle;
uint32_t inject = run & 0x1; //Inject is bit 17, if this is high we run one throttle burst then turn off
uint32_t type = (config >> 13) & 0x1; //type is bit 18, this determines which kind of throttling we do
uint32_t mask = type ? CORE_SLOWDOWN : CORE_IFU_THROTTLE;
uint32_t pgpe_throttle_assert = G_pgpe_header_data->g_pgpe_core_throttle_assert_cnt;
uint32_t pgpe_throttle_deassert = G_pgpe_header_data->g_pgpe_core_throttle_deassert_cnt;

//if currently off, we don't desire always off, this is the first evaluation since become enabled, we are in always on,
//or we (re enabled and have reached the count, then we turn throttling on (if both assert and deassert are 0 this statement fails)
if(!G_throttleOn && pgpe_throttle_assert != 0 &&
(G_throttleCount == 0 || pgpe_throttle_deassert == 0 || pgpe_throttle_deassert == G_throttleCount))
{
G_throttleOn = 1;
G_throttleCount = 0;
throttleData |= mask; //data for start throttle

}
//if currently on and we desire always off or we don't desire always on and have reached the count,
//then we turn it off (if both assert and deassert are 0 this statement true)
else if(G_throttleOn &&
(pgpe_throttle_assert == 0 || ( pgpe_throttle_deassert != 0 && pgpe_throttle_assert == G_throttleCount)))
{
G_throttleOn = 0;
G_throttleCount = 0;
throttleData &= ~mask; //data for stop throttle
}
//if currently on and we desire always off or we don't desire always on and have reached the count,
//then we turn it off (if both assert and deassert are 0 this statement true)
else if(G_throttleOn &&
(pgpe_throttle_assert == 0 || ( pgpe_throttle_deassert != 0 && pgpe_throttle_assert == G_throttleCount)))
{
G_throttleOn = 0;
G_throttleCount = 0;
throttleData &= ~mask; //data for stop throttle

if(inject == 1)
{
out32(G_OCB_OCCS2, (config & 0xFFFFBFFF)); //write out to indicate inject has finished
}
}

if(inject == 1)
if(G_throttleCount == 0)
{
out32(G_OCB_OCCS2, (config & 0xFFFFBFFF)); //write out to indicate inject has finished
p9_pgpe_pstate_write_core_throttle(throttleData, NO_RETRY);
}
}

if(G_throttleCount == 0)
G_throttleCount++; //count always incremented, it is impossible to reach a count of 0 while enabled
}
else if(G_throttleCount != 0)
{
p9_pgpe_pstate_write_core_throttle(throttleData, NO_RETRY);
G_throttleCount = 0;
G_throttleOn = 0;
p9_pgpe_pstate_write_core_throttle(G_orig_throttle, NO_RETRY);
}

G_throttleCount++; //count always incremented, it is impossible to reach a count of 0 while enabled
}
else if(G_throttleCount != 0)
{
G_throttleCount = 0;
G_throttleOn = 0;
p9_pgpe_pstate_write_core_throttle(G_orig_throttle, NO_RETRY);
}
}
//Quads must get HB value
Expand Down Expand Up @@ -378,6 +383,23 @@ __attribute__((always_inline)) inline void handle_fit_timebase_sync()
}
}

//
// handle_undervolt
//
__attribute__((always_inline)) inline void handle_wov()
{
if (G_pgpe_pstate_record.wov.status & WOV_UNDERVOLT_ENABLED)
{
G_wov_count++;

if (G_gppb->wov_sample_125us == G_wov_count)
{
p9_pgpe_pstate_adjust_wov();
G_wov_count = 0;
}
}
}

// p9_pgpe_fit_handler
//
// This is a periodic FIT Handler which is called up at fixed period
Expand All @@ -392,4 +414,5 @@ void p9_pgpe_fit_handler(void* arg, PkIrqId irq)
handle_occflg_requests();
handle_aux_task();
handle_fit_timebase_sync();
handle_wov();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HCODE Project */
/* */
/* COPYRIGHT 2016,2018 */
/* COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -26,6 +26,7 @@
#include "p9_pgpe_gppb.h"
#include "p9_pgpe_header.h"
#include "p9_hcode_image_defines.H"
#include "ppehw_common.h"

typedef enum
{
Expand Down Expand Up @@ -301,3 +302,8 @@ uint16_t p9_pgpe_gppb_vdm_threshold_from_ps(uint32_t pstate)
return ret;

}

uint32_t p9_pgpe_gppb_freq_from_ps(Pstate ps)
{
return (G_gppb->reference_frequency_khz - ((ps) * G_gppb->frequency_step_khz)) / 1000;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HCODE Project */
/* */
/* COPYRIGHT 2016,2018 */
/* COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -72,4 +72,7 @@ uint32_t p9_pgpe_gppb_vdm_vid_cmp_from_ps(Pstate ps);
// retval - VDM Threshold(VDM_OVERVOLT:VDM_DROOP_SMALL:VDM_DROOP_LARGE:VDM_DROOP_XTREME]
uint16_t p9_pgpe_gppb_vdm_threshold_from_ps(uint32_t pstate);

//Get Frequency for a Pstate
uint32_t p9_pgpe_gppb_freq_from_ps(Pstate ps);

#endif //_P9_PGPE_GPPB_H_
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HCODE Project */
/* */
/* COPYRIGHT 2016,2018 */
/* COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -162,7 +162,7 @@ void p9_pgpe_irq_handler_ocb_err()
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
(G_pgpe_pstate_record.activeCores << 8);
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
(G_pgpe_pstate_record.eVidCurr << 8) |
(G_pgpe_pstate_record.extVrmCurr << 8) |
PGPE_OP_TRACE_OCC_HB_FAULT;
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);

Expand Down Expand Up @@ -203,7 +203,7 @@ void p9_pgpe_irq_handler_sgpe_err()
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
(G_pgpe_pstate_record.activeCores << 8);
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
(G_pgpe_pstate_record.eVidCurr << 8) |
(G_pgpe_pstate_record.extVrmCurr << 8) |
PGPE_OP_TRACE_SGPE_FAULT;
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);

Expand Down Expand Up @@ -243,7 +243,7 @@ void p9_pgpe_irq_handler_pvref_err()
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
(G_pgpe_pstate_record.activeCores << 8);
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
(G_pgpe_pstate_record.eVidCurr << 8) |
(G_pgpe_pstate_record.extVrmCurr << 8) |
PGPE_OP_TRACE_PVREF_FAULT;
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);

Expand Down Expand Up @@ -288,7 +288,7 @@ void p9_pgpe_irq_handler_system_xstop(void* arg, PkIrqId irq)
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
(G_pgpe_pstate_record.activeCores << 8);
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
(G_pgpe_pstate_record.eVidCurr << 8) |
(G_pgpe_pstate_record.extVrmCurr << 8) |
PGPE_OP_TRACE_SYS_XSTOP;
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);

Expand Down Expand Up @@ -454,7 +454,7 @@ void p9_pgpe_irq_handler_cme_err()
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
(G_pgpe_pstate_record.activeCores << 8);
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
(G_pgpe_pstate_record.eVidCurr << 8) |
(G_pgpe_pstate_record.extVrmCurr << 8) |
PGPE_OP_TRACE_CME_FAULT;
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);

Expand Down

0 comments on commit e5e2761

Please sign in to comment.