Skip to content

Commit 6ae25a5

Browse files
author
Russell King
committed
Merge branch 'for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux into devel-stable
Conflicts: arch/arm/mm/ioremap.c
2 parents 3ee0fc5 + 497b7e9 commit 6ae25a5

32 files changed

Lines changed: 1199 additions & 322 deletions

‎arch/arm/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1971,7 +1971,7 @@ endchoice
19711971

19721972
config XIP_KERNEL
19731973
bool "Kernel Execute-In-Place from ROM"
1974-
depends on !ZBOOT_ROM
1974+
depends on !ZBOOT_ROM && !ARM_LPAE
19751975
help
19761976
Execute-In-Place allows the kernel to run from non-volatile storage
19771977
directly addressable by the CPU, such as NOR flash. This saves RAM

‎arch/arm/boot/compressed/head.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ __armv7_mmu_cache_on:
659659
mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer
660660
mcrne p15, 0, r1, c3, c0, 0 @ load domain access control
661661
#endif
662+
mcr p15, 0, r0, c7, c5, 4 @ ISB
662663
mcr p15, 0, r0, c1, c0, 0 @ load control register
663664
mrc p15, 0, r0, c1, c0, 0 @ and read it back
664665
mov r0, #0

‎arch/arm/include/asm/assembler.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,17 @@
186186
#define ALT_UP_B(label) b label
187187
#endif
188188

189+
/*
190+
* Instruction barrier
191+
*/
192+
.macro instr_sync
193+
#if __LINUX_ARM_ARCH__ >= 7
194+
isb
195+
#elif __LINUX_ARM_ARCH__ == 6
196+
mcr p15, 0, r0, c7, c5, 4
197+
#endif
198+
.endm
199+
189200
/*
190201
* SMP data memory barrier
191202
*/

‎arch/arm/include/asm/page.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
151151
#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
152152
extern void copy_page(void *to, const void *from);
153153

154+
#ifdef CONFIG_ARM_LPAE
155+
#include <asm/pgtable-3level-types.h>
156+
#else
154157
#include <asm/pgtable-2level-types.h>
158+
#endif
155159

156160
#endif /* CONFIG_MMU */
157161

‎arch/arm/include/asm/pgalloc.h‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,34 @@
2525
#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER))
2626
#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL))
2727

28+
#ifdef CONFIG_ARM_LPAE
29+
30+
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
31+
{
32+
return (pmd_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT);
33+
}
34+
35+
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
36+
{
37+
BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
38+
free_page((unsigned long)pmd);
39+
}
40+
41+
static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
42+
{
43+
set_pud(pud, __pud(__pa(pmd) | PMD_TYPE_TABLE));
44+
}
45+
46+
#else /* !CONFIG_ARM_LPAE */
47+
2848
/*
2949
* Since we have only two-level page tables, these are trivial
3050
*/
3151
#define pmd_alloc_one(mm,addr) ({ BUG(); ((pmd_t *)2); })
3252
#define pmd_free(mm, pmd) do { } while (0)
33-
#define pgd_populate(mm,pmd,pte) BUG()
53+
#define pud_populate(mm,pmd,pte) BUG()
54+
55+
#endif /* CONFIG_ARM_LPAE */
3456

3557
extern pgd_t *pgd_alloc(struct mm_struct *mm);
3658
extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
@@ -109,7 +131,9 @@ static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t pte,
109131
{
110132
pmdval_t pmdval = (pte + PTE_HWTABLE_OFF) | prot;
111133
pmdp[0] = __pmd(pmdval);
134+
#ifndef CONFIG_ARM_LPAE
112135
pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
136+
#endif
113137
flush_pmd_entry(pmdp);
114138
}
115139

‎arch/arm/include/asm/pgtable-2level.h‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,45 @@
140140
#define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */
141141
#define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)
142142

