diff options
Diffstat (limited to 'src/usr/runtime/populate_hbruntime.C')
-rw-r--r-- | src/usr/runtime/populate_hbruntime.C | 155 |
1 files changed, 106 insertions, 49 deletions
diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C index 371c3bee8..5ead63b3e 100644 --- a/src/usr/runtime/populate_hbruntime.C +++ b/src/usr/runtime/populate_hbruntime.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2019 */ +/* Contributors Listed Below - COPYRIGHT 2016,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -56,7 +56,6 @@ #include <secureboot/trustedbootif.H> #include <secureboot/service.H> #include <hdat/hdat.H> -#include <config.h> #include "../hdat/hdattpmdata.H" #include "../hdat/hdatpcrd.H" #include "../secureboot/trusted/tpmLogMgr.H" @@ -854,9 +853,18 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, } #ifdef CONFIG_SECUREBOOT - memcpy(reinterpret_cast<uint8_t*>(l_prevDataAddr), - reinterpret_cast<uint8_t *>(l_memd_info.vaddr), - l_memd_info.secureProtectedPayloadSize); + if (l_memd_info.hasHashTable) + { + memcpy(reinterpret_cast<uint8_t*>(l_prevDataAddr), + reinterpret_cast<uint8_t *>(l_memd_info.vaddr), + l_memd_info.size); + } + else + { + memcpy(reinterpret_cast<uint8_t*>(l_prevDataAddr), + reinterpret_cast<uint8_t *>(l_memd_info.vaddr), + l_memd_info.secureProtectedPayloadSize); + } #else memcpy(reinterpret_cast<uint8_t*>(l_prevDataAddr), reinterpret_cast<uint8_t *>(l_memd_info.vaddr), @@ -905,10 +913,15 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, l_elog->collectTrace(RUNTIME_COMP_NAME); break; } + // break out of for-loop if + if(l_elog) + { + break; + } i++; } - // exit if we hit an error + // break out of do-while if we hit an error if(l_elog) { break; @@ -1009,7 +1022,16 @@ errlHndl_t hbResvLoadSecureSection (const PNOR::SectionId i_sec, if (i_secHdrExpected) { // If section is signed, only the protected size was loaded into memory - l_imgSize = l_info.secureProtectedPayloadSize; + if (!l_info.hasHashTable) + { + l_imgSize = l_info.secureProtectedPayloadSize; + } + else + { + // Need to expose header and hash table + l_pnorVaddr -= l_info.secureProtectedPayloadSize; + l_imgSize += l_info.secureProtectedPayloadSize; + } // Include secure header // NOTE: we do not preserve the header in virtual memory when SB // is compiled out. So "-PAGESIZE" only works when SB is compiled in @@ -1257,51 +1279,10 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId, bool i_master_node) break; } - //////////////////////////////////////////////////////////////////// - // Set the Architected Reserve area in OPAL and pass it down to SBE - 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, - VMM_ARCH_REG_DATA_SIZE_ALL_PROC, - HBRT_RSVD_MEM__ARCH_REG); - if(l_elog) - { - break; - } - // Loop through all functional Procs - for (const auto & l_procChip: l_procChips) - { - uint32_t l_procNum = - l_procChip->getAttr<TARGETING::ATTR_POSITION>(); - l_homerAddr = l_memBase + - (l_procNum * VMM_ARCH_REG_DATA_PER_PROC_SIZE); - - //Pass start address down to SBE via chipop - l_elog = SBEIO::sendPsuStashKeyAddrRequest( - SBEIO::ARCH_REG_DATA_ADDR, - l_homerAddr, - l_procChip); - if (l_elog) - { - TRACFCOMP( g_trac_runtime, "sendPsuStashKeyAddrRequest " - "failed for target: %x",TARGETING::get_huid(l_procChip)); - break; - } - } - - if(l_elog) - { - break; - } - //////////////////////////////////////////////////////////////////// - #ifdef CONFIG_START_OCC_DURING_BOOT /////////////////////////////////////////////////// // OCC Common entry + /////////////////////////////////////////////////// if( !(TARGETING::is_phyp_load()) ) { TARGETING::Target * l_sys = nullptr; @@ -1324,6 +1305,69 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId, bool i_master_node) #endif } + /////////////////////////////////////////////////// + // Set the SBE Architected Dump area + // Note that this is right after HOMER areas + // PHYP goes up, OPAL goes down. Save this away + // Into targeting so dumpCollect can find later + // on the MPIPL + // + // Note that this works for PHYP multinode (as it + // grabs location from HRMOR), but OPAL only + // supports a single node style system (absolute + // address) + ////////////////////////////////////////////////// + uint64_t l_archAddr = 0; + if(TARGETING::is_phyp_load()) + { + l_archAddr = cpu_spr_value(CPU_SPR_HRMOR) + + l_mirrorBase + + VMM_ARCH_REG_DATA_START_OFFSET; + } + else if(TARGETING::is_sapphire_load()) + { + l_archAddr = l_topMemAddr + - VMM_ALL_HOMER_OCC_MEMORY_SIZE + - VMM_ARCH_REG_DATA_SIZE_ALL_PROC; + } + l_sys->setAttr<TARGETING::ATTR_SBE_ARCH_DUMP_ADDR>(l_archAddr); + + // SBE Architected Dump area is a single chunk of data + // to OPAL/PHYP -- so reserve once, but need to inform + // individual SBEs of their location + l_elog = setNextHbRsvMemEntry(HDAT::RHB_TYPE_HBRT, + i_nodeId, + l_archAddr, + VMM_ARCH_REG_DATA_SIZE_ALL_PROC, + HBRT_RSVD_MEM__ARCH_REG); + if(l_elog) + { + break; + } + + // Loop through all functional Procs + uint32_t l_procNum = 0; + for (const auto & l_procChip: l_procChips) + { + uint64_t l_addr = l_archAddr + + (l_procNum++ * VMM_ARCH_REG_DATA_PER_PROC_SIZE); + + //Pass start address down to SBE via chipop + l_elog = SBEIO::sendPsuStashKeyAddrRequest( + SBEIO::ARCH_REG_DATA_ADDR, + l_addr, + l_procChip); + if (l_elog) + { + TRACFCOMP( g_trac_runtime, "Arch dump sendPsuStashKeyAddrRequest " + "failed for target: %x",TARGETING::get_huid(l_procChip)); + break; + } + } + if(l_elog) + { + break; + } //////////////////////////////////////////////////// // HB Data area @@ -1856,6 +1900,13 @@ errlHndl_t populate_hbSecurebootData ( void ) // populate security override setting l_sysSecSets->sbeSecBackdoor = SECUREBOOT::getSbeSecurityBackdoor(); + // populate "System Physical Presence has been asserted" + TARGETING::Target* sys = nullptr; + TARGETING::targetService().getTopLevelTarget( sys ); + assert(sys != nullptr, "populate_hbSecurebootData() - Could not obtain top level target"); + l_sysSecSets->physicalPresenceAsserted = + sys->getAttr<TARGETING::ATTR_PHYS_PRES_ASSERTED>(); + // populate TPM config bits in hdat bool tpmRequired = false; #ifdef CONFIG_TPMDD @@ -2863,6 +2914,12 @@ errlHndl_t populate_hbTpmInfo() // if single node system if (!hb_images) { + // TODO RTC: 214260 Remove workaround skipping the population + // of the TPM info for runtime on single node on Axone systems + #ifdef CONFIG_AXONE_BRING_UP + TRACFCOMP( g_trac_runtime, "SKIPPING populate_hbTpmInfo: Single node system"); + break; + #endif TRACDCOMP( g_trac_runtime, "populate_hbTpmInfo: Single node system"); l_elog = populate_TpmInfoByNode(0); // 0 for single node if(l_elog != nullptr) |