summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting/runtime
diff options
context:
space:
mode:
authorMarty Gloff <mgloff@us.ibm.com>2018-02-01 09:49:42 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-03-05 12:09:33 -0500
commit40c3350ff928b8df7f7db1baefe5800b25438f0c (patch)
treef30091fcf8bd523ab182fee8025784609930a08b /src/usr/targeting/runtime
parent48235812776de62e94ed09034eba83487d1b2bf1 (diff)
downloadtalos-hostboot-40c3350ff928b8df7f7db1baefe5800b25438f0c.tar.gz
talos-hostboot-40c3350ff928b8df7f7db1baefe5800b25438f0c.zip
Support multiple nodes in HBRT - Support Multiple Nodes in TargetService
Change to call the TargetService class initialization function with the correct maximum number of nodes rather than always defaulting to 1. Provide support to get first target iterator for a specific node. Update AttrRP::translateAddr functions to handle nodes. Change-Id: Ia3496c2f4daf0b78999bde35565f4541fedb0b4d RTC: 186869 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/53190 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: Prachi Gupta <pragupta@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/runtime')
-rw-r--r--src/usr/targeting/runtime/attrrp_rt.C87
-rw-r--r--src/usr/targeting/runtime/rt_targeting.C35
-rw-r--r--src/usr/targeting/runtime/start_rt.C70
3 files changed, 139 insertions, 53 deletions
diff --git a/src/usr/targeting/runtime/attrrp_rt.C b/src/usr/targeting/runtime/attrrp_rt.C
index 21aa4b8c6..f8d6ed9e2 100644
--- a/src/usr/targeting/runtime/attrrp_rt.C
+++ b/src/usr/targeting/runtime/attrrp_rt.C
@@ -488,20 +488,86 @@ namespace TARGETING
#undef TARG_FN
}
+ void AttrRP::getNodeId(const Target* i_pTarget,
+ NODE_ID& o_nodeId) const
+ {
+ #define TARG_FN "getNodeId"
+
+ bool l_found = false;
+
+ // Initialize with invalid
+ o_nodeId = INVALID_NODE_ID;
+
+ //find the node to which this target belongs
+ for(uint8_t i=0; i<INVALID_NODE_ID; ++i)
+ {
+ for(uint32_t j=0; j<iv_nodeContainer[i].sectionCount; ++j)
+ {
+ if( iv_nodeContainer[i].pSections[j].type ==
+ SECTION_TYPE_PNOR_RO)
+ {
+ // This expects the pTarget to be always in range and !NULL.
+ // If any invalid target is passed (which is still within the
+ // RO Section scope) then behaviour is undefined.
+ if( (i_pTarget >= iv_nodeContainer[i].pTargetMap) &&
+ (i_pTarget < reinterpret_cast<Target*>((
+ reinterpret_cast<uint8_t*>(
+ iv_nodeContainer[i].pTargetMap) +
+ iv_nodeContainer[i].pSections[j].size))) )
+ {
+ l_found = true;
+ o_nodeId = i;
+ break;
+ }
+ }
+ }
+ if(l_found)
+ {
+ break;
+ }
+ }
+ #undef TARG_FN
+ }
+
void* AttrRP::translateAddr(void* i_pAddress,
- const Target* i_pUnused)
+ const Target* i_pTarget)
{
- void* l_address = i_pAddress;
+ #define TARG_FN "translateAddr(..., Target*)"
+// TARG_ENTER(); // Disabled due to number of traces created
+
+ NODE_ID l_nodeId = NODE0;
- for (size_t i = 0; i < iv_sectionCount; ++i)
+ if(i_pTarget != NULL)
{
- if ((iv_sections[i].vmmAddress + iv_sections[i].size) >=
+ getNodeId(i_pTarget, l_nodeId);
+ }
+
+ void* l_address = translateAddr(i_pAddress, l_nodeId);
+
+// TARG_EXIT(); // Disabled due to number of traces created
+ #undef TARG_FN
+
+ return l_address;
+ }
+
+ void* AttrRP::translateAddr(void* i_pAddress,
+ const TARGETING::NODE_ID i_nodeId)
+ {
+ #define TARG_FN "translateAddr(..., NODE_ID)"
+// TARG_ENTER(); // Disabled due to number of traces created
+
+ void* l_address = NULL;
+
+ for (size_t i = 0; i < iv_nodeContainer[i_nodeId].sectionCount; ++i)
+ {
+ if ((iv_nodeContainer[i_nodeId].pSections[i].vmmAddress +
+ iv_nodeContainer[i_nodeId].pSections[i].size) >=
reinterpret_cast<uint64_t>(i_pAddress))
{
l_address = reinterpret_cast<void*>(
- iv_sections[i].pnorAddress +
+ iv_nodeContainer[i_nodeId].pSections[i].pnorAddress +
reinterpret_cast<uint64_t>(i_pAddress) -
- iv_sections[i].vmmAddress);
+ iv_nodeContainer[i_nodeId].pSections[i].vmmAddress);
break;
}
}
@@ -509,12 +575,9 @@ namespace TARGETING
TRACDCOMP(g_trac_targeting, "Translated 0x%p to 0x%p",
i_pAddress, l_address);
- return l_address;
- }
+// TARG_EXIT(); // Disabled due to number of traces created
+ #undef TARG_FN
- void* AttrRP::translateAddr(void* i_pAddress,
- const TARGETING::NODE_ID i_unused)
- {
- return translateAddr(i_pAddress, static_cast<Target*>(NULL));
+ return l_address;
}
}
diff --git a/src/usr/targeting/runtime/rt_targeting.C b/src/usr/targeting/runtime/rt_targeting.C
index 8eea48a57..8da93830d 100644
--- a/src/usr/targeting/runtime/rt_targeting.C
+++ b/src/usr/targeting/runtime/rt_targeting.C
@@ -45,6 +45,8 @@
#include <util/memoize.H>
#include <util/runtime/util_rt.H>
#include <util/utillidmgr.H>
+#include <sys/internode.h>
+
using namespace TARGETING;
@@ -123,17 +125,32 @@ errlHndl_t _getHbTarget(
TARGETING::TargetHandle_t pTarget = NULL;
if(i_rtTargetId != RUNTIME::HBRT_HYP_ID_UNKNOWN)
{
- for (TARGETING::TargetIterator pIt =
- TARGETING::targetService().begin();
- pIt != TARGETING::targetService().end();
- ++pIt)
+ uint8_t l_maxNodeId =
+ TARGETING::targetService().getNumInitializedNodes();
+ for(uint8_t l_nodeId=NODE0; l_nodeId<l_maxNodeId; ++l_nodeId)
{
- auto rtTargetId = RUNTIME::HBRT_HYP_ID_UNKNOWN;
- if( ((*pIt)->tryGetAttr<
- TARGETING::ATTR_HBRT_HYP_ID>(rtTargetId))
- && (rtTargetId == i_rtTargetId))
+ TRACFCOMP( g_trac_targeting, "Node %d beginning target %p",
+ l_nodeId,
+ *(TARGETING::targetService().begin(l_nodeId)));
+
+ for (TARGETING::TargetIterator pIt =
+ TARGETING::targetService().begin(l_nodeId);
+ pIt != TARGETING::targetService().end();
+ ++pIt)
+ {
+ auto rtTargetId = RUNTIME::HBRT_HYP_ID_UNKNOWN;
+ if( (*pIt != nullptr)
+ && ((*pIt)->tryGetAttr<
+ TARGETING::ATTR_HBRT_HYP_ID>(rtTargetId))
+ && (rtTargetId == i_rtTargetId))
+ {
+ pTarget = (*pIt);
+ break;
+ }
+ }
+
+ if(pTarget)
{
- pTarget = (*pIt);
break;
}
}
diff --git a/src/usr/targeting/runtime/start_rt.C b/src/usr/targeting/runtime/start_rt.C
index b49d4524b..dac7dc137 100644
--- a/src/usr/targeting/runtime/start_rt.C
+++ b/src/usr/targeting/runtime/start_rt.C
@@ -48,7 +48,7 @@ namespace RT_TARG
}
TargetService& l_targetService = targetService();
- (void)l_targetService.init();
+ l_targetService.init(Singleton<AttrRP>::instance().getNodeCount());
adjustTargeting4Runtime();
@@ -78,45 +78,51 @@ namespace RT_TARG
// error check that ATTR_PEER_TARGET is only readable, not writable.
// adjustTargeting4Runtime has been included as a friend to allow
// access to the private target class methods.
- const Target* l_pUnused = NULL;
size_t l_xlateCnt = 0;
- for (TargetIterator target = targetService().begin();
- target != targetService().end();
- ++target)
+ uint8_t l_maxNodeId =
+ TARGETING::targetService().getNumInitializedNodes();
+ for(uint8_t l_nodeId = NODE0; l_nodeId < l_maxNodeId; ++l_nodeId)
{
- const TARGETING::Target * l_target = *target;
- TARGETING::Target * l_peer = static_cast<Target*>(NULL);
- bool l_hasPeer = l_target->tryGetAttr<ATTR_PEER_TARGET>(l_peer);
- if (l_hasPeer && (l_peer != nullptr))
+ for (TargetIterator target = targetService().begin(l_nodeId);
+ target != targetService().end();
+ ++target)
{
- TRACDCOMP(g_trac_targeting,
- "translate peer target for=%p %x",
- l_target, get_huid(l_target));
-
- ATTR_PEER_TARGET_type l_xlated = (TARGETING::Target *)
- Singleton<AttrRP>::instance().
- AttrRP::translateAddr(l_peer,l_pUnused);
- bool l_fixed = false;
- l_fixed = l_target->_trySetAttr(ATTR_PEER_TARGET,
- sizeof(l_xlated),
- &l_xlated);
- if (l_fixed)
- {
- TRACDCOMP(g_trac_targeting, " to=%p", l_xlated);
- l_xlateCnt++;
- }
- // Not good if could not be fixed. But might not be referenced.
- // A segment fault will occur if used.
- else
+ const TARGETING::Target * l_target = *target;
+ TARGETING::Target * l_peer = static_cast<Target*>(NULL);
+ bool l_hasPeer = l_target->tryGetAttr<ATTR_PEER_TARGET>(l_peer);
+ if (l_hasPeer && (l_peer != nullptr))
{
TRACFCOMP(g_trac_targeting,
- "failed to translate peer target HUID=0x%x",
- get_huid(l_target));
+ "translate peer target for=%p %x",
+ l_target, get_huid(l_target));
+
+ ATTR_PEER_TARGET_type l_xlated = (TARGETING::Target *)
+ Singleton<AttrRP>::instance().
+ AttrRP::translateAddr(l_peer,l_target);
+ bool l_fixed = false;
+ l_fixed = l_target->_trySetAttr(ATTR_PEER_TARGET,
+ sizeof(l_xlated),
+ &l_xlated);
+ if (l_fixed)
+ {
+ TRACDCOMP(g_trac_targeting, " to=%p", l_xlated);
+ l_xlateCnt++;
+ }
+ // Not good if could not be fixed. But might not be
+ // referenced. A segment fault will occur if used.
+ else
+ {
+ TRACFCOMP(g_trac_targeting,
+ "failed to translate peer target HUID=0x%x",
+ get_huid(l_target));
+ }
}
}
}
TRACFCOMP(g_trac_targeting,
- "adjustTargeting4Runtime: %d peer target addresses translated",
- l_xlateCnt);
+ "adjustTargeting4Runtime: %d peer target addresses "
+ "translated on %d nodes",
+ l_xlateCnt,
+ l_maxNodeId);
}
}
OpenPOWER on IntegriCloud