aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2021-06-25 11:49:22 +0530
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2021-06-30 15:05:55 +0530
commita382d1638aaf96371321a177a92286444fceec0d (patch)
treed62c8e7f703da1242e72cd3cc6ac24df45d57f4c /core
parent8647507d44650b411ca7741a7ce5a6a90d61a74a (diff)
downloadskiboot-a382d1638aaf96371321a177a92286444fceec0d.zip
skiboot-a382d1638aaf96371321a177a92286444fceec0d.tar.gz
skiboot-a382d1638aaf96371321a177a92286444fceec0d.tar.bz2
trace: Add nvram hack to use the old trace export behaviour
Previously we put all the trace buffer exports in the exports/ node. However, there's one trace buffer for each core so I moved them into a subdirectory since they were crowding up the place. Most kernels don't support recursively exporting subnodes though so kernel's don't have support for recursively exporting subnodes, so add a hack to restore the old behaviour for now. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> [Fixed run-trace test case - Vasant] Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/init.c3
-rw-r--r--core/test/run-trace.c5
-rw-r--r--core/trace.c17
3 files changed, 18 insertions, 7 deletions
diff --git a/core/init.c b/core/init.c
index d5ba67e..09749f4 100644
--- a/core/init.c
+++ b/core/init.c
@@ -1369,6 +1369,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
/* Disable protected execution facility in BML */
cpu_disable_pef();
+ /* export the trace buffers */
+ trace_add_dt_props();
+
/* Now release parts of memory nodes we haven't used ourselves... */
mem_region_release_unused();
diff --git a/core/test/run-trace.c b/core/test/run-trace.c
index b268276..88b0903 100644
--- a/core/test/run-trace.c
+++ b/core/test/run-trace.c
@@ -102,6 +102,11 @@ struct debug_descriptor debug_descriptor = {
.trace_mask = -1
};
+const char *nvram_query_safe(const char *key __unused)
+{
+ return NULL;
+}
+
void lock_caller(struct lock *l, const char *caller)
{
(void)caller;
diff --git a/core/trace.c b/core/trace.c
index 5a3ad49..561bd79 100644
--- a/core/trace.c
+++ b/core/trace.c
@@ -18,6 +18,7 @@
#include <skiboot.h>
#include <opal-api.h>
#include <debug_descriptor.h>
+#include <nvram.h>
#define DEBUG_TRACES
@@ -155,7 +156,7 @@ void trace_add(union trace *trace, u8 type, u16 len)
unlock(&ti->lock);
}
-static void trace_add_dt_props(void)
+void trace_add_dt_props(void)
{
uint64_t boot_buf_phys = (uint64_t) &boot_tracebuf.trace_info;
struct dt_node *exports, *traces;
@@ -168,9 +169,14 @@ static void trace_add_dt_props(void)
if (!exports)
return;
- traces = dt_new(exports, "traces");
- if (!exports)
- return;
+ /*
+ * nvram hack to put all the trace buffer exports in the exports
+ * node. This is useful if the kernel doesn't also export subnodes.
+ */
+ if (nvram_query_safe("flat-trace-buf"))
+ traces = exports;
+ else
+ traces = dt_new(exports, "traces");
prop = malloc(sizeof(u64) * 2 * be32_to_cpu(debug_descriptor.num_traces));
@@ -256,7 +262,4 @@ void init_trace_buffers(void)
continue;
t->trace = t->primary->trace;
}
-
- /* Trace node in DT. */
- trace_add_dt_props();
}