All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing.
@ 2012-08-13  8:01 Srinivas KANDAGATLA
  2012-08-15  1:11 ` David Gibson
  0 siblings, 1 reply; 9+ messages in thread
From: Srinivas KANDAGATLA @ 2012-08-13  8:01 UTC (permalink / raw)
  To: linux-kbuild; +Cc: devicetree-discuss, srinivas.kandagatla, mmarek, dwg

From: Srinivas Kandagatla <srinivas.kandagatla@st.com>

This patch add pre-processing capablity to dtc based on status property.
Now the dtc has additional option -P to enable Pre-processing based on
status property.

The SOCS have lot of device tree infrastructure files which mark the
device nodes as disabled and the board level device tree enables them if
required. However while creating device tree blob, the compiler can
preprocess the nodes and exclude nodes marked as disabled, doing this
way will reduce the size of device tree blob.

In our case this has reduced the blob size from 29K to 15K.

Also nodes with status="disabled" is are never probed by dt platform bus
code.

Again, Preprocessing is optional parameter to dtc.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
Hi All, 

I have noticed that the dtb blob also contains device nodes with property status = "disabled", 
But these device nodes are not used by device tree platform bus probe code or any of the kernel code.
Are these type of nodes ever used by the kernel code? 
If they are not it might be nice to get them out of dtb to reduce the overall size of dtb.

The size change will be significant once the SOC adds all the possible devices in to the device trees.

My patch adds option -P to dtc to skip such nodes, resulting in only nodes which are supposed to be instantiated.

Comments?

Thanks,
srini

 scripts/dtc/dtc.c        |    9 ++++++++-
 scripts/dtc/dtc.h        |    3 +++
 scripts/dtc/flattree.c   |    3 +++
 scripts/dtc/livetree.c   |   17 +++++++++++++++++
 scripts/dtc/treesource.c |    3 +++
 5 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c
index 2ef5e2e..f20d4e0 100644
--- a/scripts/dtc/dtc.c
+++ b/scripts/dtc/dtc.c
@@ -30,6 +30,7 @@ int quiet;		/* Level of quietness */
 int reservenum;		/* Number of memory reservation slots */
 int minsize;		/* Minimum blob size */
 int padsize;		/* Additional padding to blob */
+int preprocess;		/* Preprocess output */
 int phandle_format = PHANDLE_BOTH;	/* Use linux,phandle or phandle properties */
 
 static void fill_fullpaths(struct node *tree, const char *prefix)
@@ -84,6 +85,8 @@ static void  __attribute__ ((noreturn)) usage(void)
 	fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n");
 	fprintf(stderr, "\t-s\n");
 	fprintf(stderr, "\t\tSort nodes and properties before outputting (only useful for\n\t\tcomparing trees)\n");
+	fprintf(stderr, "\t-P\n");
+	fprintf(stderr, "\t\tPre-Process nodes based on status property\n");
 	fprintf(stderr, "\t-v\n");
 	fprintf(stderr, "\t\tPrint DTC version and exit\n");
 	fprintf(stderr, "\t-H <phandle format>\n");
@@ -108,12 +111,13 @@ int main(int argc, char *argv[])
 	int outversion = DEFAULT_FDT_VERSION;
 	long long cmdline_boot_cpuid = -1;
 
+	preprocess = 0;
 	quiet      = 0;
 	reservenum = 0;
 	minsize    = 0;
 	padsize    = 0;
 
-	while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fcqb:vH:s"))
+	while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fcqb:vH:s:P"))
 			!= EOF) {
 		switch (opt) {
 		case 'I':
@@ -167,6 +171,9 @@ int main(int argc, char *argv[])
 		case 's':
 			sort = 1;
 			break;
+		case 'P':
+			preprocess = 1;
+			break;
 
 		case 'h':
 		default:
diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h
index f37c97e..a1b525c 100644
--- a/scripts/dtc/dtc.h
+++ b/scripts/dtc/dtc.h
@@ -52,6 +52,7 @@ extern int quiet;		/* Level of quietness */
 extern int reservenum;		/* Number of memory reservation slots */
 extern int minsize;		/* Minimum blob size */
 extern int padsize;		/* Additional padding to blob */
+extern int preprocess;		/* Preprocess output */
 extern int phandle_format;	/* Use linux,phandle or phandle properties */
 
 #define PHANDLE_LEGACY	0x1
@@ -222,6 +223,8 @@ struct boot_info *build_boot_info(struct reserve_info *reservelist,
 				  struct node *tree, uint32_t boot_cpuid_phys);
 void sort_tree(struct boot_info *bi);
 
+int is_device_node_avaiable(struct node *node);
+
 /* Checks */
 
 void process_checks(int force, struct boot_info *bi);
diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c
index 28d0b23..162066d 100644
--- a/scripts/dtc/flattree.c
+++ b/scripts/dtc/flattree.c
@@ -304,6 +304,9 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
 	}
 
 	for_each_child(tree, child) {
+		if (preprocess && !is_device_node_avaiable(child))
+			continue;
+
 		flatten_tree(child, emit, etarget, strbuf, vi);
 	}
 
diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c
index 26d0e1e..37617d5 100644
--- a/scripts/dtc/livetree.c
+++ b/scripts/dtc/livetree.c
@@ -607,3 +607,20 @@ void sort_tree(struct boot_info *bi)
 	sort_reserve_entries(bi);
 	sort_node(bi->dt);
 }
+
+int is_device_node_avaiable(struct node *node)
+{
+	struct property *status;
+
+	status = get_property(node, "status");
+	if (status == NULL)
+		return 1;
+
+	if (status->val.len > 0) {
+		if (!strcmp(status->val.val, "okay") ||
+			 !strcmp(status->val.val, "ok"))
+			return 1;
+	}
+
+	return 0;
+}
diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c
index c09aafa..febb622 100644
--- a/scripts/dtc/treesource.c
+++ b/scripts/dtc/treesource.c
@@ -253,6 +253,9 @@ static void write_tree_source_node(FILE *f, struct node *tree, int level)
 		write_propval(f, prop);
 	}
 	for_each_child(tree, child) {
+		if (preprocess && !is_device_node_avaiable(child))
+			continue;
+
 		fprintf(f, "\n");
 		write_tree_source_node(f, child, level+1);
 	}
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing.
  2012-08-13  8:01 [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing Srinivas KANDAGATLA
@ 2012-08-15  1:11 ` David Gibson
  2012-08-15  2:12   ` Tabi Timur-B04825
  2012-08-15  9:33   ` Srinivas KANDAGATLA
  0 siblings, 2 replies; 9+ messages in thread
