Skip to content

Commit

Permalink
Revert "ARM: 7954/1: mm: remove remaining domain support from ARMv6"
Browse files Browse the repository at this point in the history
This reverts commit 565fb26.
  • Loading branch information
airend committed Jan 16, 2017
1 parent af6a7e6 commit 0a77baf
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
6 changes: 6 additions & 0 deletions arch/arm/include/asm/futex.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

#ifdef __KERNEL__

#if defined(CONFIG_CPU_USE_DOMAINS) && defined(CONFIG_SMP)
/* ARM doesn't provide unprivileged exclusive memory accessors */
#include <asm-generic/futex.h>
#else

#include <linux/futex.h>
#include <linux/uaccess.h>
#include <asm/errno.h>
Expand Down Expand Up @@ -158,5 +163,6 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
return ret;
}

#endif /* !(CPU_USE_DOMAINS && SMP) */
#endif /* __KERNEL__ */
#endif /* _ASM_ARM_FUTEX_H */
1 change: 0 additions & 1 deletion arch/arm/include/asm/pgtable-2level.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
#define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2) /* 1100 */
#define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2) /* 1001 */
#define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */
#define L_PTE_MT_VECTORS (_AT(pteval_t, 0x0f) << 2) /* 1111 */
#define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)

#ifndef __ASSEMBLY__
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ config CPU_32v5
config CPU_32v6
bool
select TLS_REG_EMUL if !CPU_32v6K && !MMU
select CPU_USE_DOMAINS if CPU_V6 && MMU

config CPU_32v6K
bool
Expand Down Expand Up @@ -669,7 +670,7 @@ config ARM_THUMBEE

config SWP_EMULATE
bool "Emulate SWP/SWPB instructions"
depends on CPU_V7
depends on !CPU_USE_DOMAINS && CPU_V7
select HAVE_PROC_CPU if PROC_FS
default y if SMP
help
Expand Down
10 changes: 0 additions & 10 deletions arch/arm/mm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,6 @@ static void __init build_mem_type_table(void)
mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_S;
mem_types[MT_MEMORY_NONCACHED].prot_pte |= L_PTE_SHARED;
}
/*
* We don't use domains on ARMv6 (since this causes problems with
* v6/v7 kernels), so we must use a separate memory type for user
* r/o, kernel r/w to map the vectors page.
*/
#ifndef CONFIG_ARM_LPAE
if (cpu_arch == CPU_ARCH_ARMv6)
vecs_pgprot |= L_PTE_MT_VECTORS;
#endif

/*
* ARMv6 and above have extended page tables.
*/
Expand Down
17 changes: 11 additions & 6 deletions arch/arm/mm/proc-macros.S
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,13 @@
* 100x 1 0 1 r/o no acc
* 10x0 1 0 1 r/o no acc
* 1011 0 0 1 r/w no acc
* 110x 0 1 0 r/w r/o
* 11x0 0 1 0 r/w r/o
* 1111 0 1 1 r/w r/w
*
* If !CONFIG_CPU_USE_DOMAINS, the following permissions are changed:
* 110x 1 1 1 r/o r/o
* 11x0 1 1 1 r/o r/o
* 1111 0 1 1 r/w r/w
*/
.macro armv6_mt_table pfx
\pfx\()_mt_table:
Expand All @@ -128,7 +132,7 @@
.long PTE_EXT_TEX(2) @ L_PTE_MT_DEV_NONSHARED
.long 0x00 @ unused
.long 0x00 @ unused
.long PTE_CACHEABLE | PTE_BUFFERABLE | PTE_EXT_APX @ L_PTE_MT_VECTORS
.long 0x00 @ unused
.endm

.macro armv6_set_pte_ext pfx
Expand All @@ -149,15 +153,16 @@

tst r1, #L_PTE_USER
orrne r3, r3, #PTE_EXT_AP1
#ifdef CONFIG_CPU_USE_DOMAINS
@ allow kernel read/write access to read-only user pages
tstne r3, #PTE_EXT_APX

@ user read-only -> kernel read-only
bicne r3, r3, #PTE_EXT_AP0
bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0
#endif

tst r1, #L_PTE_XN
orrne r3, r3, #PTE_EXT_XN

eor r3, r3, r2
orr r3, r3, r2

tst r1, #L_PTE_YOUNG
tstne r1, #L_PTE_PRESENT
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/mm/proc-v7-2level.S
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ ENTRY(cpu_v7_set_pte_ext)

tst r1, #L_PTE_USER
orrne r3, r3, #PTE_EXT_AP1
#ifdef CONFIG_CPU_USE_DOMAINS
@ allow kernel read/write access to read-only user pages
tstne r3, #PTE_EXT_APX
bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0
#endif

tst r1, #L_PTE_XN
orrne r3, r3, #PTE_EXT_XN
Expand Down

0 comments on commit 0a77baf

Please sign in to comment.