All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] ppc: Add CONFIG_TOP_HIDE option to hide memory area that doesn't get "touched"
@ 2008-03-21 11:17 Stefan Roese
  2008-03-21 11:48 ` Dave Littell
  2008-03-22 10:04 ` Matthias Fuchs
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Roese @ 2008-03-21 11:17 UTC (permalink / raw)
  To: u-boot

If CONFIG_TOP_HIDE is defined in the board config header, this specified
memory area will get subtracted from the top (end) of ram and won't get
"touched" at all by U-Boot. By fixing up gd->ram_size the Linux kernel
should gets passed the now "corrected" memory size and won't touch it
either. This should work for arch/ppc and arch/powerpc. Only Linux board
ports in arch/powerpc with bootwrapper support, that recalculate the
memory size from the SDRAM controller setup will have to get fixed.

This patch enables this config option on some PPC440EPx boards as a workaround
for the CHIP 11 errata. Here the description from the AMCC documentation:

CHIP_11: End of memory range area restricted access.
Category: 3

Overview:
The 440EPx DDR controller does not acknowledge any
transaction which is determined to be crossing over the
end-of-memory-range boundary, even if the starting address is
within valid memory space. Any such transaction from any PLB4
master will result in a PLB time-out on PLB4 bus.

Impact:
In case of such misaligned bursts, PLB4 masters will not
retrieve any data at all, just the available data up to the
end of memory, especially the 440 CPU. For example, if a CPU
instruction required an operand located in memory within the
last 7 words of memory, the DCU master would burst read 8
words to update the data cache and cross over the
end-of-memory-range boundary. Such a DCU read would not be
answered by the DDR controller, resulting in a PLB4 time-out
and ultimately in a Machine Check interrupt. The data would
be inaccessible to the CPU.

Workaround:
Forbid any application to access the last 256 bytes of DDR
memory. For example, make your operating system believe that
the last 256 bytes of DDR memory are absent. AMCC has a patch
that does this, available for Linux.

This patch sets CONFIG_TOP_HIDE for the following 440EPx boards:
lwmon5, korat, sequoia

The other remaining 440EPx board were intentionally not included
since it is not clear to me, if they use the end of ram for some
other purpose. This is unclear, since these boards have CONFIG_PRAM
defined and even comments like this:

PMC440.h:
/* esd expects pram at end of physical memory.
 * So no logbuffer at the moment.
 */

It is strongly recommendet to not use the last 256 bytes on those
boards too. Patches from the board maintainers are welcome.

Signed-off-by: Stefan Roese <sr@denx.de>
---
 include/configs/korat.h   |    2 ++
 include/configs/lwmon5.h  |    2 ++
 include/configs/sequoia.h |    4 +++-
 lib_ppc/board.c           |   17 +++++++++++++++++
 4 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/include/configs/korat.h b/include/configs/korat.h
index dcec9b0..c215c63 100644
--- a/include/configs/korat.h
+++ b/include/configs/korat.h
@@ -144,6 +144,8 @@
 #define SPD_EEPROM_ADDRESS	{0x50}
 #define CONFIG_PROG_SDRAM_TLB
 #define CFG_DRAM_TEST
+#define CONFIG_MEM_TOP_HIDE	256	/* don't use last 256 bytes	*/
+					/* 440EPx errata CHIP 11	*/
 
 /*
  * I2C
diff --git a/include/configs/lwmon5.h b/include/configs/lwmon5.h
index c3f10c7..f573730 100644
--- a/include/configs/lwmon5.h
+++ b/include/configs/lwmon5.h
@@ -85,6 +85,8 @@
 #define CFG_INIT_SP_OFFSET	CFG_GBL_DATA_OFFSET
 #define CFG_POST_ALT_WORD_ADDR	(CFG_PERIPHERAL_BASE + GPT0_COMP6)
 						/* unused GPT0 COMP reg	*/
+#define CONFIG_MEM_TOP_HIDE	256	/* don't use last 256 bytes	*/
+					/* 440EPx errata CHIP 11	*/
 
 /*-----------------------------------------------------------------------
  * Serial Port
diff --git a/include/configs/sequoia.h b/include/configs/sequoia.h
index dfa8779..0188234 100644
--- a/include/configs/sequoia.h
+++ b/include/configs/sequoia.h
@@ -221,6 +221,8 @@
 #if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
 #define CONFIG_DDR_DATA_EYE		/* use DDR2 optimization	*/
 #endif
