summaryrefslogtreecommitdiffstats
path: root/src/include/usr
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2018-03-08 15:26:29 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-03-16 13:26:03 -0400
commit945553cc05cf2ab168a6dc435e8160997402be10 (patch)
treea1e649c4e03deae6fcfd4482dbab07deef0baa32 /src/include/usr
parent05cda10a435a9e9b86a1971e6ab56365b29cc861 (diff)
downloadtalos-hostboot-945553cc05cf2ab168a6dc435e8160997402be10.tar.gz
talos-hostboot-945553cc05cf2ab168a6dc435e8160997402be10.zip
Force single-threaded access to HWPs in PRD
Hostboot does not support thread local storage, however several HWPs use this concept. Specifically the memory HWPs use it for their c_str() function that prints out target strings. If these HWPs are called in multiple threads there is a chance of a buffer overrun that leads to a crash. The fix is to create a new INVOKE-style macro that befores the same mutex lock as a regular FAPI_INVOKE_HWP call. Change-Id: I550fc752f6a6b1bb51ecb4f9c8a7011f98bb8cd3 CQ: SW420212 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/55289 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: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/usr')
-rw-r--r--src/include/usr/fapi2/plat_hwp_invoker.H36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/include/usr/fapi2/plat_hwp_invoker.H b/src/include/usr/fapi2/plat_hwp_invoker.H
index c7ababf18..a0b335a1e 100644
--- a/src/include/usr/fapi2/plat_hwp_invoker.H
+++ b/src/include/usr/fapi2/plat_hwp_invoker.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2017 */
+/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -79,4 +79,38 @@ void hwpLock( bool i_lock );
fapi2::hwpLock(false); \
}
+/**
+ * @brief Pseudo-HWP Invoker macro
+ *
+ * This macro is called by HostBoot PLAT code to invoke a HW Procedure (HWP)
+ * that does not return a ReturnCode
+ *
+ * RETURN - Local var to store the return value
+ * FUNC - HWP function name
+ * _args_... - Any additional arguments that the HWP requires
+ */
+#define FAPI_CALL_HWP( RETURN, FUNC, _args_...) \
+ {\
+ fapi2::hwpLock(true); \
+ RETURN = FUNC(_args_); \
+ fapi2::hwpLock(false); \
+ }
+
+/**
+ * @brief Pseudo-HWP Invoker macro
+ *
+ * This macro is called by HostBoot PLAT code to invoke a HW Procedure (HWP)
+ * that does not return a ReturnCode
+ *
+ * FUNC - HWP function name
+ * _args_... - Any additional arguments that the HWP requires
+ */
+#define FAPI_CALL_HWP_NORETURN( FUNC, _args_...) \
+ {\
+ fapi2::hwpLock(true); \
+ FUNC(_args_); \
+ fapi2::hwpLock(false); \
+ }
+
+
#endif // PLATHWPINVOKER_H_
OpenPOWER on IntegriCloud