Skip to content

Commit

Permalink
Merge branch 'ja-nommu-for-rmk-v2' of git://linux-arm.org/linux-ja in…
Browse files Browse the repository at this point in the history
…to devel-stable

This includes the following series sent earlier to the list:
 - nommu-fixes
 - R7 Support
 - MPU support

I've left out the ARCH_MULTIPLATFORM/!MMU stuff that Arnd and I were
discussing today until we've reached a conclusion/that's had some more
review.

This is rebased (and re-tested) on your devel-stable branch because
otherwise there were going to be conflicts with Uwe's V7M work now that
you've merged that. I've included the fix for limiting MPU to CPU_V7.
  • Loading branch information
Russell King committed Jun 17, 2013
2 parents fdeb94b + de82977 commit 04e71d7
Show file tree
Hide file tree
Showing 20 changed files with 646 additions and 51 deletions.
4 changes: 2 additions & 2 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ config SMP
depends on CPU_V6K || CPU_V7
depends on GENERIC_CLOCKEVENTS
depends on HAVE_SMP
depends on MMU
depends on MMU || ARM_MPU
select USE_GENERIC_SMP_HELPERS
help
This enables support for systems with more than one CPU. If you have
Expand All @@ -1435,7 +1435,7 @@ config SMP

config SMP_ON_UP
bool "Allow booting SMP kernel on uniprocessor systems (EXPERIMENTAL)"
depends on SMP && !XIP_KERNEL
depends on SMP && !XIP_KERNEL && MMU
default y
help
SMP kernels contain instructions which fail on non-SMP processors.
Expand Down
12 changes: 12 additions & 0 deletions arch/arm/Kconfig-nommu
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,15 @@ config REMAP_VECTORS_TO_RAM
Otherwise, say 'y' here. In this case, the kernel will require
external support to redirect the hardware exception vectors to
the writable versions located at DRAM_BASE.

config ARM_MPU
bool 'Use the ARM v7 PMSA Compliant MPU'
depends on CPU_V7
default y
help
Some ARM systems without an MMU have instead a Memory Protection
Unit (MPU) that defines the type and permissions for regions of
memory.

If your CPU has an MPU then you should choose 'y' here unless you
know that you do not want to use the MPU.
10 changes: 9 additions & 1 deletion arch/arm/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,13 @@ choice
of the tiles using the RS1 memory map, including all new A-class
core tiles, FPGA-based SMMs and software models.

config DEBUG_VEXPRESS_UART0_CRX
bool "Use PL011 UART0 at 0xb0090000 (Cortex-R compliant tiles)"
depends on ARCH_VEXPRESS && !MMU
help
This option selects UART0 at 0xb0090000. This is appropriate for
Cortex-R series tiles and SMMs, such as Cortex-R5 and Cortex-R7

config DEBUG_VT8500_UART0
bool "Use UART0 on VIA/Wondermedia SoCs"
depends on ARCH_VT8500
Expand Down Expand Up @@ -645,7 +652,8 @@ config DEBUG_LL_INCLUDE
default "debug/tegra.S" if DEBUG_TEGRA_UART
default "debug/ux500.S" if DEBUG_UX500_UART
default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \
DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1
DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1 || \
DEBUG_VEXPRESS_UART0_CRX
default "debug/vt8500.S" if DEBUG_VT8500_UART0
default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
default "mach/debug-macro.S"
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/include/asm/cp15.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
#define CR_RR (1 << 14) /* Round Robin cache replacement */
#define CR_L4 (1 << 15) /* LDR pc can set T bit */
#define CR_DT (1 << 16)
#ifdef CONFIG_MMU
#define CR_HA (1 << 17) /* Hardware management of Access Flag */
#else
#define CR_BR (1 << 17) /* MPU Background region enable (PMSA) */
#endif
#define CR_IT (1 << 18)
#define CR_ST (1 << 19)
#define CR_FI (1 << 21) /* Fast interrupt (lower latency mode) */
Expand Down
1 change: 1 addition & 0 deletions arch/arm/include/asm/cputype.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define CPUID_CACHETYPE 1
#define CPUID_TCM 2
#define CPUID_TLBTYPE 3
#define CPUID_MPUIR 4
#define CPUID_MPIDR 5

#ifdef CONFIG_CPU_V7M
Expand Down
76 changes: 76 additions & 0 deletions arch/arm/include/asm/mpu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#ifndef __ARM_MPU_H
#define __ARM_MPU_H

#ifdef CONFIG_ARM_MPU

/* MPUIR layout */
#define MPUIR_nU 1
#define MPUIR_DREGION 8
#define MPUIR_IREGION 16
#define MPUIR_DREGION_SZMASK (0xFF << MPUIR_DREGION)
#define MPUIR_IREGION_SZMASK (0xFF << MPUIR_IREGION)

/* ID_MMFR0 data relevant to MPU */
#define MMFR0_PMSA (0xF << 4)
#define MMFR0_PMSAv7 (3 << 4)

/* MPU D/I Size Register fields */
#define MPU_RSR_SZ 1
#define MPU_RSR_EN 0

/* The D/I RSR value for an enabled region spanning the whole of memory */
#define MPU_RSR_ALL_MEM 63

/* Individual bits in the DR/IR ACR */
#define MPU_ACR_XN (1 << 12)
#define MPU_ACR_SHARED (1 << 2)