+#define CONFIG_MEM_TOP_HIDE	256	/* don't use last 256 bytes	*/
+					/* 440EPx errata CHIP 11	*/
 
 /*
  * I2C
@@ -275,7 +277,7 @@
 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\
 		":${hostname}:${netdev}:off panic=1\0"			\
 	"addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}\0"\
-	"addmisc=setenv bootargs ${bootargs} mem=${mem}\0"		\
+	"addmisc=setenv bootargs ${bootargs}\0"				\
 	"flash_nfs=run nfsargs addip addtty addmisc;"			\
 		"bootm ${kernel_addr}\0"				\
 	"flash_self=run ramargs addip addtty addmisc;"			\
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index fbf1c5d..13b6f54 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -117,6 +117,10 @@ DECLARE_GLOBAL_DATA_PTR;
 #define	TOTAL_MALLOC_LEN	CFG_MALLOC_LEN
 #endif
 
+#if !defined(CONFIG_MEM_TOP_HIDE)
+#define CONFIG_MEM_TOP_HIDE	0
+#endif
+
 extern ulong __init_end;
 extern ulong _end;
 ulong monitor_flash_len;
@@ -425,6 +429,7 @@ void board_init_f (ulong bootflag)
 	 * relocate the code and continue running from DRAM.
 	 *
 	 * Reserve memory at end of RAM for (top down in that order):
+	 *  - area that won't get touched by U-Boot and Linux (optional)
 	 *  - kernel log buffer
 	 *  - protected RAM
 	 *  - LCD framebuffer
@@ -433,6 +438,18 @@ void board_init_f (ulong bootflag)
 	 */
 	len = (ulong)&_end - CFG_MONITOR_BASE;
 
+	/*
+	 * Subtract specified amount of memory to hide so that it won't
+	 * get "touched" at all by U-Boot. By fixing up gd->ram_size
+	 * the Linux kernel should now get passed the now "corrected"
+	 * memory size and won't touch it either. This should work
+	 * for arch/ppc and arch/powerpc. Only Linux board ports in
+	 * arch/powerpc with bootwrapper support, that recalculate the
+	 * memory size from the SDRAM controller setup will have to
+	 * get fixed.
+	 */
+	gd->ram_size -= CONFIG_MEM_TOP_HIDE;
+
 	addr = CFG_SDRAM_BASE + get_effective_memsize();
 
 #ifdef CONFIG_LOGBUFFER
-- 
1.5.4.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot-Users] [PATCH] ppc: Add CONFIG_TOP_HIDE option to hide memory area that doesn't get "touched"
  2008-03-21 11:17 [U-Boot-Users] [PATCH] ppc: Add CONFIG_TOP_HIDE option to hide memory area that doesn't get "touched" Stefan Roese
@ 2008-03-21 11:48 ` Dave Littell
  2008-03-21 12:39   ` Wolfgang Denk
  2008-03-22 10:04 ` Matthias Fuchs
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Littell @ 2008-03-21 11:48 UTC (permalink / raw)
  To: u-boot

Stefan Roese wrote:
[deletia
> 
> diff --git a/include/configs/korat.h b/include/configs/korat.h
> index dcec9b0..c215c63 100644
> --- a/include/configs/korat.h
> +++ b/include/configs/korat.h
> @@ -144,6 +144,8 @@
>  #define SPD_EEPROM_ADDRESS	{0x50}
>  #define CONFIG_PROG_SDRAM_TLB
>  #define CFG_DRAM_TEST
> +#define CONFIG_MEM_TOP_HIDE	256	/* don't use last 256 bytes	*/
> +					/* 440EPx errata CHIP 11	*/
>  

Hi all,

Please pardon my cluelessness, but should this be CFG_MEM_TOP_HIDE
instead of CONFIG_MEM_TOP_HIDE?  I thought I remembered reading
somewhere (the top-level README?) that CONFIG_... things are switches
and CFG_... things are values.


Thanks,
Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot-Users] [PATCH] ppc: Add CONFIG_TOP_HIDE option to hide memory area that doesn't get "touched"
  2008-03-21 11:48 ` Dave Littell
@ 2008-03-21 12:39   ` Wolfgang Denk
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2008-03-21 12:39 UTC (permalink / raw)
  To: u-boot

In message <47E3A078.7030809@verizon.net> you wrote:
>
> Please pardon my cluelessness, but should this be CFG_MEM_TOP_HIDE
> instead of CONFIG_MEM_TOP_HIDE?  I thought I remembered reading

Yes, it should.

> somewhere (the top-level README?) that CONFIG_... things are switches
> and CFG_... things are values.

No, this is wrong. CONFIG_... is supposed  to  be  user  configurable
options  (i.  e.  things  you  can  easily change in a specific board
configuration to adjust U-Boot  to  your  needs  or  likings),  while
CFG_... are specifcic configurations necessary to make U-Boot work on
a specific hardware, i. e. they cannot be changed unless the hardware
changes, to (in general, at least).

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
Wenn Du ein' weise Antwort verlangst, Mu?t Du vern?nftig fragen.
                                                -- Goethe, Invektiven

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot-Users] [PATCH] ppc: Add CONFIG_TOP_HIDE option to hide memory area that doesn't get "touched"
  2008-03-21 11:17 [U-Boot-Users] [PATCH] ppc: Add CONFIG_TOP_HIDE option to hide memory area that doesn't get "touched" Stefan Roese
  2008-03-21 11:48 ` Dave Littell
