Skip to content

Commit a05e54c

Browse files
aarch64Russell King
authored andcommitted
ARM: 8031/2: change fixmap mapping region to support 32 CPUs
In 32-bit ARM systems, the fixmap mapping region can support no more than 14 CPUs(total: 896k; one CPU: 64K). And we can configure NR_CPUS up to 32. So there is a mismatch. This patch moves fixmapping region downwards to region 0xffc00000- 0xffe00000. Then the fixmap mapping region can support up to 32 CPUs. Reviewed-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Liu Hua <sdu.liu@huawei.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 4221e2e commit a05e54c

File tree

5 files changed

+29
-21
lines changed

5 files changed

+29
-21
lines changed

Documentation/arm/memory.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fffe8000 fffeffff DTCM mapping area for platforms with
4141
fffe0000 fffe7fff ITCM mapping area for platforms with
4242
ITCM mounted inside the CPU.
4343

44-
fff00000 fffdffff Fixmap mapping region. Addresses provided
44+
fffc0000 ffdfffff Fixmap mapping region. Addresses provided
4545
by fix_to_virt() will be located here.
4646

4747
fee00000 feffffff Mapping of PCI I/O space. This is a static

arch/arm/include/asm/fixmap.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
#ifndef _ASM_FIXMAP_H
22
#define _ASM_FIXMAP_H
33

4-
/*
5-
* Nothing too fancy for now.
6-
*
7-
* On ARM we already have well known fixed virtual addresses imposed by
8-
* the architecture such as the vector page which is located at 0xffff0000,
9-
* therefore a second level page table is already allocated covering
10-
* 0xfff00000 upwards.
11-
*
12-
* The cache flushing code in proc-xscale.S uses the virtual area between
13-
* 0xfffe0000 and 0xfffeffff.
14-
*/
15-
16-
#define FIXADDR_START 0xfff00000UL
17-
#define FIXADDR_TOP 0xfffe0000UL
4+
#define FIXADDR_START 0xffc00000UL
5+
#define FIXADDR_TOP 0xffe00000UL
186
#define FIXADDR_SIZE (FIXADDR_TOP - FIXADDR_START)
197

208
#define FIX_KMAP_NR_PTES (FIXADDR_SIZE >> PAGE_SHIFT)

arch/arm/include/asm/highmem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
} while (0)
1919

2020
extern pte_t *pkmap_page_table;
21+
extern pte_t *fixmap_page_table;
2122

2223
extern void *kmap_high(struct page *page);
2324
extern void kunmap_high(struct page *page);

arch/arm/mm/highmem.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@
1818
#include <asm/tlbflush.h>
1919
#include "mm.h"
2020

21+
pte_t *fixmap_page_table;
22+
23+
static inline void set_fixmap_pte(int idx, pte_t pte)
24+
{
25+
unsigned long vaddr = __fix_to_virt(idx);
26+
set_pte_ext(fixmap_page_table + idx, pte, 0);
27+
local_flush_tlb_kernel_page(vaddr);
28+
}
29+
30+
static inline pte_t get_fixmap_pte(unsigned long vaddr)
31+
{
32+
unsigned long idx = __virt_to_fix(vaddr);
33+
return *(fixmap_page_table + idx);
34+
}
35+
2136
void *kmap(struct page *page)
2237
{
2338
might_sleep();
@@ -69,14 +84,14 @@ void *kmap_atomic(struct page *page)
6984
* With debugging enabled, kunmap_atomic forces that entry to 0.
7085
* Make sure it was indeed properly unmapped.
7186
*/
72-
BUG_ON(!pte_none(get_top_pte(vaddr)));
87+
BUG_ON(!pte_none(*(fixmap_page_table + idx)));
7388
#endif
7489
/*
7590
* When debugging is off, kunmap_atomic leaves the previous mapping
7691
* in place, so the contained TLB flush ensures the TLB is updated
7792
* with the new mapping.
7893
*/
79-
set_top_pte(vaddr, mk_pte(page, kmap_prot));
94+
set_fixmap_pte(idx, mk_pte(page, kmap_prot));
8095

8196
return (void *)vaddr;
8297
}
@@ -95,7 +110,7 @@ void __kunmap_atomic(void *kvaddr)
95110
__cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE);
96111
#ifdef CONFIG_DEBUG_HIGHMEM
97112
BUG_ON(vaddr != __fix_to_virt(idx));
98-
set_top_pte(vaddr, __pte(0));
113+
set_fixmap_pte(idx, __pte(0));
99114
#else
100115
(void) idx; /* to kill a warning */
101116
#endif
@@ -119,9 +134,9 @@ void *kmap_atomic_pfn(unsigned long pfn)
119134
idx = type + KM_TYPE_NR * smp_processor_id();
120135
vaddr = __fix_to_virt(idx);
121136
#ifdef CONFIG_DEBUG_HIGHMEM
122-
BUG_ON(!pte_none(get_top_pte(vaddr)));
137+
BUG_ON(!pte_none(*(fixmap_page_table + idx)));
123138
#endif
124-
set_top_pte(vaddr, pfn_pte(pfn, kmap_prot));
139+
set_fixmap_pte(idx, pfn_pte(pfn, kmap_prot));
125140

126141
return (void *)vaddr;
127142
}
@@ -133,5 +148,5 @@ struct page *kmap_atomic_to_page(const void *ptr)
133148
if (vaddr < FIXADDR_START)
134149
return virt_to_page(ptr);
135150

136-
return pte_page(get_top_pte(vaddr));
151+
return pte_page(get_fixmap_pte(vaddr));
137152
}

arch/arm/mm/mmu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <asm/mach/arch.h>
3636
#include <asm/mach/map.h>
3737
#include <asm/mach/pci.h>
38+
#include <asm/fixmap.h>
3839

3940
#include "mm.h"
4041
#include "tcm.h"
@@ -1359,6 +1360,9 @@ static void __init kmap_init(void)
13591360
#ifdef CONFIG_HIGHMEM
13601361
pkmap_page_table = early_pte_alloc(pmd_off_k(PKMAP_BASE),
13611362
PKMAP_BASE, _PAGE_KERNEL_TABLE);
1363+
1364+
fixmap_page_table = early_pte_alloc(pmd_off_k(FIXADDR_START),
1365+
FIXADDR_START, _PAGE_KERNEL_TABLE);
13621366
#endif
13631367
}
13641368

0 commit comments

Comments
 (0)