Skip to content

Commit

Permalink
Only store HRMOR value on primary node
Browse files Browse the repository at this point in the history
There is a single field in HDAT where Hostboot fills in
an address where PHYP will then write the new HRMOR
value any time it changes.  The problem is that the
independent Hostboot instance in each node is writing
the same field with their own node-relative address.
There is only 1 field so the last node in will win.
Then on the mpipl we won't be able to find it.

Change-Id: I18f64816f20b0a3fc2951dff457d9511ca27e1d2
CQ:SW438101
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/62763
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Richard Ward <rward15@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: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mderkse1 authored and dcrowell77 committed Jul 23, 2018
1 parent 5ce2333 commit 78c7928
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 74 deletions.
18 changes: 9 additions & 9 deletions src/usr/runtime/populate_hbruntime.C
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,6 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address,
ALIGN_PAGE(l_hbTOC.entry[l_hbTOC.total_entries].size);
l_hbTOC.total_entries++;

// Fill in HYPCOMM size
l_hbTOC.entry[l_hbTOC.total_entries].label = Util::HBRT_MEM_LABEL_HYPCOMM;
l_hbTOC.entry[l_hbTOC.total_entries].offset = 0;
l_hbTOC.entry[l_hbTOC.total_entries].size = sizeof(hbHypCommArea_t);
l_totalSectionSize +=
ALIGN_PAGE(l_hbTOC.entry[l_hbTOC.total_entries].size);
l_hbTOC.total_entries++;

// Fill in VPD_XXXX sizes (if there are any)
VPD::OverrideRsvMemMap_t l_vpdOverrides;
VPD::getListOfOverrideSections( l_vpdOverrides );
Expand All @@ -579,7 +571,7 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address,
l_hbTOC.total_entries++;
}

// Fill in the TRACEBUF only for Master Node
// Fill in the TRACEBUF & HYPCOMM only for Master Node
if(i_master_node == true )
{
// Fill in TRACEBUF size
Expand All @@ -589,6 +581,14 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address,
l_totalSectionSize +=
ALIGN_PAGE(l_hbTOC.entry[l_hbTOC.total_entries].size);
l_hbTOC.total_entries++;

// Fill in HYPCOMM size
l_hbTOC.entry[l_hbTOC.total_entries].label = Util::HBRT_MEM_LABEL_HYPCOMM;
l_hbTOC.entry[l_hbTOC.total_entries].offset = 0;
l_hbTOC.entry[l_hbTOC.total_entries].size = sizeof(hbHypCommArea_t);
l_totalSectionSize +=
ALIGN_PAGE(l_hbTOC.entry[l_hbTOC.total_entries].size);
l_hbTOC.total_entries++;
}
l_totalSectionSize += sizeof(l_hbTOC); // Add 4KB Table of Contents

Expand Down
142 changes: 77 additions & 65 deletions src/usr/targeting/targetservicestart.C
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
// This component
#include <targeting/common/targetservice.H>
#include <targeting/attrrp.H>
#include <targeting/targplatutil.H>

// Others
#include <errl/errlentry.H>
Expand Down Expand Up @@ -530,73 +531,84 @@ static void initializeAttributes(TargetService& i_targetService,
membuf->setAttr<ATTR_IBSCOM_VIRTUAL_ADDR>(0);
}

// Setup physical TOC address
uint64_t l_hbdTocAddr = AttrRP::getHbDataTocAddr();

// Variables to store information about Hostboot/Hypervisor communcation area
uint64_t l_hypComm_virt_addr = 0;
uint64_t l_hypComm_phys_addr = 0;
uint64_t l_hypComm_size = 0;

// Now map the TOC to find the total size of the data section
Util::hbrtTableOfContents_t * l_toc_ptr =
reinterpret_cast<Util::hbrtTableOfContents_t *>(
mm_block_map(reinterpret_cast<void*>(l_hbdTocAddr),
ALIGN_PAGE(sizeof(Util::hbrtTableOfContents_t))));

// read the TOC and look for ATTR data section
l_hypComm_virt_addr = Util::hb_find_rsvd_mem_label(
Util::HBRT_MEM_LABEL_HYPCOMM,
l_toc_ptr,
l_hypComm_size);


//This will tell us how far from the beginning of the toc_ptr the hypComm area starts
uint64_t l_hypComm_offset = l_hypComm_virt_addr - reinterpret_cast<uint64_t>(l_toc_ptr);

//Use the offset found w/ virtual addresses to determine the physical address of the
//hostboot/hypervisor comm area
l_hypComm_phys_addr = l_hbdTocAddr + l_hypComm_offset;

// Clear the mapped memory for the TOC, it is not longer needed as we have phys ptr
assert (0 == mm_block_unmap(reinterpret_cast<void*>(l_toc_ptr)),
"Failed to unmap hbData TOC");

// The hb/hyp communcation area is at the end of the hostboot
// data reserved mem section.
hbHypCommArea_t * l_hbHypComm_ptr =
reinterpret_cast<hbHypCommArea_t *>(
mm_block_map(reinterpret_cast<void*>(l_hypComm_phys_addr),
ALIGN_PAGE(sizeof(l_hypComm_size))));

