From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d8hQU-0003dX-SW for barebox@lists.infradead.org; Thu, 11 May 2017 06:18:16 +0000 Date: Thu, 11 May 2017 08:17:53 +0200 From: Sascha Hauer Message-ID: <20170511061753.5xsrhw5usm3ldcgg@pengutronix.de> References: <20170509075115.15702-1-jbe@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170509075115.15702-1-jbe@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH v2] PPC: request a consistent memory layout To: Juergen Borleis Cc: barebox@lists.infradead.org On Tue, May 09, 2017 at 09:51:15AM +0200, Juergen Borleis wrote: > Using the memory test command will crash barebox, because it tests the > area where the stack is located for the PPC architecture. > > On PPC the stack is below the barebox binary. Below the stack the malloc > area is located. Until this change some routines used the macros > from 'memory_layout.h', some other calculated their values by their > own - which resulted into an unrequested and unprotected stack area. > > Signed-off-by: Juergen Borleis Applied, thanks Sascha > --- > arch/ppc/mach-mpc5xxx/Kconfig | 1 - > arch/ppc/mach-mpc5xxx/cpu.c | 18 ++++++++++++++++++ > 2 files changed, 18 insertions(+), 1 deletion(-) > > diff --git a/arch/ppc/mach-mpc5xxx/Kconfig b/arch/ppc/mach-mpc5xxx/Kconfig > index 1ecce3a56..180aa32ad 100644 > --- a/arch/ppc/mach-mpc5xxx/Kconfig > +++ b/arch/ppc/mach-mpc5xxx/Kconfig > @@ -32,7 +32,6 @@ config ARCH_MPC5200 > config MPC5xxx > bool > depends on MACH_PHYCORE_MPC5200B_TINY > - select HAVE_CONFIGURABLE_MEMORY_LAYOUT > default y > > menu "Board specific settings" > diff --git a/arch/ppc/mach-mpc5xxx/cpu.c b/arch/ppc/mach-mpc5xxx/cpu.c > index 42ced9ac5..ab58967aa 100644 > --- a/arch/ppc/mach-mpc5xxx/cpu.c > +++ b/arch/ppc/mach-mpc5xxx/cpu.c > @@ -33,6 +33,8 @@ > #include > #include > #include > +#include > +#include > > int checkcpu (void) > { > @@ -60,6 +62,22 @@ int checkcpu (void) > > /* ------------------------------------------------------------------------- */ > > +static int mpc5xxx_reserve_region(void) > +{ > + struct resource *r; > + > + /* keep this in sync with the assembler routines setting up the stack */ > + r = request_sdram_region("stack", _text_base - STACK_SIZE, STACK_SIZE); > + if (r == NULL) { > + pr_err("Failed to request stack region at: 0x%08lx/0x%08lx\n", > + _text_base - STACK_SIZE, _text_base - 1); > + return -EBUSY; > + } > + > + return 0; > +} > +coredevice_initcall(mpc5xxx_reserve_region); > + > static void __noreturn mpc5xxx_restart_soc(struct restart_handler *rst) > { > ulong msr; > -- > 2.11.0 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox