From 6da5b41be5353e1b5fb1f3e6cda73c1ad1650041 Mon Sep 17 00:00:00 2001 From: Amit Tendolkar Date: Fri, 5 May 2017 07:23:01 -0500 Subject: [PATCH] Base infra for PM FFDC extraction of PPE state Allows a HWP to callback into the p9_ppe_state via FAPI return code using the collectFfdc error xml tag, such that the PPE state registers get added as FFDC to the return code Change-Id: If1c7804fb8d04ba2b8d5939f111f6d7cbb7e4443 RTC: 163327 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40139 Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: Brian T. Vanderpool Reviewed-by: Gregory S. Still Reviewed-by: Jennifer A. Stofer Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40142 Reviewed-by: Hostboot Team Tested-by: FSP CI Jenkins Tested-by: Jenkins OP Build CI Reviewed-by: Daniel M. Crowell --- .../p9/procedures/hwp/ffdc/ffdc_includes.H | 3 +- .../hwp/ffdc/p9_collect_ppe_state.C | 132 ++++++++++++++++++ .../hwp/ffdc/p9_collect_ppe_state.H | 74 ++++++++++ .../hwp/ffdc/p9_collect_ppe_state.mk | 27 ++++ .../chips/p9/procedures/hwp/lib/p9_ppe_defs.H | 65 +++++++++ .../xml/error_info/p9_collect_ppe_state.xml | 49 +++++++ 6 files changed, 349 insertions(+), 1 deletion(-) create mode 100644 src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.C create mode 100644 src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.H create mode 100644 src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.mk create mode 100644 src/import/chips/p9/procedures/hwp/lib/p9_ppe_defs.H create mode 100644 src/import/chips/p9/procedures/xml/error_info/p9_collect_ppe_state.xml diff --git a/src/import/chips/p9/procedures/hwp/ffdc/ffdc_includes.H b/src/import/chips/p9/procedures/hwp/ffdc/ffdc_includes.H index d86ddf37c74..d5b4480f902 100644 --- a/src/import/chips/p9/procedures/hwp/ffdc/ffdc_includes.H +++ b/src/import/chips/p9/procedures/hwp/ffdc/ffdc_includes.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -32,4 +32,5 @@ #include #include +#include #endif diff --git a/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.C b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.C new file mode 100644 index 00000000000..194e00d3499 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.C @@ -0,0 +1,132 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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_collect_ppe_state.C +/// +/// *HWP HW Owner : Greg Still +/// *HWP HW Backup Owner : Brian Vanderpool +/// *HWP FW Owner : Amit Tendolkar +/// *HWP Team : PM +/// *HWP Level : 3 +/// *HWP Consumed by : HB + + +#include +#include +#include + +#include +#include + +extern "C" +{ + fapi2::ReturnCode + p9_collect_ppe_state ( const fapi2::ffdc_t& i_target, + const fapi2::ffdc_t& i_v_ppe_addresses, + fapi2::ReturnCode& o_rc ) + { + FAPI_INF (">> p9_collect_ppe_state"); + fapi2::ReturnCode l_rc; + + fapi2::ffdc_t PPE_REG_NR; + fapi2::ffdc_t PPE_REG_VAL; + + fapi2::Target l_proc_chip = + *(reinterpret_cast *> + (i_target.ptr())); + + std::vector l_ppe_addresses = + *(reinterpret_cast*> + (i_v_ppe_addresses.ptr())); + + + PPE_DUMP_MODE l_mode = SNAPSHOT; // halt & restart PPE engine, if needed + + std::vector l_v_sprs; + std::vector l_v_xirs; + std::vector l_v_gprs; + + for (auto& it1 : l_ppe_addresses ) + { + fapi2::ReturnCode l_rc_tmp = fapi2::current_err; + + FAPI_INF ("p9_collect_ppe_state: PPE Base Addr 0x%.16llX, 0x%.8X", + it1, l_mode); + FAPI_EXEC_HWP (l_rc, p9_ppe_state, l_proc_chip, it1, l_mode, + l_v_sprs, l_v_xirs, l_v_gprs); + + // Ignore l_rc and continue adding whatever was collected + + // @TODO via RTC: 175232 + // Restore current_err to what was passed in + fapi2::current_err = l_rc_tmp; + + FAPI_INF ("Adding PPE Addr: 0x%.16llX, SPRs: %d XIRs: %d GPRs: %d", + it1, l_v_sprs.size(), l_v_xirs.size(), l_v_gprs.size()); + + for (auto& it : l_v_sprs) + { + PPE_REG_NR.ptr() = static_cast(&it.number); + PPE_REG_NR.size() = sizeof (it.number); + + PPE_REG_VAL.ptr() = static_cast(&it.value); + PPE_REG_VAL.size() = sizeof (it.value); + + FAPI_ADD_INFO_TO_HWP_ERROR (o_rc, RC_PPE_STATE_DATA_SPR); + } + + l_v_sprs.clear(); + + for (auto& it : l_v_xirs) + { + PPE_REG_NR.ptr() = static_cast(&it.number); + PPE_REG_NR.size() = sizeof (it.number); + + PPE_REG_VAL.ptr() = static_cast(&it.value); + PPE_REG_VAL.size() = sizeof (it.value); + + FAPI_ADD_INFO_TO_HWP_ERROR (o_rc, RC_PPE_STATE_DATA_XIR); + } + + l_v_xirs.clear(); + + for (auto& it : l_v_gprs) + { + PPE_REG_NR.ptr() = static_cast(&it.number); + PPE_REG_NR.size() = sizeof (it.number); + + PPE_REG_VAL.ptr() = static_cast(&it.value); + PPE_REG_VAL.size() = sizeof (it.value); + + FAPI_ADD_INFO_TO_HWP_ERROR (o_rc, RC_PPE_STATE_DATA_GPR); + } + + l_v_gprs.clear (); + } + + FAPI_INF ("<< p9_collect_ppe_state"); + return fapi2::FAPI2_RC_SUCCESS; // always return success + } +} diff --git a/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.H b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.H new file mode 100644 index 00000000000..109d3929f90 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.H @@ -0,0 +1,74 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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_collect_ppe_state.H +/// @brief FFDC procedure to dump a PPE engine's state to the return code +// object passed by the user. +/// +/// *HWP HW Owner : Greg Still +/// *HWP HW Backup Owner : Brian Vanderpool +/// *HWP FW Owner : Amit Tendolkar +/// *HWP Team : PM +/// *HWP Level : 3 +/// *HWP Consumed by : HB + +#ifndef __P9_COLLECT_PPE_STATE_H__ +#define __P9_COLLECT_PPE_STATE_H__ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ +#include +#include + +/// @typedef p9_collect_ppe_state_FP_t +/// function pointer typedef definition for HWP call support +typedef fapi2::ReturnCode (*p9_collect_ppe_state_FP_t) ( + const fapi2::ffdc_t&, + const fapi2::ffdc_t&, + fapi2::ReturnCode& +); + +//------------------------------------------------------------------------------ +// Function prototypes +//------------------------------------------------------------------------------ +extern "C" +{ + +/// @brief HWP to collect PPE internal register (SPRs, XIRs and GPRs) state as +/// FFDC associated to the input ReturnCode object +/// @param [in] i_target TARGET_TYPE_PROC_CHIP +/// @param [in] i_v_ppe_addresses Vector of addresses of PPEs, whose states +/// are to be collected. See p9_ppe_defs.H +/// @param[out] io_rc Return code to add FFDC data to +/// @return FAPI2_RC_SUCCESS Always succeeds + fapi2::ReturnCode + p9_collect_ppe_state ( const fapi2::ffdc_t& i_target, + const fapi2::ffdc_t& i_v_ppe_addresses, + fapi2::ReturnCode& io_rc ); + +} // extern C + +#endif // __P9_COLLECT_PPE_STATE_H___ diff --git a/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.mk b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.mk new file mode 100644 index 00000000000..86c0b62454c --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.mk @@ -0,0 +1,27 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/import/chips/p9/procedures/hwp/ffdc/p9_collect_ppe_state.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2017 +# [+] 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_collect_ppe_state +$(call ADD_MODULE_SRCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/procedures/hwp/lib) +$(call BUILD_PROCEDURE) diff --git a/src/import/chips/p9/procedures/hwp/lib/p9_ppe_defs.H b/src/import/chips/p9/procedures/hwp/lib/p9_ppe_defs.H new file mode 100644 index 00000000000..a1328b450fb --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/lib/p9_ppe_defs.H @@ -0,0 +1,65 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/lib/p9_ppe_defs.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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_ppe_defs.H +/// @brief PPE commonly used definitions +/// +/// *HWP HW Owner : Greg Still +/// *HWP HW Backup Owner : Brian Vanderpool +/// *HWP FW Owner : Amit Tendolkar +/// *HWP Team : PM +/// *HWP Level : 1 +/// *HWP Consumed by : FSP, HB, SBE +#ifndef __P9_PPE_DEFS_H__ +#define __P9_PPE_DEFS_H__ + +#include +#include +#include + +/// @brief Base SCOM addresses for PPE State Collection +const uint64_t SBE_BASE_ADDRESS = PU_PPE_XIXCR; +const uint64_t GPE0_BASE_ADDRESS = PU_GPE0_PPE_XIXCR; +const uint64_t GPE1_BASE_ADDRESS = PU_GPE1_PPE_XIXCR; +const uint64_t PGPE_BASE_ADDRESS = PU_GPE2_PPE_XIXCR; +const uint64_t SGPE_BASE_ADDRESS = PU_GPE3_PPE_XIXCR; +const uint64_t CME0_BASE_ADDRESS = EX_PPE_XIXCR; +const uint64_t IOPPE_BASE_ADDRESS = XBUS_IOPPE_PPE_XIXCR; + +/// @brief Each CME is associated with an EX target, that contains the 2 cores, +/// that are controlled by that CME. Using this relation, +/// this helper function gets the base SCOM address +/// to collect PPE State of the CME associated with an EX +/// @param[in] i_ExChipUnitPos The EX targets's ATTR_CHIP_UNIT_POS +/// @return uint64_t PPE State collection base address of the +/// associated CME +inline uint64_t getCmeBaseAddress (const uint8_t i_ExChipUnitPos) +{ + return ( CME0_BASE_ADDRESS | + ((i_ExChipUnitPos / 2) << 24) | + ((i_ExChipUnitPos % 2) << 10) ); +} + +#endif // __P9_PPE_DEFS_H__ diff --git a/src/import/chips/p9/procedures/xml/error_info/p9_collect_ppe_state.xml b/src/import/chips/p9/procedures/xml/error_info/p9_collect_ppe_state.xml new file mode 100644 index 00000000000..b8b68a5b7c9 --- /dev/null +++ b/src/import/chips/p9/procedures/xml/error_info/p9_collect_ppe_state.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RC_PPE_STATE_DATA_SPR + PPE SPR Data + PPE_REG_NR + PPE_REG_VAL + + + + RC_PPE_STATE_DATA_XIR + PPE XIR Data + PPE_REG_NR + PPE_REG_VAL + + + + RC_PPE_STATE_DATA_GPR + PPE GPR Data + PPE_REG_NR + PPE_REG_VAL + + +