diff options
author | Rahul Batra <rbatra@us.ibm.com> | 2019-01-29 09:50:58 -0500 |
---|---|---|
committer | hostboot <hostboot@us.ibm.com> | 2019-02-04 10:48:42 -0600 |
commit | d0628e156378c993cd801ebd73f12adfad8a4f12 (patch) | |
tree | 9834a7810e309f7b6692c52cc125634edfedf8f2 | |
parent | 3b77cb39ffd554e804cc189e6e7cf5eabd105466 (diff) | |
download | talos-hcode-d0628e156378c993cd801ebd73f12adfad8a4f12.tar.gz talos-hcode-d0628e156378c993cd801ebd73f12adfad8a4f12.zip |
PGPE: Use busy-wait instead of PK_SLEEP for delay
Key_Cronus_Test=PM_REGRESS
Change-Id: I830da405d7a7d2ebafaa2f9833fc638b744344ad
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71039
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-by: YUE DU <daviddu@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
-rw-r--r-- | import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_pstate.c | 70 |
1 files changed, 61 insertions, 9 deletions
diff --git a/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_pstate.c b/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_pstate.c index 749bdf6b..f1c94329 100644 --- a/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_pstate.c +++ b/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/p9_pgpe_pstate.c @@ -2055,19 +2055,25 @@ void p9_pgpe_pstate_updt_ext_volt() } #if !EPM_P9_TUNING - uint32_t delay_us = 0; + uint32_t delay_ticks = 0; //Decreasing if (G_pgpe_pstate_record.extVrmNext < G_pgpe_pstate_record.extVrmCurr) { - delay_us = (G_pgpe_pstate_record.extVrmCurr - G_pgpe_pstate_record.extVrmNext) * - G_ext_vrm_dec_rate_mult_usperus; + //Convert us to OTBR ticks. Each OTBR tick is 32ns, so 1us=(1000/32) OTBR ticks. But, + //to keep the math simple(use shift instead of multiply) we approximate + //1us as (1024/32)=32 OTBR ticks + delay_ticks = ((G_pgpe_pstate_record.extVrmCurr - G_pgpe_pstate_record.extVrmNext) * + G_ext_vrm_dec_rate_mult_usperus) << 5; } //Increasing else if (G_pgpe_pstate_record.extVrmNext > G_pgpe_pstate_record.extVrmCurr) { - delay_us = (G_pgpe_pstate_record.extVrmNext - G_pgpe_pstate_record.extVrmCurr) * - G_ext_vrm_inc_rate_mult_usperus; + //Convert us to OTBR ticks. Each OTBR tick is 32ns, so 1us=(1000/32) OTBR ticks. But, + //to keep the math simple(use shift instead of multiply) we approximate + //1us as (1024/32)=32 OTBR ticks + delay_ticks = ((G_pgpe_pstate_record.extVrmNext - G_pgpe_pstate_record.extVrmCurr) * + G_ext_vrm_inc_rate_mult_usperus) << 5; } #endif @@ -2077,16 +2083,62 @@ void p9_pgpe_pstate_updt_ext_volt() #if !EPM_P9_TUNING - //Delay for delay_us - if (delay_us > 0) + //Delay for delay_ticks. + //We do busy wait here, so that the running thread does NOT get blocked and is kept running by + //PK kernel + uint32_t tbStart, tbEnd, elapsed; + + if (delay_ticks > 0) { - pk_sleep(PK_MICROSECONDS((delay_us))); + //Read TimebaseStart + tbStart = in32(OCB_OTBR); + + do + { + //Read TimebaseEnd + tbEnd = in32(OCB_OTBR); + + //Compute Elapsed Count with accounting for Timebase Wrapping + if (tbEnd > tbStart) + { + elapsed = tbEnd - tbStart; + } + else + { + elapsed = 0xFFFFFFFF - tbStart + tbEnd + 1; + } + } + while(elapsed < delay_ticks); } + + //We do busy wait here, so that the running thread does NOT get blocked and is kept running by + //PK kernel if(G_pgpe_pstate_record.biasSyspExtVrmNext == p9_pgpe_gppb_intp_vdd_from_ps(G_pgpe_pstate_record.psNext.fields.glb, VPD_PT_SET_BIASED_SYSP)) { - pk_sleep(PK_MICROSECONDS((G_gppb->ext_vrm_stabilization_time_us))); + delay_ticks = G_gppb->ext_vrm_stabilization_time_us << 5; + + //Read TimebaseStart + tbStart = in32(OCB_OTBR); + + do + { + //Read TimebaseEnd + tbEnd = in32(OCB_OTBR); + + //Compute Elapsed Count with accounting for Timebase Wrapping + if (tbEnd > tbStart) + { + elapsed = tbEnd - tbStart; + } + else + { + elapsed = 0xFFFFFFFF - tbStart + tbEnd + 1; + } + } + while(elapsed < delay_ticks); + } #endif |