summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Geddes <crgeddes@us.ibm.com>2017-10-23 12:43:03 -0500
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-12-21 14:04:22 -0500
commit779a1c3444a348e7eccbf587ded6041cc3bbd13d (patch)
tree5b0db854286915626363b73ce82123227286ffe5
parent51d3eeea8b3a43ee443a4a92dd4d134056f7557f (diff)
downloadtalos-hostboot-779a1c3444a348e7eccbf587ded6041cc3bbd13d.tar.gz
talos-hostboot-779a1c3444a348e7eccbf587ded6041cc3bbd13d.zip
Read the hb/hyp comm area to see if hyp moved hrmor
During MPIPL it is possible that the hrmor was moved while the hypervisor was running. Before this commit if the hrmor was moved then hostboot would fail when we tried to collect dump information. With this commit hostboot will read the hyp/hb comm area to see if the hypervisor has moved the hrmor and told HB, if the hyp has then hostboot will set the ATTR_PAYLOAD_BASE attribute on the system target during the target service initialization Change-Id: I89b76913ffa106656f188364a2a077f982474084 RTC: 180959 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48699 Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Matt Derksen <mderkse1@us.ibm.com> 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> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
-rw-r--r--src/include/usr/runtime/runtime.H2
-rw-r--r--src/include/usr/targeting/attrrp.H9
-rwxr-xr-xsrc/usr/targeting/attrrp.C57
-rwxr-xr-xsrc/usr/targeting/targetservicestart.C68
4 files changed, 109 insertions, 27 deletions
diff --git a/src/include/usr/runtime/runtime.H b/src/include/usr/runtime/runtime.H
index 25177e465..d8d22a8d5 100644
--- a/src/include/usr/runtime/runtime.H
+++ b/src/include/usr/runtime/runtime.H
@@ -130,7 +130,7 @@ errlHndl_t populate_TpmInfoByNode();
#define MDT_MAINSTORE_ADDR_SECTION 0
#define MDT_RESERVED_HB_MEM_SECTION 5
-// Defines offset into mainstore address section wher HB writes the address
+// Defines offset into mainstore address section where HB writes the address
// of the HYP/HB comm area
// (See HDAT spec 11.1.2.1 Mainstore Address Configuration)
#define MDT_MAINSTORE_ADDR_SECTION_HYP_HB_COMM_ADDR_OFFSET 0x1C
diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H
index 1453d0273..02772cb6d 100644
--- a/src/include/usr/targeting/attrrp.H
+++ b/src/include/usr/targeting/attrrp.H
@@ -76,6 +76,15 @@ class AttrRP
public:
/**
+ * @brief Returns physical address of HB data reserved mem TOC
+ * note: does not unmap address
+ *
+ * @return phys addr of table of contents of hb data reserved memory
+ *
+ */
+ static uint64_t getHbDataTocAddr();
+
+ /**
* @brief Returns base address of the RO section containing the
* targets
*
diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C
index b4d5ce155..432a2481a 100755
--- a/src/usr/targeting/attrrp.C
+++ b/src/usr/targeting/attrrp.C
@@ -334,6 +334,33 @@ namespace TARGETING
}
}
+ uint64_t AttrRP::getHbDataTocAddr()
+ {
+ // Setup physical TOC address
+ uint64_t l_toc_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::RSV_MEM_ATTR_ADDR)
+ {
+ l_toc_addr = l_keyAddrPairs.addr[keyIndex];
+ break;
+ }
+ }
+
+ if(!l_toc_addr)
+ {
+ // Setup physical TOC address to hardcoded value
+ l_toc_addr = cpu_spr_value(CPU_SPR_HRMOR) +
+ VMM_HB_DATA_TOC_START_OFFSET;
+ }
+
+ // return the vaddr found from the mapping
+ return l_toc_addr;
+ }
+
errlHndl_t AttrRP::parseAttrSectHeader()
{
errlHndl_t l_errl = NULL;
@@ -372,39 +399,17 @@ namespace TARGETING
//Create a block map of the address space we used to store
//attribute information on the initial IPL
//Account HRMOR (non 0 base addr)
-
- ///////////////////////////////////////////////////////////////
- // This should change to get address from SBE. Currently hack
- // to the start of ATTR data section on FSP systems
uint64_t l_phys_attr_data_addr = 0;
uint64_t l_attr_data_size = 0;
// Setup physical TOC address
- uint64_t l_toc_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::RSV_MEM_ATTR_ADDR)
- {
- l_toc_addr = l_keyAddrPairs.addr[keyIndex];
- }
- }
-
- if(!l_toc_addr)
- {
- // Setup physical TOC address to hardcoded value
- l_toc_addr = cpu_spr_value(CPU_SPR_HRMOR) +
- VMM_HB_DATA_TOC_START_OFFSET;
- }
+ uint64_t l_toc_addr = AttrRP::getHbDataTocAddr();
// Now map the TOC to find the ATTR label address & size
Util::hbrtTableOfContents_t * l_toc_ptr =
- reinterpret_cast<Util::hbrtTableOfContents_t *>(
- mm_block_map(reinterpret_cast<void*>(l_toc_addr),
- sizeof(Util::hbrtTableOfContents_t)));
+ reinterpret_cast<Util::hbrtTableOfContents_t *>(
+ mm_block_map(reinterpret_cast<void*>(l_toc_addr),
+ sizeof(Util::hbrtTableOfContents_t)));
if (l_toc_ptr != 0)
{
diff --git a/src/usr/targeting/targetservicestart.C b/src/usr/targeting/targetservicestart.C
index 5eb625d52..636f2e60e 100755
--- a/src/usr/targeting/targetservicestart.C
+++ b/src/usr/targeting/targetservicestart.C
@@ -46,6 +46,7 @@
#include <targeting/adapters/assertadapter.H>
#include <initservice/taskargs.H>
#include <util/utilmbox_scratch.H>
+#include <util/align.H>
// This component
#include <targeting/common/targetservice.H>
@@ -58,6 +59,7 @@
#include <config.h>
#include <initservice/initserviceif.H>
#include <util/misc.H>
+#include <util/utilrsvdmem.H>
#include <kernel/bltohbdatamgr.H>
#include <map>
#include <arch/memorymap.H>
@@ -65,6 +67,8 @@
#include <xscom/xscomif.H>
#include <bootloader/bootloaderif.H>
#include <sbeio/sbeioif.H>
+#include <sys/mm.h>
+#include "../runtime/hdatstructs.H"
#ifdef CONFIG_DRTM
#include <secureboot/drtm.H>
@@ -437,6 +441,70 @@ static void initializeAttributes(TargetService& i_targetService,
auto tpmMutex=tpm->getHbMutexAttr<ATTR_HB_TPM_MUTEX>();
mutex_init(tpmMutex);
}
+
+ // 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)
+ {
+ // if the hrmor in the comm area is non-zero then set the payload base attribute
+ if( l_hbHypComm_ptr->hrmorAddress)
+ {
+ TARG_INF("Setting ATTR_PAYLOAD_BASE to new hrmor given by hypervisor: 0x%lx",
+ l_hbHypComm_ptr->hrmorAddress);
+ l_pTopLevel->setAttr<ATTR_PAYLOAD_BASE>(l_hbHypComm_ptr->hrmorAddress);
+ }
+ 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");
}
else
{
OpenPOWER on IntegriCloud