public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fdt_support: Check for bank size before updating memory node
@ 2015-10-22 14:34 Lokesh Vutla
  2015-10-22 14:51 ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: Lokesh Vutla @ 2015-10-22 14:34 UTC (permalink / raw)
  To: u-boot

In case if one of the bank that is passed is of size zero, then u-boot
will be updating memory node with a bank of size zero. There is not need
to update memory node if size is zero, so check for bank size before
updating.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 common/fdt_support.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index f86365e..0019eef 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -401,6 +401,9 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
 	char *p = buf;
 
 	for (i = 0; i < n; i++) {
+		if (size[i] == 0)
+			continue;
+
 		if (address_cells == 2)
 			*(fdt64_t *)p = cpu_to_fdt64(address[i]);
 		else
-- 
2.1.4

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

* [U-Boot] [PATCH] fdt_support: Check for bank size before updating memory node
  2015-10-22 14:34 [U-Boot] [PATCH] fdt_support: Check for bank size before updating memory node Lokesh Vutla
@ 2015-10-22 14:51 ` Tom Rini
  2015-10-23  4:38   ` Lokesh Vutla
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Rini @ 2015-10-22 14:51 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 22, 2015 at 08:04:04PM +0530, Lokesh Vutla wrote:

> In case if one of the bank that is passed is of size zero, then u-boot
> will be updating memory node with a bank of size zero. There is not need
> to update memory node if size is zero, so check for bank size before

is not.

> updating.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
>  common/fdt_support.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index f86365e..0019eef 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -401,6 +401,9 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
>  	char *p = buf;
>  
>  	for (i = 0; i < n; i++) {
> +		if (size[i] == 0)
> +			continue;
> +
>  		if (address_cells == 2)
>  			*(fdt64_t *)p = cpu_to_fdt64(address[i]);
>  		else

So I suggested something along these lines a long while ago as part of
how to fix the problem of DT has correct (and larger than U-Boot can
see) memory size, so I like the change.  But it's a "big" behavior
change that we (I) need to note in the release notes at least.  When I
looked last things were either setting a 0 size or a correct looking
size, but I bet we'll still see a few things drop out wrt incorrect (too
small) memory size being passed.  I wonder what the best list(s) would
be to let everyone know about this would be...

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151022/9c8303c6/attachment.sig>

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

* [U-Boot] [PATCH] fdt_support: Check for bank size before updating memory node
  2015-10-22 14:51 ` Tom Rini
@ 2015-10-23  4:38   ` Lokesh Vutla
  2015-10-23 13:23     ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: Lokesh Vutla @ 2015-10-23  4:38 UTC (permalink / raw)
  To: u-boot



On Thursday 22 October 2015 08:21 PM, Tom Rini wrote:
> On Thu, Oct 22, 2015 at 08:04:04PM +0530, Lokesh Vutla wrote:
> 
>> In case if one of the bank that is passed is of size zero, then u-boot
>> will be updating memory node with a bank of size zero. There is not need
>> to update memory node if size is zero, so check for bank size before
> 
> is not.
Oops. will correct it in v2.

> 
>> updating.
>>
>> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
>> ---
>>  common/fdt_support.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/common/fdt_support.c b/common/fdt_support.c
>> index f86365e..0019eef 100644
>> --- a/common/fdt_support.c
>> +++ b/common/fdt_support.c
>> @@ -401,6 +401,9 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
>>  	char *p = buf;
>>  
>>  	for (i = 0; i < n; i++) {
>> +		if (size[i] == 0)
>> +			continue;
>> +
>>  		if (address_cells == 2)
>>  			*(fdt64_t *)p = cpu_to_fdt64(address[i]);
>>  		else
> 
> So I suggested something along these lines a long while ago as part of
> how to fix the problem of DT has correct (and larger than U-Boot can
> see) memory size, so I like the change.  But it's a "big" behavior
> change that we (I) need to note in the release notes at least.  When I
> looked last things were either setting a 0 size or a correct looking
> size, but I bet we'll still see a few things drop out wrt incorrect (too
> small) memory size being passed.  I wonder what the best list(s) would
> be to let everyone know about this would be...

Shall I take this as your Reviewed-by ? Not sure about how to let
everyone know about this. Please let me know to whom all I have to cc
for posting v2 of this patch.

Thanks and regards,
Lokesh
> 

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

* [U-Boot] [PATCH] fdt_support: Check for bank size before updating memory node
  2015-10-23  4:38   ` Lokesh Vutla
@ 2015-10-23 13:23     ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2015-10-23 13:23 UTC (permalink / raw)
  To: u-boot

On Fri, Oct 23, 2015 at 10:08:29AM +0530, Lokesh Vutla wrote:
> 
> 
> On Thursday 22 October 2015 08:21 PM, Tom Rini wrote:
> > On Thu, Oct 22, 2015 at 08:04:04PM +0530, Lokesh Vutla wrote:
> > 
> >> In case if one of the bank that is passed is of size zero, then u-boot
> >> will be updating memory node with a bank of size zero. There is not need
> >> to update memory node if size is zero, so check for bank size before
> > 
> > is not.
> Oops. will correct it in v2.
> 
> > 
> >> updating.
> >>
> >> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> >> ---
> >>  common/fdt_support.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git a/common/fdt_support.c b/common/fdt_support.c
> >> index f86365e..0019eef 100644
> >> --- a/common/fdt_support.c
> >> +++ b/common/fdt_support.c
> >> @@ -401,6 +401,9 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
> >>  	char *p = buf;
> >>  
> >>  	for (i = 0; i < n; i++) {
> >> +		if (size[i] == 0)
> >> +			continue;
> >> +
> >>  		if (address_cells == 2)
> >>  			*(fdt64_t *)p = cpu_to_fdt64(address[i]);
> >>  		else
> > 
> > So I suggested something along these lines a long while ago as part of
> > how to fix the problem of DT has correct (and larger than U-Boot can
> > see) memory size, so I like the change.  But it's a "big" behavior
> > change that we (I) need to note in the release notes at least.  When I
> > looked last things were either setting a 0 size or a correct looking
> > size, but I bet we'll still see a few things drop out wrt incorrect (too
> > small) memory size being passed.  I wonder what the best list(s) would
> > be to let everyone know about this would be...
> 
> Shall I take this as your Reviewed-by ? Not sure about how to let
> everyone know about this. Please let me know to whom all I have to cc
> for posting v2 of this patch.

Yeah, that counts as a reviewed by.  Once I merge this I'll go poke
lkml/lakml/linuxppc-dev at least.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151023/97dbf40a/attachment.sig>

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

end of thread, other threads:[~2015-10-23 13:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-22 14:34 [U-Boot] [PATCH] fdt_support: Check for bank size before updating memory node Lokesh Vutla
2015-10-22 14:51 ` Tom Rini
2015-10-23  4:38   ` Lokesh Vutla
2015-10-23 13:23     ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox