Commit f637a49e507c88354ab32b5d914e06acfb7ee00d
1 parent
b16e7766d6
Exists in
master
and in
20 other branches
powerpc: Minor cleanups of kernel virt address space definitions
Make FIXADDR_TOP a compile time constant and cleanup a couple of definitions relative to the layout of the kernel address space on ppc32. We also print out that layout at boot time for debugging purposes. This is a pre-requisite for properly fixing non-coherent DMA allocactions. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Showing 5 changed files with 37 additions and 12 deletions Side-by-side Diff
arch/powerpc/include/asm/fixmap.h
... | ... | @@ -14,8 +14,6 @@ |
14 | 14 | #ifndef _ASM_FIXMAP_H |
15 | 15 | #define _ASM_FIXMAP_H |
16 | 16 | |
17 | -extern unsigned long FIXADDR_TOP; | |
18 | - | |
19 | 17 | #ifndef __ASSEMBLY__ |
20 | 18 | #include <linux/kernel.h> |
21 | 19 | #include <asm/page.h> |
... | ... | @@ -23,6 +21,8 @@ |
23 | 21 | #include <linux/threads.h> |
24 | 22 | #include <asm/kmap_types.h> |
25 | 23 | #endif |
24 | + | |
25 | +#define FIXADDR_TOP ((unsigned long)(-PAGE_SIZE)) | |
26 | 26 | |
27 | 27 | /* |
28 | 28 | * Here we define all the compile-time 'special' virtual |
arch/powerpc/include/asm/pgtable-ppc32.h
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | |
11 | 11 | extern unsigned long va_to_phys(unsigned long address); |
12 | 12 | extern pte_t *va_to_pte(unsigned long address); |
13 | -extern unsigned long ioremap_bot, ioremap_base; | |
13 | +extern unsigned long ioremap_bot; | |
14 | 14 | |
15 | 15 | #ifdef CONFIG_44x |
16 | 16 | extern int icache_44x_need_flush; |
17 | 17 | |
... | ... | @@ -56,8 +56,26 @@ |
56 | 56 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) |
57 | 57 | |
58 | 58 | /* |
59 | + * This is the bottom of the PKMAP area with HIGHMEM or an arbitrary | |
60 | + * value (for now) on others, from where we can start layout kernel | |
61 | + * virtual space that goes below PKMAP and FIXMAP | |
62 | + */ | |
63 | +#ifdef CONFIG_HIGHMEM | |
64 | +#define KVIRT_TOP PKMAP_BASE | |
65 | +#else | |
66 | +#define KVIRT_TOP (0xfe000000UL) /* for now, could be FIXMAP_BASE ? */ | |
67 | +#endif | |
68 | + | |
69 | +/* | |
70 | + * ioremap_bot starts at that address. Early ioremaps move down from there, | |
71 | + * until mem_init() at which point this becomes the top of the vmalloc | |
72 | + * and ioremap space | |
73 | + */ | |
74 | +#define IOREMAP_TOP KVIRT_TOP | |
75 | + | |
76 | +/* | |
59 | 77 | * Just any arbitrary offset to the start of the vmalloc VM area: the |
60 | - * current 64MB value just means that there will be a 64MB "hole" after the | |
78 | + * current 16MB value just means that there will be a 64MB "hole" after the | |
61 | 79 | * physical memory until the kernel virtual memory starts. That means that |
62 | 80 | * any out-of-bounds memory accesses will hopefully be caught. |
63 | 81 | * The vmalloc() routines leaves a hole of 4kB between each vmalloced |
arch/powerpc/mm/init_32.c
... | ... | @@ -168,12 +168,8 @@ |
168 | 168 | ppc_md.progress("MMU:mapin", 0x301); |
169 | 169 | mapin_ram(); |
170 | 170 | |
171 | -#ifdef CONFIG_HIGHMEM | |
172 | - ioremap_base = PKMAP_BASE; | |
173 | -#else | |
174 | - ioremap_base = 0xfe000000UL; /* for now, could be 0xfffff000 */ | |
175 | -#endif /* CONFIG_HIGHMEM */ | |
176 | - ioremap_bot = ioremap_base; | |
171 | + /* Initialize early top-down ioremap allocator */ | |
172 | + ioremap_bot = IOREMAP_TOP; | |
177 | 173 | |
178 | 174 | /* Map in I/O resources */ |
179 | 175 | if (ppc_md.progress) |
arch/powerpc/mm/mem.c
... | ... | @@ -380,6 +380,19 @@ |
380 | 380 | bsssize >> 10, |
381 | 381 | initsize >> 10); |
382 | 382 | |
383 | +#ifdef CONFIG_PPC32 | |
384 | + pr_info("Kernel virtual memory layout:\n"); | |
385 | + pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP); | |
386 | +#ifdef CONFIG_HIGHMEM | |
387 | + pr_info(" * 0x%08lx..0x%08lx : highmem PTEs\n", | |
388 | + PKMAP_BASE, PKMAP_ADDR(LAST_PKMAP)); | |
389 | +#endif /* CONFIG_HIGHMEM */ | |
390 | + pr_info(" * 0x%08lx..0x%08lx : early ioremap\n", | |
391 | + ioremap_bot, IOREMAP_TOP); | |
392 | + pr_info(" * 0x%08lx..0x%08lx : vmalloc & ioremap\n", | |
393 | + VMALLOC_START, VMALLOC_END); | |
394 | +#endif /* CONFIG_PPC32 */ | |
395 | + | |
383 | 396 | mem_init_done = 1; |
384 | 397 | } |
385 | 398 |
arch/powerpc/mm/pgtable_32.c