// Make sure the magic number and version are valid
if(l_hbHypComm_ptr->magicNum == HYPECOMM_MAGIC_NUM && l_hbHypComm_ptr->version >= STRUCT_VERSION_FIRST)
// HYPCOMM section is only present for master node
if ( TARGETING::UTIL::isCurrentMasterNode() )
{
// if the hrmor in the comm area is non-zero then set the payload base attribute
if( l_hbHypComm_ptr->hrmorAddress)
{
const uint64_t THREAD_STATE_RUNNING = 0x8000000000000000ULL;
TARG_INF("Setting ATTR_PAYLOAD_BASE to new hrmor given by hypervisor: 0x%lx",
l_hbHypComm_ptr->hrmorAddress);
//Mask off THREAD_STATE_RUNNING bit and then divide remaining address by 1 MB
uint64_t l_payloadBase_MB = ((~(THREAD_STATE_RUNNING)) & l_hbHypComm_ptr->hrmorAddress) / MEGABYTE;
//ATTR_PAYLOAD_BASE's is MB
l_pTopLevel->setAttr<ATTR_PAYLOAD_BASE>(l_payloadBase_MB);
}
else
{
TARG_INF("Using default HRMOR as hypervisor did notify us of a change in it's HRMOR on previous boot");
}

}
else
{
TARG_INF("Warning!! hbHypCommArea_t's version is invalid so we cannot check if hrmor has been changed");
}
// Setup physical TOC address
uint64_t l_hbdTocAddr = AttrRP::getHbDataTocAddr();

// Variables to store information about Hostboot/Hypervisor
// communication area
uint64_t l_hypComm_virt_addr = 0;
uint64_t l_hypComm_phys_addr = 0;
uint64_t l_hypComm_size = 0;

// Now map the TOC to find the total size of the data section
Util::hbrtTableOfContents_t * l_toc_ptr =
reinterpret_cast<Util::hbrtTableOfContents_t *>(
mm_block_map(reinterpret_cast<void*>(l_hbdTocAddr),
ALIGN_PAGE(sizeof(Util::hbrtTableOfContents_t))));

// read the TOC and look for ATTR data section
l_hypComm_virt_addr = Util::hb_find_rsvd_mem_label(
Util::HBRT_MEM_LABEL_HYPCOMM,
l_toc_ptr,
l_hypComm_size);

//This will tell us how far from the beginning of
//the toc_ptr the hypComm area starts
uint64_t l_hypComm_offset = l_hypComm_virt_addr -
reinterpret_cast<uint64_t>(l_toc_ptr);

//Use the offset found w/ virtual addresses to determine
//the physical address of the hostboot/hypervisor comm area
l_hypComm_phys_addr = l_hbdTocAddr + l_hypComm_offset;

//Clear the mapped memory for the TOC,
//it is not longer needed as we have phys ptr
assert (0 == mm_block_unmap(reinterpret_cast<void*>(l_toc_ptr)),
"Failed to unmap hbData TOC");

// The hb/hyp communcation area is at the end of the hostboot
// data reserved mem section.
hbHypCommArea_t * l_hbHypComm_ptr =
reinterpret_cast<hbHypCommArea_t *>(
mm_block_map(reinterpret_cast<void*>(l_hypComm_phys_addr),
ALIGN_PAGE(sizeof(l_hypComm_size))));

// Make sure the magic number and version are valid
if( l_hbHypComm_ptr->magicNum == HYPECOMM_MAGIC_NUM &&
l_hbHypComm_ptr->version >= STRUCT_VERSION_FIRST )
{
// if the hrmor in the comm area is non-zero then
// set the payload base attribute
if( l_hbHypComm_ptr->hrmorAddress)
{
const uint64_t THREAD_STATE_RUNNING = 0x8000000000000000ULL;
TARG_INF("Setting ATTR_PAYLOAD_BASE to new hrmor given by hypervisor: 0x%lx",
l_hbHypComm_ptr->hrmorAddress);
//Mask off THREAD_STATE_RUNNING bit and
//then divide remaining address by 1 MB
uint64_t l_payloadBase_MB = ( (~(THREAD_STATE_RUNNING)) &
l_hbHypComm_ptr->hrmorAddress) / MEGABYTE;
//ATTR_PAYLOAD_BASE's is MB
l_pTopLevel->setAttr<ATTR_PAYLOAD_BASE>(l_payloadBase_MB);
}
else
{
TARG_INF("Using default HRMOR as hypervisor did notify us of a change in it's HRMOR on previous boot");
}
}
else
{
TARG_INF("Warning!! hbHypCommArea_t's version is invalid so we cannot check if hrmor has been changed");
}

// Clear the mapped memory for the hbHypComm area
assert(0 == mm_block_unmap(reinterpret_cast<void*>(l_hbHypComm_ptr)),
"Failed to unmap hbHypComm area");
// Clear the mapped memory for the hbHypComm area
assert(0 == mm_block_unmap(
reinterpret_cast<void*>(l_hbHypComm_ptr)),
"Failed to unmap hbHypComm area");
} // end of master node only HRMOR setup
}
else
{
Expand Down

0 comments on commit 78c7928

Please sign in to comment.