summaryrefslogtreecommitdiffstats
path: root/src/include/usr/secureboot
diff options
context:
space:
mode:
authorIlya Smirnov <ismirno@us.ibm.com>2018-10-18 09:54:09 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-11-27 09:53:52 -0600
commit50182cf759b9a9c233c7bca4719b6dbc40de7952 (patch)
tree8b24c335823038d2146aba9bc71b1f531f0fa10b /src/include/usr/secureboot
parentcbf7565aeb3f5294dc1aef26e94421f74d5e9c50 (diff)
downloadtalos-hostboot-50182cf759b9a9c233c7bca4719b6dbc40de7952.tar.gz
talos-hostboot-50182cf759b9a9c233c7bca4719b6dbc40de7952.zip
SMF: Distribute Secure Memory Among Procs
Logic for distributing the requested amount of SMF memory between the procs with memory on the system. The algorithm attempts to allocate the memory in power-of-two increments of 256MB (such is the HW limitation) under each proc until the requested amount is satisfied or until we run out of procs with memory. Change-Id: Ica3e1706bdb731762a3daf07c11d889fc7b6367f RTC: 192411 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/68128 Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Roland Veloz <rveloz@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: FSP CI Jenkins <fsp-CI-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>
Diffstat (limited to 'src/include/usr/secureboot')
-rw-r--r--src/include/usr/secureboot/secure_reasoncodes.H3
-rw-r--r--src/include/usr/secureboot/smf.H66
-rw-r--r--src/include/usr/secureboot/smf_utils.H6
3 files changed, 74 insertions, 1 deletions
diff --git a/src/include/usr/secureboot/secure_reasoncodes.H b/src/include/usr/secureboot/secure_reasoncodes.H
index 7188b4e4f..acd3b0c5d 100644
--- a/src/include/usr/secureboot/secure_reasoncodes.H
+++ b/src/include/usr/secureboot/secure_reasoncodes.H
@@ -51,6 +51,7 @@ namespace SECUREBOOT
MOD_LOCK_ABUS_SEC_MAILBOXES = 0x11,
MOD_SECURE_LOG_PLAT_SECURITY_CONFIG = 0x12,
MOD_CHECK_RISK_LEVEL_FOR_SMF = 0x13,
+ MOD_SMF_SPLIT_SMF_MEM = 0x14,
// Use 0x20-0x2F range for Node Communications
MOD_NCDD_CHECK_FOR_ERRORS = 0x20,
@@ -91,6 +92,8 @@ namespace SECUREBOOT
RC_LOCK_MAILBOXES_FAILED = SECURE_COMP_ID | 0x14,
RC_SECURE_LOG_PLAT_SECURITY_CONFIG = SECURE_COMP_ID | 0x15,
RC_RISK_LEVEL_TOO_LOW = SECURE_COMP_ID | 0x16,
+ RC_COULD_NOT_ALLOCATE_SMF_MEM = SECURE_COMP_ID | 0x17,
+ RC_ALLOCATED_NE_REQUESTED = SECURE_COMP_ID | 0x18,
// Use 0x20-0x2F range for Node Communications
RC_NCDD_HW_ERROR_FOUND = SECURE_COMP_ID | 0x20,
diff --git a/src/include/usr/secureboot/smf.H b/src/include/usr/secureboot/smf.H
new file mode 100644
index 000000000..c77688585
--- /dev/null
+++ b/src/include/usr/secureboot/smf.H
@@ -0,0 +1,66 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/secureboot/smf.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2018 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __SMF_H
+#define __SMF_H
+
+#include <errl/errlentry.H>
+#include <stdint.h>
+
+namespace SMF_TRACE
+{
+ extern trace_desc_t* g_trac_smf;
+}
+
+namespace SECUREBOOT
+{
+namespace SMF
+{
+
+/**
+ * @brief A function that destributes the requested amount of secure
+ * memory between the functional procs with memory on the system.
+ * The memory is distributed in power-of-two chunks of 256MB
+ * until either all memory is distributed or there are no procs
+ * remaining with memory available. The function returns predictive
+ * or informational errors in the following cases: there is no
+ * available memory behind the procs on the system (predictive error),
+ * the exact amount of secure mem allocated did not match the requested
+ * amount (informational error). If 0 is passed in to the function, no
+ * attempt at distribution occurs and the SMF mode is turned off.
+ *
+ * @param[in] i_requestedSmfMemAmtInBytes the amount of secure memory to be
+ * distributed (in bytes)
+ * among the procs on the system
+ *
+ * @return nullptr: the memory was successfully distributed as requested
+ * non-nullptr: a distribution error occurred (this error is never
+ * unrecoverable)
+ */
+errlHndl_t distributeSmfMem(uint64_t i_requestedSmfMemAmtInBytes);
+
+} // namespace SMF
+} // namespace SECUREBOOT
+
+#endif
diff --git a/src/include/usr/secureboot/smf_utils.H b/src/include/usr/secureboot/smf_utils.H
index 554f8affe..4c059eb08 100644
--- a/src/include/usr/secureboot/smf_utils.H
+++ b/src/include/usr/secureboot/smf_utils.H
@@ -35,9 +35,13 @@ namespace SMF
{
// HW limitations dictate that SMF memory needs to be a power-of-two
-// multiple of 256MB starting with 256MB.
+// multiple of 256MB starting with 256MB (amount in bytes).
extern const uint64_t MIN_SMF_MEMORY_AMT;
+// The minimum amount of memory, in bytes, required for hostboot to run on
+// master proc.
+extern const uint64_t MIN_MEM_RESERVED_FOR_HB;
+
/**
* @brief Checks whether SMF mode is enabled on the system
*
OpenPOWER on IntegriCloud