From 2717c6b8ddcd631dcf27eaed0f76b662be36a569 Mon Sep 17 00:00:00 2001 From: Jordan Niethe Date: Tue, 2 Apr 2019 10:43:18 +1100 Subject: core/trace: Change buffer alignment from 4K to 64K We want to be able to mmap the trace buffers to be used by the dump_trace tool. This means that the trace bufferes must be page aligned. Currently they are aligned to 4K. Most power systems have a 64K page size. On systems with a 4K page size, 64K aligned will still be page aligned. Change the allocation of the trace buffers to be 64K aligned. The trace_info struct that contains the trace buffer is actually what is allocated aligned memory. This means the trace buffer itself is not actually aligned and this is the address that is currently exposed through sysfs. To get around this change the address that is exposed to sysfs to be the trace_info struct. This means the lock in trace_info is now visible too. Signed-off-by: Jordan Niethe Signed-off-by: Stewart Smith --- core/trace.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'core/trace.c') diff --git a/core/trace.c b/core/trace.c index a7b3cd1..4b7d570 100644 --- a/core/trace.c +++ b/core/trace.c @@ -193,7 +193,7 @@ static void trace_add_desc(struct trace_info *t, uint64_t size) } debug_descriptor.num_traces++; - debug_descriptor.trace_phys[i] = (uint64_t)&t->tb; + debug_descriptor.trace_phys[i] = (uint64_t)t; debug_descriptor.trace_tce[i] = 0; /* populated later */ debug_descriptor.trace_size[i] = size; } @@ -206,16 +206,16 @@ void init_trace_buffers(void) uint64_t size; /* Boot the boot trace in the debug descriptor */ - trace_add_desc(any, sizeof(boot_tracebuf.buf)); + trace_add_desc(any, sizeof(boot_tracebuf)); /* Allocate a trace buffer for each primary cpu. */ for_each_cpu(t) { if (t->is_secondary) continue; - /* Use a 4K alignment for TCE mapping */ - size = ALIGN_UP(sizeof(*t->trace) + tracebuf_extra(), 0x1000); - t->trace = local_alloc(t->chip_id, size, 0x1000); + /* Use a 64K alignment for TCE mapping */ + size = ALIGN_UP(sizeof(*t->trace) + tracebuf_extra(), 0x10000); + t->trace = local_alloc(t->chip_id, size, 0x10000); if (t->trace) { any = t->trace; memset(t->trace, 0, size); -- cgit v1.1