Skip to content

Commit

Permalink
Add support to find relocated payload base address
Browse files Browse the repository at this point in the history
OPAL relocates itself after boot. During MPIPL, hostboot needs to access
relocated SPIRAH. Hence lets add support to get relocated payload base address.

OPAL will use SBE stash chip-op to send relocated address to SBE. During early
IPL SBE sends stashed data to hostboot. And hostboot will use that information
to find relocated payload (OPAL) base.

SBE stash chip op:
  key = 0x03
  val = <relocated payload base address>

Change-Id: I1089bd38f32b01b877d1580ba76313fc250e5c08
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/57514
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
Vasant Hegde authored and dcrowell77 committed Apr 21, 2018
1 parent 89f9205 commit 9a3aa40
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/include/usr/runtime/runtime.H
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,13 @@ void saveActualCount( SectionId i_id,
*/
errlHndl_t writeActualCount( SectionId i_id );

/**
* @brief Use relocated payload base address
*
* @param[in] val 'true' for post dump data collection
*/
void useRelocatedPayloadAddr(bool val);

/**
* @brief Retrieve and log FFDC data relevant to a given section of
* host data memory
Expand Down
7 changes: 4 additions & 3 deletions src/include/usr/sbeio/sbeioif.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* Contributors Listed Below - COPYRIGHT 2013,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -31,8 +31,9 @@ namespace SBEIO
{
enum KeyAddrStashKeys
{
RSV_MEM_ATTR_ADDR = 0x01, //Start at non-zero
HYPERVISOR_HRMOR = 0x02,
RSV_MEM_ATTR_ADDR = 0x01, //Start at non-zero
HYPERVISOR_HRMOR = 0x02,
RELOC_PAYLOAD_ADDR = 0x03,
//On SBE side struct is defaulted so that
//Keys are 0xFF and Vals are 0xFFFFFFFFFFFFFFFF
//So a key w/ FF means its empty or at its default val
Expand Down
8 changes: 8 additions & 0 deletions src/include/usr/targeting/attrrp.H
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ class AttrRP
void* getTargetMapPtr(const NODE_ID i_nodeId);
#endif

/**
* @brief Returns relocated absolute address of payload
*
* @return phys addr of payload
*
*/
static uint64_t getHbDataRelocPayloadAddr();

/**
* @brief Returns base address of the RO section containing the
* targets
Expand Down
5 changes: 5 additions & 0 deletions src/usr/dump/dumpCollect.C
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ errlHndl_t doDumpCollect(void)
{
TRACFCOMP(g_trac_dump, "doDumpCollect - start ");

// Use relocated payload base to get MDST, MDDT, MDRT details
RUNTIME::useRelocatedPayloadAddr(true);

errlHndl_t l_err = NULL;

// Table Sizes
Expand Down Expand Up @@ -100,6 +103,8 @@ errlHndl_t doDumpCollect(void)

}while (0);

RUNTIME::useRelocatedPayloadAddr(false);

return (l_err);
}

Expand Down
27 changes: 27 additions & 0 deletions src/usr/runtime/hdatservice.C
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "hdatservice.H"
#include "errlud_hdat.H"
#include <errl/errlmanager.H>
#include <targeting/attrrp.H>

//#define REAL_HDAT_TEST

Expand Down Expand Up @@ -316,6 +317,7 @@ hdatService::hdatService(void)
:iv_spiraL(NULL)
,iv_spiraH(NULL)
,iv_spiraS(NULL)
,iv_useRelocatedPayload(false)
{
for( uint8_t id = static_cast<uint8_t>(RUNTIME::FIRST_SECTION);
id <= static_cast<uint8_t>(RUNTIME::LAST_SECTION);
Expand Down Expand Up @@ -492,6 +494,26 @@ errlHndl_t hdatService::loadHostData(void)
uint64_t hdat_start = payload_base*MEGABYTE;
uint64_t hdat_size = HDAT_MEM_SIZE;

// OPAL relocates itself after boot. Hence get relocated payload
// address. If relocated address not available then use normal
// base address (as OPAL would have crashed during early init).
if (iv_useRelocatedPayload == true &&
TARGETING::PAYLOAD_KIND_SAPPHIRE == payload_kind)
{
uint64_t reloc_base;

reloc_base = TARGETING::AttrRP::getHbDataRelocPayloadAddr();
if (reloc_base != 0)
{
hdat_start = reloc_base;
TRACFCOMP( g_trac_runtime, "Relocated payload base =%p", hdat_start);
}
else
{
TRACFCOMP( g_trac_runtime, "No relocated payload base found, continuing on");
}
}

#ifdef REAL_HDAT_TEST
hdat_start = 256*MEGABYTE;
#endif
Expand Down Expand Up @@ -1745,6 +1767,11 @@ errlHndl_t writeActualCount( SectionId i_id )
return Singleton<hdatService>::instance().writeActualCount(i_id);
}

void useRelocatedPayloadAddr(bool val)
{
return Singleton<hdatService>::instance().useRelocatedPayloadAddr(val);
}

/**
* @brief Retrieve and log FFDC data relevant to a given section of
* host data memory
Expand Down
17 changes: 17 additions & 0 deletions src/usr/runtime/hdatservice.H
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,12 @@ namespace RUNTIME
*/
uint16_t iv_actuals[RUNTIME::LAST_SECTION+1];

/**
* Used to identify whether to use relocated payload base address
* or normal address.
*/
bool iv_useRelocatedPayload;

/**
* Dummy value for unassigned actual
*/
Expand Down Expand Up @@ -339,6 +345,17 @@ namespace RUNTIME
}
return l_err;
}

/**
* @brief Use relocated payload base address
*
* @param[in] val 'true' for post dump data collection
*
*/
void useRelocatedPayloadAddr(bool val)
{
iv_useRelocatedPayload = val;
}
};

};
Expand Down
19 changes: 19 additions & 0 deletions src/usr/targeting/attrrp.C
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,25 @@ namespace TARGETING
return l_toc_addr;
}

uint64_t AttrRP::getHbDataRelocPayloadAddr()
{
uint64_t payload_addr = 0;
Bootloader::keyAddrPair_t l_keyAddrPairs =
g_BlToHbDataManager.getKeyAddrPairs();

for (uint8_t keyIndex = 0; keyIndex < MAX_ROW_COUNT; keyIndex++)
{
if(l_keyAddrPairs.key[keyIndex] == SBEIO::RELOC_PAYLOAD_ADDR)
{
payload_addr = l_keyAddrPairs.addr[keyIndex];
break;
}
}

// return relocated payload physical address
return payload_addr;
}

errlHndl_t AttrRP::parseAttrSectHeader()
{
errlHndl_t l_errl = NULL;
Expand Down

0 comments on commit 9a3aa40

Please sign in to comment.