All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 16/23] Adjust board_f.c for ppc
Date: Tue, 12 Feb 2013 16:48:38 -0600	[thread overview]
Message-ID: <1360709318.24612.15@snotra> (raw)
In-Reply-To: <CAPnjgZ1yLaA6KahA4-WUF0g8KTDAdeKf5Hon-YGA9PCzhwCgQw@mail.gmail.com> (from sjg@chromium.org on Tue Feb 12 16:41:15 2013)

On 02/12/2013 04:41:15 PM, Simon Glass wrote:
> Hi Scott,
> 
> On Tue, Feb 12, 2013 at 2:32 PM, Scott Wood <scottwood@freescale.com>  
> wrote:
> > On 02/08/2013 09:12:12 AM, Simon Glass wrote:
> >>
> >>  #ifndef CONFIG_SPL_BUILD
> >>  static int reserve_stacks(void)
> >>  {
> >> +#ifdef CONFIG_PPC
> >> +       ulong *s;
> >> +#endif
> >> +
> >>         /* setup stack pointer for exceptions */
> >>         gd->dest_addr_sp -= 16;
> >>         gd->dest_addr_sp &= ~0xf;
> >> @@ -398,6 +532,14 @@ static int reserve_stacks(void)
> >>         /* leave 3 words for abort-stack, plus 1 for alignment */
> >>         gd->dest_addr_sp -= 16;
> >>
> >> +#ifdef CONFIG_PPC
> >> +       /* Clear initial stack frame */
> >> +       s = (ulong *) gd->dest_addr_sp;
> >> +       *s = 0; /* Terminate back chain */
> >> +       *++s = 0; /* NULL return address */
> >> +       gd->dest_addr_sp = (ulong) s;
> >> +#endif
> >> +
> >
> >
> > PPC ABI requires 16-byte stack alignment, which would be broken by  
> the
> > CONFIG_USE_IRQ section (which even still has an "ARM ABI" comment).
> >
> > I think this entire function should be kept in arch code.  Stack  
> layout is
> > inherently architecture/ABI specific.  Some architectures even have  
> a stack
> > that grows upward (not sure if any such are supported by U-Boot).
> 
> Thanks for reviewing all this.
> 
> While I am working to avoid it, one option is to create a weak
> function which archs can override. The reason I am keen to avoid it,
> at least for a first implementation, is that it obscures the
> similarities.

That's fine for most of the file, but I think there's not much that's  
truly generic when it comes to setting up the stack.  It's not as if  
this is a huge function (at least before it grows a bunch of ifdefs).

> In this case we could just just force 16-byte alignment,
> and make the PPC code unconditional. It shouldn't hurt anything.

The CONFIG_USE_IRQ section also has references to FIQs... if it's meant  
to be an ARM-specific CONFIG, perhaps it should be renamed (and  
definitely it should be documented).

-Scott

  reply	other threads:[~2013-02-12 22:48 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 15:11 [U-Boot] [PATCH v5 0/23] Create generic board init for ARM, x86, PPC Simon Glass
2013-02-08 15:11 ` [U-Boot] [PATCH v5 01/23] ppc: Add initial memory barrier macros Simon Glass
2013-02-11 19:52   ` Scott Wood
2013-02-12 18:44     ` Simon Glass
2013-02-12 18:50       ` Scott Wood
2013-02-12 18:55         ` Simon Glass
2013-02-12 19:04           ` Scott Wood
2013-02-12 19:06             ` Simon Glass
2013-02-08 15:11 ` [U-Boot] [PATCH v5 02/23] Introduce generic u-boot.h file Simon Glass
2013-02-08 15:11 ` [U-Boot] [PATCH v5 03/23] Replace __bss_end__ with __bss_end Simon Glass
2013-02-18 20:13   ` Tom Rini
2013-02-18 21:40     ` Otavio Salvador
2013-02-19  0:23       ` Simon Glass
2013-02-19  0:30         ` Otavio Salvador
2013-02-19  0:32           ` Simon Glass
2013-02-18 23:20   ` Andy Fleming
2013-02-08 15:12 ` [U-Boot] [PATCH v5 04/23] Introduce generic link section.h symbol files Simon Glass
2013-02-18 20:12   ` Tom Rini
2013-02-08 15:12 ` [U-Boot] [PATCH v5 05/23] arm: Use sections header to obtain link symbols Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 06/23] x86: nds32: Change stub example to use asm-generic/sections.h Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 07/23] Introduce a basic initcall implementation Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 08/23] Define CONFIG_SYS_LEGACY_BOARD everywhere Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 09/23] Declare watchdog functions in watchdog.h Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 10/23] Introduce generic pre-relocation board_f.c Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 11/23] Introduce generic post-relocation board_r.c Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 12/23] Add spl load feature Simon Glass
2013-02-12 20:29   ` Scott Wood
2013-02-12 22:23     ` Simon Glass
2013-02-12 22:34       ` Scott Wood
2013-03-02 23:39         ` Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 13/23] arm: Remove use of board_early_init_r/last_stage_init() Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 14/23] arm: Enable generic board support Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 15/23] Add CONFIG_SYS_SYM_OFFSETS to support offset symbols Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 16/23] Adjust board_f.c for ppc Simon Glass
2013-02-12 22:32   ` Scott Wood
2013-02-12 22:41     ` Simon Glass
2013-02-12 22:48       ` Scott Wood [this message]
2013-02-08 15:12 ` [U-Boot] [PATCH v5 17/23] Adjust board_r.c " Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 18/23] ppc: Enable generic board support Simon Glass
2013-02-12 20:38   ` Scott Wood
2013-02-12 22:29     ` Simon Glass
2013-02-12 22:40       ` Scott Wood
2013-02-08 15:12 ` [U-Boot] [PATCH v5 19/23] x86: Adjust board_f.c for x86 Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 20/23] x86: Adjust board_r.c " Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 21/23] x86: Use sections header to obtain link symbols Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 22/23] x86: Enable generic board support Simon Glass
2013-02-08 15:12 ` [U-Boot] [PATCH v5 23/23] tegra: Enable generic board for Seaboard Simon Glass
2013-02-08 17:23   ` Stephen Warren
2013-02-08 18:10     ` Simon Glass
2013-02-08 19:12       ` Stephen Warren

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=1360709318.24612.15@snotra \
    --to=scottwood@freescale.com \
    --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 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.