public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH 0/19] Create generic board init and move ARM and x86 to it
Date: Mon, 02 Jan 2012 07:50:49 +0100	[thread overview]
Message-ID: <20120102065049.4AC0182272@gemini.denx.de> (raw)
In-Reply-To: <CAPnjgZ1eutEboyvEtYcxcZcv=1Z_3tKq_45wBrgNdPsnxRth3A@mail.gmail.com>

Dear Simon Glass,

In message <CAPnjgZ1eutEboyvEtYcxcZcv=1Z_3tKq_45wBrgNdPsnxRth3A@mail.gmail.com> you wrote:
> 
> >> - getting generic relocation working
> >
> > I don;t see why this would be a direct prerequisite here. =A0We want to
> > have that, no boubt about that. =A0But it appears to be an unrelated
> > change to me.
> 
> I don't think it's essential, but it is desirable, which I why it is
> on the list.

I recommend to put this on a different list.  Please keep changes
orthogonal and restict this discussion and patch series to things
dealing with the normalization of the board init code.

This is complicated enough, and it does not good to include
additional, unrelated tasks.

> >> - adding functions for anything that is missing from board init code
> >
> > "anything that is missing from board init code" ?
> 
> By that I mean that if the architecture has its own little things
> which aren't supported by generic board init, then these would need to
> be worked into the generic board init somehow, perhaps initially with
> a new function in the initcall list.

Such an approach will most probable result in a mess of code that is
even more dificult to maintain than the current split we have now.

> >> - removing things which don't work on the architecture?
> >
> > That would probably reander systems broken that need these things?
> 
> Sorry for being so vague. What I mean is that if an arch does not
> support a feature, then we don't want to call the init functions for
> it on that architecture. Sometimes this is handled automatically -
> e.g. if an arch does not support CONFIG_POST then the generic board
> init code will skip this anyway. But there may be other cases where
> features available in the generic board init cannot be supported in
> all archs.

This is the same problem as above, right?  Each architecture, and
actually each board may or may not require certain initializations,
and actually may require them to happen in a certain order (which may
be different from other boards).

> > Keep in mind that my original ida of providing a function call table
> > was to allow to define this table in a board specific way (i. e. in
> > the board config file).
> >
> > [Not that this idea found many friends...]
> 
> With this series I have moved over to purely having a function call
> table, with no actual init code in board_init_f() and board_init_r().

This was the original plan.

> Having done this, I have found that the list of functions is very
> long, So we probably don't want boards to duplicate this list and
> #ifdefs may be the lesser of two evils. If we can move to Graham'

I don't really see this as an practical approach.  Did you look at the
PPC code?  init_sequence[]  has a total of 29 entries, "decorated"
with 21 conditionals.  If we merge in ARM and x86, we will have a mess
nobody is able to understand.

> For now I have tried to simply move the code into separate functions,
> since this makes it easier to compare against the original code in the
> arch/xxx/lib/board.c files, to make sure nothing is left out and the
> ordering is OK.

Agreed.

> I'm not convinced it is the best idea. A trivial change of just
> removing duplicated code from all the archs and inserting it into
> generic board should be safe enough. But is that really a common case?
> I have found lots of subtle differences that need to be worked out,
> and there is the ordering to worry about. Every time there is a patch
> we need to re-test all boards. It might be easier to just create a
> generic board implementation one, and then test it once on each board,
> rather than testing on each board with every patch. Of course every
> time you patch generic board you might introduce a breakage in an
> existing (previously working) board, but that is the normal situation
> with development so I don't see a problem there.
> 
> Perhaps the biggest problem is the difficulty of testing, and if we
> can avoid months of little patches (each one potentially breaking lots
> of boards at run-time) then I would prefer that.

I am not sure that the whole approach makes sense.  The resulkting
mess of #ifdef's is not there because people didn't care, but because
of very specific requirements of specific hardware, that - at least
given the tools of the respective point of time - could not be solved
more efficiently.

I see two options here:

- We can take the existing code and try to unify it, and make all
  boards (including a large number of EOLed and unmaintained ones) to
  that new code base.

  This will be a lot of work, and the resulting code will probably
  messy again.

- We could as well try to come up with a new, cleaned up implementa-
  tion that maybe doesn't fit all, but only 80 or 90% of the existing
  boards.  We could then (1) convert existing code step by step to the
  new implementation and (2) accept new submissions only when using
  the new code.

  There may be a number of boards where conversion is non trivial, or
  where nobody is willing or able to perform the changes and / or the
  testing.  My gut feeling tis that this would be a relatively small
  number of boards, and mostly old and unmaintained ones.  We might
  give them some grace period and then remove them.


> Well I suppose that's what I'm saying. Doing this once, accepting that
> some boards will thereby be broken, and then accepting patches to fix
> them feels easier than trying to keep everything working through a
> long series of little changes.

You appear to assume that onlly a small percentage of boards would be
broken.  My expectations are different.  Intentionally causing
breakage may be useful here and there, but I don;t think it;s the
right thing here.

> >> It is a feature used by about half, and it does include the complexity
> >> of jumping from pre-reloc to post-reloc init. I think it was a
> >> reasonable first target.
> >
> > What exactly is the problem here?
> 
> The problem is the code duplication inherent in relocation - each
> architecture has its own way of doing it, but really it can mostly be
> written generically in C. ARM is even worse with each CPU implementing
> essentially the same code!

I suggect we leave relocation out of this discussion here.  It is an
area that  needs to be cleaned up, definitely.  But it is another,
unrelated topic.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"No problem is so formidable that you can't walk away from it."
- C. Schulz

      reply	other threads:[~2012-01-02  6:50 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28  6:35 [U-Boot] [RFC PATCH 0/19] Create generic board init and move ARM and x86 to it Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 01/19] Introduce generic global_data Simon Glass
2011-12-29  7:47   ` Andreas Bießmann
2012-01-07 22:33     ` Simon Glass
2012-01-08 10:48       ` Graeme Russ
2012-01-08 18:13         ` Simon Glass
2012-01-09 11:21           ` Andreas Bießmann
2012-01-09 18:17             ` Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 02/19] Make relocation functions global Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 03/19] Add basic initcall implementation Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 04/19] define CONFIG_SYS_LEGACY_BOARD everywhere Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 05/19] Add generic post-relocation board_r.c Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 06/19] Add generic pre-relocation board_f.c Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 07/19] Add spl load feature Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 08/19] switch ARM over to generic board Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 09/19] arm: Remove unused code in board.c, global_data.h Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 10/19] Add CONFIG_SYS_SYM_OFFSETS to support offset symbols Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 11/19] x86: Remove compiler warning in sc520_timer.c Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 12/19] x86: Remove dead code in eNET Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 13/19] x86: Add processor library and relocation functions Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 14/19] Tidy up asm/generic sections.h to include x86 symbols Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 15/19] Add fields required by x86 to global_data Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 16/19] x86: Change stub example to use asm-generic/sections.h Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 17/19] x86: Add initial memory barrier macros Simon Glass
2011-12-28  6:35 ` [U-Boot] [RFC PATCH 18/19] Bring in x86 to unified board architecture Simon Glass
2011-12-28  6:36 ` [U-Boot] [RFC PATCH 19/19] x86: Remove unused board/global_data code Simon Glass
2011-12-28 17:30 ` [U-Boot] [RFC PATCH 0/19] Create generic board init and move ARM and x86 to it Wolfgang Denk
2011-12-28 18:13   ` Simon Glass
2011-12-30 15:49 ` Graeme Russ
2011-12-31  0:03   ` Wolfgang Denk
2011-12-31  2:02   ` Simon Glass
2011-12-31 11:52     ` Graeme Russ
2012-01-01 23:48       ` Simon Glass
2012-01-02 11:26         ` Graeme Russ
2012-01-02 14:46           ` Wolfgang Denk
2012-01-03  5:33             ` Simon Glass
2012-01-03  8:12               ` Wolfgang Denk
2012-01-03  9:15                 ` Graeme Russ
2012-01-03 15:55                 ` Simon Glass
2012-01-03 22:35                   ` Wolfgang Denk
2012-01-03 22:52                     ` Simon Glass
2012-01-03  5:28           ` Simon Glass
2012-01-01  1:54     ` Wolfgang Denk
2012-01-01 23:47       ` Simon Glass
2012-01-02  6:50         ` Wolfgang Denk [this message]

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=20120102065049.4AC0182272@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox