Commit 5b1aa762 authored by Martin J. Bligh's avatar Martin J. Bligh Committed by Linus Torvalds

[PATCH] Assign PKMAP_BASE dynamically

Badari hit a problem when configuring PAE off (ie CONFIG_4G) where the
pkmap area could end up overlapping the fixmap area.  For some reason,
PKMAP_BASE was defined statically, which seems rather pointless, and asking
for trouble.  Patch below definines it dynamically, under the fixmap area. 
The ordering of the VMALLOC_RESERVE space is:

FIXADDR_TOP
			fixed_addresses
FIXADDR_START
			temp fixed addresses
FIXADDR_BOOT_START
			Persistent kmap area
PKMAP_BASE
VMALLOC_END
			Vmalloc area
VMALLOC_START
high_memory
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a696762d
...@@ -109,7 +109,9 @@ extern void __set_fixmap (enum fixed_addresses idx, ...@@ -109,7 +109,9 @@ extern void __set_fixmap (enum fixed_addresses idx,
#define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP)
#define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) #define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
#define __FIXADDR_BOOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
#define FIXADDR_BOOT_START (FIXADDR_TOP - __FIXADDR_BOOT_SIZE)
#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
......
...@@ -40,16 +40,27 @@ extern void kmap_init(void); ...@@ -40,16 +40,27 @@ extern void kmap_init(void);
* easily, subsequent pte tables have to be allocated in one physical * easily, subsequent pte tables have to be allocated in one physical
* chunk of RAM. * chunk of RAM.
*/ */
#if NR_CPUS <= 32
#define PKMAP_BASE (0xff800000UL)
#else
#define PKMAP_BASE (0xff600000UL)
#endif
#ifdef CONFIG_X86_PAE #ifdef CONFIG_X86_PAE
#define LAST_PKMAP 512 #define LAST_PKMAP 512
#else #else
#define LAST_PKMAP 1024 #define LAST_PKMAP 1024
#endif #endif
/*
* Ordering is:
*
* FIXADDR_TOP
* fixed_addresses
* FIXADDR_START
* temp fixed addresses
* FIXADDR_BOOT_START
* Persistent kmap area
* PKMAP_BASE
* VMALLOC_END
* Vmalloc area
* VMALLOC_START
* high_memory
*/
#define PKMAP_BASE ( (FIXADDR_BOOT_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK )
#define LAST_PKMAP_MASK (LAST_PKMAP-1) #define LAST_PKMAP_MASK (LAST_PKMAP-1)
#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) #define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment