Re: Bug: Discontigmem virt_to_page() [Alpha,ARM,Mips64?]

From: Russell King (rmk@arm.linux.org.uk)
Date: Mon May 06 2002 - 03:57:15 EST


On Mon, May 06, 2002 at 04:03:15AM +0200, Daniel Phillips wrote:
> On Monday 06 May 2002 02:55, Russell King wrote:
> > I see no problem with the above with the existing discontigmem stuff.
> > discontigmem does *not* require a linear relationship between kernel
> > virtual and physical memory. I've been running kernels for a while
> > on such systems.
>
> I just went through every variant of arm in the kernel tree, and I found that
> *all* of them implement a simple linear relationship between kernel virtual
> and physical memory, of the form:

Whoops. I didn't say _current_ kernels, did I? 8) (Don't write mails at
2am...)

We got rid of it later as we cleaned up the kernel mappings to use ioremap
instead of static device mappings. Hence 2.4/2.5 don't contain them any
more. However, from 2.3.35:

diff -urN linux-orig/include/asm-arm/arch-sa1100/memory.h linux/include/asm-arm/arch-sa1100/memory.h
...
 /*
  * The following gives a maximum memory size of 128MB (32MB in each bank).
- *
- * Does this still need to be optimised for one bank machines?
  */
-#define __virt_to_phys(x) (((x) & 0xe0ffffff) | ((x) & 0x06000000) << 2)
-#define __phys_to_virt(x) (((x) & 0xe7ffffff) | ((x) & 0x30000000) >> 2)
+#define __virt_to_phys(x) (((x) & 0xf9ffffff) | ((x) & 0x06000000) << 2)
+#define __phys_to_virt(x) (((x) & 0xe7ffffff) | ((x) & 0x18000000) >> 2)

This type of mapping went away in 2.4.0-test9, which is after this
particular platform got discontig mem support in 2.3.99-pre2-rmk1.

An example is right up to date, and was the subject of the first mail
is:

+#define __virt_to_phys(vpage) (((vpage) + ((vpage) & 0x18000000)) & \
+ ~0x40000000)
+
+#define __phys_to_virt(ppage) (((ppage) & ~0x30000000) | \
+ (((ppage) & 0x30000000) >> 1) | \
+ 0x40000000)

You won't find this one in my patches nor Linus' kernel tree though.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 07 2002 - 22:00:26 EST