5
5
/* */
6
6
/* OpenPOWER HCODE Project */
7
7
/* */
8
- /* COPYRIGHT 2016,2018 */
8
+ /* COPYRIGHT 2016,2019 */
9
9
/* [+] International Business Machines Corp. */
10
10
/* */
11
11
/* */
@@ -50,6 +50,8 @@ uint32_t G_tb_sync_count;
50
50
51
51
uint32_t G_quad_hb_value ;
52
52
53
+ uint32_t G_wov_count ;
54
+
53
55
extern GlobalPstateParmBlock * G_gppb ;
54
56
extern PgpeHeader_t * G_pgpe_header_data ;
55
57
extern PgpePstateRecord G_pgpe_pstate_record ;
@@ -129,7 +131,7 @@ void p9_pgpe_fit_init()
129
131
G_throttleCount = 0 ;
130
132
G_beacon_count = 0 ;
131
133
G_tb_sync_count = 0 ;
132
-
134
+ G_wov_count = 0 ;
133
135
//Set FIT handler which is called on every FIT interrupt tick
134
136
ppe42_fit_setup (p9_pgpe_fit_handler , NULL );
135
137
}
@@ -146,52 +148,55 @@ __attribute__((always_inline)) inline void handle_core_throttle()
146
148
uint32_t config = in32 (G_OCB_OCCS2 ); //bits 16-18 in OCC Scratch Register 2
147
149
uint32_t run = (config >> 14 ) & 0x3 ; //this looks at the inject and enable bits, if either are high we run
148
150
149
- if ( run ) //Currently running
151
+ if (!( in32 ( G_OCB_OCCFLG ) & BIT32 ( PGPE_PROLONGED_DROOP_WORKAROUND_ACTIVE )))
150
152
{
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
162
154
{
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
166
170
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
+ }
176
186
177
- if (inject == 1 )
187
+ if (G_throttleCount == 0 )
178
188
{
179
- out32 ( G_OCB_OCCS2 , ( config & 0xFFFFBFFF )); //write out to indicate inject has finished
189
+ p9_pgpe_pstate_write_core_throttle ( throttleData , NO_RETRY );
180
190
}
181
- }
182
191
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 )
184
195
{
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 );
186
199
}
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 );
195
200
}
196
201
}
197
202
//Quads must get HB value
@@ -378,6 +383,23 @@ __attribute__((always_inline)) inline void handle_fit_timebase_sync()
378
383
}
379
384
}
380
385
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
+
381
403
// p9_pgpe_fit_handler
382
404
//
383
405
// 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)
392
414
handle_occflg_requests ();
393
415
handle_aux_task ();
394
416
handle_fit_timebase_sync ();
417
+ handle_wov ();
395
418
}
0 commit comments