143+
#ifndef __ASSEMBLY__
144+
145+
/*
146+
* The "pud_xxx()" functions here are trivial when the pmd is folded into
147+
* the pud: the pud entry is never bad, always exists, and can't be set or
148+
* cleared.
149+
*/
150+
#define pud_none(pud) (0)
151+
#define pud_bad(pud) (0)
152+
#define pud_present(pud) (1)
153+
#define pud_clear(pudp) do { } while (0)
154+
#define set_pud(pud,pudp) do { } while (0)
155+
156+
static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
157+
{
158+
return (pmd_t *)pud;
159+
}
160+
161+
#define pmd_bad(pmd) (pmd_val(pmd) & 2)
162+
163+
#define copy_pmd(pmdpd,pmdps) \
164+
do { \
165+
pmdpd[0] = pmdps[0]; \
166+
pmdpd[1] = pmdps[1]; \
167+
flush_pmd_entry(pmdpd); \
168+
} while (0)
169+
170+
#define pmd_clear(pmdp) \
171+
do { \
172+
pmdp[0] = __pmd(0); \
173+
pmdp[1] = __pmd(0); \
174+
clean_pmd_entry(pmdp); \
175+
} while (0)
176+
177+
/* we don't need complex calculations here as the pmd is folded into the pgd */
178+
#define pmd_addr_end(addr,end) (end)
179+
180+
#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext)
181+
182+
#endif /* __ASSEMBLY__ */
183+
143184
#endif /* _ASM_PGTABLE_2LEVEL_H */
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* arch/arm/include/asm/pgtable-3level-hwdef.h
3+
*
4+
* Copyright (C) 2011 ARM Ltd.
5+
* Author: Catalin Marinas <catalin.marinas@arm.com>
6+
*
7+
* This program is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License version 2 as
9+
* published by the Free Software Foundation.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program; if not, write to the Free Software
18+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19+
*/
20+
#ifndef _ASM_PGTABLE_3LEVEL_HWDEF_H
21+
#define _ASM_PGTABLE_3LEVEL_HWDEF_H
22+
23+
/*
24+
* Hardware page table definitions.
25+
*
26+
* + Level 1/2 descriptor
27+
* - common
28+
*/
29+
#define PMD_TYPE_MASK (_AT(pmdval_t, 3) << 0)
30+
#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0)
31+
#define PMD_TYPE_TABLE (_AT(pmdval_t, 3) << 0)
32+
#define PMD_TYPE_SECT (_AT(pmdval_t, 1) << 0)
33+
#define PMD_BIT4 (_AT(pmdval_t, 0))
34+
#define PMD_DOMAIN(x) (_AT(pmdval_t, 0))
35+
36+
/*
37+
* - section
38+
*/
39+
#define PMD_SECT_BUFFERABLE (_AT(pmdval_t, 1) << 2)
40+
#define PMD_SECT_CACHEABLE (_AT(pmdval_t, 1) << 3)
41+
#define PMD_SECT_S (_AT(pmdval_t, 3) << 8)
42+
#define PMD_SECT_AF (_AT(pmdval_t, 1) << 10)
43+
#define PMD_SECT_nG (_AT(pmdval_t, 1) << 11)
44+
#define PMD_SECT_XN (_AT(pmdval_t, 1) << 54)
45+
#define PMD_SECT_AP_WRITE (_AT(pmdval_t, 0))
46+
#define PMD_SECT_AP_READ (_AT(pmdval_t, 0))
47+
#define PMD_SECT_TEX(x) (_AT(pmdval_t, 0))
48+
49+
/*
50+
* AttrIndx[2:0] encoding (mapping attributes defined in the MAIR* registers).
51+
*/
52+
#define PMD_SECT_UNCACHED (_AT(pmdval_t, 0) << 2) /* strongly ordered */
53+
#define PMD_SECT_BUFFERED (_AT(pmdval_t, 1) << 2) /* normal non-cacheable */
54+
#define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */
55+
#define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */
56+
#define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */
57+
58+
/*
59+
* + Level 3 descriptor (PTE)
60+
*/
61+
#define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0)
62+
#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0)
63+
#define PTE_TYPE_PAGE (_AT(pteval_t, 3) << 0)
64+
#define PTE_BUFFERABLE (_AT(pteval_t, 1) << 2) /* AttrIndx[0] */
65+
#define PTE_CACHEABLE (_AT(pteval_t, 1) << 3) /* AttrIndx[1] */
66+
#define PTE_EXT_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
67+
#define PTE_EXT_AF (_AT(pteval_t, 1) << 10) /* Access Flag */
68+
#define PTE_EXT_NG (_AT(pteval_t, 1) << 11) /* nG */
69+
#define PTE_EXT_XN (_AT(pteval_t, 1) << 54) /* XN */
70+
71+
/*
72+
* 40-bit physical address supported.
73+
*/
74+
#define PHYS_MASK_SHIFT (40)
75+
#define PHYS_MASK ((1ULL << PHYS_MASK_SHIFT) - 1)
76+
77+
#endif
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* arch/arm/include/asm/pgtable-3level-types.h
3+
*
4+
* Copyright (C) 2011 ARM Ltd.
5+
* Author: Catalin Marinas <catalin.marinas@arm.com>
6+
*
7+
* This program is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License version 2 as
9+
* published by the Free Software Foundation.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program; if not, write to the Free Software
18+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19+
*/
20+
#ifndef _ASM_PGTABLE_3LEVEL_TYPES_H
21+
#define _ASM_PGTABLE_3LEVEL_TYPES_H
22+
23+
#include <asm/types.h>
24+
25+
typedef u64 pteval_t;
26+
typedef u64 pmdval_t;
27+
typedef u64 pgdval_t;
28+
29+
#undef STRICT_MM_TYPECHECKS
30+
31+
#ifdef STRICT_MM_TYPECHECKS
32+
33+
/*
34+
* These are used to make use of C type-checking..
35+
*/
36+
typedef struct { pteval_t pte; } pte_t;
37+
typedef struct { pmdval_t pmd; } pmd_t;
38+
typedef struct { pgdval_t pgd; } pgd_t;
39+
typedef struct { pteval_t pgprot; } pgprot_t;
40+
41+
#define pte_val(x) ((x).pte)
42+
#define pmd_val(x) ((x).pmd)
43+
#define pgd_val(x) ((x).pgd)
44+
#define pgprot_val(x) ((x).pgprot)
45+
46+
#define __pte(x) ((pte_t) { (x) } )
47+
#define __pmd(x) ((pmd_t) { (x) } )
48+
#define __pgd(x) ((pgd_t) { (x) } )
49+
#define __pgprot(x) ((pgprot_t) { (x) } )
50+
51+
#else /* !STRICT_MM_TYPECHECKS */
52+
53+
typedef pteval_t pte_t;
54+
typedef pmdval_t pmd_t;
55+
typedef pgdval_t pgd_t;
56+
typedef pteval_t pgprot_t;
57+
58+
#define pte_val(x) (x)
59+
#define pmd_val(x) (x)
60+
#define pgd_val(x) (x)
61+
#define pgprot_val(x) (x)
62+
63+
#define __pte(x) (x)
64+
#define __pmd(x) (x)
65+
#define __pgd(x) (x)
66+
#define __pgprot(x) (x)
67+
68+
#endif /* STRICT_MM_TYPECHECKS */
69+
70+
#endif /* _ASM_PGTABLE_3LEVEL_TYPES_H */

0 commit comments

Comments
 (0)