Skip to content

Commit e5e2761

Browse files
rbatraAustinIBMop-jenkins
authored andcommitted
PGPE: WOV Hcode Updates (3/3)
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>
1 parent 9b0e0c7 commit e5e2761

File tree

11 files changed

+487
-141
lines changed

11 files changed

+487
-141
lines changed

import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_fit.c

Lines changed: 62 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HCODE Project */
77
/* */
8-
/* COPYRIGHT 2016,2018 */
8+
/* COPYRIGHT 2016,2019 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -50,6 +50,8 @@ uint32_t G_tb_sync_count;
5050

5151
uint32_t G_quad_hb_value;
5252

53+
uint32_t G_wov_count;
54+
5355
extern GlobalPstateParmBlock* G_gppb;
5456
extern PgpeHeader_t* G_pgpe_header_data;
5557
extern PgpePstateRecord G_pgpe_pstate_record;
@@ -129,7 +131,7 @@ void p9_pgpe_fit_init()
129131
G_throttleCount = 0;
130132
G_beacon_count = 0;
131133
G_tb_sync_count = 0;
132-
134+
G_wov_count = 0;
133135
//Set FIT handler which is called on every FIT interrupt tick
134136
ppe42_fit_setup(p9_pgpe_fit_handler, NULL);
135137
}
@@ -146,52 +148,55 @@ __attribute__((always_inline)) inline void handle_core_throttle()
146148
uint32_t config = in32(G_OCB_OCCS2); //bits 16-18 in OCC Scratch Register 2
147149
uint32_t run = (config >> 14) & 0x3; //this looks at the inject and enable bits, if either are high we run
148150

149-
if(run) //Currently running
151+
if (!(in32(G_OCB_OCCFLG) & BIT32(PGPE_PROLONGED_DROOP_WORKAROUND_ACTIVE)))
150152
{
151-
uint32_t throttleData = G_orig_throttle;
152-
uint32_t inject = run & 0x1; //Inject is bit 17, if this is high we run one throttle burst then turn off
153-
uint32_t type = (config >> 13) & 0x1; //type is bit 18, this determines which kind of throttling we do
154-
uint32_t mask = type ? CORE_SLOWDOWN : CORE_IFU_THROTTLE;
155-
uint32_t pgpe_throttle_assert = G_pgpe_header_data->g_pgpe_core_throttle_assert_cnt;
156-
uint32_t pgpe_throttle_deassert = G_pgpe_header_data->g_pgpe_core_throttle_deassert_cnt;
157-
158-
//if currently off, we don't desire always off, this is the first evaluation since become enabled, we are in always on,
159-
//or we (re enabled and have reached the count, then we turn throttling on (if both assert and deassert are 0 this statement fails)
160-
if(!G_throttleOn && pgpe_throttle_assert != 0 &&
161-
(G_throttleCount == 0 || pgpe_throttle_deassert == 0 || pgpe_throttle_deassert == G_throttleCount))
153+
if(run) //Currently running
162154
{
163-
G_throttleOn = 1;
164-
G_throttleCount = 0;
165-
throttleData |= mask; //data for start throttle
155+
uint32_t throttleData = G_orig_throttle;
156+
uint32_t inject = run & 0x1; //Inject is bit 17, if this is high we run one throttle burst then turn off
157+
uint32_t type = (config >> 13) & 0x1; //type is bit 18, this determines which kind of throttling we do
158+
uint32_t mask = type ? CORE_SLOWDOWN : CORE_IFU_THROTTLE;
159+
uint32_t pgpe_throttle_assert = G_pgpe_header_data->g_pgpe_core_throttle_assert_cnt;
160+
uint32_t pgpe_throttle_deassert = G_pgpe_header_data->g_pgpe_core_throttle_deassert_cnt;
161+
162+
//if currently off, we don't desire always off, this is the first evaluation since become enabled, we are in always on,
163+
//or we (re enabled and have reached the count, then we turn throttling on (if both assert and deassert are 0 this statement fails)
164+
if(!G_throttleOn && pgpe_throttle_assert != 0 &&
165+
(G_throttleCount == 0 || pgpe_throttle_deassert == 0 || pgpe_throttle_deassert == G_throttleCount))
166+
{
167+
G_throttleOn = 1;
168+
G_throttleCount = 0;
169+
throttleData |= mask; //data for start throttle
166170

167-
}
168-
//if currently on and we desire always off or we don't desire always on and have reached the count,
169-
//then we turn it off (if both assert and deassert are 0 this statement true)
170-
else if(G_throttleOn &&
171-
(pgpe_throttle_assert == 0 || ( pgpe_throttle_deassert != 0 && pgpe_throttle_assert == G_throttleCount)))
172-
{
173-
G_throttleOn = 0;
174-
G_throttleCount = 0;
175-
throttleData &= ~mask; //data for stop throttle
171+
}
172+
//if currently on and we desire always off or we don't desire always on and have reached the count,
173+
//then we turn it off (if both assert and deassert are 0 this statement true)
174+
else if(G_throttleOn &&
175+
(pgpe_throttle_assert == 0 || ( pgpe_throttle_deassert != 0 && pgpe_throttle_assert == G_throttleCount)))
176+
{
177+
G_throttleOn = 0;
178+
G_throttleCount = 0;
179+
throttleData &= ~mask; //data for stop throttle
180+
181+
if(inject == 1)
182+
{
183+
out32(G_OCB_OCCS2, (config & 0xFFFFBFFF)); //write out to indicate inject has finished
184+
}
185+
}
176186

177-
if(inject == 1)
187+
if(G_throttleCount == 0)
178188
{
179-
out32(G_OCB_OCCS2, (config & 0xFFFFBFFF)); //write out to indicate inject has finished
189+
p9_pgpe_pstate_write_core_throttle(throttleData, NO_RETRY);
180190
}
181-
}
182191

183-
if(G_throttleCount == 0)
192+
G_throttleCount++; //count always incremented, it is impossible to reach a count of 0 while enabled
193+
}
194+
else if(G_throttleCount != 0)
184195
{
185-
p9_pgpe_pstate_write_core_throttle(throttleData, NO_RETRY);
196+
G_throttleCount = 0;
197+
G_throttleOn = 0;
198+
p9_pgpe_pstate_write_core_throttle(G_orig_throttle, NO_RETRY);
186199
}
187-
188-
G_throttleCount++; //count always incremented, it is impossible to reach a count of 0 while enabled
189-
}
190-
else if(G_throttleCount != 0)
191-
{
192-
G_throttleCount = 0;
193-
G_throttleOn = 0;
194-
p9_pgpe_pstate_write_core_throttle(G_orig_throttle, NO_RETRY);
195200
}
196201
}
197202
//Quads must get HB value
@@ -378,6 +383,23 @@ __attribute__((always_inline)) inline void handle_fit_timebase_sync()
378383
}
379384
}
380385

386+
//
387+
// handle_undervolt
388+
//
389+
__attribute__((always_inline)) inline void handle_wov()
390+
{
391+
if (G_pgpe_pstate_record.wov.status & WOV_UNDERVOLT_ENABLED)
392+
{
393+
G_wov_count++;
394+
395+
if (G_gppb->wov_sample_125us == G_wov_count)
396+
{
397+
p9_pgpe_pstate_adjust_wov();
398+
G_wov_count = 0;
399+
}
400+
}
401+
}
402+
381403
// p9_pgpe_fit_handler
382404
//
383405
// This is a periodic FIT Handler which is called up at fixed period
@@ -392,4 +414,5 @@ void p9_pgpe_fit_handler(void* arg, PkIrqId irq)
392414
handle_occflg_requests();
393415
handle_aux_task();
394416
handle_fit_timebase_sync();
417+
handle_wov();
395418
}

import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_gppb.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HCODE Project */
77
/* */
8-
/* COPYRIGHT 2016,2018 */
8+
/* COPYRIGHT 2016,2019 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -26,6 +26,7 @@
2626
#include "p9_pgpe_gppb.h"
2727
#include "p9_pgpe_header.h"
2828
#include "p9_hcode_image_defines.H"
29+
#include "ppehw_common.h"
2930

3031
typedef enum
3132
{
@@ -301,3 +302,8 @@ uint16_t p9_pgpe_gppb_vdm_threshold_from_ps(uint32_t pstate)
301302
return ret;
302303

303304
}
305+
306+
uint32_t p9_pgpe_gppb_freq_from_ps(Pstate ps)
307+
{
308+
return (G_gppb->reference_frequency_khz - ((ps) * G_gppb->frequency_step_khz)) / 1000;
309+
}

import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_gppb.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HCODE Project */
77
/* */
8-
/* COPYRIGHT 2016,2018 */
8+
/* COPYRIGHT 2016,2019 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -72,4 +72,7 @@ uint32_t p9_pgpe_gppb_vdm_vid_cmp_from_ps(Pstate ps);
7272
// retval - VDM Threshold(VDM_OVERVOLT:VDM_DROOP_SMALL:VDM_DROOP_LARGE:VDM_DROOP_XTREME]
7373
uint16_t p9_pgpe_gppb_vdm_threshold_from_ps(uint32_t pstate);
7474

75+
//Get Frequency for a Pstate
76+
uint32_t p9_pgpe_gppb_freq_from_ps(Pstate ps);
77+
7578
#endif //_P9_PGPE_GPPB_H_

import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_irq_handlers.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HCODE Project */
77
/* */
8-
/* COPYRIGHT 2016,2018 */
8+
/* COPYRIGHT 2016,2019 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -162,7 +162,7 @@ void p9_pgpe_irq_handler_ocb_err()
162162
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
163163
(G_pgpe_pstate_record.activeCores << 8);
164164
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
165-
(G_pgpe_pstate_record.eVidCurr << 8) |
165+
(G_pgpe_pstate_record.extVrmCurr << 8) |
166166
PGPE_OP_TRACE_OCC_HB_FAULT;
167167
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);
168168

@@ -203,7 +203,7 @@ void p9_pgpe_irq_handler_sgpe_err()
203203
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
204204
(G_pgpe_pstate_record.activeCores << 8);
205205
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
206-
(G_pgpe_pstate_record.eVidCurr << 8) |
206+
(G_pgpe_pstate_record.extVrmCurr << 8) |
207207
PGPE_OP_TRACE_SGPE_FAULT;
208208
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);
209209

@@ -243,7 +243,7 @@ void p9_pgpe_irq_handler_pvref_err()
243243
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
244244
(G_pgpe_pstate_record.activeCores << 8);
245245
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
246-
(G_pgpe_pstate_record.eVidCurr << 8) |
246+
(G_pgpe_pstate_record.extVrmCurr << 8) |
247247
PGPE_OP_TRACE_PVREF_FAULT;
248248
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);
249249

@@ -288,7 +288,7 @@ void p9_pgpe_irq_handler_system_xstop(void* arg, PkIrqId irq)
288288
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
289289
(G_pgpe_pstate_record.activeCores << 8);
290290
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
291-
(G_pgpe_pstate_record.eVidCurr << 8) |
291+
(G_pgpe_pstate_record.extVrmCurr << 8) |
292292
PGPE_OP_TRACE_SYS_XSTOP;
293293
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);
294294

@@ -454,7 +454,7 @@ void p9_pgpe_irq_handler_cme_err()
454454
G_pgpe_optrace_data.word[0] = (G_pgpe_pstate_record.activeQuads << 24) |
455455
(G_pgpe_pstate_record.activeCores << 8);
456456
G_pgpe_optrace_data.word[1] = (G_pgpe_pstate_record.psCurr.fields.glb << 24) |
457-
(G_pgpe_pstate_record.eVidCurr << 8) |
457+
(G_pgpe_pstate_record.extVrmCurr << 8) |
458458
PGPE_OP_TRACE_CME_FAULT;
459459
p9_pgpe_optrace(SEVERE_FAULT_DETECTED);
460460

0 commit comments

Comments
 (0)