@ 2008-03-22 10:04 ` Matthias Fuchs
  2008-03-22 10:19   ` Stefan Roese
  2008-03-22 13:57   ` Wolfgang Denk
  1 sibling, 2 replies; 6+ messages in thread
From: Matthias Fuchs @ 2008-03-22 10:04 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

I followed this discussion. The DU440 board will also need this fix.
On the PMC440 board we reserved the top memory region for 
some PCI accessable shared memory. I will check how we can
handle skipping the top 256 bytes and provide a patch for both of our 440EPx 
boards soon.

I did not get into much depth with this issue, but your fix will make the 
logbuffer ram and pram unaligned to a page boundary. I am not sure if this 
is a good idea. Let's say you want to ioremap the pram under Linux you cannot 
let the mapped region end at log bufferbuffer start address because it just 
lost its alignment on a 4k page boundary.

Matthias

> The other remaining 440EPx board were intentionally not included
> since it is not clear to me, if they use the end of ram for some
> other purpose. This is unclear, since these boards have CONFIG_PRAM
> defined and even comments like this:
>
> PMC440.h:
> /* esd expects pram at end of physical memory.
>  * So no logbuffer at the moment.
>  */
>
> It is strongly recommendet to not use the last 256 bytes on those
> boards too. Patches from the board maintainers are welcome.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> ---
>  include/configs/korat.h   |    2 ++
>  include/configs/lwmon5.h  |    2 ++
>  include/configs/sequoia.h |    4 +++-
>  lib_ppc/board.c           |   17 +++++++++++++++++
>  4 files changed, 24 insertions(+), 1 deletions(-)
>
> diff --git a/include/configs/korat.h b/include/configs/korat.h
> index dcec9b0..c215c63 100644
> --- a/include/configs/korat.h
> +++ b/include/configs/korat.h
> @@ -144,6 +144,8 @@
>  #define SPD_EEPROM_ADDRESS	{0x50}
>  #define CONFIG_PROG_SDRAM_TLB
>  #define CFG_DRAM_TEST
> +#define CONFIG_MEM_TOP_HIDE	256	/* don't use last 256 bytes	*/
> +					/* 440EPx errata CHIP 11	*/
>
>  /*
>   * I2C
> diff --git a/include/configs/lwmon5.h b/include/configs/lwmon5.h
> index c3f10c7..f573730 100644
> --- a/include/configs/lwmon5.h
> +++ b/include/configs/lwmon5.h
> @@ -85,6 +85,8 @@
>  #define CFG_INIT_SP_OFFSET	CFG_GBL_DATA_OFFSET
>  #define CFG_POST_ALT_WORD_ADDR	(CFG_PERIPHERAL_BASE + GPT0_COMP6)
>  						/* unused GPT0 COMP reg	*/
> +#define CONFIG_MEM_TOP_HIDE	256	/* don't use last 256 bytes	*/
> +					/* 440EPx errata CHIP 11	*/
>
>  /*-----------------------------------------------------------------------
>   * Serial Port
> diff --git a/include/configs/sequoia.h b/include/configs/sequoia.h
> index dfa8779..0188234 100644
> --- a/include/configs/sequoia.h
> +++ b/include/configs/sequoia.h
> @@ -221,6 +221,8 @@
>  #if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
>  #define CONFIG_DDR_DATA_EYE		/* use DDR2 optimization	*/
>  #endif
> +#define CONFIG_MEM_TOP_HIDE	256	/* don't use last 256 bytes	*/
> +					/* 440EPx errata CHIP 11	*/
>
>  /*
>   * I2C
> @@ -275,7 +277,7 @@
>  		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\
>  		":${hostname}:${netdev}:off panic=1\0"			\
>  	"addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}\0"\
> -	"addmisc=setenv bootargs ${bootargs} mem=${mem}\0"		\
> +	"addmisc=setenv bootargs ${bootargs}\0"				\
>  	"flash_nfs=run nfsargs addip addtty addmisc;"			\
>  		"bootm ${kernel_addr}\0"				\
>  	"flash_self=run ramargs addip addtty addmisc;"			\
> diff --git a/lib_ppc/board.c b/lib_ppc/board.c
> index fbf1c5d..13b6f54 100644
> --- a/lib_ppc/board.c
> +++ b/lib_ppc/board.c
> @@ -117,6 +117,10 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define	TOTAL_MALLOC_LEN	CFG_MALLOC_LEN
>  #endif
>
> +#if !defined(CONFIG_MEM_TOP_HIDE)
> +#define CONFIG_MEM_TOP_HIDE	0
> +#endif
> +
>  extern ulong __init_end;
>  extern ulong _end;
>  ulong monitor_flash_len;
> @@ -425,6 +429,7 @@ void board_init_f (ulong bootflag)
>  	 * relocate the code and continue running from DRAM.
>  	 *
>  	 * Reserve memory at end of RAM for (top down in that order):
> +	 *  - area that won't get touched by U-Boot and Linux (optional)
>  	 *  - kernel log buffer
>  	 *  - protected RAM
>  	 *  - LCD framebuffer
> @@ -433,6 +438,18 @@ void board_init_f (ulong bootflag)
>  	 */
>  	len = (ulong)&_end - CFG_MONITOR_BASE;
>
> +	/*
> +	 * Subtract specified amount of memory to hide so that it won't
> +	 * get "touched" at all by U-Boot. By fixing up gd->ram_size
> +	 * the Linux kernel should now get passed the now "corrected"
> +	 * memory size and won't touch it either. This should work
> +	 * for arch/ppc and arch/powerpc. Only Linux board ports in
> +	 * arch/powerpc with bootwrapper support, that recalculate the
> +	 * memory size from the SDRAM controller setup will have to
> +	 * get fixed.
> +	 */
> +	gd->ram_size -= CONFIG_MEM_TOP_HIDE;
> +
>  	addr = CFG_SDRAM_BASE + get_effective_memsize();
>
>  #ifdef CONFIG_LOGBUFFER



-- 
-------------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs
Head of System Design

esd electronic system design gmbh
Vahrenwalder Str. 207 - 30165 Hannover - GERMANY
Phone: +49-511-37298-0 - Fax: +49-511-37298-68
Please visit our homepage http://www.esd.eu
Quality Products - Made in Germany
-------------------------------------------------------------------------
Gesch?ftsf?hrer: Klaus Detering, Dr. Werner Schulze
Amtsgericht Hannover HRB 51373 - VAT-ID DE 115672832
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot-Users] [PATCH] ppc: Add CONFIG_TOP_HIDE option to hide memory area that doesn't get "touched"
  2008-03-22 10:04 ` Matthias Fuchs
