diff options
author | Jaymes Wilks <mjwilks@us.ibm.com> | 2018-03-08 16:30:41 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-04-06 12:30:40 -0400 |
commit | be53610329532c64c3a924db343c0d474079b95d (patch) | |
tree | c3f3e95129ad545d5be44e59bb3d42124d8251cb /src/usr/hdat | |
parent | d5ba4627b254190f6b37ee487b3be1951c056e08 (diff) | |
download | talos-hostboot-be53610329532c64c3a924db343c0d474079b95d.tar.gz talos-hostboot-be53610329532c64c3a924db343c0d474079b95d.zip |
Propagate TPM information into HDAT on non-master nodes
Extends HDAT population to add TPM data to all functional nodes
- Added message sends from the master to each node
- Each node updates # of instances, sizes of structures, etc.
- Each node navigates to its appropriate offset in HDAT
- HDAT now populates entries for all TPMs in the blueprint
- Physical presence interaction mechanism is master-only obtained
- TPM SRTM and DRTM logs are no longer interlaced between TPM info
- Single node workaround reverted
Change-Id: Ic77cbeb7ba3d35a9f02ba68525ed79f27159e9bf
RTC:167290
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/55283
Reviewed-by: Nicholas E. Bofferding <bofferdn@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>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: ILYA SMIRNOV <ismirno@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/hdat')
-rw-r--r-- | src/usr/hdat/hdatcommonutil.C | 11 | ||||
-rw-r--r-- | src/usr/hdat/hdattpmdata.C | 57 | ||||
-rw-r--r-- | src/usr/hdat/hdattpmdata.H | 17 |
3 files changed, 54 insertions, 31 deletions
diff --git a/src/usr/hdat/hdatcommonutil.C b/src/usr/hdat/hdatcommonutil.C index 1bb9d43ac..ed92e4da8 100644 --- a/src/usr/hdat/hdatcommonutil.C +++ b/src/usr/hdat/hdatcommonutil.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017 */ +/* Contributors Listed Below - COPYRIGHT 2017,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -72,17 +72,10 @@ uint16_t hdatCalcMaxTpmsPerNode() return l_maxTpms; } -uint32_t hdatTpmDataCalcMaxSize() +uint32_t hdatTpmDataCalcInstanceSize() { uint32_t l_size = 0; - // TODO RTC 167290 - In order to support multiple nodes, this calculation - // needs to be #nodes * [ the entire 18.x set of structures ] and the - // initialization needs to be done on each instance. The reported size - // (in variable o_size) needs to be the size of a single instance and the - // reported count (via o_count) needs to be the number of nodes. For now, - // we assume one node. - // account for the size of the TPM data header l_size += sizeof(hdatTpmData_t); diff --git a/src/usr/hdat/hdattpmdata.C b/src/usr/hdat/hdattpmdata.C index 9ef885227..9337c7b9e 100644 --- a/src/usr/hdat/hdattpmdata.C +++ b/src/usr/hdat/hdattpmdata.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017 */ +/* Contributors Listed Below - COPYRIGHT 2017,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -55,7 +55,23 @@ HdatTpmData::HdatTpmData(errlHndl_t &o_errlHndl, const uint64_t l_baseAddr = static_cast<uint64_t>(i_msAddr.hi) << 32 | i_msAddr.lo; - const auto maxLogicalSize = hdatTpmDataCalcMaxSize(); + + // get the top level target + TARGETING::Target* sys = nullptr; + TARGETING::targetService().getTopLevelTarget( sys ); + assert(sys != nullptr, + "HdatTpmData::HdatTpmData: Bug! Could not obtain top level target"); + + // get the node bit string to see what our node layout looks like + auto l_nodeBits = sys->getAttr<TARGETING::ATTR_HB_EXISTING_IMAGE>(); + + // count the bits to get the functional/present nodes + iv_numNodes = __builtin_popcount(l_nodeBits); + + // Must be at least one. Add one in the zero case. + iv_numNodes += !iv_numNodes; + + const auto maxLogicalSize = hdatTpmDataCalcInstanceSize() * iv_numNodes; const uint64_t l_size = ALIGN_PAGE(maxLogicalSize) + PAGESIZE; const uint64_t l_alignedAddr = ALIGN_PAGE_DOWN(l_baseAddr); @@ -69,9 +85,6 @@ HdatTpmData::HdatTpmData(errlHndl_t &o_errlHndl, iv_hdatTpmData = reinterpret_cast<hdatTpmData_t *>(l_virtAddr + l_offset); - // TODO RTC 167290 - This memset needs to be revisited for multinode - // support. We may need to do this memset once per node or use some - // other approach to initialization. memset(iv_hdatTpmData, 0x0, maxLogicalSize); HDAT_DBG("Ctr iv_hdatTpmData addr 0x%.16llX virtual addr 0x%.16llX", @@ -147,25 +160,35 @@ errlHndl_t HdatTpmData::hdatLoadTpmData(uint32_t &o_size, uint32_t &o_count) o_count = 0; - o_size = hdatTpmDataCalcMaxSize(); + // calculate the size of each instance + o_size = hdatTpmDataCalcInstanceSize(); - // Note: HdatTpmData constructor already cleared the memory to the tune of - // o_size (hdatTpmDataCalcMaxSize()) bytes + auto l_hdatTpmData = iv_hdatTpmData; - // We add the first two fields for a reference to aid in debugging, - // but the rest will be populated in FSP/OpenPower common code. Any - // work here would just be duplicated later during the runtime istep. + for (uint32_t i_instance = 0; i_instance < iv_numNodes; i_instance++) + { + // Note: HdatTpmData constructor already cleared the memory to the tune + // of o_size (hdatTpmDataCalcInstanceSize()) bytes + + // We add the first two fields for a reference to aid in debugging, + // but the rest will be populated in FSP/OpenPower common code. Any + // work here would just be duplicated later during the runtime istep. - // add the format magic number - iv_hdatTpmData->hdatHdr.hdatStructId = HDAT::HDAT_HDIF_STRUCT_ID; + // add the format magic number + iv_hdatTpmData->hdatHdr.hdatStructId = HDAT::HDAT_HDIF_STRUCT_ID; - // add the eyecatcher - memcpy(iv_hdatTpmData->hdatHdr.hdatStructName, + // add the eyecatcher + memcpy(iv_hdatTpmData->hdatHdr.hdatStructName, g_hdatTpmDataEyeCatch, strlen(g_hdatTpmDataEyeCatch)); - // account for this one instance of Node TPM Related Data - ++o_count; + // Account for this one instance of Node TPM Related Data. + ++o_count; + + // Move to the next instance + l_hdatTpmData = reinterpret_cast<hdatTpmData_t *>( + reinterpret_cast<uint8_t*>(l_hdatTpmData) + o_size); + } return l_errl; } diff --git a/src/usr/hdat/hdattpmdata.H b/src/usr/hdat/hdattpmdata.H index b1ac99676..f04403e1e 100644 --- a/src/usr/hdat/hdattpmdata.H +++ b/src/usr/hdat/hdattpmdata.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017 */ +/* Contributors Listed Below - COPYRIGHT 2017,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -239,10 +239,11 @@ class HdatTpmData private: - HDAT::hdatMsAddr_t iv_msAddr; + HDAT::hdatMsAddr_t iv_msAddr; hdatTpmData_t *iv_hdatTpmData; + uint32_t iv_numNodes; }; // end of HdatTpmData class @@ -258,15 +259,21 @@ class HdatTpmData uint16_t hdatCalcMaxTpmsPerNode(); /** - * @brief Calculate the maximum size of the HDAT TPM data section + * @brief Calculate the maximum size of an instance of HDAT TPM data. There + * will be one instance per functional node in the system. It is assumed + * that this function will be used determine how much space one node's + * worth of HDAT TPM data will occupy worst case. It is assumed that each + * instance will have the same max size and that the instances will be + * placed one after another in memory (not page aligned) with enough + * space to accommodate the maximum possible size of each node. * * @pre None * * @post None * - * @retval uint32_t Maximum size of the HDAT TPM data section + * @retval uint32_t Maximum size of one instance of HDAT TPM data. */ -uint32_t hdatTpmDataCalcMaxSize(); +uint32_t hdatTpmDataCalcInstanceSize(); } #endif // HDATTPMDATA_H |