diff options
author | Matt Fleming <matt@console-pimps.org> | 2009-12-24 15:38:45 -0500 |
---|---|---|
committer | Matt Fleming <matt@console-pimps.org> | 2010-01-01 19:51:45 -0500 |
commit | 3f5ab768164df9a44721660b96e0accb92eb2c24 (patch) | |
tree | ef4fb658cd28994fad4046844bc51a388bb6447b | |
parent | e591a517230a97e93f5edd19e7bef7ec8d22ac2b (diff) |
sh: Correct the PTRS_PER_PMD and PMD_SHIFT values
The previous expressions were wrong which made free_pmd_range() explode
when using anything other than 4KB pages (which is why 8KB and 64KB
pages were disabled with the 3-level page table layout).
The problem was that pmd_offset() was returning an index of non-zero
when it should have been returning 0. This non-zero offset was used to
calculate the address of the pmd table to free in free_pmd_range(),
which ended up trying to free an object that was not aligned on a page
boundary.
Now 3-level page tables should work with 4KB, 8KB and 64KB pages.
Signed-off-by: Matt Fleming <matt@console-pimps.org>
-rw-r--r-- | arch/sh/include/asm/pgtable_pmd.h | 4 | ||||
-rw-r--r-- | arch/sh/mm/Kconfig | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/arch/sh/include/asm/pgtable_pmd.h b/arch/sh/include/asm/pgtable_pmd.h index 78dc36e1c2dd..42a180e534a8 100644 --- a/arch/sh/include/asm/pgtable_pmd.h +++ b/arch/sh/include/asm/pgtable_pmd.h | |||
@@ -17,11 +17,11 @@ | |||
17 | #define USER_PTRS_PER_PGD 2 | 17 | #define USER_PTRS_PER_PGD 2 |
18 | 18 | ||
19 | /* PMD bits */ | 19 | /* PMD bits */ |
20 | #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT - 3)) | 20 | #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT - PTE_MAGNITUDE)) |
21 | #define PMD_SIZE (1UL << PMD_SHIFT) | 21 | #define PMD_SIZE (1UL << PMD_SHIFT) |
22 | #define PMD_MASK (~(PMD_SIZE-1)) | 22 | #define PMD_MASK (~(PMD_SIZE-1)) |
23 | 23 | ||
24 | #define PTRS_PER_PMD (PAGE_SIZE / sizeof(pmd_t)) | 24 | #define PTRS_PER_PMD ((1 << PGDIR_SHIFT) / PMD_SIZE) |
25 | 25 | ||
26 | #define pmd_ERROR(e) \ | 26 | #define pmd_ERROR(e) \ |
27 | printk("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e)) | 27 | printk("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e)) |
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig index b3f6c1a30b22..1b4364871899 100644 --- a/arch/sh/mm/Kconfig +++ b/arch/sh/mm/Kconfig | |||
@@ -220,7 +220,7 @@ config PAGE_SIZE_4KB | |||
220 | 220 | ||
221 | config PAGE_SIZE_8KB | 221 | config PAGE_SIZE_8KB |
222 | bool "8kB" | 222 | bool "8kB" |
223 | depends on !MMU || X2TLB && !PGTABLE_LEVELS_3 | 223 | depends on !MMU || X2TLB |
224 | help | 224 | help |
225 | This enables 8kB pages as supported by SH-X2 and later MMUs. | 225 | This enables 8kB pages as supported by SH-X2 and later MMUs. |
226 | 226 | ||
@@ -232,7 +232,7 @@ config PAGE_SIZE_16KB | |||
232 | 232 | ||
233 | config PAGE_SIZE_64KB | 233 | config PAGE_SIZE_64KB |
234 | bool "64kB" | 234 | bool "64kB" |
235 | depends on !MMU || CPU_SH4 && !PGTABLE_LEVELS_3 || CPU_SH5 | 235 | depends on !MMU || CPU_SH4 || CPU_SH5 |
236 | help | 236 | help |
237 | This enables support for 64kB pages, possible on all SH-4 | 237 | This enables support for 64kB pages, possible on all SH-4 |
238 | CPUs and later. | 238 | CPUs and later. |