Skip to contentSkip to conversation

405 OCM warning

PATCH New Robert Schwebel 3 participants 4 messages Jun 12, 2004 – Jul 2, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 405 OCM warning

Hi,

any chance to get this in? It took too much time to let anybody else do the same stuff again...

Robert

Signature · 36 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hornemannstra?e 12,  31137 Hildesheim, Germany
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
-------------- next part --------------
# 
# Author:	Robert Schwebel <[email protected]>
# 
# Description:	ChangeLog:
#		* Patch added by Robert Schwebel, 14 May 2004:
#		  add warning for OCM on PPC. 
#
# State:	2004-05-14: submit
#
#		2004-06-12: submitted

#
# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
#

--- u-boot-ptx-test/README~readme	2004-02-10 13:01:19.000000000 +0100
+++ u-boot-ptx-test/README	2004-02-10 13:04:46.000000000 +0100
@@ -2961,6 +2961,13 @@
 	-Chris Hallinan
 	DS4.COM, Inc.
 
+NOTE: for IBM 405GP the On Chip Memory (OCM) is mapped on virtual
+addresses! So take care that you configure it to be mapped
+(CFG_OCM_DATA_ADDR) in an area which is not used by your operating
+system's virtual addresses. For Linux it has to be located above the
+maximum task size (see CONFIG_TASK_SIZE in the Linux configuration).
+Otherwhise you will see strange effects with your user land stack. 
+
 It is essential to remember this, since it has some impact on the C
 code for the initialization procedures:
#1 lore raw

PATCH 1/1 405 OCM warning

Quoted 2 lines · In message <[email protected]> you wrote:

any chance to get this in? It took too much time to let anybody else do

the same stuff again...

Ummm... actually I think this is a FAQ which has been answered somewhere else (http://www.denx.de/twiki/bin/view/PPCEmbedded/Kernel#Section_10.2.
resp. http://lists.linuxppc.org/linuxppc-embedded/200005/msg00157.html
and Documentation/IO-mapping.txt).

Quoted 6 lines

NOTE: for IBM 405GP the On Chip Memory (OCM) is mapped on virtual addresses! So take care that you configure it to be mapped (CFG_OCM_DATA_ADDR) in an area which is not used by your operating system's virtual addresses. For Linux it has to be located above the maximum task size (see CONFIG_TASK_SIZE in the Linux configuration). Otherwhise you will see strange effects with your user land stack.

Isn't it the other way round? U-Boot does not use "virtual addresses" as it doesn't enable the MMU for virtual memory. It's the Linux kernel which uses a 1:1 physical to virtual mapping for certain address ranges.

Or am I missing something?

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
It is easier to change the specification to fit the program than vice
versa.
#2 lore raw

PATCH 1/1 405 OCM warning

Quoted 11 lines
Quoted 6 lines

NOTE: for IBM 405GP the On Chip Memory (OCM) is mapped on virtual addresses! So take care that you configure it to be mapped (CFG_OCM_DATA_ADDR) in an area which is not used by your operating system's virtual addresses. For Linux it has to be located above the maximum task size (see CONFIG_TASK_SIZE in the Linux configuration). Otherwhise you will see strange effects with your user land stack.

Isn't it the other way round? U-Boot does not use "virtual addresses" as it doesn't enable the MMU for virtual memory. It's the Linux kernel which uses a 1:1 physical to virtual mapping for certain address ranges.

But U-Boot initializes CFG_OCM_DATA_ADDR. When I started with the 405 port I had this macro pointing to 0x4000'0000 which is right in the middle of the Linux user space task virtual address range. I doubt that the kernel makes a 1:1 mapping for this memory area ;) I don't have the 405 manual here for reference, but if I remember correctly it was the virtual address you could configure here. Although this is not directly a problem which influences U-Boot it should IMHO be noted in the description of U-Boot's config variable that this is dangerous, and not only with Linux.

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hornemannstra?e 12,  31137 Hildesheim, Germany
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
#3 lore raw

PATCH 1/1 405 OCM warning

Quoted 3 lines · In message <[email protected]> you wrote:

But U-Boot initializes CFG_OCM_DATA_ADDR. When I started with the 405 port I had this macro pointing to 0x4000'0000 which is right in the

I guess you had a special reason to do this when all other boards use either 0xF0000000 (4 boards) or 0xF8000000 (17 boards) for this definition.

Quoted 4 lines

middle of the Linux user space task virtual address range. I doubt that the kernel makes a 1:1 mapping for this memory area ;) I don't have the 405 manual here for reference, but if I remember correctly it was the virtual address you could configure here. Although this is not directly

I think this is the relevant part:

"If address translation is enabled (MSR[IR,DR] = 1), one or more TLB entries for the OCM address space must exist to validate accesses. However, the virtual addresses are _not_ translated, and 32 bit effective addresses (virtual addresses) are presented to the OCM."

So basicly you have a 1:1 mapping here: virtual addresses are passed through to the OCM's address range compare registers 1:1.

Quoted 3 lines

a problem which influences U-Boot it should IMHO be noted in the description of U-Boot's config variable that this is dangerous, and not only with Linux.

It is not exactly dangerous, just inappropriate for certain uses.

Setting up the memory map of a system requires a lot of experience and detailed knowledge about both the hardware and the software architecture of the whole system. For example, mapping the IMMR of 8xx or 82xx processors to - say - 0x04700000 like some board vendors do in their documentation is perfectly OK for some purposes - and U-Boot was running perfectly fine on the MPC8260ADS which used to use such a setting for a long time. Also, some other RTOS work fine in such a configuration. Linux will crash.

So what is really needed is some kind of Linux porting documentation, i. e. a list of requirements for boot loaders - similar to the "ARM Linux Kernel Boot Requirements"
(http://www.arm.linux.org.uk/developer/booting.php),
probably extended by hints about memory mapping issues, etc.

To make the long storey short: CFG_OCM_DATA_ADDR is just one of many parameters which can be set wrong, resulting in a system which either does not work aty all or crashes in most funny ways. I agree that a hint about potential problems is appropriate, but then we should probably add a separate file in the doc/ directory for such critical settings.

My main concern and the reson why I rejected this patch again is the
wording: the text "the ... (OCM) is mapped on virtual addresses" is not correct, and misleading to the reader especially since U-Boot does not use any virtual memory.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Beware of the Turing Tar-pit in  which  everything  is  possible  but
nothing of interest is easy.