From 611d91a0295e17ea202f01e0143fc040820eadb8 Mon Sep 17 00:00:00 2001 From: Doug Gilbert Date: Thu, 23 Oct 2014 15:04:03 -0500 Subject: HTMGT Pstate support Change-Id: I68388d448afa027439c78f654c00ca2f9904d65e RTC: 114284 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14191 Reviewed-by: Christopher Cain Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/usr/htmgt/genPstate.C | 105 ++++++++++++++++++++++++++++++++++++++++ src/usr/htmgt/genPstate.H | 44 +++++++++++++++++ src/usr/htmgt/htmgt.C | 37 +++++++++----- src/usr/htmgt/htmgt_activate.H | 12 ----- src/usr/htmgt/makefile | 5 +- src/usr/htmgt/runtime/makefile | 4 +- src/usr/htmgt/test/pstatetest.H | 55 ++++++++++----------- 7 files changed, 207 insertions(+), 55 deletions(-) create mode 100644 src/usr/htmgt/genPstate.C create mode 100644 src/usr/htmgt/genPstate.H (limited to 'src/usr') diff --git a/src/usr/htmgt/genPstate.C b/src/usr/htmgt/genPstate.C new file mode 100644 index 000000000..9eaae1747 --- /dev/null +++ b/src/usr/htmgt/genPstate.C @@ -0,0 +1,105 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/htmgt/genPstate.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#include "genPstate.H" +#include "htmgt_utility.H" +#include +#include + +// Targeting support +#include +#include +#include +#include + +// occ hwp support +#include +#include + +using namespace TARGETING; + +namespace HTMGT +{ +errlHndl_t genPstateTables() +{ + errlHndl_t err = NULL; + + TargetHandleList processors; + + getChipResources(processors, + TYPE_PROC, + UTIL_FILTER_FUNCTIONAL); + + for(TargetHandleList::const_iterator + procItr = processors.begin(); + procItr != processors.end(); + ++procItr) + { + Target * procTarget = *procItr; + + TargetHandleList occs; + getChildChiplets(occs, + procTarget, + TYPE_OCC, + true); + + if(occs.size() > 0) + { + PstateSuperStructure pstate_data; + Target * occTarget = occs[0]; + ATTR_HUID_type huid = occTarget->getAttr(); + + TMGT_INF("Building pstate table for huid 0x%x", huid); + + err = FREQVOLTSVC::runP8BuildPstateDataBlock( procTarget, + &pstate_data); + + if(err) + { + TMGT_ERR( "tmgtProcessAppGenPstateTable: Failed to" + " generate PSTATE data for OCC " + "(huid=%x).", + huid + ); + + // collectTrace is called by the calling routine (htmgt.C). + break; + + } + else + { + ATTR_PSTATE_TABLE_type * pstateData = + reinterpret_cast + (&pstate_data); + + CPPASSERT(sizeof(ATTR_PSTATE_TABLE_type) == + sizeof(PstateSuperStructure)); + + occTarget->setAttr(*pstateData); + } + } + } + return err; +} +}; // end namespace diff --git a/src/usr/htmgt/genPstate.H b/src/usr/htmgt/genPstate.H new file mode 100644 index 000000000..71106de27 --- /dev/null +++ b/src/usr/htmgt/genPstate.H @@ -0,0 +1,44 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/htmgt/genPstate.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef GENPSTATE_H +#define GENPSTATE_H + +#include + +namespace HTMGT +{ + +/** + * @brief Build the pstate tables + * @post Sets pstate table data into PSTATE_TABLE attribute for each OCC. + * @note Attributes will not be written if the corresponding pstate table + * could not be generated. + * @note this function is only available at IPL time + * @return error log handle on error, otherwise NULL + */ +errlHndl_t genPstateTables(); + +}; +#endif diff --git a/src/usr/htmgt/htmgt.C b/src/usr/htmgt/htmgt.C index d693a52b0..5ed8be6c7 100644 --- a/src/usr/htmgt/htmgt.C +++ b/src/usr/htmgt/htmgt.C @@ -28,6 +28,9 @@ #include "htmgt_activate.H" #include "htmgt_cfgdata.H" #include "htmgt_utility.H" +#ifndef __HOSTBOOT_RUNTIME +#include "genPstate.H" +#endif // Targeting support #include @@ -58,22 +61,34 @@ namespace HTMGT // Query functional OCCs if (occMgr::instance().buildOccs() > 0) { - // Build pstate tables - // TODO RTC 114284 + do + { + //Pstatetable only built once at boot time. +#ifndef __HOSTBOOT_RUNTIME + l_err = genPstateTables(); + if(l_err) + { + break; + } +#endif - // Calc memory throttles - // TODO RTC 116306 + // Calc memory throttles + // TODO RTC 116306 - // Send ALL config data - sendOccConfigData(); + // Send ALL config data + sendOccConfigData(); - // Wait for all OCCs to go active - l_err = waitForOccsActive(); - if (NULL == l_err) + // Wait for all OCCs to go active + l_err = waitForOccsActive(); + if( l_err ) { - // Set active sensors for all OCCs so BMC can start comm + break; + } + + //Set active sensors for all OCCs so BMC can start comm l_err = setOccActiveSensors(); - } + + } while(0); } else { diff --git a/src/usr/htmgt/htmgt_activate.H b/src/usr/htmgt/htmgt_activate.H index 4c0bf9fd0..6e85dfd17 100644 --- a/src/usr/htmgt/htmgt_activate.H +++ b/src/usr/htmgt/htmgt_activate.H @@ -38,18 +38,6 @@ namespace HTMGT { - /** - * @brief Build the pstate tables - */ - void buildPstateTables(); - - - /** - * @brief Calculate memory throttles - */ - void calculateMemoryThrottles(); - - /** * @brief Set the OCC state * diff --git a/src/usr/htmgt/makefile b/src/usr/htmgt/makefile index f49953fcb..174f207a1 100644 --- a/src/usr/htmgt/makefile +++ b/src/usr/htmgt/makefile @@ -31,12 +31,15 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/mc_config/mss_eff_config +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/occ +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/pstates/pstates # objects common to hostboot and hbrt include htmgt_common.mk -# objects unique to hostboot (none yet) +# objects unique to hostboot OBJS += htmgt_memthrottles.o +OBJS += genPstate.o SUBDIRS += test.d SUBDIRS += runtime.d diff --git a/src/usr/htmgt/runtime/makefile b/src/usr/htmgt/runtime/makefile index 6312bab42..e996c938e 100644 --- a/src/usr/htmgt/runtime/makefile +++ b/src/usr/htmgt/runtime/makefile @@ -31,8 +31,8 @@ MODULE = htmgt_rt #include common ojects between hostboot and runtime hostboot include ../htmgt_common.mk -#include unique object modules - currently none -# OBJS += +#include unique object modules +#OBJS += #SUBDIRS += test.d diff --git a/src/usr/htmgt/test/pstatetest.H b/src/usr/htmgt/test/pstatetest.H index 7e6d8a595..6559a841c 100644 --- a/src/usr/htmgt/test/pstatetest.H +++ b/src/usr/htmgt/test/pstatetest.H @@ -45,6 +45,7 @@ #include #include #include +#include "../genPstate.H" using namespace TARGETING; @@ -52,18 +53,13 @@ class pstateTest: public CxxTest::TestSuite { public: - // Test function to build pstate table - // TODO RCT 114284 fix testcase - // Requires Hostboot functions that are not yet merged. Testcase should - // eventually call hb function "runP8BuildPstateDataBlock" declaired in - // freqVoltageSvc.H to build pstate table. - // p8_build_pstate_datablock reads VPD from all existing cores, not - // just functional cores. The current SIMICS standalone model does - // not support MVDP for all existing cores. + // TODO RTC: 116310 VPD needs to be fixed in simics before a valid + // pstate table can be built in simics. void DISABLE_test_verifyPstate( void ) { errlHndl_t l_errl = NULL; bool pstateLibLoadedLocally = false; + bool htmgtLibLoadedLocally = false; if(!VFS::module_is_loaded( "libpstates.so" ) ) { @@ -79,39 +75,40 @@ class pstateTest: public CxxTest::TestSuite } } - PstateSuperStructure pstateData; - TargetHandleList procChips; - getAllChips(procChips, TYPE_PROC, true); - - for (TargetHandleList::iterator itr = procChips.begin(); - itr != procChips.end(); - ++itr) + if(!VFS::module_is_loaded("libhtmgt.so")) { - // cast OUR type of target to a FAPI type of target. - const fapi::Target - fapiTarg(fapi::TARGET_TYPE_PROC_CHIP, - (const_cast(*itr))); - - - FAPI_INVOKE_HWP( l_errl, - p8_build_pstate_datablock, - fapiTarg, - &pstateData - ); - + l_errl = VFS::module_load("libhtmgt.so"); if( l_errl ) { + TS_FAIL("Could not load libhtmgt.so module"); errlCommit(l_errl,HTMGT_COMP_ID); - TS_FAIL("verifyPstate failed for huid 0x%x", - get_huid(*itr)); + } + else + { + htmgtLibLoadedLocally = true; } } + l_errl = genPstateTables(); + + if( l_errl ) + { + errlCommit(l_errl,HTMGT_COMP_ID); + TS_FAIL("verifyPstate failed"); + } + + // TODO RTC 116310 check eyecatcher in pstate table + if(pstateLibLoadedLocally) { VFS::module_unload( "libpstates.so" ); } + if(htmgtLibLoadedLocally) + { + VFS::module_unload( "libhtmgt.so" ); + } + } // test to call procedures HTMGT will need -- cgit v1.2.1