ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
If CFG_MEM_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 CFG_MEM_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.
---
Changes in this version v4:
- Add CFG_MEM_TOP_HIDE decription to README
Changes in this version v3:
- Changed value of CFG_MEM_TOP_HIDE from 256 to 4k so that memory end location is on a page boundary
- Rebased on current git version
Changes in this version v2:
- Changed name of define to CFG_MEM_TOP_HIDE
README | 21 +++++++++++++++++++++ include/configs/korat.h | 2 ++ include/configs/lwmon5.h | 2 ++ include/configs/sequoia.h | 4 +++- lib_ppc/board.c | 13 +++++++++++++ 5 files changed, 41 insertions(+), 1 deletions(-)
README +21 -0
@@ -1854,6 +1854,27 @@ Configuration Settings: Scratch address used by the alternate memory test You only need to set this if address zero isn't writeable +- CFG_MEM_TOP_HIDE (PPC only): + If CFG_MEM_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 option can be used as a workaround for the 440EPx/GRx + CHIP 11 errata where the last 256 bytes in SDRAM shouldn't + be touched. + + WARNING: Please make sure that this value is a multiple of + the Linux page size (normally 4k). If this is not the case, + then the end address of the Linux memory will be located at a + non page size aligned address and this could cause mayor + problems. + - CFG_TFTP_LOADADDR: Default load address for network file downloads
include/configs/korat.h +2 -0
@@ -144,6 +144,8 @@#define SPD_EEPROM_ADDRESS {0x50}#define CONFIG_PROG_SDRAM_TLB #define CFG_DRAM_TEST +#define CFG_MEM_TOP_HIDE (4 << 10)/* don't use last 4kbytes */ +/* 440EPx errata CHIP 11 */ /* * I2C
include/configs/lwmon5.h +2 -0
@@ -86,6 +86,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 CFG_MEM_TOP_HIDE (4 << 10)/* don't use last 4kbytes */ +/* 440EPx errata CHIP 11 */ /* Additional registers for watchdog timer post test */
include/configs/sequoia.h +3 -1
@@ -221,6 +221,8 @@#if !defined(CONFIG_NAND_U_BOOT ) && !defined(CONFIG_NAND_SPL )#define CONFIG_DDR_DATA_EYE /* use DDR2 optimization */ #endif +#define CFG_MEM_TOP_HIDE (4 << 10)/* don't use last 4kbytes */ +/* 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;" \
lib_ppc/board.c +13 -0
@@ -425,6 +425,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 +434,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"@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 -=CFG_MEM_TOP_HIDE ; +#ifndef CONFIG_MAX_MEM_MAPPED #define CONFIG_MAX_MEM_MAPPED (256 << 20)#endif
Signature · 1 line
1.5.4.4
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
Dear Stefan,
Quoted 2 lines · in message <[email protected]> you wrote:
It is strongly recommendet to not use the last 256 bytes on those
<nitpick> recommended </nitpick>
Quoted 15 lines
README +9
-0@@ -1854,6 +1854,27 @@ Configuration Settings: Scratch address used by the alternate memory test You only need to set this if address zero isn't writeable +- CFG_MEM_TOP_HIDE (PPC only): + If CFG_MEM_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
README Configuration Settings: · line 1875
Quoted 10 lines
README +10
-0+ will have to get fixed. + + This option can be used as a workaround for the 440EPx/GRx + CHIP 11 errata where the last 256 bytes in SDRAM shouldn't + be touched. + + WARNING: Please make sure that this value is a multiple of + the Linux page size (normally 4k). If this is not the case, + then the end address of the Linux memory will be located at a + non page size aligned address and this could cause mayor
<nitpick> major </nitpick>
Will you send a pull request for the ppc4xx repo, or should I apply this directly?
Best regards,
Wolfgang Denk
Signature · 5 lines
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 The human mind treats a new idea the way the body treats a strange protein - it rejects it. - P. Medawar
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
Hi Wolfgang,
On Wednesday 26 March 2008, Wolfgang Denk wrote:
<snip>
Quoted 6 lines
README Configuration Settings: · line 1875
Quoted 4 lines
README +4
-0+ WARNING: Please make sure that this value is a multiple of + the Linux page size (normally 4k). If this is not the case, + then the end address of the Linux memory will be located at a + non page size aligned address and this could cause mayor<nitpick> major </nitpick>
Changed in current version. Thanks.
Quoted 2 lines
Will you send a pull request for the ppc4xx repo, or should I apply this directly?
I was going to ask you this too. Since I was going to send a pull request today anyways, I'll integrate this patch too if you have no objections.
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
=====================================================================
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
In reply to Stefan RoeseREADME Configuration Settings: · line 1866
Quoted 12 lines · Stefan Roese
[...]
+-CFG_MEM_TOP_HIDE(PPC only):README +9
-0+ If CFG_MEM_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.
Hi Stefan,
I also have a nit to pick :-) . It's not clear to me whether the clause in the last sentence is meant to be restrictive or non-restrictive. If restrictive, I recommend removing the comma before the word "that". If non-restrictive, I recommend replacing the word "that" with the word "which".
Best regards,
Larry
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
Quoted 14 lines · I wrote:
README Configuration Settings: · line 1866
Quoted 12 lines · Stefan Roese
[...]
+-CFG_MEM_TOP_HIDE(PPC only):README +9
-0+ If CFG_MEM_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.
Quoted 7 lines
Hi Stefan,
I also have a nit to pick :-) . It's not clear to me whether the clause in the last sentence is meant to be restrictive or non-restrictive. If restrictive, I recommend removing the comma before the word "that". If non-restrictive, I recommend replacing the word "that" with the word "which".
Oops, I forgot to write that, for the non-restrictive clause, there should also be a comma after the word "setup".
Best regards,
Larry
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
In reply to Larry JohnsonQuoted 14 lines · Larry Johnson
README Configuration Settings: · line 1866
Quoted 11 lines
+-
CFG_MEM_TOP_HIDE(PPC only):README +9
-0+ If CFG_MEM_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.Hi Stefan,
Quoted 5 lines
I also have a nit to pick :-) . It's not clear to me whether the clause in the last sentence is meant to be restrictive or non-restrictive. If restrictive, I recommend removing the comma before the word "that". If non-restrictive, I recommend replacing the word "that" with the word "which".
Thanks. Its sometimes helpful if native English speakers helps out here. I have to admit that I don't really get the difference of both versions you mention above. In this sentense I refer to Linux board ports which need *additional* fixes in Linux. I'll send the changed patch in a few minutes with this sentence:
"
Only Linux board
ports in arch/powerpc with bootwrapper support, which recalculate the memory size from the SDRAM controller setup, will have to get fixed in Linux additionally.
"
I hope its clear now.
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
=====================================================================
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
Quoted 26 lines · Stefan Roese
Quoted 13 lines · Larry Johnson
README Configuration Settings: · line 1866
Quoted 11 lines
+-
CFG_MEM_TOP_HIDE(PPC only):README +9
-0+ If CFG_MEM_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.Hi Stefan,
Quoted 5 lines
I also have a nit to pick :-) . It's not clear to me whether the clause in the last sentence is meant to be restrictive or non-restrictive. If restrictive, I recommend removing the comma before the word "that". If non-restrictive, I recommend replacing the word "that" with the word "which".
Thanks. Its sometimes helpful if native English speakers helps out here. I have to admit that I don't really get the difference of both versions you mention above. In this sentense I refer to Linux board ports which need *additional* fixes in Linux. I'll send the changed patch in a few minutes with this sentence:
Quoted 8 lines
"
Only Linux board
ports inarch/powerpcwith bootwrapper support, which recalculate the memory size from the SDRAM controller setup, will have to get fixed in Linux additionally.
"I hope its clear now.
It's clear now, but unfortunately I don't know enough to tell whether it is also correct :-( . The statement as now written implies that the statement without the clause, i.e., "Only Linux board ports in arch/powerpc with bootwrapper support will have to get fixed in Linux additionally", is also true. If this is not correct (because boards that do not recalculate their memory size do not need to be fixed in Linux), then you would write: "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 in Linux additionally."
BTW, there is no general agreement on whether the word "that" in the preceding sentence is correct. While I prefer it, some believe the word "which" should be used instead. English is such a complicated language, even for native speakers, that I am always amazed at the quality of the postings from contributors who did not learn it as their first language.
Best regards,
Larry
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
Larry Johnson wrote:
[snip]
Quoted 8 lines
BTW, there is no general agreement on whether the word "that" in the preceding sentence is correct. While I prefer it, some believe the word "which" should be used instead. English is such a complicated language, even for native speakers, that I am always amazed at the quality of the postings from contributors who did not learn it as their first language.
Best regards,
Larry
Yeah, Wolfgang has corrected my English more than once. :-D
Best regards,
gvb
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
Quoted 2 lines · In message <[email protected]> you wrote:
Yeah, Wolfgang has corrected my English more than once. :-D
Really? That must have been by accident, then.
Best regards,
Wolfgang Denk
Signature · 5 lines
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 The one who says it cannot be done should never interrupt the one who is doing it.
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
In reply to Larry JohnsonQuoted 9 lines · Larry Johnson
It's clear now, but unfortunately I don't know enough to tell whether it is also correct :-( . The statement as now written implies that the statement without the clause, i.e., "Only Linux board ports in
arch/powerpcwith bootwrapper support will have to get fixed in Linux additionally", is also true. If this is not correct (because boards that do not recalculate their memory size do not need to be fixed in Linux), then you would write: "Only Linux board ports inarch/powerpcwith bootwrapper support that recalculate the memory size from the SDRAM controller setup will have to get fixed in Linux additionally."
Now I'm confused. :)
Here is the current version I now have in my "master" branch (with your last sentense):
- CFG_MEM_TOP_HIDE (PPC only):
If CFG_MEM_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 in Linux additionally.
This option can be used as a workaround for the 440EPx/GRx CHIP 11 errata where the last 256 bytes in SDRAM shouldn't be touched.
WARNING: Please make sure that this value is a multiple of the Linux page size (normally 4k). If this is not the case, then the end address of the Linux memory will be located at a non page size aligned address and this could cause major problems.
Please send a patch to change this description if necessary.
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
=====================================================================
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
Quoted 37 lines · Stefan Roese
Quoted 9 lines · Larry Johnson
It's clear now, but unfortunately I don't know enough to tell whether it is also correct :-( . The statement as now written implies that the statement without the clause, i.e., "Only Linux board ports in
arch/powerpcwith bootwrapper support will have to get fixed in Linux additionally", is also true. If this is not correct (because boards that do not recalculate their memory size do not need to be fixed in Linux), then you would write: "Only Linux board ports inarch/powerpcwith bootwrapper support that recalculate the memory size from the SDRAM controller setup will have to get fixed in Linux additionally."Now I'm confused. :)
Here is the current version I now have in my "master" branch (with your last sentense):
-
CFG_MEM_TOP_HIDE(PPC only):
IfCFG_MEM_TOP_HIDEis 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 upgd->ram_sizethe Linux kernel should gets passed the now "corrected" memory size and won't touch it either. This should work forarch/ppcandarch/powerpc. Only Linux board ports inarch/powerpcwith bootwrapper support that recalculate the memory size from the SDRAM controller setup will have to get fixed in Linux additionally.This option can be used as a workaround for the 440EPx/GRx CHIP 11 errata where the last 256 bytes in SDRAM shouldn't be touched.
WARNING: Please make sure that this value is a multiple of the Linux page size (normally 4k). If this is not the case, then the end address of the Linux memory will be located at a non page size aligned address and this could cause major problems.
Quoted 3 lines
Please send a patch to change this description if necessary.
Thanks.
I'm not explaining it well, you can look at "http://en.wikipedia.org/wiki/English_relative_clauses" for a better explanation. What you have above should be technically correct, at worse it would be redundant.
Best regards,
Larry
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
In reply to Stefan RoeseQuoted 11 lines · Stefan Roese
If
CFG_MEM_TOP_HIDEis 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 upgd->ram_sizethe Linux kernel should gets passed the now "corrected" memory size and won't touch it either. This should work forarch/ppcandarch/powerpc. Only Linux board
ports inarch/powerpcwith bootwrapper support, that recalculate the memory size from the SDRAM controller setup will have to get fixed.
Quoted 4 lines
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:
If you reduce the memory size this way does the 44x kernel have issues with the TLBs that are used to mapped pin kernel lowmem?
I know on 85xx this would be a bad thing and rather than changing gd-
Quoted 1 line
ram_size, i'd add a memreserve in the device tree that the kernel
got passed.
- k
PATCH v4 1/1 ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
Quoted 7 lines · Kumar Gala
Quoted 4 lines
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:If you reduce the memory size this way does the 44x kernel have issues with the TLBs that are used to mapped pin kernel lowmem?
Not that I am aware of. I tested arch/ppc and arch/powerpc kernel version without problems.
Quoted 3 lines
I know on 85xx this would be a bad thing and rather than changing gd->
ram_size, i'd add a memreserve in the device tree that the kernel got passed.
This way I have no chance to "fix" arch/ppc kernels too. I know, arch/ppc is dead. :) But we need to support it a little while longer.
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
=====================================================================