From: David Gibson @ 2012-08-15  1:11 UTC (permalink / raw)
  To: Srinivas KANDAGATLA; +Cc: linux-kbuild, devicetree-discuss, mmarek

On Mon, Aug 13, 2012 at 09:01:53AM +0100, Srinivas KANDAGATLA wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> 
> This patch add pre-processing capablity to dtc based on status property.
> Now the dtc has additional option -P to enable Pre-processing based on
> status property.
> 
> The SOCS have lot of device tree infrastructure files which mark the
> device nodes as disabled and the board level device tree enables them if
> required. However while creating device tree blob, the compiler can
> preprocess the nodes and exclude nodes marked as disabled, doing this
> way will reduce the size of device tree blob.
> 
> In our case this has reduced the blob size from 29K to 15K.
> 
> Also nodes with status="disabled" is are never probed by dt platform bus
> code.
> 
> Again, Preprocessing is optional parameter to dtc.

Hrm.

1) Changes to dtc should be made first against upstream dtc at
git://git.jdl.com/software/dtc.git.  The version in the kernel is just
a snapshot of the upstream tree which is updated periodically.

2) I'm not convinced this filtering-by-status is something that
belongs in dtc, but I'm willing to be persuaded.

3) The name has to change.  "preprocess" is far to general a term for
the very specific function you're implementing here.  Especially when
there are serious discussions ongoing about having dtc use cpp or a
similar preprocessor in a general capacity.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing.
  2012-08-15  1:11 ` David Gibson
@ 2012-08-15  2:12   ` Tabi Timur-B04825
  2012-08-15  9:49     ` Srinivas KANDAGATLA
  2012-08-15  9:33   ` Srinivas KANDAGATLA
  1 sibling, 1 reply; 9+ messages in thread