@ 2008-03-22 10:19   ` Stefan Roese
  2008-03-22 13:57   ` Wolfgang Denk
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Roese @ 2008-03-22 10:19 UTC (permalink / raw)
  To: u-boot

Hi Matthias,

On Saturday 22 March 2008, Matthias Fuchs wrote:
> I followed this discussion. The DU440 board will also need this fix.
> On the PMC440 board we reserved the top memory region for
> some PCI accessable shared memory. I will check how we can
> handle skipping the top 256 bytes and provide a patch for both of our
> 440EPx boards soon.

Good.

> I did not get into much depth with this issue, but your fix will make the
> logbuffer ram and pram unaligned to a page boundary. I am not sure if this
> is a good idea. Let's say you want to ioremap the pram under Linux you
> cannot let the mapped region end at log bufferbuffer start address because
> it just lost its alignment on a 4k page boundary.

Good point. If nobody objects I'll change the size of CFG_MEM_TOP_HIDE from 
256 to 4k in the next patch version.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot-Users] [PATCH] ppc: Add CONFIG_TOP_HIDE option to hide memory area that doesn't get "touched"
  2008-03-22 10:04 ` Matthias Fuchs
  2008-03-22 10:19   ` Stefan Roese
@ 2008-03-22 13:57   ` Wolfgang Denk
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2008-03-22 13:57 UTC (permalink / raw)
  To: u-boot

In message <200803221104.53441.matthias.fuchs@esd-electronics.com> you wrote:
> 
> I did not get into much depth with this issue, but your fix will make the
> logbuffer ram and pram unaligned to a page boundary. I am not sure if this
> is a good idea. Let's say you want to ioremap the pram under Linux you cannot
> let the mapped region end at log bufferbuffer start address because it just
> lost its alignment on a 4k page boundary.

This may indeed be a problem which must be fixed.

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
If at first you don't succeed, you are running about average.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-03-22 13:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-21 11:17 [U-Boot-Users] [PATCH] ppc: Add CONFIG_TOP_HIDE option to hide memory area that doesn't get "touched" Stefan Roese
2008-03-21 11:48 ` Dave Littell
2008-03-21 12:39   ` Wolfgang Denk
2008-03-22 10:04 ` Matthias Fuchs
2008-03-22 10:19   ` Stefan Roese
2008-03-22 13:57   ` Wolfgang Denk

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.