From 3db6c1479f40d745525e3414bdce95d5f280a660 Mon Sep 17 00:00:00 2001 From: Ilya Smirnov Date: Mon, 29 Jul 2019 09:54:40 -0500 Subject: Cache VERSION Partition This commit adds logic to cache the VERSION partition so that errl commit function is able to use the cached data instead of sending messages to SPnorRP queue. Said messages also cause deadlocks if secureboot verifications fail, since the code attempts to send a synch message to the SPnorRP queue while it's handling another synch message. These changes only impact OP systems and code paths. Change-Id: I9eeb05878d98fb2891fe76adc06ad376edc77fbe CQ: SW465038 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/82304 Reviewed-by: Nicholas E Bofferding Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Glenn Miles Reviewed-by: Michael Baiocchi Reviewed-by: Daniel M Crowell --- src/include/usr/errl/errlmanager.H | 65 +++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) (limited to 'src/include/usr') diff --git a/src/include/usr/errl/errlmanager.H b/src/include/usr/errl/errlmanager.H index f7407d8c4..5bd2aa196 100644 --- a/src/include/usr/errl/errlmanager.H +++ b/src/include/usr/errl/errlmanager.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* Contributors Listed Below - COPYRIGHT 2011,2019 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -81,6 +81,32 @@ void errlCommit(errlHndl_t& io_err, compId_t i_committerComp ); */ uint8_t getHiddenLogsEnable(); +/** + * @brief Returns the cached VERSION partition, if any. Makes a call to + * ErrlManager::getCachedVersionPartition + * @return uint8_t* The pointer to the binary contents of the VERSION + * partition; nullptr will be returned if VERSION hasn't been + * cached yet of if there was an error during caching + */ +const uint8_t* getCachedVersionPartition(); + +/** + * @brief Returns the size of the cached VERSION partition. Makes a call + * to ErrlManager::getCachedVersionPartitionSize + * @return size_t The size of the cached VERSION partition. A 0 will be + * returned if VERSION hasn't been cached yet or if there was an + * error during caching + */ +size_t getCachedVersionPartitionSize(); + +/* + * @brief Call to ErrlManager to cache the VERSION PNOR partition into an + * internal buffer. + * + * @return errlHndl_t nullptr on success; non-nullptr on error. + */ +errlHndl_t cacheVersionPartition(); + /** * @brief Global enums used by static errlResourceReady function */ @@ -209,6 +235,34 @@ public: */ static bool errlCommittedThisBoot(); + /** + * @brief Returns the cached VERSION partition, if any + * @return uint8_t* The pointer to the binary contents of the VERSION + * partition + */ + const uint8_t* getCachedVersionPartition() const; + + /** + * @brief Returns the size of the cached VERSION partition + * @return size_t The size of the cached VERSION partition + */ + size_t getCachedVersionPartitionSize() const; + + /** + * @brief Cache the VERSION PNOR partition into a member buffer. The + * buffer is dynamically allocated here to hold the contents of the + * partition. If any error occurs during the execution, the buffer + * is deleted and the error is returned. This function is not + * supposed to be called within ErrlManager message handler, since + * the function itself makes synchronous calls to various message + * handlers. Note that once the partition is cached, the cache is + * never purged to make sure all possible error logs receive the + * VERSION field. No-op on FSP systems. + * + * @return errlHndl_t nullptr on success; non-nullptr on error. + */ + errlHndl_t cacheVersionPartition(); + /** * @brief Value to determine what logs are to be skipped. Mirrors @@ -634,6 +688,15 @@ private: bool allowCallHomeEselsToBmc(void); #endif + const uint8_t* iv_versionPartitionCache; // The bin contents of the VERSION + // partition; once cached, the + // constents are never removed + + size_t iv_versionPartitionCacheSize; // The size of the VERSION partition + + bool iv_isVersionPartitionCached; // Whether the caching of the VERSION + // partition has been attempted + }; -- cgit v1.2.1