/* C, B and TEX[2:0] bits only have semantic meanings when grouped */
#define MPU_RGN_CACHEABLE 0xB
#define MPU_RGN_SHARED_CACHEABLE (MPU_RGN_CACHEABLE | MPU_ACR_SHARED)
#define MPU_RGN_STRONGLY_ORDERED 0

/* Main region should only be shared for SMP */
#ifdef CONFIG_SMP
#define MPU_RGN_NORMAL (MPU_RGN_CACHEABLE | MPU_ACR_SHARED)
#else
#define MPU_RGN_NORMAL MPU_RGN_CACHEABLE
#endif

/* Access permission bits of ACR (only define those that we use)*/
#define MPU_AP_PL1RW_PL0RW (0x3 << 8)
#define MPU_AP_PL1RW_PL0R0 (0x2 << 8)
#define MPU_AP_PL1RW_PL0NA (0x1 << 8)

/* For minimal static MPU region configurations */
#define MPU_PROBE_REGION 0
#define MPU_BG_REGION 1
#define MPU_RAM_REGION 2
#define MPU_VECTORS_REGION 3

/* Maximum number of regions Linux is interested in */
#define MPU_MAX_REGIONS 16

#define MPU_DATA_SIDE 0
#define MPU_INSTR_SIDE 1

#ifndef __ASSEMBLY__

struct mpu_rgn {
/* Assume same attributes for d/i-side */
u32 drbar;
u32 drsr;
u32 dracr;
};

struct mpu_rgn_info {
u32 mpuir;
struct mpu_rgn rgns[MPU_MAX_REGIONS];
};
extern struct mpu_rgn_info mpu_rgn_info;

#endif /* __ASSEMBLY__ */

#endif /* CONFIG_ARM_MPU */

#endif
4 changes: 4 additions & 0 deletions arch/arm/include/asm/proc-fns.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ extern void cpu_resume(void);
})
#endif

#else /*!CONFIG_MMU */

#define cpu_switch_mm(pgd,mm) { }

#endif

#endif /* __ASSEMBLY__ */
Expand Down
5 changes: 4 additions & 1 deletion arch/arm/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ asmlinkage void secondary_start_kernel(void);
* Initial data for bringing up a secondary CPU.
*/
struct secondary_data {
unsigned long pgdir;
union {
unsigned long mpu_rgn_szr;
unsigned long pgdir;
};
unsigned long swapper_pg_dir;
void *stack;
};
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/include/asm/smp_plat.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ static inline bool is_smp(void)
}

/* all SMP configurations have the extended CPUID registers */
#ifndef CONFIG_MMU
#define tlb_ops_need_broadcast() 0
#else
static inline int tlb_ops_need_broadcast(void)
{
if (!is_smp())
return 0;

return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 2;
}
#endif

#if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7
#define cache_ops_need_broadcast() 0
Expand Down
25 changes: 24 additions & 1 deletion arch/arm/include/asm/tlbflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,29 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,

#endif

#endif /* CONFIG_MMU */
#elif defined(CONFIG_SMP) /* !CONFIG_MMU */

#ifndef __ASSEMBLY__

#include <linux/mm_types.h>

static inline void local_flush_tlb_all(void) { }
static inline void local_flush_tlb_mm(struct mm_struct *mm) { }
static inline void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) { }
static inline void local_flush_tlb_kernel_page(unsigned long kaddr) { }
static inline void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) { }
static inline void local_flush_tlb_kernel_range(unsigned long start, unsigned long end) { }
static inline void local_flush_bp_all(void) { }

extern void flush_tlb_all(void);
extern void flush_tlb_mm(struct mm_struct *mm);
extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr);
extern void flush_tlb_kernel_page(unsigned long kaddr);
extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
extern void flush_bp_all(void);
#endif /* __ASSEMBLY__ */

#endif

#endif
10 changes: 10 additions & 0 deletions arch/arm/include/debug/vexpress.S
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#define DEBUG_LL_PHYS_BASE_RS1 0x1c000000
#define DEBUG_LL_UART_OFFSET_RS1 0x00090000

#define DEBUG_LL_UART_PHYS_CRX 0xb0090000

#define DEBUG_LL_VIRT_BASE 0xf8000000

#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT)
Expand Down Expand Up @@ -67,6 +69,14 @@

#include <asm/hardware/debug-pl01x.S>

#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_CRX)

.macro addruart,rp,tmp,tmp2
ldr \rp, =DEBUG_LL_UART_PHYS_CRX
.endm

#include <asm/hardware/debug-pl01x.S>

#else /* CONFIG_DEBUG_LL_UART_NONE */

.macro addruart, rp, rv, tmp
Expand Down
5 changes: 4 additions & 1 deletion arch/arm/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ obj-$(CONFIG_ARTHUR) += arthur.o
obj-$(CONFIG_ISA_DMA) += dma-isa.o
obj-$(CONFIG_PCI) += bios32.o isa.o
obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o
obj-$(CONFIG_SMP) += smp.o smp_tlb.o
obj-$(CONFIG_SMP) += smp.o
ifdef CONFIG_MMU
obj-$(CONFIG_SMP) += smp_tlb.o
endif
obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o
obj-$(CONFIG_ARM_ARCH_TIMER) += arch_timer.o
Expand Down
Loading

0 comments on commit 04e71d7

Please sign in to comment.