From 793c77ef0f8bf646858ee53ce6d379c1c45aebdc Mon Sep 17 00:00:00 2001 From: Rahul Batra Date: Mon, 25 Mar 2019 13:24:31 -0400 Subject: PM: Fix Clip Update Timeout Key_Cronus_Test=PM_REGRESS Change-Id: Ia943cdd3bb646104bfd686356cd3f23bc5876a7d CQ: SW452077 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/74964 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Tested-by: Cronus HW CI Reviewed-by: RANGANATHPRASAD G. BRAHMASAMUDRA Reviewed-by: Gregory S. Still Reviewed-by: Jennifer A. Stofer --- .../p9/common/pmlib/include/pstate_pgpe_cme_api.h | 3 +- .../ppe_closed/cme/pstate_cme/p9_cme_thread_db.c | 71 +++++++++++++++++++++- .../ppe_closed/pgpe/pstate_gpe/p9_pgpe_pstate.c | 29 ++++----- 3 files changed, 87 insertions(+), 16 deletions(-) diff --git a/import/chips/p9/common/pmlib/include/pstate_pgpe_cme_api.h b/import/chips/p9/common/pmlib/include/pstate_pgpe_cme_api.h index a171b47d..489458c1 100644 --- a/import/chips/p9/common/pmlib/include/pstate_pgpe_cme_api.h +++ b/import/chips/p9/common/pmlib/include/pstate_pgpe_cme_api.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HCODE Project */ /* */ -/* COPYRIGHT 2016,2018 */ +/* COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -113,6 +113,7 @@ enum MESSAGE_ID_DB3 MSGID_DB3_DISABLE_SGPE_HANDOFF = 0x04, MSGID_DB3_SUSPEND_STOP_ENTRY = 0x05, MSGID_DB3_UNSUSPEND_STOP_ENTRY = 0x06, + MSGID_DB3_CLIP_BROADCAST = 0x07, MSGID_DB3_IMMEDIATE_HALT = 0xF1, MSGID_DB3_RESTORE_STATE_AND_HALT = 0xF2, }; diff --git a/import/chips/p9/procedures/ppe_closed/cme/pstate_cme/p9_cme_thread_db.c b/import/chips/p9/procedures/ppe_closed/cme/pstate_cme/p9_cme_thread_db.c index 4038626b..72ba30ef 100644 --- a/import/chips/p9/procedures/ppe_closed/cme/pstate_cme/p9_cme_thread_db.c +++ b/import/chips/p9/procedures/ppe_closed/cme/pstate_cme/p9_cme_thread_db.c @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HCODE Project */ /* */ -/* COPYRIGHT 2016,2018 */ +/* COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -297,6 +297,75 @@ void p9_cme_pstate_db3_handler(void) } } + else if (db3.fields.cme_message_numbern == MSGID_DB3_CLIP_BROADCAST) + { + PK_TRACE_INF("PSTATE: DB3 Clip Enter"); + + uint32_t dbQuadInfo, dbBit8_15; + cppm_cmedb0_t dbData; + CME_GETSCOM(CPPM_CMEDB0, G_cme_pstate_record.firstGoodCoreMask, dbData.value); + dbBit8_15 = (dbData.value & BITS64(8, 8)) >> SHIFT64(15); + dbQuadInfo = (dbData.value >> (in32(G_CME_LCL_SRTCH0) & + (BITS32(CME_SCRATCH_LOCAL_PSTATE_IDX_START, CME_SCRATCH_LOCAL_PSTATE_IDX_LENGTH) + ))) & 0xFF; + + //Quad Manager + if(G_cme_pstate_record.qmFlag) + { + //Sync up with sibling CME + p9_cme_pstate_notify_sib(INTERCME_DIRECT_IN2); + + if (dbBit8_15 == DB0_CLIP_BCAST_TYPE_PMIN) + { + G_cme_pstate_record.pmin = dbQuadInfo; + } + else + { + G_cme_pstate_record.pmax = dbQuadInfo; + } + + PK_TRACE_INF("PSTATE: Pmin=0x%x,Pmax=0x%x", G_cme_pstate_record.pmin, G_cme_pstate_record.pmax); + + + p9_cme_pstate_pmsr_updt(); + + //Sync up with the sibling CME before ACKing back to PGPE + p9_cme_pstate_notify_sib(INTERCME_DIRECT_IN2); //Notify sibling + + //Send type4(ack doorbell) + send_ack_to_pgpe(MSGID_PCB_TYPE4_ACK_PSTATE_PROTO_ACK); + + } + //On Sibling, poll on intercme_in2 direct msg. + else + { + //Wait to receive a notify from Quad Manager + //and then ACK back to quad manager + while(!(in32_sh(CME_LCL_EISR) & BIT64SH(39))); + + intercme_direct(INTERCME_DIRECT_IN2, INTERCME_DIRECT_ACK, 0); + + if (dbBit8_15 == DB0_CLIP_BCAST_TYPE_PMIN) + { + G_cme_pstate_record.pmin = dbQuadInfo; + } + else + { + G_cme_pstate_record.pmax = dbQuadInfo; + } + + p9_cme_pstate_pmsr_updt(); + + //Wait to receive a notify from Quad Manager + //and then ACK back to quad manager + while(!(in32_sh(CME_LCL_EISR) & BIT64SH(39))); + + intercme_direct(INTERCME_DIRECT_IN2, INTERCME_DIRECT_ACK, 0); + } + + PK_TRACE_INF("PSTATE: DB3 Clip Exit"); + } + else { //\todo Will be done as part of 41947 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 f1c94329..0beff6d9 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 @@ -1138,18 +1138,13 @@ void p9_pgpe_pstate_stop() PK_TRACE_DBG("PSS: Stop Done"); } -// -// p9_pgpe_pstate_clip_bcast -// -// Wrapper function for sending Pstate Clip Bcast DB0 to CMEs void p9_pgpe_pstate_clip_bcast(uint32_t clip_bcast_type) { PK_TRACE_DBG("CLB: Clip Bcast"); pgpe_db0_clip_bcast_t db0; db0.value = 0; - db0.fields.msg_id = MSGID_DB0_CLIP_BROADCAST; + db0.fields.msg_id = MSGID_DB0_DB3_PAYLOAD; db0.fields.clip_type = clip_bcast_type; - db0_parms_t p; //Note that we store PMIN as psClipMax(which is lower Pstate, but higher numbered Pstate) if (clip_bcast_type == DB0_CLIP_BCAST_TYPE_PMIN) @@ -1171,15 +1166,21 @@ void p9_pgpe_pstate_clip_bcast(uint32_t clip_bcast_type) db0.fields.quad5_clip = G_pgpe_pstate_record.psClipMin[5]; } - p.db0val = db0.value; - p.type = PGPE_DB0_TYPE_UNICAST; - p.targetCores = G_pgpe_pstate_record.activeDB; - p.waitForAcks = PGPE_DB_ACK_WAIT_CME; - p.expectedAckFrom = G_pgpe_pstate_record.activeQuads; - p.expectedAckValue = MSGID_PCB_TYPE4_ACK_PSTATE_PROTO_ACK; - p9_pgpe_send_db0(p); + //Write DB0, but with top-byte = 0. This way DB0 interrupt doesn't happen, but + //we still send CME the necessary data. CME will read this inside the DB3 interrupt + //which we write next + db3_parms_t p = { MSGID_DB3_CLIP_BROADCAST, + db0.value, + PGPE_DB3_WRITE_DB0, + G_pgpe_pstate_record.activeDB, + PGPE_DB_ACK_WAIT_CME, + G_pgpe_pstate_record.activeQuads, + MSGID_PCB_TYPE4_ACK_PSTATE_PROTO_ACK, + PGPE_DB3_SKIP_CHECK_NACKS + }; + p.db3val = (uint64_t)(MSGID_DB3_CLIP_BROADCAST) << 56; + p9_pgpe_send_db3(p); } - // // p9_pgpe_pstate_wof_ctrl // -- cgit v1.2.1