From 15641e1a1fae0e60f9d74a5ef9ddf6f1fb6d5efc Mon Sep 17 00:00:00 2001 From: Prem Shanker Jha Date: Wed, 8 Aug 2018 10:13:39 -0500 Subject: UV Support: HWP inits runtime wakeup mode for each functional core. Commit initializes CPMMR[59] with 1 if SMF is not enabled otherwise with 0. This bit is read by CME in STOP 4/5 exit path. Based on the bit value, sets the runtime wakeup mode for core in thread scratch register. Change-Id: If339c62e2e2bb504b5bf8e6b5e864d6ca6b4dc75 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/64119 Tested-by: Jenkins Server Reviewed-by: Gregory S. Still Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/64234 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Christian R. Geddes --- .../hwp/pm/p9_setup_runtime_wakeup_mode.C | 92 ++++++++++++++++++++++ .../hwp/pm/p9_setup_runtime_wakeup_mode.H | 59 ++++++++++++++ .../hwp/pm/p9_setup_runtime_wakeup_mode.mk | 26 ++++++ 3 files changed, 177 insertions(+) create mode 100644 src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.C create mode 100644 src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.H create mode 100644 src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.mk (limited to 'src') diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.C b/src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.C new file mode 100644 index 000000000..6f2fdb0f4 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.C @@ -0,0 +1,92 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] 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 */ +/// +/// @file p9_setup_runtime_wakeup_mode.H +/// @brief describes HWP interface that configures runtime wakeup mode of core. +/// +/// *HWP HWP Owner: Greg Still +/// *HWP FW Owner: Prem S Jha +/// *HWP Team: PM +/// *HWP Level: 2 +/// *HWP Consumed by: Hostboot +// + +#if 0 +#include +#include + +enum +{ + RUN_TIME_WAKEUP_MODE_BIT_POS = 59, +}; + + +fapi2::ReturnCode p9_setup_runtime_wakeup_mode( + const fapi2::Target < fapi2::TARGET_TYPE_PROC_CHIP>& i_procTarget ) +{ + FAPI_INF("> p9_setup_runtime_wakeup_mode" ); + fapi2::buffer l_wakeupMode; + uint8_t l_smfEnabled; + const fapi2::Target FAPI_SYSTEM; + auto l_coreList = + i_procTarget.getChildren(fapi2::TARGET_STATE_FUNCTIONAL); + + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_SMF_ENABLED, + FAPI_SYSTEM, + l_smfEnabled), + "Error from FAPI_ATTR_GET for attribute ATTR_SMF_ENABLED "); + + for( auto core : l_coreList ) + { + FAPI_TRY(fapi2::getScom(i_procTarget, C_CPPM_CPMMR, l_wakeupMode), + "Failed To Read CPMMR"); + + FAPI_DBG( "Initial CPMMR Value 0x%016llx", l_wakeupMode ); + + if( l_smfEnabled ) + { + FAPI_DBG("SMF Enabled"); + //Wakeup in Ultravisor mode + l_wakeupMode.clearBit( RUN_TIME_WAKEUP_MODE_BIT_POS ); + } + else + { + //Wakeup in Hypervisor mode + l_wakeupMode.setBit( RUN_TIME_WAKEUP_MODE_BIT_POS ); + } + + FAPI_TRY(fapi2::putScom(core, C_CPPM_CPMMR, l_wakeupMode), + "Failed To Write CPMMR"); + + FAPI_DBG( "Final CPMMR Value 0x%016llx", l_wakeupMode ); + + } + +fapi_try_exit: + FAPI_INF("< p9_setup_runtime_wakeup_mode" ); + return fapi2::current_err; +} + +#endif diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.H b/src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.H new file mode 100644 index 000000000..27e9086ad --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.H @@ -0,0 +1,59 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] 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 */ + +#if 0 +#ifndef __RUN_TIME_WAKEUP_MODE_ +#define __RUN_TIME_WAKEUP_MODE_ + +/// +/// @file p9_setup_runtime_wakeup_mode.H +/// @brief describes HWP interface that configures runtime wakeup mode of core. +/// +/// *HWP HWP Owner: Greg Still +/// *HWP FW Owner: Prem S Jha +/// *HWP Team: PM +/// *HWP Level: 2 +/// *HWP Consumed by: Hostboot +// + + +#include + +extern "C" +{ + + typedef fapi2::ReturnCode( *p9_setup_runtime_wakeup_mode_FP_t ) ( + const fapi2::Target < fapi2::TARGET_TYPE_PROC_CHIP>& i_procTarget ); + + /// @brief sets runtime wakeup mode for all functional cores in the proc. + /// @param[in] i_procTarget fapi2 target for P9 chip. + /// @return FAPI2_RC_SUCCESS if HWP succeeds, error code otherwise. + fapi2::ReturnCode p9_setup_runtime_wakeup_mode( const fapi2::Target < fapi2::TARGET_TYPE_PROC_CHIP>& i_procTarget ); + +} //extern "C" + +#endif //__RUN_TIME_WAKEUP_MODE_ + +#endif diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.mk b/src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.mk new file mode 100644 index 000000000..9c4f8cd26 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.mk @@ -0,0 +1,26 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/import/chips/p9/procedures/hwp/pm/p9_setup_runtime_wakeup_mode.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2018 +# [+] 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 +#PROCEDURE = p9_setup_runtime_wakeup_mode +#$(call BUILD_PROCEDURE) -- cgit v1.2.1