[Skiboot] [PATCH v2 09/16] core/trace: Add pir number to debug_descriptor
Jordan Niethe
jniethe5 at gmail.com
Tue Apr 2 10:43:20 AEDT 2019
The names given to the trace buffers when exported to sysfs should show
what cpu they are associated with to make it easier to understand there
output. The debug_descriptor currently stores the address and length of
each trace buffer and this is used for adding properties to the device
tree. Extend debug_descriptor to include a cpu associated with each
trace. This will be used for creating properties in the device-tree
under /ibm,opal/firmware/exports/.
---
v2: change from 'cpu' to 'pir' for naming consistency
Signed-off-by: Jordan Niethe <jniethe5 at gmail.com>
---
core/test/run-trace.c | 2 +-
core/trace.c | 7 ++++---
include/debug_descriptor.h | 1 +
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/core/test/run-trace.c b/core/test/run-trace.c
index 8eb4258181fb..fb885556d48a 100644
--- a/core/test/run-trace.c
+++ b/core/test/run-trace.c
@@ -274,8 +274,8 @@ int main(void)
fake_cpus[i].is_secondary = (i & 0x1);
fake_cpus[i].primary = &fake_cpus[i & ~0x1];
}
- init_trace_buffers();
my_fake_cpu = &fake_cpus[0];
+ init_trace_buffers();
for (i = 0; i < CPUS; i++) {
assert(trace_empty(&fake_cpus[i].trace->tb));
diff --git a/core/trace.c b/core/trace.c
index 4b7d570409e8..169282e84508 100644
--- a/core/trace.c
+++ b/core/trace.c
@@ -183,7 +183,7 @@ static void trace_add_dt_props(void)
dt_add_property_u64(opal_node, "ibm,opal-trace-mask", tmask);
}
-static void trace_add_desc(struct trace_info *t, uint64_t size)
+static void trace_add_desc(struct trace_info *t, uint64_t size, uint16_t pir)
{
unsigned int i = debug_descriptor.num_traces;
@@ -196,6 +196,7 @@ static void trace_add_desc(struct trace_info *t, uint64_t size)
debug_descriptor.trace_phys[i] = (uint64_t)t;
debug_descriptor.trace_tce[i] = 0; /* populated later */
debug_descriptor.trace_size[i] = size;
+ debug_descriptor.trace_pir[i] = pir;
}
/* Allocate trace buffers once we know memory topology */
@@ -206,7 +207,7 @@ void init_trace_buffers(void)
uint64_t size;
/* Boot the boot trace in the debug descriptor */
- trace_add_desc(any, sizeof(boot_tracebuf));
+ trace_add_desc(any, sizeof(boot_tracebuf), this_cpu()->pir);
/* Allocate a trace buffer for each primary cpu. */
for_each_cpu(t) {
@@ -223,7 +224,7 @@ void init_trace_buffers(void)
t->trace->tb.max_size = cpu_to_be32(MAX_SIZE);
t->trace->tb.buf_size = cpu_to_be64(TBUF_SZ);
trace_add_desc(any, sizeof(t->trace->tb) +
- tracebuf_extra());
+ tracebuf_extra(), t->pir);
} else
prerror("TRACE: cpu 0x%x allocation failed\n", t->pir);
}
diff --git a/include/debug_descriptor.h b/include/debug_descriptor.h
index 619f49374385..0a4d17c4c0ed 100644
--- a/include/debug_descriptor.h
+++ b/include/debug_descriptor.h
@@ -44,6 +44,7 @@ struct debug_descriptor {
u64 trace_phys[DEBUG_DESC_MAX_TRACES];
u32 trace_size[DEBUG_DESC_MAX_TRACES];
u32 trace_tce[DEBUG_DESC_MAX_TRACES];
+ u16 trace_pir[DEBUG_DESC_MAX_TRACES];
};
extern struct debug_descriptor debug_descriptor;
--
2.20.1
More information about the Skiboot
mailing list