summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorIlya Smirnov <ismirno@us.ibm.com>2018-07-24 13:25:28 -0500
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2018-09-05 13:10:50 -0500
commitfd77849e3981e7a6e463d35c748ecb53b6a5dd81 (patch)
tree39673ae6c9c634fe80077e3a21bbbf044f20e4a5 /src/include
parent4bff76ae17a525ce3459361d72e09999e6b0a2d4 (diff)
downloadtalos-hostboot-fd77849e3981e7a6e463d35c748ecb53b6a5dd81.tar.gz
talos-hostboot-fd77849e3981e7a6e463d35c748ecb53b6a5dd81.zip
Port System and Node Targets Stitching Code
HBRT's targeting doesn't map the System target to its nodes correctly because the target stitching code, that already exists on FSP, is not present in HBRT. This change ports the abovementioned code to HBRT, so that the system and node targets are correctly associated to each other at the end of targeting init. Note that unstitching is required during MPIPL to break the links between sys <-> node because only one node on which hb is running is visible during the boot. Change-Id: I9731144c480b3357ff7b4aff02d13623a1119dac CQ: SW432119 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65494 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/usr/targeting/attrrp.H37
-rw-r--r--src/include/usr/targeting/common/associationmanager.H189
-rw-r--r--src/include/usr/targeting/common/iterators/rawtargetiterator.H5
-rw-r--r--src/include/usr/targeting/common/targetservice.H53
-rw-r--r--src/include/usr/targeting/targplatreasoncodes.H6
5 files changed, 288 insertions, 2 deletions
diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H
index ab800beb8..c863c8417 100644
--- a/src/include/usr/targeting/attrrp.H
+++ b/src/include/usr/targeting/attrrp.H
@@ -165,6 +165,43 @@ class AttrRP
* @return Address of targeting image as a void*
*/
void* getTargetMapPtr(const NODE_ID i_nodeId);
+
+ /**
+ * @brief Converts target's platform address to a common address
+ *
+ * @par Detailed Description:
+ * Takes a platform target address, and converts it to a
+ * common address by looking up the node/section holding the
+ * address and adding the previously stripped out VMM offset
+ * back in
+ *
+ * @param[in] i_pTarget
+ * Pointer to target. Must not be nullptr (decode error otherwise)
+ * @param[out] o_rawAddr
+ * Target's platform address converted to common address. On
+ * failure, returns 0. May include node ID in leftmost byte.
+ *
+ * @return Error log handle indicating the status of the request
+ *
+ * @retval nullptr Translated the platform address into a common
+ * address and returned result in o_rawAddr
+ * @retval !nullptr Failed to translate the platform address into a
+ * common address and set o_rawAddr to 0
+ *
+ * Error log handle points to a valid error log object whose
+ * primary SRC reason code (pError->getSRC()->reasonCode())
+ * indicates the type of error. This API may return one
+ * of the following "special" reason codes:
+ * N/A
+ *
+ * @note It is up to the caller to change the severity of the
+ * returned error based on what it decides to do with it. By
+ * default any returned error created by this function will
+ * be a non-reported tracing event error log.
+ */
+ errlHndl_t convertPlatTargAddrToCommonAddr(
+ const Target* const i_pTarget,
+ uint64_t& o_rawAddr) const;
#endif
/**
diff --git a/src/include/usr/targeting/common/associationmanager.H b/src/include/usr/targeting/common/associationmanager.H
new file mode 100644
index 000000000..306d6f79a
--- /dev/null
+++ b/src/include/usr/targeting/common/associationmanager.H
@@ -0,0 +1,189 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/targeting/common/associationmanager.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 */
+#ifndef ASSOCIATIONMANAGER_H
+#define ASSOCIATIONMANAGER_H
+
+#include <targeting/common/error.H>
+#include <targeting/common/target.H>
+#include <targeting/common/targetservice.H>
+
+namespace TARGETING
+{
+
+class AssociationManager
+{
+ public:
+
+ /**
+ * @brief Links system targets to node targets via associations, and vice
+ * versa
+ *
+ * @par Detailed Description:
+ * Links system targets to node targets via associations, and vice
+ * versa. Should be called any time targeting is brought up, as well
+ * as whenever the master system target changes. Any existing
+ * associations between system and node targets (any variety) are
+ * first discarded. Should only be attempted when other targeting
+ * operations are quiesced (i.e. exclusive mode).
+ *
+ * @return Error log handle indicating the status of the request
+ *
+ * @retval nullptr Relinked node and system targets with associations
+ * @retval !nullptr Failed to relink the node and system targets with
+ * associations.
+ *
+ * Error log handle points to a valid error log object whose
+ * primary SRC reason code (pError->getSRC()->reasonCode())
+ * indicates the type of error. This API may return one
+ * of the following "special" reason codes:
+ * N/A
+ *
+ * @note It is up to the caller to change the severity of the
+ * returned error based on what it decides to do with it. By
+ * default any returned error created by this function will
+ * be a non-reported tracing event error log.
+ */
+ static errlHndl_t reconnectSyAndNodeTargets();
+
+ private:
+
+ /**
+ * @brief Clears assocations of requested type from a system or node target
+ *
+ * @par Detailed Description:
+ * For the specified target and association type, clears all
+ * association links that are configured. Used to clear association
+ * entries in preparation for cross linking nodes to the master system
+ * target (and vice versa). Relies on association data being
+ * copy-on-write memory mapped. Any input error will assert, as this
+ * is designed to be used in a well controlled way as a helper
+ * function. All other errors will return error log handles.
+ *
+ * @param[in] i_assocType
+ * Type of association link to clear from input target (supports parent
+ * by containment and parent by affinity for node input targets, and
+ * child by affinity and child by containment for system input
+ * targets). Asserts if unsupported association type/target combo
+ * specified.
+ * @param[in] i_pSourceSysOrNodeTarget
+ * Pointer to target to clear the associations from. Must not be
+ * nullptr (asserts in that case). Must be a node (any variety) or
+ * system target.
+ *
+ * @return Error log handle indicating the status of the request
+ *
+ * @retval nullptr Cleared the associations from the source target
+ * @retval !nullptr Failed to clear the associations from the source target
+ *
+ * Error log handle points to a valid error log object whose
+ * primary SRC reason code (pError->getSRC()->reasonCode())
+ * indicates the type of error. This API may return one
+ * of the following "special" reason codes:
+ * N/A
+ *
+ * @note It is up to the caller to change the severity of the
+ * returned error based on what it decides to do with it. By
+ * default any returned error created by this function will
+ * be a non-reported tracing event error log.
+ *
+ * @pre Should only be called by reconnectSysAndNodeTargets function
+ * @pre Assumes changed memory area is in a copy-on-write memory mapping
+ */
+ static errlHndl_t _clearAssocsOfTypeFromSysOrNodeTarget(
+ const TargetService::ASSOCIATION_TYPE i_assocType,
+ Target* const i_pSourceSysOrNodeTarget);
+
+ /**
+ * @brief Adds an association of a given type to a source target, pointing
+ * to a given destination target
+ *
+ * @par Detailed Description:
+ * Adds an association of a given type to a source target, pointing to
+ * a given destination target. A common pointer to the destination
+ * target is registered in the association list of the given type, for
+ * the given source target. Only node and system targets can be linked
+ * in this fashion, and source/destination must be different types.
+ * Any input error will assert, as this is designed to be used in a
+ * well controlled way as a helper function. All other errors will
+ * return error log handles.
+ *
+ * @param[in] i_assocType
+ * Type of association link to add to input target (supports parent by
+ * containment and parent by affinity for node input targets, and child
+ * by affinity and child by containment for system input targets).
+ * Asserts if unsupported association type/target combo specified.
+ * @param[in] i_pSourceSysOrNodeTarget
+ * Pointer to target to add the associations to. Must not be nullptr
+ * (asserts in that case). Must be a node (any variety) or system
+ * target. If node target, the i_pDestTarget must refer to a system
+ * target. If system target, the i_pDestTarget must refer to a node
+ * target.
+ * @param[in] i_pDestSysOrNodeTarget
+ * Pointer to target to be linked to. Must not be nullptr
+ * (asserts in that case). Must be a node (any variety) or system
+ * target. If node target, the source target must refer to a system
+ * target. If system target, the source target must refer to a node
+ * target.
+ *
+ * @return Error log handle indicating the status of the request
+ *
+ * @retval nullptr Added the association to the source target (points to
+ * destination target)
+ * @retval !nullptr Failed to add the association
+ *
+ * Error log handle points to a valid error log object whose
+ * primary SRC reason code (pError->getSRC()->reasonCode())
+ * indicates the type of error. This API may return one
+ * of the following "special" reason codes:
+ * N/A
+ *
+ * @note It is up to the caller to change the severity of the
+ * returned error based on what it decides to do with it. By
+ * default any returned error created by this function will
+ * be a non-reported tracing event error log.
+ *
+ * @pre Should only be called by reconnectSysAndNodeTargets function
+ * @pre Assumes changed memory area is in a copy-on-write memory mapping
+ */
+ static errlHndl_t _addAssocToSysOrNodeTarget(
+ const TargetService::ASSOCIATION_TYPE i_assocType,
+ Target* const i_pSourceSysOrNodeTarget,
+ const Target* const i_pDestSysOrNodeTarget);
+
+ // Disable copy constructor
+ AssociationManager(const AssociationManager& i_other);
+
+ // Disable assignment operator
+ AssociationManager& operator=(const AssociationManager& i_other);
+
+ // Disable CTOR
+ AssociationManager();
+
+ // Disable DTOR
+ ~AssociationManager();
+};
+
+} //End namespace TARGETING
+#endif //ASSOCIATIONMANAGER_H
diff --git a/src/include/usr/targeting/common/iterators/rawtargetiterator.H b/src/include/usr/targeting/common/iterators/rawtargetiterator.H
index 8dbd2118f..b99dfebd8 100644
--- a/src/include/usr/targeting/common/iterators/rawtargetiterator.H
+++ b/src/include/usr/targeting/common/iterators/rawtargetiterator.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,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. */
@@ -108,7 +110,6 @@ class _TargetRawIterator : public _TargetIterator<T>
*
* @return The reference to the same iterator after advancing it
*/
- ALWAYS_INLINE
_TargetRawIterator& operator++();
/**
diff --git a/src/include/usr/targeting/common/targetservice.H b/src/include/usr/targeting/common/targetservice.H
index 37bf6216e..4c6f78996 100644
--- a/src/include/usr/targeting/common/targetservice.H
+++ b/src/include/usr/targeting/common/targetservice.H
@@ -129,6 +129,35 @@ namespace TARGETING
*/
TARGETING::TargetService& targetService();
+#ifdef __HOSTBOOT_MODULE
+ /**
+ * @brief Maps a system target to its node target and node ID
+ */
+ struct SysToNode
+ {
+ Target* pNodeTarget; ///< Node target handle (do not delete)
+ Target* pSysTarget; ///< System target handle (do not delete)
+ NODE_ID nodeId; ///< Ordinal ID of node
+
+ SysToNode(
+ Target* const i_pNodeTarget,
+ Target* const i_pSysTarget,
+ const NODE_ID i_nodeId)
+ : pNodeTarget(i_pNodeTarget),
+ pSysTarget(i_pSysTarget),
+ nodeId(i_nodeId)
+ {
+ }
+ };
+
+/**
+ * @brief Aliases related to system->node associations
+ */
+typedef std::vector< SysToNode >SysToNodeContainer;
+typedef SysToNodeContainer::iterator SysToNodeContainerIt;
+typedef SysToNodeContainer::const_iterator SysToNodeContainerConstIt;
+#endif
+
/**
* @brief Sentinel representing the master processor chip target early in
* host boot prior to initialization of the target service. Needed by the
@@ -857,7 +886,31 @@ class TargetService
* @return number of mutex attributes reset
*/
uint32_t resetMutexAttributes( const Target* i_pTarget);
+
+ /**
+ * @brief Returns container which maps each system target to the ordinal
+ * ID/target of node associated with it.
+ *
+ * @par Detailed Description:
+ * Returns container which maps each system target to the ordinal
+ * ID/target of node associated with it. Each node in PNOR
+ * contains one copy of the system target, but targeting usually
+ * only exposes one copy of it to applets and services.
+ * This facility provides convenient access to the
+ * list of those normally hidden system targets, and their
+ * corresponding node targets. Optionally, it also reports on
+ * control nodes.
+ *
+ * @param[in] i_anyNodeType
+ * When false (default), only look up compute nodes. When true,
+ * look up any node type (compute + control nodes).
+ *
+ * @return Container which maps each system target to the ordinal
+ * ID/target of node associated with it
+ */
+ SysToNodeContainer getSysToNodeAssociations(const bool i_anyNodeType);
#endif
+
private:
/**
diff --git a/src/include/usr/targeting/targplatreasoncodes.H b/src/include/usr/targeting/targplatreasoncodes.H
index 274b14757..625509cb6 100644
--- a/src/include/usr/targeting/targplatreasoncodes.H
+++ b/src/include/usr/targeting/targplatreasoncodes.H
@@ -62,6 +62,10 @@ enum PlatTargetingModuleId
TARG_RT_VALIDATEDATA = 0x86,
TARG_RT_SAVERESTOREATTRS = 0x87,
TARG_SVC_RESET_MUTEX = 0x88,
+ TARG_MOD_ATTRRP_TO_COMMON_ADDR = 0x89,
+ TARG_MOD_CLR_ASSOCS_FROM_SYS_OR_NODE_TARGET = 0x8A,
+ TARG_MOD_ADD_ASSOC_TO_SYS_OR_NODE_TARGET = 0x8B,
+ TARG_MOD_RECONNECT_SYS_AND_NODE_TARGETS = 0x8C,
};
/**
@@ -83,6 +87,8 @@ enum PlatTargetingReasonCode
TARG_RT_BAD_ATTR_SIZES = TARG_COMP_ID | 0x88,
TARG_SVC_MISSING_ATTR = TARG_COMP_ID | 0x89,
TARG_RT_NODE_NOT_IN_IMAGE = TARG_COMP_ID | 0x8A,
+ TARG_RC_FAILED_TO_XLATE_ADDR = TARG_COMP_ID | 0x8B,
+ TARG_RC_EXCEEDED_ENTRY_LIMIT = TARG_COMP_ID | 0x8C,
};
} // End TARGETING namespace
OpenPOWER on IntegriCloud