summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/runtime/interface.h12
-rw-r--r--src/include/usr/runtime/runtime_reasoncodes.H5
-rw-r--r--src/include/usr/util/utilrsvdmem.H8
-rw-r--r--src/makefile1
-rw-r--r--src/runtime/rt_main.C15
-rw-r--r--src/usr/runtime/populate_hbruntime.C27
-rw-r--r--src/usr/trace/interface.C26
-rw-r--r--src/usr/trace/runtime/makefile6
-rw-r--r--src/usr/trace/runtime/rt_service.C16
-rw-r--r--src/usr/trace/runtime/test/makefile31
-rw-r--r--src/usr/trace/service.H6
-rw-r--r--src/usr/util/runtime/util_rt.C3
-rw-r--r--src/usr/util/utilrsvdmem.C3
13 files changed, 145 insertions, 14 deletions
diff --git a/src/include/runtime/interface.h b/src/include/runtime/interface.h
index aca952616..3d5cba1f4 100644
--- a/src/include/runtime/interface.h
+++ b/src/include/runtime/interface.h
@@ -989,6 +989,18 @@ struct postInitCalls_t
*/
void (*callClearPendingOccMsgs)();
+ /** @brief Calls RsvdTraceBufService::init() which maps
+ * the Reserved Memory section to the circular buffer, which will keep
+ * track of all runtime traces
+ */
+ void (*callInitRsvdTraceBufService)();
+
+ /** @brief Calls RsvdTraceBufService::commitRsvdMemTraceErrl(), which commits
+ * the ERRL with Rsved Mem Traces from previous boot, if created in
+ * RsvdTraceBufService::init()
+ */
+ void (*callCommitRsvdTraceBufErrl)();
+
};
extern hostInterfaces_t* g_hostInterfaces;
diff --git a/src/include/usr/runtime/runtime_reasoncodes.H b/src/include/usr/runtime/runtime_reasoncodes.H
index 12d9db472..3dd2fc01e 100644
--- a/src/include/usr/runtime/runtime_reasoncodes.H
+++ b/src/include/usr/runtime/runtime_reasoncodes.H
@@ -63,7 +63,8 @@ namespace RUNTIME
MOD_RT_FIRMWARE_NOTIFY = 0x23, /**< rt_fwnotify.C */
MOD_RT_FIRMWARE_REQUEST = 0x24, /**< rt_fwreq_helper.C */
MOD_RT_ATTR_SYNC_REQUEST = 0x25, /**< rt_fwnotify.C */
- MOD_CHECK_HB_RES_MEM_LIMIT = 0x26, /**<populate_hbruntime.C */
+ MOD_CHECK_HB_RES_MEM_LIMIT = 0x26, /**< populate_hbruntime.C */
+ MOD_INIT_RT_RES_MEM_TRACE_BUF = 0x27, /**< rt_rsvdtracebuffer.C */
};
enum RuntimeReasonCode
@@ -132,6 +133,8 @@ namespace RUNTIME
RC_HB_RES_MEM_EXCEEDED = RUNTIME_COMP_ID | 0x3D,
RC_SEND_SBE_TIMER_EXPIRED = RUNTIME_COMP_ID | 0x3E,
RC_HOST_TIMER_THREAD_FAIL = RUNTIME_COMP_ID | 0x3F,
+ RC_RT_RES_TRACE_BUF_DUMPED = RUNTIME_COMP_ID | 0x40,
+ RC_RT_RES_TRACE_BUF_INVALID = RUNTIME_COMP_ID | 0x41,
};
enum UserDetailsTypes
diff --git a/src/include/usr/util/utilrsvdmem.H b/src/include/usr/util/utilrsvdmem.H
index aed49d54b..ed4d0e4f5 100644
--- a/src/include/usr/util/utilrsvdmem.H
+++ b/src/include/usr/util/utilrsvdmem.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2017 */
+/* Contributors Listed Below - COPYRIGHT 2017,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -49,6 +49,9 @@ namespace Util
// Ascii label "HYPCOMM " in hex
constexpr hbrt_mem_label_t HBRT_MEM_LABEL_HYPCOMM = 0x485950434f4d4d20;
+ // Ascii label "TRACEBUF" in hex
+ constexpr hbrt_mem_label_t HBRT_MEM_LABEL_TRACEBUF = 0x5452414345425546;
+
/** @brief A 32 byte table of contents entry */
struct hbrtTableOfContentsEntry_t
{
@@ -62,6 +65,9 @@ namespace Util
#define HBRT_TOC_MAX_ENTRIES \
(((4*KILOBYTE) - 64) / sizeof(hbrtTableOfContentsEntry_t))
+ // HBRT Reserved memory size for TRACEBUF
+ constexpr uint64_t HBRT_RSVD_TRACEBUF_SIZE = (64*KILOBYTE);
+
/** @brief A 4KB Table of Contents */
struct hbrtTableOfContents_t
{
diff --git a/src/makefile b/src/makefile
index 5a278a265..d6a4cf944 100644
--- a/src/makefile
+++ b/src/makefile
@@ -317,6 +317,7 @@ RUNTIME_TESTCASE_MODULES += testsecureboot_rt
RUNTIME_TESTCASE_MODULES += testtargeting_rt
RUNTIME_TESTCASE_MODULES += testsbeio_rt
RUNTIME_TESTCASE_MODULES += testpm_rt
+RUNTIME_TESTCASE_MODULES += testrsvdtracebuf_rt
RELOCATABLE_IMAGE_LDFLAGS = -pie --export-dynamic
diff --git a/src/runtime/rt_main.C b/src/runtime/rt_main.C
index 7aa631c7e..b8f37e46c 100644
--- a/src/runtime/rt_main.C
+++ b/src/runtime/rt_main.C
@@ -128,8 +128,16 @@ runtimeInterfaces_t* rt_start(hostInterfaces_t* intf)
// Initialize all modules.
vfs_module_init();
- // apply temp overrides
+ // Call rtPost functions
postInitCalls_t* rtPost = getPostInitCalls();
+
+ // Call InitRsvdTraceBufService
+ // NOTE: This function has pre-req of vfs_module_init() for using
+ // hb_get_rt_rsvd_mem(). Due to pre-req of rtPost->callInitErrlManager()
+ // committing ERRL is moved to callCommitRsvdTraceBufErrl().
+ rtPost->callInitRsvdTraceBufService();
+
+ // apply temp overrides
rtPost->callApplyTempOverrides();
// load FIRDATA section into memory so PRD can access
@@ -139,6 +147,11 @@ runtimeInterfaces_t* rt_start(hostInterfaces_t* intf)
// Make sure errlmanager is ready
rtPost->callInitErrlManager();
+ // Call commitRsvdTraceBufErrl
+ // NOTE: This function has pre-req of rtPost->callInitErrlManager()
+ // for committing ERRL, which was created in InitRsvdTraceBufService().
+ rtPost->callCommitRsvdTraceBufErrl();
+
// check for possible missed in-flight messages/interrupts
rtPost->callClearPendingSbeMsgs();
diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C
index f36851b7d..7672a572a 100644
--- a/src/usr/runtime/populate_hbruntime.C
+++ b/src/usr/runtime/populate_hbruntime.C
@@ -462,12 +462,14 @@ errlHndl_t setNextHbRsvMemEntry(const HDAT::hdatMsVpdRhbAddrRangeType i_type,
* @param[in] i_startAddressValid Is io_start_address valid?
* @param[out] io_size if not zero, maxSize in bytes allowed
* returns Total 64kb aligned size for all the data
+ * @param[in] i_master_node = true if we are the master hb instance
* @return Error handle if error
*/
errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address,
uint64_t & io_end_address,
bool i_startAddressValid,
- uint64_t & io_size)
+ uint64_t & io_size,
+ bool i_master_node)
{
TRACFCOMP( g_trac_runtime, ENTER_MRK"fill_RsvMem_hbData> io_start_address=0x%.16llX,io_end_address=0x%.16llX,startAddressValid=%d",
io_start_address, io_end_address, i_startAddressValid?1:0 );
@@ -563,6 +565,17 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address,
ALIGN_PAGE(l_hbTOC.entry[l_hbTOC.total_entries].size);
l_hbTOC.total_entries++;
+ // Fill in the TRACEBUF only for Master Node
+ if(i_master_node == true )
+ {
+ // Fill in TRACEBUF size
+ l_hbTOC.entry[l_hbTOC.total_entries].label = Util::HBRT_MEM_LABEL_TRACEBUF;
+ l_hbTOC.entry[l_hbTOC.total_entries].offset = 0;
+ l_hbTOC.entry[l_hbTOC.total_entries].size = Util::HBRT_RSVD_TRACEBUF_SIZE;
+ l_totalSectionSize +=
+ ALIGN_PAGE(l_hbTOC.entry[l_hbTOC.total_entries].size);
+ l_hbTOC.total_entries++;
+ }
l_totalSectionSize += sizeof(l_hbTOC); // Add 4KB Table of Contents
// Fill in PADDING size
@@ -758,6 +771,14 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address,
}
break;
}
+
+ case Util::HBRT_MEM_LABEL_TRACEBUF:
+
+ TRACFCOMP( g_trac_runtime, "fill_RsvMem_hbData> TRACEBUF v address 0x%.16llX, size: %lld", l_prevDataAddr, aligned_size);
+ //Nothing much to do here, except zero-ing the memory
+ memset(reinterpret_cast<uint8_t*>(l_prevDataAddr),0,aligned_size);
+ break;
+
default:
break;
}
@@ -1103,7 +1124,7 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId, bool i_master_node)
// fills in the reserved memory with HB Data and
// will update addresses and totalSize
l_elog = fill_RsvMem_hbData(l_startAddr, l_endAddr,
- startAddressValid, l_totalSizeAligned);
+ startAddressValid, l_totalSizeAligned,i_master_node);
if (l_elog)
{
@@ -3114,7 +3135,7 @@ errlHndl_t populate_hbRuntimeData( void )
bool startAddressValid = true;
l_elog = fill_RsvMem_hbData(l_startAddr, l_endAddr,
- startAddressValid, l_totalSizeAligned);
+ startAddressValid, l_totalSizeAligned,true);
if(l_elog != nullptr)
{
TRACFCOMP( g_trac_runtime, "fill_RsvMem_hbData failed" );
diff --git a/src/usr/trace/interface.C b/src/usr/trace/interface.C
index f7d8e68ff..af7040fdf 100644
--- a/src/usr/trace/interface.C
+++ b/src/usr/trace/interface.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -34,10 +34,14 @@
#include <util/singleton.H>
#include <stdarg.h>
#include <limits.h>
+#include <string.h>
#include "compdesc.H"
#include "service.H"
+#if __HOSTBOOT_RUNTIME
+#include "runtime/rt_rsvdtracebufservice.H"
+#endif
namespace TRACE
{
@@ -105,15 +109,31 @@ namespace TRACE
void * o_data,
size_t i_bufferSize )
{
+ size_t l_bufferSize(0);
+
ComponentDesc* l_comp =
Singleton<ComponentList>::instance().getDescriptor(i_comp, 0);
if (NULL == l_comp)
{
- return 0;
+#if __HOSTBOOT_RUNTIME
+ // All the components will have a corresponding CompDescriptor,
+ // if buffer is created. RSVD_MEM_TRACE is a speacial case without
+ // a corresponding compDescriptor. Check for RSVD_MEM_TRACE, if
+ // not RSVD_MEM_TRACE then return 0.
+ if(strcmp( i_comp, "RSVD_MEM_TRACE") == 0)
+ {
+ l_bufferSize = Singleton<RsvdTraceBufService>::
+ instance().getBuffer(o_data,i_bufferSize);
+ }
+#endif
}
- return Singleton<Service>::instance().getBuffer(l_comp,
+ else
+ {
+ l_bufferSize = Singleton<Service>::instance().getBuffer(l_comp,
o_data, i_bufferSize);
+ }
+ return l_bufferSize;
}
void flushBuffers()
diff --git a/src/usr/trace/runtime/makefile b/src/usr/trace/runtime/makefile
index c7307e0cd..8974e15c0 100644
--- a/src/usr/trace/runtime/makefile
+++ b/src/usr/trace/runtime/makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2013,2017
+# Contributors Listed Below - COPYRIGHT 2013,2018
# [+] International Business Machines Corp.
#
#
@@ -26,6 +26,8 @@ HOSTBOOT_RUNTIME = 1
ROOTPATH = ../../../..
MODULE = trace_rt
+SUBDIRS += test.d
+
OBJS += interface.o
OBJS += assert.o
OBJS += compdesc.o
@@ -34,6 +36,8 @@ OBJS += rt_service.o
OBJS += bufferpage.o
OBJS += rt_daemon.o
OBJS += rt_buffer.o
+OBJS += rt_rsvdtracebuffer.o
+OBJS += rt_rsvdtracebufservice.o
VPATH += ..
diff --git a/src/usr/trace/runtime/rt_service.C b/src/usr/trace/runtime/rt_service.C
index 476e6052d..d3dbde773 100644
--- a/src/usr/trace/runtime/rt_service.C
+++ b/src/usr/trace/runtime/rt_service.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2017 */
+/* Contributors Listed Below - COPYRIGHT 2013,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -38,6 +38,7 @@
#include <util/align.H>
#include <runtime/interface.h>
#include <util/singleton.H>
+#include "rt_rsvdtracebufservice.H"
namespace TRACE
{
@@ -52,6 +53,9 @@ namespace TRACE
iv_buffers[BUFFER_SLOW] = nullptr;
iv_buffers[BUFFER_FAST] = new Buffer(iv_daemon);
+ // Force create the Reserved Trace Buffer Service object
+ iv_rsvdtracebufservice = &(Singleton<RsvdTraceBufService>::instance());
+
iv_compList = &(Singleton<ComponentList>::instance());
}
@@ -240,6 +244,11 @@ namespace TRACE
// "Commit" entry to buffer.
l_buffer->commitEntry(l_entry);
+ // Copy the trace entry in to the Reserved Trace Buffer too
+ iv_rsvdtracebufservice->writeEntry(i_td,
+ reinterpret_cast<char*>(&l_entry->data[0]),
+ l_realSize);
+
} while(0);
}
@@ -384,6 +393,11 @@ namespace TRACE
// "Commit" entry to buffer.
l_buffer->commitEntry(l_entry);
+ // Copy the trace entry in to the Reserved Trace Buffer too
+ iv_rsvdtracebufservice->writeEntry(i_td,
+ reinterpret_cast<char*>(&l_entry->data[0]),
+ l_realSize);
+
} while(0);
}
diff --git a/src/usr/trace/runtime/test/makefile b/src/usr/trace/runtime/test/makefile
new file mode 100644
index 000000000..b0ad1841c
--- /dev/null
+++ b/src/usr/trace/runtime/test/makefile
@@ -0,0 +1,31 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/trace/runtime/test/makefile $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2013,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
+HOSTBOOT_RUNTIME = 1
+ROOTPATH = ../../../../..
+
+MODULE = testrsvdtracebuf_rt
+TESTS = testrsvdtracebuf.H
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/trace/service.H b/src/usr/trace/service.H
index afe2c18f7..fdb4b460b 100644
--- a/src/usr/trace/service.H
+++ b/src/usr/trace/service.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -71,6 +71,7 @@ namespace TRACE
class DaemonIf;
class ComponentList;
class trace_entry_stamp_t;
+ class RsvdTraceBufService;
/** @class Service
*
@@ -189,6 +190,9 @@ namespace TRACE
#else
/** Runtime daemon **/
TRACEDAEMON::Daemon * iv_daemon;
+
+ /** Runtime Reserved Trace Buffer Service **/
+ RsvdTraceBufService * iv_rsvdtracebufservice;
#endif
};
}
diff --git a/src/usr/util/runtime/util_rt.C b/src/usr/util/runtime/util_rt.C
index 447e42656..3dc3935f3 100644
--- a/src/usr/util/runtime/util_rt.C
+++ b/src/usr/util/runtime/util_rt.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2017 */
+/* Contributors Listed Below - COPYRIGHT 2017,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -54,6 +54,7 @@ uint64_t hb_get_rt_rsvd_mem(Util::hbrt_mem_label_t i_label,
case Util::HBRT_MEM_LABEL_ATTROVER:
case Util::HBRT_MEM_LABEL_PADDING:
case Util::HBRT_MEM_LABEL_HYPCOMM:
+ case Util::HBRT_MEM_LABEL_TRACEBUF:
if( (g_hostInterfaces != NULL) &&
(g_hostInterfaces->get_reserved_mem) )
{
diff --git a/src/usr/util/utilrsvdmem.C b/src/usr/util/utilrsvdmem.C
index 91db385b2..32859f311 100644
--- a/src/usr/util/utilrsvdmem.C
+++ b/src/usr/util/utilrsvdmem.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2017 */
+/* Contributors Listed Below - COPYRIGHT 2017,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -61,6 +61,7 @@ namespace Util
case HBRT_MEM_LABEL_ATTROVER:
case HBRT_MEM_LABEL_PADDING:
case HBRT_MEM_LABEL_HYPCOMM:
+ case HBRT_MEM_LABEL_TRACEBUF:
// Find offset of label section
for (uint16_t i = 0; i < toc_ptr->total_entries; i++)
{
OpenPOWER on IntegriCloud