From: Tabi Timur-B04825 @ 2012-08-15  2:12 UTC (permalink / raw)
  To: David Gibson
  Cc: Srinivas KANDAGATLA, mmarek, devicetree-discuss, linux-kbuild

On Tue, Aug 14, 2012 at 8:11 PM, David Gibson <dwg@au1.ibm.com> wrote:
> On Mon, Aug 13, 2012 at 09:01:53AM +0100, Srinivas KANDAGATLA wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>>
>> This patch add pre-processing capablity to dtc based on status property.
>> Now the dtc has additional option -P to enable Pre-processing based on
>> status property.
>>
>> The SOCS have lot of device tree infrastructure files which mark the
>> device nodes as disabled and the board level device tree enables them if
>> required. However while creating device tree blob, the compiler can
>> preprocess the nodes and exclude nodes marked as disabled, doing this
>> way will reduce the size of device tree blob.

IMHO, many devices that are marked as "disabled" in the DTS are
expecting to be enabled by the boot loader, so just because a node is
disabled in the DTS does not mean that it will be disabled when Linux
sees it.

>> In our case this has reduced the blob size from 29K to 15K.

I don't see that as significant.

>> Also nodes with status="disabled" is are never probed by dt platform bus
>> code.
>>
>> Again, Preprocessing is optional parameter to dtc.

Using this option would break a lot of our device trees.  Perhaps it
should be given a better name, like --strip-disabled.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing.
  2012-08-15  1:11 ` David Gibson
  2012-08-15  2:12   ` Tabi Timur-B04825
@ 2012-08-15  9:33   ` Srinivas KANDAGATLA
  1 sibling, 0 replies; 9+ messages in thread
From: Srinivas KANDAGATLA @ 2012-08-15  9:33 UTC (permalink / raw)
  To: David Gibson; +Cc: linux-kbuild, devicetree-discuss, mmarek, B04825

On 15/08/12 02:11, David Gibson wrote:
> On Mon, Aug 13, 2012 at 09:01:53AM +0100, Srinivas KANDAGATLA wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>>
>> This patch add pre-processing capablity to dtc based on status property.
>> Now the dtc has additional option -P to enable Pre-processing based on
>> status property.
>>
>> The SOCS have lot of device tree infrastructure files which mark the
>> device nodes as disabled and the board level device tree enables them if
>> required. However while creating device tree blob, the compiler can
>> preprocess the nodes and exclude nodes marked as disabled, doing this
>> way will reduce the size of device tree blob.
>>
>> In our case this has reduced the blob size from 29K to 15K.
>>
>> Also nodes with status="disabled" is are never probed by dt platform bus
>> code.
>>
>> Again, Preprocessing is optional parameter to dtc.
> Hrm.
>
> 1) Changes to dtc should be made first against upstream dtc at
> git://git.jdl.com/software/dtc.git.  The version in the kernel is just
> a snapshot of the upstream tree which is updated periodically.
I agree, will re-base the patch against
git://git.jdl.com/software/dtc.git and add Jon Loeliger (dtc maintainer)
to CC.
> 2) I'm not convinced this filtering-by-status is something that
> belongs in dtc, but I'm willing to be persuaded.
As its not a default dtc behavior, Adding filtering-by-status as
optional to dtc would a good addition towards reducing overall dtb sizes.
>
> 3) The name has to change.  "preprocess" is far to general a term for
> the very specific function you're implementing here.  Especially when
> there are serious discussions ongoing about having dtc use cpp or a
> similar preprocessor in a general capacity.
Yes, Pre-process looks very generic, As Tabi suggested --strip-disabled
would be more appropriate.
Will repost the patch with this change.
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing.
  2012-08-15  2:12   ` Tabi Timur-B04825
