Skip to content

Commit

Permalink
Base infra for PM FFDC extraction of PPE state
Browse files Browse the repository at this point in the history
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 <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Brian T. Vanderpool <vanderp@us.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40142
Reviewed-by: Hostboot Team <hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
am10dolkar authored and dcrowell77 committed Jun 11, 2017
1 parent c22f744 commit 6da5b41
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/import/chips/p9/procedures/hwp/ffdc/ffdc_includes.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -32,4 +32,5 @@

#include <p9_collect_some_ffdc.H>
#include <p9_pib2pcb_mux_seq.H>
#include <p9_collect_ppe_state.H>
#endif
132 changes: 132 additions & 0 deletions 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 <stillgs@us.ibm.com>
/// *HWP HW Backup Owner : Brian Vanderpool <vanderp@us.ibm.com>
/// *HWP FW Owner : Amit Tendolkar <amit.tendolkar@in.ibm.com>
/// *HWP Team : PM
/// *HWP Level : 3
/// *HWP Consumed by : HB


#include <fapi2.H>
#include <hwp_error_info.H>
#include <p9_const_common.H>

#include <p9_collect_ppe_state.H>
#include <p9_ppe_state.H>

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<fapi2::TARGET_TYPE_PROC_CHIP> l_proc_chip =
*(reinterpret_cast<const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> *>
(i_target.ptr()));

std::vector<uint64_t> l_ppe_addresses =
*(reinterpret_cast<const std::vector<uint64_t>*>
(i_v_ppe_addresses.ptr()));


PPE_DUMP_MODE l_mode = SNAPSHOT; // halt & restart PPE engine, if needed

std::vector<PPERegValue_t> l_v_sprs;
std::vector<PPERegValue_t> l_v_xirs;
std::vector<PPERegValue_t> 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<void*>(&it.number);
PPE_REG_NR.size() = sizeof (it.number);

PPE_REG_VAL.ptr() = static_cast<void*>(&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<void*>(&it.number);
PPE_REG_NR.size() = sizeof (it.number);

PPE_REG_VAL.ptr() = static_cast<void*>(&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<void*>(&it.number);
PPE_REG_NR.size() = sizeof (it.number);

PPE_REG_VAL.ptr() = static_cast<void*>(&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
}
}
74 changes: 74 additions & 0 deletions 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 <stillgs@us.ibm.com>
/// *HWP HW Backup Owner : Brian Vanderpool <vanderp@us.ibm.com>
/// *HWP FW Owner : Amit Tendolkar <amit.tendolkar@in.ibm.com>
/// *HWP Team : PM
/// *HWP Level : 3
/// *HWP Consumed by : HB

#ifndef __P9_COLLECT_PPE_STATE_H__
#define __P9_COLLECT_PPE_STATE_H__

//------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------
#include <return_code.H>
#include <error_info_defs.H>

/// @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___
27 changes: 27 additions & 0 deletions 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)
65 changes: 65 additions & 0 deletions 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 <stillgs@us.ibm.com>
/// *HWP HW Backup Owner : Brian Vanderpool <vanderp@us.ibm.com>
/// *HWP FW Owner : Amit Tendolkar <amit.tendolkar@in.ibm.com>
/// *HWP Team : PM
/// *HWP Level : 1
/// *HWP Consumed by : FSP, HB, SBE
#ifndef __P9_PPE_DEFS_H__
#define __P9_PPE_DEFS_H__

#include <p9_quad_scom_addresses.H>
#include <p9_misc_scom_addresses.H>
#include <p9_xbus_scom_addresses.H>

/// @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__
@@ -0,0 +1,49 @@
<!-- IBM_PROLOG_BEGIN_TAG -->
<!-- This is an automatically generated prolog. -->
<!-- -->
<!-- $Source: src/import/chips/p9/procedures/xml/error_info/p9_collect_ppe_state.xml $ -->
<!-- -->
<!-- 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 -->
<!-- Error definitions for p9_collect_ppe_state procedure -->
<hwpErrors>
<!--************************************************************************-->
<hwpError>
<rc>RC_PPE_STATE_DATA_SPR</rc>
<description>PPE SPR Data</description>
<ffdc>PPE_REG_NR</ffdc>
<ffdc>PPE_REG_VAL</ffdc>
</hwpError>
<!--************************************************************************-->
<hwpError>
<rc>RC_PPE_STATE_DATA_XIR</rc>
<description>PPE XIR Data</description>
<ffdc>PPE_REG_NR</ffdc>
<ffdc>PPE_REG_VAL</ffdc>
</hwpError>
<!--************************************************************************-->
<hwpError>
<rc>RC_PPE_STATE_DATA_GPR</rc>
<description>PPE GPR Data</description>
<ffdc>PPE_REG_NR</ffdc>
<ffdc>PPE_REG_VAL</ffdc>
</hwpError>
<!--************************************************************************-->
</hwpErrors>

0 comments on commit 6da5b41

Please sign in to comment.