All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dirk Brandewie <dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
Cc: sodaville-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	"H. Peter Anvin" <hpa-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	arjan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org
Subject: Re: [sodaville] [PATCH 3/4] of/dtc: force dtb size to modulo 32 bytes
Date: Fri, 12 Nov 2010 08:24:53 -0800	[thread overview]
Message-ID: <4CDD6A55.6040603@gmail.com> (raw)
In-Reply-To: <20101112011617.GA3102@yookeroo>

Hi David,
On 11/11/2010 05:16 PM, David Gibson wrote:
> On Thu, Nov 11, 2010 at 05:01:16PM -0800, Dirk Brandewie wrote:
>> On 11/11/2010 04:47 PM, H. Peter Anvin wrote:
>>> On 11/11/2010 04:03 PM, dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>>>> From: Dirk Brandewie<dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>>>
>>>> This patch forces the size of the DTB to be modulo 32 bytes. This is
>>>> needed to support linking multiple DTB's into a single section in the
>>>> image. GCC wants structures to be 32 byte aligned without this change
>>>> DTB's after the first in the section may not be properly aligned so
>>>> the flat tree parsing code will fall over.
>>>>
>>>> Signed-off-by: Dirk Brandewie<dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>>
>>> I don't think 32 is a universal number; it should depend on the ABI.  On
>>> x86, for one thing, I'm pretty sure that there is no particular
>>> alignment requirements beyond the natural alignment of the data items,
>>> for example.
>>>
>>> Although 32 is probably conservative on any platform, please flag the
>>> origin of this with a comment, or make it a constant defined in a header
>>> file... otherwise, if this breaks for whatever reason it'll be near
>>> impossible to find.
>>>
>>
>> I will change . = ALIGN(32); to STRUCT_ALIGN();
>>
>> from vmlinux.lds.h:
>> /*
>>   * Align to a 32 byte boundary equal to the
>>   * alignment gcc 4.5 uses for a struct
>>   */
>> #define STRUCT_ALIGN() . = ALIGN(32)
>
> I also think this is the wrong place to do this.  scripts/dtc is a
> mirror of copy of upstream dtc, designed for making dtb images for
> general purposes.  I think the alignment should instead go into the
> linker script fragments you generate to incbin the dtbs.
>

I was sleep deprived when I responded to HPA I thought he had replied to the 
patch modifying vmlinux.lds.h since we had talked about that file a fair amount. 
So my first response had little bearing on patch in question.

I am trying to solve two issues with this change.

The structure needs to be 32 byte aligned for the code in fdt.c to be able parse 
the blob.  You are right I can force this alignment in the assembly fragment.

The second issue is being able to parse the section in the kernel image to find 
each of the blobs that have been concatenated together.  If the DTB size is 
modulo 32 bytes I can use  blob = blob+be32_to_cpu(blob->totalsize) to find the 
next blob in the section and use that address directly to have fdt.c parse the 
blob.  Otherwise I would need to search for the signature of the next blob 
somewhere past the end of the current blob which is knid of messy IMHO.

I have two questions,
Do you think this acceptable if I made forcing the alignment a command line 
argument?

Where is the DTC git tree I should be delivering patches against?  is 
git://www.jdl.com/software/dtc.git the correct tree?

Thanks
--Dirk

  reply	other threads:[~2010-11-12 16:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-12  0:03 [PATCH 0/4] [RFC V4] Adding DTB to architecture independent vmlinux dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
     [not found] ` <cover.1289520079.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-12  0:03   ` [PATCH 1/4] x86/of: Support building device tree blob(s) into image dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
     [not found]     ` <1b004c685c67c07a5a0b2b16b3a00dd016e2b759.1289520079.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-14  5:13       ` Grant Likely
2010-11-12  0:03   ` [PATCH 2/4] of: Add support for linking device tree blobs into vmlinux dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
     [not found]     ` <7d0a9d70f1616340115c187547006c76b0135ca7.1289520079.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-14  5:25       ` Grant Likely
     [not found]         ` <20101114052525.GC2355-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-11-15 16:37           ` Dirk Brandewie
     [not found]             ` <4CE161AE.4030103-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-15 21:27               ` [sodaville] " H. Peter Anvin
2010-11-12  0:03   ` [PATCH 3/4] of/dtc: force dtb size to modulo 32 bytes dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
     [not found]     ` <a7e6885535e6c930560f3d79a8a55ae922499752.1289520079.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-12  0:47       ` [sodaville] " H. Peter Anvin
     [not found]         ` <4CDC8EA3.6080608-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2010-11-12  1:01           ` Dirk Brandewie
     [not found]             ` <4CDC91DC.7030407-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-12  1:16               ` David Gibson
2010-11-12 16:24                 ` Dirk Brandewie [this message]
     [not found]                   ` <4CDD6A55.6040603-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-12 19:08                     ` H. Peter Anvin
2010-11-12 22:20                     ` Jon Loeliger
2010-11-14  0:44                     ` David Gibson
2010-11-14  4:35                       ` Grant Likely
2010-11-12  0:03   ` [PATCH 4/4] of/fdt: add kernel command line option for dtb_compat string dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
     [not found]     ` <855a5a11d04a7c1883675b6a77992c4af85222fd.1289520079.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-14  6:22       ` Grant Likely
2010-11-14  6:26         ` Stephen Neuendorffer
     [not found]           ` <2573ead1-944d-4ba5-ace3-12936693d872-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
2010-11-14  6:33             ` Grant Likely
     [not found]         ` <20101114062246.GD2355-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-11-16  0:27           ` H. Peter Anvin
     [not found]             ` <4CE1CFDA.7030900-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2010-11-16  6:34               ` Grant Likely

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=4CDD6A55.6040603@gmail.com \
    --to=dirk.brandewie-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=arjan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=hpa-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=sodaville-hfZtesqFncYOwBW4kG4KsQ@public.gmane.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.