All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: make the padding for the device tree a configurable option
Date: Wed, 19 May 2010 16:33:50 -0500	[thread overview]
Message-ID: <4BF4593E.8030101@freescale.com> (raw)
In-Reply-To: <1274304013.1931.6.camel@pasglop>

Benjamin Herrenschmidt wrote:

>> So to accommodate future boards where more padding is needed, we make the
>> option for the -p parameter configurable.
> 
> Can't u-boot just allocate more space ?

Yes and no.  U-Boot has functions to increase the size of an fdt, but these
functions can't be sure that the fdt will grow beyond its allocated space.
So if U-Boot calls fdt_setprop() or fdt_add_subnode(), and there isn't
enough space in the fdt, those functions will return with an error.

The problem with growing the fdt is that the function which does this
(fdt_open_into) cannot guarantee that the fdt will grow too large and
overwrite the end of whatever allocated memory it's in.

I had a long argument with Wolfgang on this (see "libfdt: make
fdt_increase_size() available to everyone"), and he says he'll reject any
patch that can't guarantee that fdt_open_into() won't grow too large.  He'll
also reject any patch that uses a macro constant to reserve this space, even
if I use that constant to ensure that fdt_open_into() won't do anything bad.

So in other words, U-Boot could allocate more space, but Wolfgang won't let it.

-- 
Timur Tabi
Linux kernel developer at Freescale

WARNING: multiple messages have this Message-ID (diff)
From: Timur Tabi <timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Benjamin Herrenschmidt
	<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
Cc: linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH] powerpc: make the padding for the device tree a configurable option
Date: Wed, 19 May 2010 16:33:50 -0500	[thread overview]
Message-ID: <4BF4593E.8030101@freescale.com> (raw)
In-Reply-To: <1274304013.1931.6.camel@pasglop>

Benjamin Herrenschmidt wrote:

>> So to accommodate future boards where more padding is needed, we make the
>> option for the -p parameter configurable.
> 
> Can't u-boot just allocate more space ?

Yes and no.  U-Boot has functions to increase the size of an fdt, but these
functions can't be sure that the fdt will grow beyond its allocated space.
So if U-Boot calls fdt_setprop() or fdt_add_subnode(), and there isn't
enough space in the fdt, those functions will return with an error.

The problem with growing the fdt is that the function which does this
(fdt_open_into) cannot guarantee that the fdt will grow too large and
overwrite the end of whatever allocated memory it's in.

I had a long argument with Wolfgang on this (see "libfdt: make
fdt_increase_size() available to everyone"), and he says he'll reject any
patch that can't guarantee that fdt_open_into() won't grow too large.  He'll
also reject any patch that uses a macro constant to reserve this space, even
if I use that constant to ensure that fdt_open_into() won't do anything bad.

So in other words, U-Boot could allocate more space, but Wolfgang won't let it.

-- 
Timur Tabi
Linux kernel developer at Freescale

  reply	other threads:[~2010-05-19 21:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 19:53 [PATCH] powerpc: make the padding for the device tree a configurable option Timur Tabi
2010-05-19 19:53 ` Timur Tabi
2010-05-19 21:20 ` Benjamin Herrenschmidt
2010-05-19 21:20   ` Benjamin Herrenschmidt
2010-05-19 21:33   ` Timur Tabi [this message]
2010-05-19 21:33     ` Timur Tabi
2010-05-19 22:44     ` Benjamin Herrenschmidt
2010-05-19 22:44       ` Benjamin Herrenschmidt
2010-05-20  0:03       ` Timur Tabi
2010-05-20  0:03         ` Timur Tabi
2010-05-20  0:23         ` Benjamin Herrenschmidt
2010-05-20  0:23           ` Benjamin Herrenschmidt
2010-05-20  0:36         ` M. Warner Losh
2010-05-20  0:36           ` M. Warner Losh
2010-05-20  1:18         ` David Gibson
2010-05-20  1:18           ` David Gibson
2010-05-20  1:46           ` Timur Tabi
2010-05-20  1:46             ` Timur Tabi
2010-05-20  6:17             ` David Gibson
2010-05-20  6:17               ` David Gibson
2010-05-20 11:40               ` Timur Tabi
2010-05-20 11:40                 ` Timur Tabi
2010-05-20 16:04           ` Scott Wood
2010-05-20 16:04             ` Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BF4593E.8030101@freescale.com \
    --to=timur@freescale.com \
    --cc=benh@kernel.crashing.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.