@ 2012-08-15  9:49     ` Srinivas KANDAGATLA
       [not found]       ` <502B70B8.1030709-qxv4g6HH51o@public.gmane.org>
  2012-08-15 12:04       ` Tabi Timur-B04825
  0 siblings, 2 replies; 9+ messages in thread
From: Srinivas KANDAGATLA @ 2012-08-15  9:49 UTC (permalink / raw)
  To: Tabi Timur-B04825; +Cc: David Gibson, mmarek, devicetree-discuss, linux-kbuild

On 15/08/12 03:12, Tabi Timur-B04825 wrote:
> On Tue, Aug 14, 2012 at 8:11 PM, David Gibson <dwg@au1.ibm.com> wrote:
>> On Mon, Aug 13, 2012 at 09:01:53AM +0100, Srinivas KANDAGATLA wrote:
>>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>>>
>>> This patch add pre-processing capablity to dtc based on status property.
>>> Now the dtc has additional option -P to enable Pre-processing based on
>>> status property.
>>>
>>> The SOCS have lot of device tree infrastructure files which mark the
>>> device nodes as disabled and the board level device tree enables them if
>>> required. However while creating device tree blob, the compiler can
>>> preprocess the nodes and exclude nodes marked as disabled, doing this
>>> way will reduce the size of device tree blob.
> IMHO, many devices that are marked as "disabled" in the DTS are
> expecting to be enabled by the boot loader, so just because a node is
> disabled in the DTS does not mean that it will be disabled when Linux
> sees it.
Good to know that,
But some of the secured bootloaders like the one's we use don't even
touch the dt blob.
>
>>> In our case this has reduced the blob size from 29K to 15K.
> I don't see that as significant.
>
>>> Also nodes with status="disabled" is are never probed by dt platform bus
>>> code.
>>>
>>> Again, Preprocessing is optional parameter to dtc.
> Using this option would break a lot of our device trees.
As this is optional parameter, I did not expect it to break the
default/existing behavior.
Correct me am missing anything?
>   Perhaps it
> should be given a better name, like --strip-disabled.
Thanks for the advice. I agree, Will be reposting the patch making this
option as --strip-disabled with CC to Jon Loeliger (dtc maintainer).


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing.
  2012-08-15  9:49     ` Srinivas KANDAGATLA
@ 2012-08-15 11:29           ` David Gibson
  2012-08-15 12:04       ` Tabi Timur-B04825
  1 sibling, 0 replies; 9+ messages in thread
From: David Gibson @ 2012-08-15 11:29 UTC (permalink / raw)
  To: Srinivas KANDAGATLA
  Cc: mmarek-AlSwsSmVLrQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	Tabi Timur-B04825, linux-kbuild-u79uwXL29TY76Z2rM5mHXA

On Wed, Aug 15, 2012 at 10:49:44AM +0100, Srinivas KANDAGATLA wrote:
> On 15/08/12 03:12, Tabi Timur-B04825 wrote:
> > On Tue, Aug 14, 2012 at 8:11 PM, David Gibson <dwg-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org> wrote:
> >> On Mon, Aug 13, 2012 at 09:01:53AM +0100, Srinivas KANDAGATLA wrote:
> >>> From: Srinivas Kandagatla <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
> >>>
> >>> This patch add pre-processing capablity to dtc based on status property.
> >>> Now the dtc has additional option -P to enable Pre-processing based on
> >>> status property.
> >>>
> >>> The SOCS have lot of device tree infrastructure files which mark the
> >>> device nodes as disabled and the board level device tree enables them if
> >>> required. However while creating device tree blob, the compiler can
> >>> preprocess the nodes and exclude nodes marked as disabled, doing this
> >>> way will reduce the size of device tree blob.
> > IMHO, many devices that are marked as "disabled" in the DTS are
> > expecting to be enabled by the boot loader, so just because a node is
> > disabled in the DTS does not mean that it will be disabled when Linux
> > sees it.
> Good to know that,
> But some of the secured bootloaders like the one's we use don't even
> touch the dt blob.

It's not just a question of bootloaders.  Status "disabled" devices
can potentially be activated in some way by the OS.  For example ePAPR
specifies that all secondary CPUs be marked "disabled" with other
properties indicating the method by which the OS can turn them on.

> >>> In our case this has reduced the blob size from 29K to 15K.
> > I don't see that as significant.
> >
> >>> Also nodes with status="disabled" is are never probed by dt platform bus
> >>> code.
> >>>
> >>> Again, Preprocessing is optional parameter to dtc.
> > Using this option would break a lot of our device trees.
> As this is optional parameter, I did not expect it to break the
> default/existing behavior.
> Correct me am missing anything?
> >   Perhaps it
> > should be given a better name, like --strip-disabled.
> Thanks for the advice. I agree, Will be reposting the patch making this
> option as --strip-disabled with CC to Jon Loeliger (dtc maintainer).

--strip-disabled is a reasonable name, however at present dtc doesn't
support long option names, so there will be some more work enabling
that.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing.
@ 2012-08-15 11:29           ` David Gibson
  0 siblings, 0 replies; 9+ messages in thread
From: David Gibson @ 2012-08-15 11:29 UTC (permalink / raw)
  To: Srinivas KANDAGATLA
  Cc: Tabi Timur-B04825, mmarek, devicetree-discuss, linux-kbuild

On Wed, Aug 15, 2012 at 10:49:44AM +0100, Srinivas KANDAGATLA wrote:
> On 15/08/12 03:12, Tabi Timur-B04825 wrote:
> > On Tue, Aug 14, 2012 at 8:11 PM, David Gibson <dwg@au1.ibm.com> wrote:
> >> On Mon, Aug 13, 2012 at 09:01:53AM +0100, Srinivas KANDAGATLA wrote:
> >>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> >>>
> >>> This patch add pre-processing capablity to dtc based on status property.
> >>> Now the dtc has additional option -P to enable Pre-processing based on
> >>> status property.
> >>>
> >>> The SOCS have lot of device tree infrastructure files which mark the
> >>> device nodes as disabled and the board level device tree enables them if
> >>> required. However while creating device tree blob, the compiler can
> >>> preprocess the nodes and exclude nodes marked as disabled, doing this
> >>> way will reduce the size of device tree blob.
> > IMHO, many devices that are marked as "disabled" in the DTS are
> > expecting to be enabled by the boot loader, so just because a node is
> > disabled in the DTS does not mean that it will be disabled when Linux
> > sees it.
> Good to know that,
> But some of the secured bootloaders like the one's we use don't even
> touch the dt blob.

It's not just a question of bootloaders.  Status "disabled" devices
can potentially be activated in some way by the OS.  For example ePAPR
specifies that all secondary CPUs be marked "disabled" with other
properties indicating the method by which the OS can turn them on.

> >>> In our case this has reduced the blob size from 29K to 15K.
> > I don't see that as significant.
> >
> >>> Also nodes with status="disabled" is are never probed by dt platform bus
> >>> code.
> >>>
> >>> Again, Preprocessing is optional parameter to dtc.
> > Using this option would break a lot of our device trees.
> As this is optional parameter, I did not expect it to break the
> default/existing behavior.
> Correct me am missing anything?
> >   Perhaps it
> > should be given a better name, like --strip-disabled.
> Thanks for the advice. I agree, Will be reposting the patch making this
> option as --strip-disabled with CC to Jon Loeliger (dtc maintainer).

--strip-disabled is a reasonable name, however at present dtc doesn't
support long option names, so there will be some more work enabling
that.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing.
  2012-08-15  9:49     ` Srinivas KANDAGATLA
       [not found]       ` <502B70B8.1030709-qxv4g6HH51o@public.gmane.org>
@ 2012-08-15 12:04       ` Tabi Timur-B04825
  1 sibling, 0 replies; 9+ messages in thread
From: Tabi Timur-B04825 @ 2012-08-15 12:04 UTC (permalink / raw)
  To: srinivas.kandagatla
  Cc: David Gibson, mmarek, devicetree-discuss, linux-kbuild

Srinivas KANDAGATLA wrote:
>> >Using this option would break a lot of our device trees.

> As this is optional parameter, I did not expect it to break the
> default/existing behavior.
> Correct me am missing anything?

I'm just concerned that someone might accidentally set it and then wonder 
why strange things happen during boot.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing.
  2012-08-15 11:29           ` David Gibson
  (?)
@ 2012-08-15 16:00           ` Mitch Bradley
  -1 siblings, 0 replies; 9+ messages in thread
From: Mitch Bradley @ 2012-08-15 16:00 UTC (permalink / raw)
  To: David Gibson
  Cc: Srinivas KANDAGATLA, mmarek, devicetree-discuss,
	Tabi Timur-B04825, linux-kbuild

On 8/15/2012 1:29 AM, David Gibson wrote:
> On Wed, Aug 15, 2012 at 10:49:44AM +0100, Srinivas KANDAGATLA wrote:
>> On 15/08/12 03:12, Tabi Timur-B04825 wrote:
>>> On Tue, Aug 14, 2012 at 8:11 PM, David Gibson <dwg@au1.ibm.com> wrote:
>>>> On Mon, Aug 13, 2012 at 09:01:53AM +0100, Srinivas KANDAGATLA wrote:
>>>>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>>>>>
>>>>> This patch add pre-processing capablity to dtc based on status property.
>>>>> Now the dtc has additional option -P to enable Pre-processing based on
>>>>> status property.
>>>>>
>>>>> The SOCS have lot of device tree infrastructure files which mark the
>>>>> device nodes as disabled and the board level device tree enables them if
>>>>> required. However while creating device tree blob, the compiler can
>>>>> preprocess the nodes and exclude nodes marked as disabled, doing this
>>>>> way will reduce the size of device tree blob.
>>> IMHO, many devices that are marked as "disabled" in the DTS are
>>> expecting to be enabled by the boot loader, so just because a node is
>>> disabled in the DTS does not mean that it will be disabled when Linux
>>> sees it.
>> Good to know that,
>> But some of the secured bootloaders like the one's we use don't even
>> touch the dt blob.
> 
> It's not just a question of bootloaders.  Status "disabled" devices
> can potentially be activated in some way by the OS.  For example ePAPR
> specifies that all secondary CPUs be marked "disabled" with other
> properties indicating the method by which the OS can turn them on.
> 

You could use a different value for status, for example "not present",
to indicate that the device can never be used, and this is fair game for
removal from the tree.

>>>>> In our case this has reduced the blob size from 29K to 15K.
>>> I don't see that as significant.
>>>
>>>>> Also nodes with status="disabled" is are never probed by dt platform bus
>>>>> code.
>>>>>
>>>>> Again, Preprocessing is optional parameter to dtc.
>>> Using this option would break a lot of our device trees.
>> As this is optional parameter, I did not expect it to break the
>> default/existing behavior.
>> Correct me am missing anything?
>>>   Perhaps it
>>> should be given a better name, like --strip-disabled.
>> Thanks for the advice. I agree, Will be reposting the patch making this
>> option as --strip-disabled with CC to Jon Loeliger (dtc maintainer).
> 
> --strip-disabled is a reasonable name, however at present dtc doesn't
> support long option names, so there will be some more work enabling
> that.
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-08-15 16:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-13  8:01 [RFC:PATCH 3.6.0-rc1] dtc: Add -P option to dtc for Pre-Processing Srinivas KANDAGATLA
2012-08-15  1:11 ` David Gibson
2012-08-15  2:12   ` Tabi Timur-B04825
2012-08-15  9:49     ` Srinivas KANDAGATLA
     [not found]       ` <502B70B8.1030709-qxv4g6HH51o@public.gmane.org>
2012-08-15 11:29         ` David Gibson
2012-08-15 11:29           ` David Gibson
2012-08-15 16:00           ` Mitch Bradley
2012-08-15 12:04       ` Tabi Timur-B04825
2012-08-15  9:33   ` Srinivas KANDAGATLA

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.