@@ -1372,6 +1372,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();
@@ -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();
}
@@ -25,6 +25,7 @@ struct trace_info {
/* Allocate trace buffers once we know memory topology */
void init_trace_buffers(void);
+void trace_add_dt_props(void);
/* This will fill in timestamp and cpu; you must do type and len. */
void trace_add(union trace *trace, u8 type, u16 len);
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> --- core/init.c | 3 +++ core/trace.c | 17 ++++++++++------- include/trace.h | 1 + 3 files changed, 14 insertions(+), 7 deletions(-)