diff mbox series

[1/2] core/trace: Move trace buffer exports to a subnode

Message ID 20191101065410.4804-1-oohall@gmail.com
State Accepted
Headers show
Series [1/2] core/trace: Move trace buffer exports to a subnode | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (d75e82dbfbb9443efeb3f9a5921ac23605aab469)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Oliver O'Halloran Nov. 1, 2019, 6:54 a.m. UTC
The top level exports node is getting a bit crowded. Move the trace
entries into their own directory since there's a lot of them and there
(currently) isn't any hard dependencies on them being in the top level
node so we can move them into a sub-node.

Cc: Jordan Niethe <jniethe5@gmail.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 core/trace.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Vasant Hegde Nov. 6, 2019, 10:28 a.m. UTC | #1
On 11/1/19 12:24 PM, Oliver O'Halloran wrote:
> The top level exports node is getting a bit crowded. Move the trace
> entries into their own directory since there's a lot of them and there
> (currently) isn't any hard dependencies on them being in the top level
> node so we can move them into a sub-node.

I think current kernel code can parse only properties inside exports node, not 
subnodes.
This means we need kernel side change as well.

Otherwise patch looks good to me.

-Vasant
Oliver O'Halloran Nov. 6, 2019, 10:35 a.m. UTC | #2
On Wed, Nov 6, 2019 at 9:28 PM Vasant Hegde
<hegdevasant@linux.vnet.ibm.com> wrote:
>
> On 11/1/19 12:24 PM, Oliver O'Halloran wrote:
> > The top level exports node is getting a bit crowded. Move the trace
> > entries into their own directory since there's a lot of them and there
> > (currently) isn't any hard dependencies on them being in the top level
> > node so we can move them into a sub-node.
>
> I think current kernel code can parse only properties inside exports node, not
> subnodes.
> This means we need kernel side change as well.
>
> Otherwise patch looks good to me.

Yep, they're on the list already:
http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=140036
diff mbox series

Patch

diff --git a/core/trace.c b/core/trace.c
index 614be08d7de1..a3739eba5a17 100644
--- a/core/trace.c
+++ b/core/trace.c
@@ -157,14 +157,21 @@  void trace_add(union trace *trace, u8 type, u16 len)
 
 static void trace_add_dt_props(void)
 {
+	struct dt_node *exports, *traces;
 	unsigned int i;
 	u64 *prop, tmask;
-	struct dt_node *exports;
 	char tname[256];
 
+	exports = dt_find_by_path(opal_node, "firmware/exports");
+	if (!exports)
+		return;
+
+	traces = dt_new(exports, "traces");
+	if (!exports)
+		return;
+
 	prop = malloc(sizeof(u64) * 2 * debug_descriptor.num_traces);
 
-	exports = dt_find_by_path(opal_node, "firmware/exports");
 	for (i = 0; i < debug_descriptor.num_traces; i++) {
 		prop[i * 2] = cpu_to_fdt64(debug_descriptor.trace_phys[i]);
 		prop[i * 2 + 1] = cpu_to_fdt64(debug_descriptor.trace_size[i]);
@@ -172,7 +179,7 @@  static void trace_add_dt_props(void)
 		snprintf(tname, sizeof(tname), "trace-%x-%"PRIx64,
 			 debug_descriptor.trace_pir[i],
 			 debug_descriptor.trace_phys[i]);
-		dt_add_property_u64s(exports, tname, debug_descriptor.trace_phys[i],
+		dt_add_property_u64s(traces, tname, debug_descriptor.trace_phys[i],
 				     debug_descriptor.trace_size[i]);
 	}