diff options
author | Ilya Smirnov <ismirno@us.ibm.com> | 2018-12-11 09:47:55 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-04-12 12:12:11 -0500 |
commit | a9addc3db4f8940ca38fb63c99fcab26126c88f0 (patch) | |
tree | 081e8545ba2b6585342c73dd6101fef562765fae /src/usr/runtime | |
parent | 75c14bbdbc1f8706d8dccab7d273cc3fd581717f (diff) | |
download | talos-hostboot-a9addc3db4f8940ca38fb63c99fcab26126c88f0.tar.gz talos-hostboot-a9addc3db4f8940ca38fb63c99fcab26126c88f0.zip |
SMF: Logic For Creating Non-Secure HOMER Memory Space
For SMF to be enabled, HOMER requires a small amount of
non-SMF (unsecure) memory where the "jump to Ultravisor"
instruction can be put (to transition to UV mode). This
commit sets up a region of non-secure memory space for
that purpose.
Change-Id: Ib91ec69f49a4e174e65f3c2aad337a68eaa0803b
RTC: 205986
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70699
Reviewed-by: Prem Shanker Jha <premjha2@in.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: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/runtime')
-rw-r--r-- | src/usr/runtime/populate_hbruntime.C | 57 |
1 files changed, 48 insertions, 9 deletions
diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C index ea9530d7f..764404804 100644 --- a/src/usr/runtime/populate_hbruntime.C +++ b/src/usr/runtime/populate_hbruntime.C @@ -81,6 +81,8 @@ #include <vmmconst.h> #include <runtime/customize_attrs_for_payload.H> #include <isteps/mem_utils.H> +#include <secureboot/smf_utils.H> +#include <secureboot/smf.H> namespace RUNTIME { @@ -1078,6 +1080,11 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId, bool i_master_node) do { + TARGETING::Target* l_sys = nullptr; + TARGETING::targetService().getTopLevelTarget(l_sys); + assert(l_sys != nullptr, + "populate_HbRsvMem: top level target nullptr" ); + // Configure the ATTR_HBRT_HYP_ID attributes so that runtime code and // whichever hypervisor is loaded can reference equivalent targets // When populating hbRuntimeData, we make IPC calls if we are running @@ -1128,11 +1135,6 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId, bool i_master_node) // If mirroring enabled, // change address start to be at its mirrored address equivalent - TARGETING::Target* l_sys = nullptr; - TARGETING::targetService().getTopLevelTarget(l_sys); - assert( l_sys != nullptr, - "populate_HbRsvMem: top level target nullptr" ); - auto l_mirrored = l_sys->getAttr<TARGETING::ATTR_PAYLOAD_IN_MIRROR_MEM>(); if (l_mirrored) @@ -1257,8 +1259,10 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId, bool i_master_node) //////////////////////////////////////////////////////////////////// // Set the Architected Reserve area in OPAL and pass it down to SBE - uint64_t l_memBase = l_topMemAddr - - VMM_ARCH_REG_DATA_SIZE_ALL_PROC - VMM_ALL_HOMER_OCC_MEMORY_SIZE; + uint64_t l_memBase = l_topMemAddr + - VMM_ALL_HOMER_OCC_MEMORY_SIZE + - VMM_ARCH_REG_DATA_SIZE_ALL_PROC; + l_elog = setNextHbRsvMemEntry(HDAT::RHB_TYPE_HBRT, i_nodeId, l_memBase, @@ -1343,8 +1347,9 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId, bool i_master_node) } else if(TARGETING::is_sapphire_load()) { - l_endAddr = l_topMemAddr - - VMM_ALL_HOMER_OCC_MEMORY_SIZE - VMM_ARCH_REG_DATA_SIZE_ALL_PROC; + l_endAddr = l_topMemAddr + - VMM_ALL_HOMER_OCC_MEMORY_SIZE + - VMM_ARCH_REG_DATA_SIZE_ALL_PROC; startAddressValid = false; } @@ -1691,6 +1696,40 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId, bool i_master_node) break; } } + + // Also add unsecure HOMER to the reserved mem if in SMF mode + if(SECUREBOOT::SMF::isSmfEnabled()) + { + auto l_unsecureHomerSize = l_sys-> + getAttr<TARGETING::ATTR_UNSECURE_HOMER_SIZE>(); + + // The address of unsecure HOMER is the same among all the + // procs, so we can just fetch it from the master proc. + TARGETING::Target* l_masterProc = nullptr; + l_elog = TARGETING::targetService() + .queryMasterProcChipTargetHandle(l_masterProc); + if(l_elog) + { + break; + } + + auto l_unsecureHomerAddr = l_masterProc-> + getAttr<TARGETING::ATTR_UNSECURE_HOMER_ADDRESS>(); + assert(l_unsecureHomerAddr, + "populate_HbRsvMem: Unsecure HOMER address is 0"); + assert(l_unsecureHomerSize <= MAX_UNSECURE_HOMER_SIZE, + "populate_HbRsvMem: Unsecure HOMER size is bigger than 0x%x", MAX_UNSECURE_HOMER_SIZE); + + l_elog = setNextHbRsvMemEntry(HDAT::RHB_TYPE_UNSECURE_HOMER, + i_nodeId, + l_unsecureHomerAddr, + l_unsecureHomerSize, + HBRT_RSVD_MEM__UNSEC_HOMER); + if(l_elog) + { + break; + } + } } } while(0); |