aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-28 14:50:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-28 14:50:53 -0500
commitd4f4cf77b37eaea58ef863a4cbc95dad3880b524 (patch)
treec1d6c963d55e7f9afaa4fc9a5c6d1438a43bb94d
parentf89db789de2157441d3b5e879a742437ed69cbbc (diff)
parent17a870bea3b86f464706b6ba2736210cb8602693 (diff)
Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM updates from Russell King: - nommu updates from Afzal Mohammed cleaning up the vectors support - allow DMA memory "mapping" for nommu Benjamin Gaignard - fixing a correctness issue with R_ARM_PREL31 relocations in the module linker - add strlen() prototype for the decompressor - support for DEBUG_VIRTUAL from Florian Fainelli - adjusting memory bounds after memory reservations have been registered - unipher cache handling updates from Masahiro Yamada - initrd and Thumb Kconfig cleanups * 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm: (23 commits) ARM: mm: round the initrd reservation to page boundaries ARM: mm: clean up initrd initialisation ARM: mm: move initrd init code out of arm_memblock_init() ARM: 8655/1: improve NOMMU definition of pgprot_*() ARM: 8654/1: decompressor: add strlen prototype ARM: 8652/1: cache-uniphier: clean up active way setup code ARM: 8651/1: cache-uniphier: include <linux/errno.h> instead of <linux/types.h> ARM: 8650/1: module: handle negative R_ARM_PREL31 addends correctly ARM: 8649/2: nommu: remove Hivecs configuration is asm ARM: 8648/2: nommu: display vectors base ARM: 8647/2: nommu: dynamic exception base address setting ARM: 8646/1: mmu: decouple VECTORS_BASE from Kconfig ARM: 8644/1: Reduce "CPU: shutdown" message to debug level ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol ARM: 8640/1: Add support for CONFIG_DEBUG_VIRTUAL ARM: 8639/1: Define KERNEL_START and KERNEL_END ARM: 8638/1: mtd: lart: Rename partition defines to be prefixed with PART_ ARM: 8637/1: Adjust memory boundaries after reservations ARM: 8636/1: Cleanup sanity_check_meminfo ARM: add CPU_THUMB_CAPABLE to indicate possible Thumb support ...
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/Kconfig-nommu3
-rw-r--r--arch/arm/boot/compressed/decompress.c1
-rw-r--r--arch/arm/common/mcpm_entry.c12
-rw-r--r--arch/arm/include/asm/hardware/cache-uniphier.h2
-rw-r--r--arch/arm/include/asm/memory.h29
-rw-r--r--arch/arm/include/asm/pgtable-nommu.h6
-rw-r--r--arch/arm/kernel/head-nommu.S5
-rw-r--r--arch/arm/kernel/module.c13
-rw-r--r--arch/arm/kernel/setup.c10
-rw-r--r--arch/arm/kernel/smp.c2
-rw-r--r--arch/arm/mach-alpine/platsmp.c2
-rw-r--r--arch/arm/mach-axxia/platsmp.c2
-rw-r--r--arch/arm/mach-bcm/bcm63xx_smp.c2
-rw-r--r--arch/arm/mach-bcm/platsmp-brcmstb.c2
-rw-r--r--arch/arm/mach-bcm/platsmp.c4
-rw-r--r--arch/arm/mach-berlin/platsmp.c5
-rw-r--r--arch/arm/mach-exynos/firmware.c4
-rw-r--r--arch/arm/mach-exynos/mcpm-exynos.c2
-rw-r--r--arch/arm/mach-exynos/platsmp.c4
-rw-r--r--arch/arm/mach-exynos/pm.c6
-rw-r--r--arch/arm/mach-exynos/suspend.c6
-rw-r--r--arch/arm/mach-hisi/platmcpm.c2
-rw-r--r--arch/arm/mach-hisi/platsmp.c6
-rw-r--r--arch/arm/mach-imx/platsmp.c2
-rw-r--r--arch/arm/mach-imx/pm-imx6.c2
-rw-r--r--arch/arm/mach-imx/src.c2
-rw-r--r--arch/arm/mach-mediatek/platsmp.c2
-rw-r--r--arch/arm/mach-mvebu/pm.c2
-rw-r--r--arch/arm/mach-mvebu/pmsu.c2
-rw-r--r--arch/arm/mach-mvebu/system-controller.c2
-rw-r--r--arch/arm/mach-omap2/control.c8
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c12
-rw-r--r--arch/arm/mach-omap2/omap-smp.c4
-rw-r--r--arch/arm/mach-prima2/platsmp.c2
-rw-r--r--arch/arm/mach-prima2/pm.c2
-rw-r--r--arch/arm/mach-pxa/palmz72.c2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c2
-rw-r--r--arch/arm/mach-pxa/pxa27x.c2
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c2
-rw-r--r--arch/arm/mach-realview/platsmp-dt.c2
-rw-r--r--arch/arm/mach-rockchip/platsmp.c4
-rw-r--r--arch/arm/mach-rockchip/pm.c2
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c2
-rw-r--r--arch/arm/mach-s3c24xx/pm-s3c2410.c2
-rw-r--r--arch/arm/mach-s3c24xx/pm-s3c2416.c2
-rw-r--r--arch/arm/mach-s3c64xx/pm.c2
-rw-r--r--arch/arm/mach-s5pv210/pm.c2
-rw-r--r--arch/arm/mach-sa1100/pm.c2
-rw-r--r--arch/arm/mach-shmobile/platsmp-apmu.c6
-rw-r--r--arch/arm/mach-shmobile/platsmp-scu.c4
-rw-r--r--arch/arm/mach-socfpga/platsmp.c4
-rw-r--r--arch/arm/mach-spear/platsmp.c2
-rw-r--r--arch/arm/mach-sti/platsmp.c2
-rw-r--r--arch/arm/mach-sunxi/platsmp.c4
-rw-r--r--arch/arm/mach-tango/platsmp.c2
-rw-r--r--arch/arm/mach-tango/pm.c2
-rw-r--r--arch/arm/mach-tegra/reset.c4
-rw-r--r--arch/arm/mach-ux500/platsmp.c2
-rw-r--r--arch/arm/mach-vexpress/dcscb.c2
-rw-r--r--arch/arm/mach-vexpress/platsmp.c2
-rw-r--r--arch/arm/mach-vexpress/tc2_pm.c4
-rw-r--r--arch/arm/mach-zx/platsmp.c4
-rw-r--r--arch/arm/mach-zynq/platsmp.c2
-rw-r--r--arch/arm/mm/Kconfig31
-rw-r--r--arch/arm/mm/Makefile1
-rw-r--r--arch/arm/mm/cache-uniphier.c23
-rw-r--r--arch/arm/mm/dma-mapping.c3
-rw-r--r--arch/arm/mm/dump.c5
-rw-r--r--arch/arm/mm/flush.c6
-rw-r--r--arch/arm/mm/init.c64
-rw-r--r--arch/arm/mm/mmu.c75
-rw-r--r--arch/arm/mm/nommu.c60
-rw-r--r--arch/arm/mm/physaddr.c57
-rw-r--r--drivers/mtd/devices/lart.c24
75 files changed, 382 insertions, 214 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fda6a46d27cf..0d4e71b42c77 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2,6 +2,7 @@ config ARM
2 bool 2 bool
3 default y 3 default y
4 select ARCH_CLOCKSOURCE_DATA 4 select ARCH_CLOCKSOURCE_DATA
5 select ARCH_HAS_DEBUG_VIRTUAL
5 select ARCH_HAS_DEVMEM_IS_ALLOWED 6 select ARCH_HAS_DEVMEM_IS_ALLOWED
6 select ARCH_HAS_ELF_RANDOMIZE 7 select ARCH_HAS_ELF_RANDOMIZE
7 select ARCH_HAS_SET_MEMORY 8 select ARCH_HAS_SET_MEMORY
diff --git a/arch/arm/Kconfig-nommu b/arch/arm/Kconfig-nommu
index aed66d5df7f1..b7576349528c 100644
--- a/arch/arm/Kconfig-nommu
+++ b/arch/arm/Kconfig-nommu
@@ -34,8 +34,7 @@ config PROCESSOR_ID
34 used instead of the auto-probing which utilizes the register. 34 used instead of the auto-probing which utilizes the register.
35 35
36config REMAP_VECTORS_TO_RAM 36config REMAP_VECTORS_TO_RAM
37 bool 'Install vectors to the beginning of RAM' if DRAM_BASE 37 bool 'Install vectors to the beginning of RAM'
38 depends on DRAM_BASE
39 help 38 help
40 The kernel needs to change the hardware exception vectors. 39 The kernel needs to change the hardware exception vectors.
41 In nommu mode, the hardware exception vectors are normally 40 In nommu mode, the hardware exception vectors are normally
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
index a0765e7ed6c7..ea7832702a8f 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -32,6 +32,7 @@ extern void error(char *);
32 32
33/* Not needed, but used in some headers pulled in by decompressors */ 33/* Not needed, but used in some headers pulled in by decompressors */
34extern char * strstr(const char * s1, const char *s2); 34extern char * strstr(const char * s1, const char *s2);
35extern size_t strlen(const char *s);
35 36
36#ifdef CONFIG_KERNEL_GZIP 37#ifdef CONFIG_KERNEL_GZIP
37#include "../../../../lib/decompress_inflate.c" 38#include "../../../../lib/decompress_inflate.c"
diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c
index a923524d1040..cf062472e07b 100644
--- a/arch/arm/common/mcpm_entry.c
+++ b/arch/arm/common/mcpm_entry.c
@@ -144,7 +144,7 @@ extern unsigned long mcpm_entry_vectors[MAX_NR_CLUSTERS][MAX_CPUS_PER_CLUSTER];
144 144
145void mcpm_set_entry_vector(unsigned cpu, unsigned cluster, void *ptr) 145void mcpm_set_entry_vector(unsigned cpu, unsigned cluster, void *ptr)
146{ 146{
147 unsigned long val = ptr ? virt_to_phys(ptr) : 0; 147 unsigned long val = ptr ? __pa_symbol(ptr) : 0;
148 mcpm_entry_vectors[cluster][cpu] = val; 148 mcpm_entry_vectors[cluster][cpu] = val;
149 sync_cache_w(&mcpm_entry_vectors[cluster][cpu]); 149 sync_cache_w(&mcpm_entry_vectors[cluster][cpu]);
150} 150}
@@ -299,8 +299,8 @@ void mcpm_cpu_power_down(void)
299 * the kernel as if the power_up method just had deasserted reset 299 * the kernel as if the power_up method just had deasserted reset
300 * on the CPU. 300 * on the CPU.
301 */ 301 */
302 phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset); 302 phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
303 phys_reset(virt_to_phys(mcpm_entry_point)); 303 phys_reset(__pa_symbol(mcpm_entry_point));
304 304
305 /* should never get here */ 305 /* should never get here */
306 BUG(); 306 BUG();
@@ -388,8 +388,8 @@ static int __init nocache_trampoline(unsigned long _arg)
388 __mcpm_outbound_leave_critical(cluster, CLUSTER_DOWN); 388 __mcpm_outbound_leave_critical(cluster, CLUSTER_DOWN);
389 __mcpm_cpu_down(cpu, cluster); 389 __mcpm_cpu_down(cpu, cluster);
390 390
391 phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset); 391 phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
392 phys_reset(virt_to_phys(mcpm_entry_point)); 392 phys_reset(__pa_symbol(mcpm_entry_point));
393 BUG(); 393 BUG();
394} 394}
395 395
@@ -449,7 +449,7 @@ int __init mcpm_sync_init(
449 sync_cache_w(&mcpm_sync); 449 sync_cache_w(&mcpm_sync);
450 450
451 if (power_up_setup) { 451 if (power_up_setup) {
452 mcpm_power_up_setup_phys = virt_to_phys(power_up_setup); 452 mcpm_power_up_setup_phys = __pa_symbol(power_up_setup);
453 sync_cache_w(&mcpm_power_up_setup_phys); 453 sync_cache_w(&mcpm_power_up_setup_phys);
454 } 454 }
455 455
diff --git a/arch/arm/include/asm/hardware/cache-uniphier.h b/arch/arm/include/asm/hardware/cache-uniphier.h
index eaa60da7dac3..0ef42ae75b6c 100644
--- a/arch/arm/include/asm/hardware/cache-uniphier.h
+++ b/arch/arm/include/asm/hardware/cache-uniphier.h
@@ -16,7 +16,7 @@
16#ifndef __CACHE_UNIPHIER_H 16#ifndef __CACHE_UNIPHIER_H
17#define __CACHE_UNIPHIER_H 17#define __CACHE_UNIPHIER_H
18 18
19#include <linux/types.h> 19#include <linux/errno.h>
20 20
21#ifdef CONFIG_CACHE_UNIPHIER 21#ifdef CONFIG_CACHE_UNIPHIER
22int uniphier_cache_init(void); 22int uniphier_cache_init(void);
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 76cbd9c674df..1f54e4e98c1e 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -83,8 +83,15 @@
83#define IOREMAP_MAX_ORDER 24 83#define IOREMAP_MAX_ORDER 24
84#endif 84#endif
85 85
86#define VECTORS_BASE UL(0xffff0000)
87
86#else /* CONFIG_MMU */ 88#else /* CONFIG_MMU */
87 89
90#ifndef __ASSEMBLY__
91extern unsigned long vectors_base;
92#define VECTORS_BASE vectors_base
93#endif
94
88/* 95/*
89 * The limitation of user task size can grow up to the end of free ram region. 96 * The limitation of user task size can grow up to the end of free ram region.
90 * It is difficult to define and perhaps will never meet the original meaning 97 * It is difficult to define and perhaps will never meet the original meaning
@@ -111,6 +118,13 @@
111 118
112#endif /* !CONFIG_MMU */ 119#endif /* !CONFIG_MMU */
113 120
121#ifdef CONFIG_XIP_KERNEL
122#define KERNEL_START _sdata
123#else
124#define KERNEL_START _stext
125#endif
126#define KERNEL_END _end
127
114/* 128/*
115 * We fix the TCM memories max 32 KiB ITCM resp DTCM at these 129 * We fix the TCM memories max 32 KiB ITCM resp DTCM at these
116 * locations 130 * locations
@@ -206,7 +220,7 @@ extern const void *__pv_table_begin, *__pv_table_end;
206 : "r" (x), "I" (__PV_BITS_31_24) \ 220 : "r" (x), "I" (__PV_BITS_31_24) \
207 : "cc") 221 : "cc")
208 222
209static inline phys_addr_t __virt_to_phys(unsigned long x) 223static inline phys_addr_t __virt_to_phys_nodebug(unsigned long x)
210{ 224{
211 phys_addr_t t; 225 phys_addr_t t;
212 226
@@ -238,7 +252,7 @@ static inline unsigned long __phys_to_virt(phys_addr_t x)
238#define PHYS_OFFSET PLAT_PHYS_OFFSET 252#define PHYS_OFFSET PLAT_PHYS_OFFSET
239#define PHYS_PFN_OFFSET ((unsigned long)(PHYS_OFFSET >> PAGE_SHIFT)) 253#define PHYS_PFN_OFFSET ((unsigned long)(PHYS_OFFSET >> PAGE_SHIFT))
240 254
241static inline phys_addr_t __virt_to_phys(unsigned long x) 255static inline phys_addr_t __virt_to_phys_nodebug(unsigned long x)
242{ 256{
243 return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET; 257 return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET;
244} 258}
@@ -254,6 +268,16 @@ static inline unsigned long __phys_to_virt(phys_addr_t x)
254 ((((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) + \ 268 ((((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) + \
255 PHYS_PFN_OFFSET) 269 PHYS_PFN_OFFSET)
256 270
271#define __pa_symbol_nodebug(x) __virt_to_phys_nodebug((x))
272
273#ifdef CONFIG_DEBUG_VIRTUAL
274extern phys_addr_t __virt_to_phys(unsigned long x);
275extern phys_addr_t __phys_addr_symbol(unsigned long x);
276#else
277#define __virt_to_phys(x) __virt_to_phys_nodebug(x)
278#define __phys_addr_symbol(x) __pa_symbol_nodebug(x)
279#endif
280
257/* 281/*
258 * These are *only* valid on the kernel direct mapped RAM memory. 282 * These are *only* valid on the kernel direct mapped RAM memory.
259 * Note: Drivers should NOT use these. They are the wrong 283 * Note: Drivers should NOT use these. They are the wrong
@@ -276,6 +300,7 @@ static inline void *phys_to_virt(phys_addr_t x)
276 * Drivers should NOT use these either. 300 * Drivers should NOT use these either.
277 */ 301 */
278#define __pa(x) __virt_to_phys((unsigned long)(x)) 302#define __pa(x) __virt_to_phys((unsigned long)(x))
303#define __pa_symbol(x) __phys_addr_symbol(RELOC_HIDE((unsigned long)(x), 0))
279#define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x))) 304#define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x)))
280#define pfn_to_kaddr(pfn) __va((phys_addr_t)(pfn) << PAGE_SHIFT) 305#define pfn_to_kaddr(pfn) __va((phys_addr_t)(pfn) << PAGE_SHIFT)
281 306
diff --git a/arch/arm/include/asm/pgtable-nommu.h b/arch/arm/include/asm/pgtable-nommu.h
index add094d09e3e..302240c19a5a 100644
--- a/arch/arm/include/asm/pgtable-nommu.h
+++ b/arch/arm/include/asm/pgtable-nommu.h
@@ -63,9 +63,9 @@ typedef pte_t *pte_addr_t;
63/* 63/*
64 * Mark the prot value as uncacheable and unbufferable. 64 * Mark the prot value as uncacheable and unbufferable.
65 */ 65 */
66#define pgprot_noncached(prot) __pgprot(0) 66#define pgprot_noncached(prot) (prot)
67#define pgprot_writecombine(prot) __pgprot(0) 67#define pgprot_writecombine(prot) (prot)
68#define pgprot_dmacoherent(prot) __pgprot(0) 68#define pgprot_dmacoherent(prot) (prot)
69 69
70 70
71/* 71/*
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 6b4eb27b8758..2e21e08de747 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -152,11 +152,6 @@ __after_proc_init:
152#ifdef CONFIG_CPU_ICACHE_DISABLE 152#ifdef CONFIG_CPU_ICACHE_DISABLE
153 bic r0, r0, #CR_I 153 bic r0, r0, #CR_I
154#endif 154#endif
155#ifdef CONFIG_CPU_HIGH_VECTOR
156 orr r0, r0, #CR_V
157#else
158 bic r0, r0, #CR_V
159#endif
160 mcr p15, 0, r0, c1, c0, 0 @ write control reg 155 mcr p15, 0, r0, c1, c0, 0 @ write control reg
161#elif defined (CONFIG_CPU_V7M) 156#elif defined (CONFIG_CPU_V7M)
162 /* For V7M systems we want to modify the CCR similarly to the SCTLR */ 157 /* For V7M systems we want to modify the CCR similarly to the SCTLR */
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 4f14b5ce6535..80254b47dc34 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -155,8 +155,17 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
155 break; 155 break;
156 156
157 case R_ARM_PREL31: 157 case R_ARM_PREL31:
158 offset = *(u32 *)loc + sym->st_value - loc; 158 offset = (*(s32 *)loc << 1) >> 1; /* sign extend */
159 *(u32 *)loc = offset & 0x7fffffff; 159 offset += sym->st_value - loc;
160 if (offset >= 0x40000000 || offset < -0x40000000) {
161 pr_err("%s: section %u reloc %u sym '%s': relocation %u out of range (%#lx -> %#x)\n",
162 module->name, relindex, i, symname,
163 ELF32_R_TYPE(rel->r_info), loc,
164 sym->st_value);
165 return -ENOEXEC;
166 }
167 *(u32 *)loc &= 0x80000000;
168 *(u32 *)loc |= offset & 0x7fffffff;
160 break; 169 break;
161 170
162 case R_ARM_MOVW_ABS_NC: 171 case R_ARM_MOVW_ABS_NC:
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 34e3f3c45634..f4e54503afa9 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -81,7 +81,7 @@ __setup("fpe=", fpe_setup);
81extern void init_default_cache_policy(unsigned long); 81extern void init_default_cache_policy(unsigned long);
82extern void paging_init(const struct machine_desc *desc); 82extern void paging_init(const struct machine_desc *desc);
83extern void early_paging_init(const struct machine_desc *); 83extern void early_paging_init(const struct machine_desc *);
84extern void sanity_check_meminfo(void); 84extern void adjust_lowmem_bounds(void);
85extern enum reboot_mode reboot_mode; 85extern enum reboot_mode reboot_mode;
86extern void setup_dma_zone(const struct machine_desc *desc); 86extern void setup_dma_zone(const struct machine_desc *desc);
87 87
@@ -1093,8 +1093,14 @@ void __init setup_arch(char **cmdline_p)
1093 setup_dma_zone(mdesc); 1093 setup_dma_zone(mdesc);
1094 xen_early_init(); 1094 xen_early_init();
1095 efi_init(); 1095 efi_init();
1096 sanity_check_meminfo(); 1096 /*
1097 * Make sure the calculation for lowmem/highmem is set appropriately
1098 * before reserving/allocating any mmeory
1099 */
1100 adjust_lowmem_bounds();
1097 arm_memblock_init(mdesc); 1101 arm_memblock_init(mdesc);
1102 /* Memory may have been removed so recalculate the bounds. */
1103 adjust_lowmem_bounds();
1098 1104
1099 early_ioremap_reset(); 1105 early_ioremap_reset();
1100 1106
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index c6514ce0fcbc..5a07c5a4b894 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -251,7 +251,7 @@ void __cpu_die(unsigned int cpu)
251 pr_err("CPU%u: cpu didn't die\n", cpu); 251 pr_err("CPU%u: cpu didn't die\n", cpu);
252 return; 252 return;
253 } 253 }
254 pr_notice("CPU%u: shutdown\n", cpu); 254 pr_debug("CPU%u: shutdown\n", cpu);
255 255
256 /* 256 /*
257 * platform_cpu_kill() is generally expected to do the powering off 257 * platform_cpu_kill() is generally expected to do the powering off
diff --git a/arch/arm/mach-alpine/platsmp.c b/arch/arm/mach-alpine/platsmp.c
index dd77ea25e7ca..6dc6d491f88a 100644
--- a/arch/arm/mach-alpine/platsmp.c
+++ b/arch/arm/mach-alpine/platsmp.c
@@ -27,7 +27,7 @@ static int alpine_boot_secondary(unsigned int cpu, struct task_struct *idle)
27{ 27{
28 phys_addr_t addr; 28 phys_addr_t addr;
29 29
30 addr = virt_to_phys(secondary_startup); 30 addr = __pa_symbol(secondary_startup);
31 31
32 if (addr > (phys_addr_t)(uint32_t)(-1)) { 32 if (addr > (phys_addr_t)(uint32_t)(-1)) {
33 pr_err("FAIL: resume address over 32bit (%pa)", &addr); 33 pr_err("FAIL: resume address over 32bit (%pa)", &addr);
diff --git a/arch/arm/mach-axxia/platsmp.c b/arch/arm/mach-axxia/platsmp.c
index ffbd71d45008..502e3df69f69 100644
--- a/arch/arm/mach-axxia/platsmp.c
+++ b/arch/arm/mach-axxia/platsmp.c
@@ -25,7 +25,7 @@
25static void write_release_addr(u32 release_phys) 25static void write_release_addr(u32 release_phys)
26{ 26{
27 u32 *virt = (u32 *) phys_to_virt(release_phys); 27 u32 *virt = (u32 *) phys_to_virt(release_phys);
28 writel_relaxed(virt_to_phys(secondary_startup), virt); 28 writel_relaxed(__pa_symbol(secondary_startup), virt);
29 /* Make sure this store is visible to other CPUs */ 29 /* Make sure this store is visible to other CPUs */
30 smp_wmb(); 30 smp_wmb();
31 __cpuc_flush_dcache_area(virt, sizeof(u32)); 31 __cpuc_flush_dcache_area(virt, sizeof(u32));
diff --git a/arch/arm/mach-bcm/bcm63xx_smp.c b/arch/arm/mach-bcm/bcm63xx_smp.c
index 9b6727ed68cd..f5fb10b4376f 100644
--- a/arch/arm/mach-bcm/bcm63xx_smp.c
+++ b/arch/arm/mach-bcm/bcm63xx_smp.c
@@ -135,7 +135,7 @@ static int bcm63138_smp_boot_secondary(unsigned int cpu,
135 } 135 }
136 136
137 /* Write the secondary init routine to the BootLUT reset vector */ 137 /* Write the secondary init routine to the BootLUT reset vector */
138 val = virt_to_phys(secondary_startup); 138 val = __pa_symbol(secondary_startup);
139 writel_relaxed(val, bootlut_base + BOOTLUT_RESET_VECT); 139 writel_relaxed(val, bootlut_base + BOOTLUT_RESET_VECT);
140 140
141 /* Power up the core, will jump straight to its reset vector when we 141 /* Power up the core, will jump straight to its reset vector when we
diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c
index 40dc8448445e..12379960e982 100644
--- a/arch/arm/mach-bcm/platsmp-brcmstb.c
+++ b/arch/arm/mach-bcm/platsmp-brcmstb.c
@@ -151,7 +151,7 @@ static void brcmstb_cpu_boot(u32 cpu)
151 * Set the reset vector to point to the secondary_startup 151 * Set the reset vector to point to the secondary_startup
152 * routine 152 * routine
153 */ 153 */
154 cpu_set_boot_addr(cpu, virt_to_phys(secondary_startup)); 154 cpu_set_boot_addr(cpu, __pa_symbol(secondary_startup));
155 155
156 /* Unhalt the cpu */ 156 /* Unhalt the cpu */
157 cpu_rst_cfg_set(cpu, 0); 157 cpu_rst_cfg_set(cpu, 0);
diff --git a/arch/arm/mach-bcm/platsmp.c b/arch/arm/mach-bcm/platsmp.c
index 3ac3a9bc663c..582886d0d02f 100644
--- a/arch/arm/mach-bcm/platsmp.c
+++ b/arch/arm/mach-bcm/platsmp.c
@@ -116,7 +116,7 @@ static int nsp_write_lut(unsigned int cpu)
116 return -ENOMEM; 116 return -ENOMEM;
117 } 117 }
118 118
119 secondary_startup_phy = virt_to_phys(secondary_startup); 119 secondary_startup_phy = __pa_symbol(secondary_startup);
120 BUG_ON(secondary_startup_phy > (phys_addr_t)U32_MAX); 120 BUG_ON(secondary_startup_phy > (phys_addr_t)U32_MAX);
121 121
122 writel_relaxed(secondary_startup_phy, sku_rom_lut); 122 writel_relaxed(secondary_startup_phy, sku_rom_lut);
@@ -189,7 +189,7 @@ static int kona_boot_secondary(unsigned int cpu, struct task_struct *idle)
189 * Secondary cores will start in secondary_startup(), 189 * Secondary cores will start in secondary_startup(),
190 * defined in "arch/arm/kernel/head.S" 190 * defined in "arch/arm/kernel/head.S"
191 */ 191 */
192 boot_func = virt_to_phys(secondary_startup); 192 boot_func = __pa_symbol(secondary_startup);
193 BUG_ON(boot_func & BOOT_ADDR_CPUID_MASK); 193 BUG_ON(boot_func & BOOT_ADDR_CPUID_MASK);
194 BUG_ON(boot_func > (phys_addr_t)U32_MAX); 194 BUG_ON(boot_func > (phys_addr_t)U32_MAX);
195 195
diff --git a/arch/arm/mach-berlin/platsmp.c b/arch/arm/mach-berlin/platsmp.c
index 93f90688db18..7586b7aec272 100644
--- a/arch/arm/mach-berlin/platsmp.c
+++ b/arch/arm/mach-berlin/platsmp.c
@@ -15,6 +15,7 @@
15 15
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/cp15.h> 17#include <asm/cp15.h>
18#include <asm/memory.h>
18#include <asm/smp_plat.h> 19#include <asm/smp_plat.h>
19#include <asm/smp_scu.h> 20#include <asm/smp_scu.h>
20 21
@@ -75,7 +76,7 @@ static void __init berlin_smp_prepare_cpus(unsigned int max_cpus)
75 if (!cpu_ctrl) 76 if (!cpu_ctrl)
76 goto unmap_scu; 77 goto unmap_scu;
77 78
78 vectors_base = ioremap(CONFIG_VECTORS_BASE, SZ_32K); 79 vectors_base = ioremap(VECTORS_BASE, SZ_32K);
79 if (!vectors_base) 80 if (!vectors_base)
80 goto unmap_scu; 81 goto unmap_scu;
81 82
@@ -92,7 +93,7 @@ static void __init berlin_smp_prepare_cpus(unsigned int max_cpus)
92 * Write the secondary startup address into the SW reset address 93 * Write the secondary startup address into the SW reset address
93 * vector. This is used by boot_inst. 94 * vector. This is used by boot_inst.
94 */ 95 */
95 writel(virt_to_phys(secondary_startup), vectors_base + SW_RESET_ADDR); 96 writel(__pa_symbol(secondary_startup), vectors_base + SW_RESET_ADDR);
96 97
97 iounmap(vectors_base); 98 iounmap(vectors_base);
98unmap_scu: 99unmap_scu:
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index fd6da5419b51..e81a78b125d9 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -41,7 +41,7 @@ static int exynos_do_idle(unsigned long mode)
41 case FW_DO_IDLE_AFTR: 41 case FW_DO_IDLE_AFTR:
42 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) 42 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
43 exynos_save_cp15(); 43 exynos_save_cp15();
44 writel_relaxed(virt_to_phys(exynos_cpu_resume_ns), 44 writel_relaxed(__pa_symbol(exynos_cpu_resume_ns),
45 sysram_ns_base_addr + 0x24); 45 sysram_ns_base_addr + 0x24);
46 writel_relaxed(EXYNOS_AFTR_MAGIC, sysram_ns_base_addr + 0x20); 46 writel_relaxed(EXYNOS_AFTR_MAGIC, sysram_ns_base_addr + 0x20);
47 if (soc_is_exynos3250()) { 47 if (soc_is_exynos3250()) {
@@ -135,7 +135,7 @@ static int exynos_suspend(void)
135 exynos_save_cp15(); 135 exynos_save_cp15();
136 136
137 writel(EXYNOS_SLEEP_MAGIC, sysram_ns_base_addr + EXYNOS_BOOT_FLAG); 137 writel(EXYNOS_SLEEP_MAGIC, sysram_ns_base_addr + EXYNOS_BOOT_FLAG);
138 writel(virt_to_phys(exynos_cpu_resume_ns), 138 writel(__pa_symbol(exynos_cpu_resume_ns),
139 sysram_ns_base_addr + EXYNOS_BOOT_ADDR); 139 sysram_ns_base_addr + EXYNOS_BOOT_ADDR);
140 140
141 return cpu_suspend(0, exynos_cpu_suspend); 141 return cpu_suspend(0, exynos_cpu_suspend);
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index 038fd8c993d0..b42622562ea7 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -221,7 +221,7 @@ static void exynos_mcpm_setup_entry_point(void)
221 */ 221 */
222 __raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */ 222 __raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */
223 __raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */ 223 __raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */
224 __raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8); 224 __raw_writel(__pa_symbol(mcpm_entry_point), ns_sram_base_addr + 8);
225} 225}
226 226
227static struct syscore_ops exynos_mcpm_syscore_ops = { 227static struct syscore_ops exynos_mcpm_syscore_ops = {
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index a5d68411a037..5a03bffe7226 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -353,7 +353,7 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle)
353 353
354 smp_rmb(); 354 smp_rmb();
355 355
356 boot_addr = virt_to_phys(exynos4_secondary_startup); 356 boot_addr = __pa_symbol(exynos4_secondary_startup);
357 357
358 ret = exynos_set_boot_addr(core_id, boot_addr); 358 ret = exynos_set_boot_addr(core_id, boot_addr);
359 if (ret) 359 if (ret)
@@ -413,7 +413,7 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
413 413
414 mpidr = cpu_logical_map(i); 414 mpidr = cpu_logical_map(i);
415 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); 415 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
416 boot_addr = virt_to_phys(exynos4_secondary_startup); 416 boot_addr = __pa_symbol(exynos4_secondary_startup);
417 417
418 ret = exynos_set_boot_addr(core_id, boot_addr); 418 ret = exynos_set_boot_addr(core_id, boot_addr);
419 if (ret) 419 if (ret)
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 487295f4a56b..1a7e5b5d08d8 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -132,7 +132,7 @@ static void exynos_set_wakeupmask(long mask)
132 132
133static void exynos_cpu_set_boot_vector(long flags) 133static void exynos_cpu_set_boot_vector(long flags)
134{ 134{
135 writel_relaxed(virt_to_phys(exynos_cpu_resume), 135 writel_relaxed(__pa_symbol(exynos_cpu_resume),
136 exynos_boot_vector_addr()); 136 exynos_boot_vector_addr());
137 writel_relaxed(flags, exynos_boot_vector_flag()); 137 writel_relaxed(flags, exynos_boot_vector_flag());
138} 138}
@@ -238,7 +238,7 @@ static int exynos_cpu0_enter_aftr(void)
238 238
239abort: 239abort:
240 if (cpu_online(1)) { 240 if (cpu_online(1)) {
241 unsigned long boot_addr = virt_to_phys(exynos_cpu_resume); 241 unsigned long boot_addr = __pa_symbol(exynos_cpu_resume);
242 242
243 /* 243 /*
244 * Set the boot vector to something non-zero 244 * Set the boot vector to something non-zero
@@ -330,7 +330,7 @@ cpu1_aborted:
330 330
331static void exynos_pre_enter_aftr(void) 331static void exynos_pre_enter_aftr(void)
332{ 332{
333 unsigned long boot_addr = virt_to_phys(exynos_cpu_resume); 333 unsigned long boot_addr = __pa_symbol(exynos_cpu_resume);
334 334
335 (void)exynos_set_boot_addr(1, boot_addr); 335 (void)exynos_set_boot_addr(1, boot_addr);
336} 336}
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
index adf4e8f182bd..748cfb8d5212 100644
--- a/arch/arm/mach-exynos/suspend.c
+++ b/arch/arm/mach-exynos/suspend.c
@@ -301,7 +301,7 @@ static void exynos_pm_prepare(void)
301 exynos_pm_enter_sleep_mode(); 301 exynos_pm_enter_sleep_mode();
302 302
303 /* ensure at least INFORM0 has the resume address */ 303 /* ensure at least INFORM0 has the resume address */
304 pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0); 304 pmu_raw_writel(__pa_symbol(exynos_cpu_resume), S5P_INFORM0);
305} 305}
306 306
307static void exynos3250_pm_prepare(void) 307static void exynos3250_pm_prepare(void)
@@ -318,7 +318,7 @@ static void exynos3250_pm_prepare(void)
318 exynos_pm_enter_sleep_mode(); 318 exynos_pm_enter_sleep_mode();
319 319
320 /* ensure at least INFORM0 has the resume address */ 320 /* ensure at least INFORM0 has the resume address */
321 pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0); 321 pmu_raw_writel(__pa_symbol(exynos_cpu_resume), S5P_INFORM0);
322} 322}
323 323
324static void exynos5420_pm_prepare(void) 324static void exynos5420_pm_prepare(void)
@@ -343,7 +343,7 @@ static void exynos5420_pm_prepare(void)
343 343
344 /* ensure at least INFORM0 has the resume address */ 344 /* ensure at least INFORM0 has the resume address */
345 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) 345 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM))
346 pmu_raw_writel(virt_to_phys(mcpm_entry_point), S5P_INFORM0); 346 pmu_raw_writel(__pa_symbol(mcpm_entry_point), S5P_INFORM0);
347 347
348 tmp = pmu_raw_readl(EXYNOS_L2_OPTION(0)); 348 tmp = pmu_raw_readl(EXYNOS_L2_OPTION(0));
349 tmp &= ~EXYNOS_L2_USE_RETENTION; 349 tmp &= ~EXYNOS_L2_USE_RETENTION;
diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c
index 4b653a8cb75c..a6c117622d67 100644
--- a/arch/arm/mach-hisi/platmcpm.c
+++ b/arch/arm/mach-hisi/platmcpm.c
@@ -327,7 +327,7 @@ static int __init hip04_smp_init(void)
327 */ 327 */
328 writel_relaxed(hip04_boot_method[0], relocation); 328 writel_relaxed(hip04_boot_method[0], relocation);
329 writel_relaxed(0xa5a5a5a5, relocation + 4); /* magic number */ 329 writel_relaxed(0xa5a5a5a5, relocation + 4); /* magic number */
330 writel_relaxed(virt_to_phys(secondary_startup), relocation + 8); 330 writel_relaxed(__pa_symbol(secondary_startup), relocation + 8);
331 writel_relaxed(0, relocation + 12); 331 writel_relaxed(0, relocation + 12);
332 iounmap(relocation); 332 iounmap(relocation);
333 333
diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
index e1d67648d5d0..91bb02dec20f 100644
--- a/arch/arm/mach-hisi/platsmp.c
+++ b/arch/arm/mach-hisi/platsmp.c
@@ -28,7 +28,7 @@ void hi3xxx_set_cpu_jump(int cpu, void *jump_addr)
28 cpu = cpu_logical_map(cpu); 28 cpu = cpu_logical_map(cpu);
29 if (!cpu || !ctrl_base) 29 if (!cpu || !ctrl_base)
30 return; 30 return;
31 writel_relaxed(virt_to_phys(jump_addr), ctrl_base + ((cpu - 1) << 2)); 31 writel_relaxed(__pa_symbol(jump_addr), ctrl_base + ((cpu - 1) << 2));
32} 32}
33 33
34int hi3xxx_get_cpu_jump(int cpu) 34int hi3xxx_get_cpu_jump(int cpu)
@@ -118,7 +118,7 @@ static int hix5hd2_boot_secondary(unsigned int cpu, struct task_struct *idle)
118{ 118{
119 phys_addr_t jumpaddr; 119 phys_addr_t jumpaddr;
120 120
121 jumpaddr = virt_to_phys(secondary_startup); 121 jumpaddr = __pa_symbol(secondary_startup);
122 hix5hd2_set_scu_boot_addr(HIX5HD2_BOOT_ADDRESS, jumpaddr); 122 hix5hd2_set_scu_boot_addr(HIX5HD2_BOOT_ADDRESS, jumpaddr);
123 hix5hd2_set_cpu(cpu, true); 123 hix5hd2_set_cpu(cpu, true);
124 arch_send_wakeup_ipi_mask(cpumask_of(cpu)); 124 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
@@ -156,7 +156,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)
156 struct device_node *node; 156 struct device_node *node;
157 157
158 158
159 jumpaddr = virt_to_phys(secondary_startup); 159 jumpaddr = __pa_symbol(secondary_startup);
160 hip01_set_boot_addr(HIP01_BOOT_ADDRESS, jumpaddr); 160 hip01_set_boot_addr(HIP01_BOOT_ADDRESS, jumpaddr);
161 161
162 node = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl"); 162 node = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 711dbbd5badd..c2d1b329fba1 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -117,7 +117,7 @@ static void __init ls1021a_smp_prepare_cpus(unsigned int max_cpus)
117 dcfg_base = of_iomap(np, 0); 117 dcfg_base = of_iomap(np, 0);
118 BUG_ON(!dcfg_base); 118 BUG_ON(!dcfg_base);
119 119
120 paddr = virt_to_phys(secondary_startup); 120 paddr = __pa_symbol(secondary_startup);
121 writel_relaxed(cpu_to_be32(paddr), dcfg_base + DCFG_CCSR_SCRATCHRW1); 121 writel_relaxed(cpu_to_be32(paddr), dcfg_base + DCFG_CCSR_SCRATCHRW1);
122 122
123 iounmap(dcfg_base); 123 iounmap(dcfg_base);
diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
index 1515e498d348..e61b1d1027e1 100644
--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -499,7 +499,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
499 memset(suspend_ocram_base, 0, sizeof(*pm_info)); 499 memset(suspend_ocram_base, 0, sizeof(*pm_info));
500 pm_info = suspend_ocram_base; 500 pm_info = suspend_ocram_base;
501 pm_info->pbase = ocram_pbase; 501 pm_info->pbase = ocram_pbase;
502 pm_info->resume_addr = virt_to_phys(v7_cpu_resume); 502 pm_info->resume_addr = __pa_symbol(v7_cpu_resume);
503 pm_info->pm_info_size = sizeof(*pm_info); 503 pm_info->pm_info_size = sizeof(*pm_info);
504 504
505 /* 505 /*
diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c
index 70b083fe934a..495d85d0fe7e 100644
--- a/arch/arm/mach-imx/src.c
+++ b/arch/arm/mach-imx/src.c
@@ -99,7 +99,7 @@ void imx_enable_cpu(int cpu, bool enable)
99void imx_set_cpu_jump(int cpu, void *jump_addr) 99void imx_set_cpu_jump(int cpu, void *jump_addr)
100{ 100{
101 cpu = cpu_logical_map(cpu); 101 cpu = cpu_logical_map(cpu);
102 writel_relaxed(virt_to_phys(jump_addr), 102 writel_relaxed(__pa_symbol(jump_addr),
103 src_base + SRC_GPR1 + cpu * 8); 103 src_base + SRC_GPR1 + cpu * 8);
104} 104}
105 105
diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index b821e34474b6..726eb69bb655 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -122,7 +122,7 @@ static void __init __mtk_smp_prepare_cpus(unsigned int max_cpus, int trustzone)
122 * write the address of slave startup address into the system-wide 122 * write the address of slave startup address into the system-wide
123 * jump register 123 * jump register
124 */ 124 */
125 writel_relaxed(virt_to_phys(secondary_startup_arm), 125 writel_relaxed(__pa_symbol(secondary_startup_arm),
126 mtk_smp_base + mtk_smp_info->jump_reg); 126 mtk_smp_base + mtk_smp_info->jump_reg);
127} 127}
128 128
diff --git a/arch/arm/mach-mvebu/pm.c b/arch/arm/mach-mvebu/pm.c
index 2990c5269b18..c487be61d6d8 100644
--- a/arch/arm/mach-mvebu/pm.c
+++ b/arch/arm/mach-mvebu/pm.c
@@ -110,7 +110,7 @@ static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr)
110{ 110{
111 phys_addr_t resume_pc; 111 phys_addr_t resume_pc;
112 112
113 resume_pc = virt_to_phys(armada_370_xp_cpu_resume); 113 resume_pc = __pa_symbol(armada_370_xp_cpu_resume);
114 114
115 /* 115 /*
116 * The bootloader expects the first two words to be a magic 116 * The bootloader expects the first two words to be a magic
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index f39bd51bce18..27a78c80e5b1 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -112,7 +112,7 @@ static const struct of_device_id of_pmsu_table[] = {
112 112
113void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr) 113void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
114{ 114{
115 writel(virt_to_phys(boot_addr), pmsu_mp_base + 115 writel(__pa_symbol(boot_addr), pmsu_mp_base +
116 PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu)); 116 PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu));
117} 117}
118 118
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index 76cbc82a7407..04d9ebe6a90a 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -153,7 +153,7 @@ void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr)
153 if (of_machine_is_compatible("marvell,armada375")) 153 if (of_machine_is_compatible("marvell,armada375"))
154 mvebu_armada375_smp_wa_init(); 154 mvebu_armada375_smp_wa_init();
155 155
156 writel(virt_to_phys(boot_addr), system_controller_base + 156 writel(__pa_symbol(boot_addr), system_controller_base +
157 mvebu_sc->resume_boot_addr); 157 mvebu_sc->resume_boot_addr);
158} 158}
159#endif 159#endif
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 1662071bb2cc..bd8089ff929f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -315,15 +315,15 @@ void omap3_save_scratchpad_contents(void)
315 scratchpad_contents.boot_config_ptr = 0x0; 315 scratchpad_contents.boot_config_ptr = 0x0;
316 if (cpu_is_omap3630()) 316 if (cpu_is_omap3630())
317 scratchpad_contents.public_restore_ptr = 317 scratchpad_contents.public_restore_ptr =
318 virt_to_phys(omap3_restore_3630); 318 __pa_symbol(omap3_restore_3630);
319 else if (omap_rev() != OMAP3430_REV_ES3_0 && 319 else if (omap_rev() != OMAP3430_REV_ES3_0 &&
320 omap_rev() != OMAP3430_REV_ES3_1 && 320 omap_rev() != OMAP3430_REV_ES3_1 &&
321 omap_rev() != OMAP3430_REV_ES3_1_2) 321 omap_rev() != OMAP3430_REV_ES3_1_2)
322 scratchpad_contents.public_restore_ptr = 322 scratchpad_contents.public_restore_ptr =
323 virt_to_phys(omap3_restore); 323 __pa_symbol(omap3_restore);
324 else 324 else
325 scratchpad_contents.public_restore_ptr = 325 scratchpad_contents.public_restore_ptr =
326 virt_to_phys(omap3_restore_es3); 326 __pa_symbol(omap3_restore_es3);
327 327
328 if (omap_type() == OMAP2_DEVICE_TYPE_GP) 328 if (omap_type() == OMAP2_DEVICE_TYPE_GP)
329 scratchpad_contents.secure_ram_restore_ptr = 0x0; 329 scratchpad_contents.secure_ram_restore_ptr = 0x0;
@@ -395,7 +395,7 @@ void omap3_save_scratchpad_contents(void)
395 sdrc_block_contents.flags = 0x0; 395 sdrc_block_contents.flags = 0x0;
396 sdrc_block_contents.block_size = 0x0; 396 sdrc_block_contents.block_size = 0x0;
397 397
398 arm_context_addr = virt_to_phys(omap3_arm_context); 398 arm_context_addr = __pa_symbol(omap3_arm_context);
399 399
400 /* Copy all the contents to the scratchpad location */ 400 /* Copy all the contents to the scratchpad location */
401 scratchpad_address = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD); 401 scratchpad_address = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD);
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 7d62ad48c7c9..113ab2dd2ee9 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -273,7 +273,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
273 cpu_clear_prev_logic_pwrst(cpu); 273 cpu_clear_prev_logic_pwrst(cpu);
274 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state); 274 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
275 pwrdm_set_logic_retst(pm_info->pwrdm, cpu_logic_state); 275 pwrdm_set_logic_retst(pm_info->pwrdm, cpu_logic_state);
276 set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.resume)); 276 set_cpu_wakeup_addr(cpu, __pa_symbol(omap_pm_ops.resume));
277 omap_pm_ops.scu_prepare(cpu, power_state); 277 omap_pm_ops.scu_prepare(cpu, power_state);
278 l2x0_pwrst_prepare(cpu, save_state); 278 l2x0_pwrst_prepare(cpu, save_state);
279 279
@@ -325,7 +325,7 @@ int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
325 325
326 pwrdm_clear_all_prev_pwrst(pm_info->pwrdm); 326 pwrdm_clear_all_prev_pwrst(pm_info->pwrdm);
327 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state); 327 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
328 set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.hotplug_restart)); 328 set_cpu_wakeup_addr(cpu, __pa_symbol(omap_pm_ops.hotplug_restart));
329 omap_pm_ops.scu_prepare(cpu, power_state); 329 omap_pm_ops.scu_prepare(cpu, power_state);
330 330
331 /* 331 /*
@@ -467,13 +467,13 @@ void __init omap4_mpuss_early_init(void)
467 sar_base = omap4_get_sar_ram_base(); 467 sar_base = omap4_get_sar_ram_base();
468 468
469 if (cpu_is_omap443x()) 469 if (cpu_is_omap443x())
470 startup_pa = virt_to_phys(omap4_secondary_startup); 470 startup_pa = __pa_symbol(omap4_secondary_startup);
471 else if (cpu_is_omap446x()) 471 else if (cpu_is_omap446x())
472 startup_pa = virt_to_phys(omap4460_secondary_startup); 472 startup_pa = __pa_symbol(omap4460_secondary_startup);
473 else if ((__boot_cpu_mode & MODE_MASK) == HYP_MODE) 473 else if ((__boot_cpu_mode & MODE_MASK) == HYP_MODE)
474 startup_pa = virt_to_phys(omap5_secondary_hyp_startup); 474 startup_pa = __pa_symbol(omap5_secondary_hyp_startup);
475 else 475 else
476 startup_pa = virt_to_phys(omap5_secondary_startup); 476 startup_pa = __pa_symbol(omap5_secondary_startup);
477 477
478 if (cpu_is_omap44xx()) 478 if (cpu_is_omap44xx())
479 writel_relaxed(startup_pa, sar_base + 479 writel_relaxed(startup_pa, sar_base +
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index b4de3da6dffa..003353b0b794 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -316,9 +316,9 @@ static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
316 * A barrier is added to ensure that write buffer is drained 316 * A barrier is added to ensure that write buffer is drained
317 */ 317 */
318 if (omap_secure_apis_support()) 318 if (omap_secure_apis_support())
319 omap_auxcoreboot_addr(virt_to_phys(cfg.startup_addr)); 319 omap_auxcoreboot_addr(__pa_symbol(cfg.startup_addr));
320 else 320 else
321 writel_relaxed(virt_to_phys(cfg.startup_addr), 321 writel_relaxed(__pa_symbol(cfg.startup_addr),
322 base + OMAP_AUX_CORE_BOOT_1); 322 base + OMAP_AUX_CORE_BOOT_1);
323} 323}
324 324
diff --git a/arch/arm/mach-prima2/platsmp.c b/arch/arm/mach-prima2/platsmp.c
index 0875b99add18..75ef5d4be554 100644
--- a/arch/arm/mach-prima2/platsmp.c
+++ b/arch/arm/mach-prima2/platsmp.c
@@ -65,7 +65,7 @@ static int sirfsoc_boot_secondary(unsigned int cpu, struct task_struct *idle)
65 * waiting for. This would wake up the secondary core from WFE 65 * waiting for. This would wake up the secondary core from WFE
66 */ 66 */
67#define SIRFSOC_CPU1_JUMPADDR_OFFSET 0x2bc 67#define SIRFSOC_CPU1_JUMPADDR_OFFSET 0x2bc
68 __raw_writel(virt_to_phys(sirfsoc_secondary_startup), 68 __raw_writel(__pa_symbol(sirfsoc_secondary_startup),
69 clk_base + SIRFSOC_CPU1_JUMPADDR_OFFSET); 69 clk_base + SIRFSOC_CPU1_JUMPADDR_OFFSET);
70 70
71#define SIRFSOC_CPU1_WAKEMAGIC_OFFSET 0x2b8 71#define SIRFSOC_CPU1_WAKEMAGIC_OFFSET 0x2b8
diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c
index 83e94c95e314..b0bcf1ff02dd 100644
--- a/arch/arm/mach-prima2/pm.c
+++ b/arch/arm/mach-prima2/pm.c
@@ -54,7 +54,7 @@ static void sirfsoc_set_sleep_mode(u32 mode)
54 54
55static int sirfsoc_pre_suspend_power_off(void) 55static int sirfsoc_pre_suspend_power_off(void)
56{ 56{
57 u32 wakeup_entry = virt_to_phys(cpu_resume); 57 u32 wakeup_entry = __pa_symbol(cpu_resume);
58 58
59 sirfsoc_rtc_iobrg_writel(wakeup_entry, sirfsoc_pwrc_base + 59 sirfsoc_rtc_iobrg_writel(wakeup_entry, sirfsoc_pwrc_base +
60 SIRFSOC_PWRC_SCRATCH_PAD1); 60 SIRFSOC_PWRC_SCRATCH_PAD1);
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index 9c308de158c6..29630061e700 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -249,7 +249,7 @@ static int palmz72_pm_suspend(void)
249 store_ptr = *PALMZ72_SAVE_DWORD; 249 store_ptr = *PALMZ72_SAVE_DWORD;
250 250
251 /* Setting PSPR to a proper value */ 251 /* Setting PSPR to a proper value */
252 PSPR = virt_to_phys(&palmz72_resume_info); 252 PSPR = __pa_symbol(&palmz72_resume_info);
253 253
254 return 0; 254 return 0;
255} 255}
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index c725baf119e1..ba431fad5c47 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -85,7 +85,7 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state)
85static int pxa25x_cpu_pm_prepare(void) 85static int pxa25x_cpu_pm_prepare(void)
86{ 86{
87 /* set resume return address */ 87 /* set resume return address */
88 PSPR = virt_to_phys(cpu_resume); 88 PSPR = __pa_symbol(cpu_resume);
89 return 0; 89 return 0;
90} 90}
91 91
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index c0185c5c5a08..9b69be4e9fe3 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -168,7 +168,7 @@ static int pxa27x_cpu_pm_valid(suspend_state_t state)
168static int pxa27x_cpu_pm_prepare(void) 168static int pxa27x_cpu_pm_prepare(void)
169{ 169{
170 /* set resume return address */ 170 /* set resume return address */
171 PSPR = virt_to_phys(cpu_resume); 171 PSPR = __pa_symbol(cpu_resume);
172 return 0; 172 return 0;
173} 173}
174 174
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 87acc96388c7..0cc9f124c9ac 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -123,7 +123,7 @@ static void pxa3xx_cpu_pm_suspend(void)
123 PSPR = 0x5c014000; 123 PSPR = 0x5c014000;
124 124
125 /* overwrite with the resume address */ 125 /* overwrite with the resume address */
126 *p = virt_to_phys(cpu_resume); 126 *p = __pa_symbol(cpu_resume);
127 127
128 cpu_suspend(0, pxa3xx_finish_suspend); 128 cpu_suspend(0, pxa3xx_finish_suspend);
129 129
diff --git a/arch/arm/mach-realview/platsmp-dt.c b/arch/arm/mach-realview/platsmp-dt.c
index 70ca99eb52c6..c242423bf8db 100644
--- a/arch/arm/mach-realview/platsmp-dt.c
+++ b/arch/arm/mach-realview/platsmp-dt.c
@@ -76,7 +76,7 @@ static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
76 } 76 }
77 /* Put the boot address in this magic register */ 77 /* Put the boot address in this magic register */
78 regmap_write(map, REALVIEW_SYS_FLAGSSET_OFFSET, 78 regmap_write(map, REALVIEW_SYS_FLAGSSET_OFFSET,
79 virt_to_phys(versatile_secondary_startup)); 79 __pa_symbol(versatile_secondary_startup));
80} 80}
81 81
82static const struct smp_operations realview_dt_smp_ops __initconst = { 82static const struct smp_operations realview_dt_smp_ops __initconst = {
diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
index 4d827a069d49..3abafdbdd7f4 100644
--- a/arch/arm/mach-rockchip/platsmp.c
+++ b/arch/arm/mach-rockchip/platsmp.c
@@ -156,7 +156,7 @@ static int rockchip_boot_secondary(unsigned int cpu, struct task_struct *idle)
156 */ 156 */
157 mdelay(1); /* ensure the cpus other than cpu0 to startup */ 157 mdelay(1); /* ensure the cpus other than cpu0 to startup */
158 158
159 writel(virt_to_phys(secondary_startup), sram_base_addr + 8); 159 writel(__pa_symbol(secondary_startup), sram_base_addr + 8);
160 writel(0xDEADBEAF, sram_base_addr + 4); 160 writel(0xDEADBEAF, sram_base_addr + 4);
161 dsb_sev(); 161 dsb_sev();
162 } 162 }
@@ -195,7 +195,7 @@ static int __init rockchip_smp_prepare_sram(struct device_node *node)
195 } 195 }
196 196
197 /* set the boot function for the sram code */ 197 /* set the boot function for the sram code */
198 rockchip_boot_fn = virt_to_phys(secondary_startup); 198 rockchip_boot_fn = __pa_symbol(secondary_startup);
199 199
200 /* copy the trampoline to sram, that runs during startup of the core */ 200 /* copy the trampoline to sram, that runs during startup of the core */
201 memcpy(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz); 201 memcpy(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz);
diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c
index bee8c8051929..0592534e0b88 100644
--- a/arch/arm/mach-rockchip/pm.c
+++ b/arch/arm/mach-rockchip/pm.c
@@ -62,7 +62,7 @@ static inline u32 rk3288_l2_config(void)
62static void rk3288_config_bootdata(void) 62static void rk3288_config_bootdata(void)
63{ 63{
64 rkpm_bootdata_cpusp = rk3288_bootram_phy + (SZ_4K - 8); 64 rkpm_bootdata_cpusp = rk3288_bootram_phy + (SZ_4K - 8);
65 rkpm_bootdata_cpu_code = virt_to_phys(cpu_resume); 65 rkpm_bootdata_cpu_code = __pa_symbol(cpu_resume);
66 66
67 rkpm_bootdata_l2ctlr_f = 1; 67 rkpm_bootdata_l2ctlr_f = 1;
68 rkpm_bootdata_l2ctlr = rk3288_l2_config(); 68 rkpm_bootdata_l2ctlr = rk3288_l2_config();
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index 895aca225952..f5b5c49b56ac 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -484,7 +484,7 @@ static int jive_pm_suspend(void)
484 * correct address to resume from. */ 484 * correct address to resume from. */
485 485
486 __raw_writel(0x2BED, S3C2412_INFORM0); 486 __raw_writel(0x2BED, S3C2412_INFORM0);
487 __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); 487 __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2412_INFORM1);
488 488
489 return 0; 489 return 0;
490} 490}
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2410.c b/arch/arm/mach-s3c24xx/pm-s3c2410.c
index 20e481d8a33a..a4588daeddb0 100644
--- a/arch/arm/mach-s3c24xx/pm-s3c2410.c
+++ b/arch/arm/mach-s3c24xx/pm-s3c2410.c
@@ -45,7 +45,7 @@ static void s3c2410_pm_prepare(void)
45{ 45{
46 /* ensure at least GSTATUS3 has the resume address */ 46 /* ensure at least GSTATUS3 has the resume address */
47 47
48 __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2410_GSTATUS3); 48 __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2410_GSTATUS3);
49 49
50 S3C_PMDBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3)); 50 S3C_PMDBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3));
51 S3C_PMDBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4)); 51 S3C_PMDBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4));
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2416.c b/arch/arm/mach-s3c24xx/pm-s3c2416.c
index c0e328e37bd6..b5bbf0d5985c 100644
--- a/arch/arm/mach-s3c24xx/pm-s3c2416.c
+++ b/arch/arm/mach-s3c24xx/pm-s3c2416.c
@@ -48,7 +48,7 @@ static void s3c2416_pm_prepare(void)
48 * correct address to resume from. 48 * correct address to resume from.
49 */ 49 */
50 __raw_writel(0x2BED, S3C2412_INFORM0); 50 __raw_writel(0x2BED, S3C2412_INFORM0);
51 __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); 51 __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2412_INFORM1);
52} 52}
53 53
54static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif) 54static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif)
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
index b0be382ff6bb..2f579be8fe67 100644
--- a/arch/arm/mach-s3c64xx/pm.c
+++ b/arch/arm/mach-s3c64xx/pm.c
@@ -304,7 +304,7 @@ static void s3c64xx_pm_prepare(void)
304 wake_irqs, ARRAY_SIZE(wake_irqs)); 304 wake_irqs, ARRAY_SIZE(wake_irqs));
305 305
306 /* store address of resume. */ 306 /* store address of resume. */
307 __raw_writel(virt_to_phys(s3c_cpu_resume), S3C64XX_INFORM0); 307 __raw_writel(__pa_symbol(s3c_cpu_resume), S3C64XX_INFORM0);
308 308
309 /* ensure previous wakeup state is cleared before sleeping */ 309 /* ensure previous wakeup state is cleared before sleeping */
310 __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT), S3C64XX_WAKEUP_STAT); 310 __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT), S3C64XX_WAKEUP_STAT);
diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c
index 7d69666de5ba..07cee14a363b 100644
--- a/arch/arm/mach-s5pv210/pm.c
+++ b/arch/arm/mach-s5pv210/pm.c
@@ -69,7 +69,7 @@ static void s5pv210_pm_prepare(void)
69 __raw_writel(s5pv210_irqwake_intmask, S5P_WAKEUP_MASK); 69 __raw_writel(s5pv210_irqwake_intmask, S5P_WAKEUP_MASK);
70 70
71 /* ensure at least INFORM0 has the resume address */ 71 /* ensure at least INFORM0 has the resume address */
72 __raw_writel(virt_to_phys(s5pv210_cpu_resume), S5P_INFORM0); 72 __raw_writel(__pa_symbol(s5pv210_cpu_resume), S5P_INFORM0);
73 73
74 tmp = __raw_readl(S5P_SLEEP_CFG); 74 tmp = __raw_readl(S5P_SLEEP_CFG);
75 tmp &= ~(S5P_SLEEP_CFG_OSC_EN | S5P_SLEEP_CFG_USBOSC_EN); 75 tmp &= ~(S5P_SLEEP_CFG_OSC_EN | S5P_SLEEP_CFG_USBOSC_EN);
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index 34853d5dfda2..9a7079f565bd 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -73,7 +73,7 @@ static int sa11x0_pm_enter(suspend_state_t state)
73 RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR; 73 RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR;
74 74
75 /* set resume return address */ 75 /* set resume return address */
76 PSPR = virt_to_phys(cpu_resume); 76 PSPR = __pa_symbol(cpu_resume);
77 77
78 /* go zzz */ 78 /* go zzz */
79 cpu_suspend(0, sa1100_finish_suspend); 79 cpu_suspend(0, sa1100_finish_suspend);
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index e19266844e16..3ca2c13346f0 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -190,7 +190,7 @@ static void apmu_parse_dt(void (*fn)(struct resource *res, int cpu, int bit))
190static void __init shmobile_smp_apmu_setup_boot(void) 190static void __init shmobile_smp_apmu_setup_boot(void)
191{ 191{
192 /* install boot code shared by all CPUs */ 192 /* install boot code shared by all CPUs */
193 shmobile_boot_fn = virt_to_phys(shmobile_smp_boot); 193 shmobile_boot_fn = __pa_symbol(shmobile_smp_boot);
194} 194}
195 195
196void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus, 196void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
@@ -204,7 +204,7 @@ void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
204int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle) 204int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
205{ 205{
206 /* For this particular CPU register boot vector */ 206 /* For this particular CPU register boot vector */
207 shmobile_smp_hook(cpu, virt_to_phys(secondary_startup), 0); 207 shmobile_smp_hook(cpu, __pa_symbol(secondary_startup), 0);
208 208
209 return apmu_wrap(cpu, apmu_power_on); 209 return apmu_wrap(cpu, apmu_power_on);
210} 210}
@@ -308,7 +308,7 @@ int shmobile_smp_apmu_cpu_kill(unsigned int cpu)
308#if defined(CONFIG_SUSPEND) 308#if defined(CONFIG_SUSPEND)
309static int shmobile_smp_apmu_do_suspend(unsigned long cpu) 309static int shmobile_smp_apmu_do_suspend(unsigned long cpu)
310{ 310{
311 shmobile_smp_hook(cpu, virt_to_phys(cpu_resume), 0); 311 shmobile_smp_hook(cpu, __pa_symbol(cpu_resume), 0);
312 shmobile_smp_apmu_cpu_shutdown(cpu); 312 shmobile_smp_apmu_cpu_shutdown(cpu);
313 cpu_do_idle(); /* WFI selects Core Standby */ 313 cpu_do_idle(); /* WFI selects Core Standby */
314 return 1; 314 return 1;
diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index d1ecaf37d142..f1a1efde4beb 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -24,7 +24,7 @@ static void __iomem *shmobile_scu_base;
24static int shmobile_scu_cpu_prepare(unsigned int cpu) 24static int shmobile_scu_cpu_prepare(unsigned int cpu)
25{ 25{
26 /* For this particular CPU register SCU SMP boot vector */ 26 /* For this particular CPU register SCU SMP boot vector */
27 shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu), 27 shmobile_smp_hook(cpu, __pa_symbol(shmobile_boot_scu),
28 shmobile_scu_base_phys); 28 shmobile_scu_base_phys);
29 return 0; 29 return 0;
30} 30}
@@ -33,7 +33,7 @@ void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
33 unsigned int max_cpus) 33 unsigned int max_cpus)
34{ 34{
35 /* install boot code shared by all CPUs */ 35 /* install boot code shared by all CPUs */
36 shmobile_boot_fn = virt_to_phys(shmobile_smp_boot); 36 shmobile_boot_fn = __pa_symbol(shmobile_smp_boot);
37 37
38 /* enable SCU and cache coherency on booting CPU */ 38 /* enable SCU and cache coherency on booting CPU */
39 shmobile_scu_base_phys = scu_base_phys; 39 shmobile_scu_base_phys = scu_base_phys;
diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index 07945748b571..0ee76772b507 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -40,7 +40,7 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
40 40
41 memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size); 41 memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
42 42
43 writel(virt_to_phys(secondary_startup), 43 writel(__pa_symbol(secondary_startup),
44 sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff)); 44 sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff));
45 45
46 flush_cache_all(); 46 flush_cache_all();
@@ -63,7 +63,7 @@ static int socfpga_a10_boot_secondary(unsigned int cpu, struct task_struct *idle
63 SOCFPGA_A10_RSTMGR_MODMPURST); 63 SOCFPGA_A10_RSTMGR_MODMPURST);
64 memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size); 64 memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
65 65
66 writel(virt_to_phys(secondary_startup), 66 writel(__pa_symbol(secondary_startup),
67 sys_manager_base_addr + (socfpga_cpu1start_addr & 0x00000fff)); 67 sys_manager_base_addr + (socfpga_cpu1start_addr & 0x00000fff));
68 68
69 flush_cache_all(); 69 flush_cache_all();
diff --git a/arch/arm/mach-spear/platsmp.c b/arch/arm/mach-spear/platsmp.c
index 8d1e2d551786..39038a03836a 100644
--- a/arch/arm/mach-spear/platsmp.c
+++ b/arch/arm/mach-spear/platsmp.c
@@ -117,7 +117,7 @@ static void __init spear13xx_smp_prepare_cpus(unsigned int max_cpus)
117 * (presently it is in SRAM). The BootMonitor waits until it receives a 117 * (presently it is in SRAM). The BootMonitor waits until it receives a
118 * soft interrupt, and then the secondary CPU branches to this address. 118 * soft interrupt, and then the secondary CPU branches to this address.
119 */ 119 */
120 __raw_writel(virt_to_phys(spear13xx_secondary_startup), SYS_LOCATION); 120 __raw_writel(__pa_symbol(spear13xx_secondary_startup), SYS_LOCATION);
121} 121}
122 122
123const struct smp_operations spear13xx_smp_ops __initconst = { 123const struct smp_operations spear13xx_smp_ops __initconst = {
diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
index ea5a2277ee46..231f19e17436 100644
--- a/arch/arm/mach-sti/platsmp.c
+++ b/arch/arm/mach-sti/platsmp.c
@@ -103,7 +103,7 @@ static void __init sti_smp_prepare_cpus(unsigned int max_cpus)
103 u32 __iomem *cpu_strt_ptr; 103 u32 __iomem *cpu_strt_ptr;
104 u32 release_phys; 104 u32 release_phys;
105 int cpu; 105 int cpu;
106 unsigned long entry_pa = virt_to_phys(sti_secondary_startup); 106 unsigned long entry_pa = __pa_symbol(sti_secondary_startup);
107 107
108 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); 108 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
109 109
diff --git a/arch/arm/mach-sunxi/platsmp.c b/arch/arm/mach-sunxi/platsmp.c
index 6642267812c9..8fb5088464db 100644
--- a/arch/arm/mach-sunxi/platsmp.c
+++ b/arch/arm/mach-sunxi/platsmp.c
@@ -80,7 +80,7 @@ static int sun6i_smp_boot_secondary(unsigned int cpu,
80 spin_lock(&cpu_lock); 80 spin_lock(&cpu_lock);
81 81
82 /* Set CPU boot address */ 82 /* Set CPU boot address */
83 writel(virt_to_phys(secondary_startup), 83 writel(__pa_symbol(secondary_startup),
84 cpucfg_membase + CPUCFG_PRIVATE0_REG); 84 cpucfg_membase + CPUCFG_PRIVATE0_REG);
85 85
86 /* Assert the CPU core in reset */ 86 /* Assert the CPU core in reset */
@@ -162,7 +162,7 @@ static int sun8i_smp_boot_secondary(unsigned int cpu,
162 spin_lock(&cpu_lock); 162 spin_lock(&cpu_lock);
163 163
164 /* Set CPU boot address */ 164 /* Set CPU boot address */
165 writel(virt_to_phys(secondary_startup), 165 writel(__pa_symbol(secondary_startup),
166 cpucfg_membase + CPUCFG_PRIVATE0_REG); 166 cpucfg_membase + CPUCFG_PRIVATE0_REG);
167 167
168 /* Assert the CPU core in reset */ 168 /* Assert the CPU core in reset */
diff --git a/arch/arm/mach-tango/platsmp.c b/arch/arm/mach-tango/platsmp.c
index 98c62a4a8623..2f0c6c050fed 100644
--- a/arch/arm/mach-tango/platsmp.c
+++ b/arch/arm/mach-tango/platsmp.c
@@ -5,7 +5,7 @@
5 5
6static int tango_boot_secondary(unsigned int cpu, struct task_struct *idle) 6static int tango_boot_secondary(unsigned int cpu, struct task_struct *idle)
7{ 7{
8 tango_set_aux_boot_addr(virt_to_phys(secondary_startup)); 8 tango_set_aux_boot_addr(__pa_symbol(secondary_startup));
9 tango_start_aux_core(cpu); 9 tango_start_aux_core(cpu);
10 return 0; 10 return 0;
11} 11}
diff --git a/arch/arm/mach-tango/pm.c b/arch/arm/mach-tango/pm.c
index b05c6d6f99d0..406c0814eb6e 100644
--- a/arch/arm/mach-tango/pm.c
+++ b/arch/arm/mach-tango/pm.c
@@ -5,7 +5,7 @@
5 5
6static int tango_pm_powerdown(unsigned long arg) 6static int tango_pm_powerdown(unsigned long arg)
7{ 7{
8 tango_suspend(virt_to_phys(cpu_resume)); 8 tango_suspend(__pa_symbol(cpu_resume));
9 9
10 return -EIO; /* tango_suspend has failed */ 10 return -EIO; /* tango_suspend has failed */
11} 11}
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
index 6fd9db54887e..dc558892753c 100644
--- a/arch/arm/mach-tegra/reset.c
+++ b/arch/arm/mach-tegra/reset.c
@@ -94,14 +94,14 @@ void __init tegra_cpu_reset_handler_init(void)
94 __tegra_cpu_reset_handler_data[TEGRA_RESET_MASK_PRESENT] = 94 __tegra_cpu_reset_handler_data[TEGRA_RESET_MASK_PRESENT] =
95 *((u32 *)cpu_possible_mask); 95 *((u32 *)cpu_possible_mask);
96 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_SECONDARY] = 96 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_SECONDARY] =
97 virt_to_phys((void *)secondary_startup); 97 __pa_symbol((void *)secondary_startup);
98#endif 98#endif
99 99
100#ifdef CONFIG_PM_SLEEP 100#ifdef CONFIG_PM_SLEEP
101 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP1] = 101 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP1] =
102 TEGRA_IRAM_LPx_RESUME_AREA; 102 TEGRA_IRAM_LPx_RESUME_AREA;
103 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP2] = 103 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP2] =
104 virt_to_phys((void *)tegra_resume); 104 __pa_symbol((void *)tegra_resume);
105#endif 105#endif
106 106
107 tegra_cpu_reset_handler_enable(); 107 tegra_cpu_reset_handler_enable();
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index e0ee139fdebf..9b124c22035f 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -79,7 +79,7 @@ static int ux500_boot_secondary(unsigned int cpu, struct task_struct *idle)
79 * backup ram register at offset 0x1FF0, which is what boot rom code 79 * backup ram register at offset 0x1FF0, which is what boot rom code
80 * is waiting for. This will wake up the secondary core from WFE. 80 * is waiting for. This will wake up the secondary core from WFE.
81 */ 81 */
82 writel(virt_to_phys(secondary_startup), 82 writel(__pa_symbol(secondary_startup),
83 backupram + UX500_CPU1_JUMPADDR_OFFSET); 83 backupram + UX500_CPU1_JUMPADDR_OFFSET);
84 writel(0xA1FEED01, 84 writel(0xA1FEED01,
85 backupram + UX500_CPU1_WAKEMAGIC_OFFSET); 85 backupram + UX500_CPU1_WAKEMAGIC_OFFSET);
diff --git a/arch/arm/mach-vexpress/dcscb.c b/arch/arm/mach-vexpress/dcscb.c
index 5cedcf572104..ee2a0faafaa1 100644
--- a/arch/arm/mach-vexpress/dcscb.c
+++ b/arch/arm/mach-vexpress/dcscb.c
@@ -166,7 +166,7 @@ static int __init dcscb_init(void)
166 * Future entries into the kernel can now go 166 * Future entries into the kernel can now go
167 * through the cluster entry vectors. 167 * through the cluster entry vectors.
168 */ 168 */
169 vexpress_flags_set(virt_to_phys(mcpm_entry_point)); 169 vexpress_flags_set(__pa_symbol(mcpm_entry_point));
170 170
171 return 0; 171 return 0;
172} 172}
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 98e29dee91e8..742499bac6d0 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -79,7 +79,7 @@ static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
79 * until it receives a soft interrupt, and then the 79 * until it receives a soft interrupt, and then the
80 * secondary CPU branches to this address. 80 * secondary CPU branches to this address.
81 */ 81 */
82 vexpress_flags_set(virt_to_phys(versatile_secondary_startup)); 82 vexpress_flags_set(__pa_symbol(versatile_secondary_startup));
83} 83}
84 84
85const struct smp_operations vexpress_smp_dt_ops __initconst = { 85const struct smp_operations vexpress_smp_dt_ops __initconst = {
diff --git a/arch/arm/mach-vexpress/tc2_pm.c b/arch/arm/mach-vexpress/tc2_pm.c
index 1aa4ccece69f..9b5f3c427086 100644
--- a/arch/arm/mach-vexpress/tc2_pm.c
+++ b/arch/arm/mach-vexpress/tc2_pm.c
@@ -54,7 +54,7 @@ static int tc2_pm_cpu_powerup(unsigned int cpu, unsigned int cluster)
54 if (cluster >= TC2_CLUSTERS || cpu >= tc2_nr_cpus[cluster]) 54 if (cluster >= TC2_CLUSTERS || cpu >= tc2_nr_cpus[cluster])
55 return -EINVAL; 55 return -EINVAL;
56 ve_spc_set_resume_addr(cluster, cpu, 56 ve_spc_set_resume_addr(cluster, cpu,
57 virt_to_phys(mcpm_entry_point)); 57 __pa_symbol(mcpm_entry_point));
58 ve_spc_cpu_wakeup_irq(cluster, cpu, true); 58 ve_spc_cpu_wakeup_irq(cluster, cpu, true);
59 return 0; 59 return 0;
60} 60}
@@ -159,7 +159,7 @@ static int tc2_pm_wait_for_powerdown(unsigned int cpu, unsigned int cluster)
159 159
160static void tc2_pm_cpu_suspend_prepare(unsigned int cpu, unsigned int cluster) 160static void tc2_pm_cpu_suspend_prepare(unsigned int cpu, unsigned int cluster)
161{ 161{
162 ve_spc_set_resume_addr(cluster, cpu, virt_to_phys(mcpm_entry_point)); 162 ve_spc_set_resume_addr(cluster, cpu, __pa_symbol(mcpm_entry_point));
163} 163}
164 164
165static void tc2_pm_cpu_is_up(unsigned int cpu, unsigned int cluster) 165static void tc2_pm_cpu_is_up(unsigned int cpu, unsigned int cluster)
diff --git a/arch/arm/mach-zx/platsmp.c b/arch/arm/mach-zx/platsmp.c
index 0297f92084e0..afb9a82dedc3 100644
--- a/arch/arm/mach-zx/platsmp.c
+++ b/arch/arm/mach-zx/platsmp.c
@@ -76,7 +76,7 @@ void __init zx_smp_prepare_cpus(unsigned int max_cpus)
76 * until it receives a soft interrupt, and then the 76 * until it receives a soft interrupt, and then the
77 * secondary CPU branches to this address. 77 * secondary CPU branches to this address.
78 */ 78 */
79 __raw_writel(virt_to_phys(zx_secondary_startup), 79 __raw_writel(__pa_symbol(zx_secondary_startup),
80 aonsysctrl_base + AON_SYS_CTRL_RESERVED1); 80 aonsysctrl_base + AON_SYS_CTRL_RESERVED1);
81 81
82 iounmap(aonsysctrl_base); 82 iounmap(aonsysctrl_base);
@@ -94,7 +94,7 @@ void __init zx_smp_prepare_cpus(unsigned int max_cpus)
94 94
95 /* Map the first 4 KB IRAM for suspend usage */ 95 /* Map the first 4 KB IRAM for suspend usage */
96 sys_iram = __arm_ioremap_exec(ZX_IRAM_BASE, PAGE_SIZE, false); 96 sys_iram = __arm_ioremap_exec(ZX_IRAM_BASE, PAGE_SIZE, false);
97 zx_secondary_startup_pa = virt_to_phys(zx_secondary_startup); 97 zx_secondary_startup_pa = __pa_symbol(zx_secondary_startup);
98 fncpy(sys_iram, &zx_resume_jump, zx_suspend_iram_sz); 98 fncpy(sys_iram, &zx_resume_jump, zx_suspend_iram_sz);
99} 99}
100 100
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 7cd9865bdeb7..caa6d5fe9078 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(zynq_cpun_start);
89 89
90static int zynq_boot_secondary(unsigned int cpu, struct task_struct *idle) 90static int zynq_boot_secondary(unsigned int cpu, struct task_struct *idle)
91{ 91{
92 return zynq_cpun_start(virt_to_phys(secondary_startup), cpu); 92 return zynq_cpun_start(__pa_symbol(secondary_startup), cpu);
93} 93}
94 94
95/* 95/*
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 35e3a56e5d86..c6c4c9c8824b 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -29,6 +29,7 @@ config CPU_ARM720T
29 select CPU_COPY_V4WT if MMU 29 select CPU_COPY_V4WT if MMU
30 select CPU_CP15_MMU 30 select CPU_CP15_MMU
31 select CPU_PABRT_LEGACY 31 select CPU_PABRT_LEGACY
32 select CPU_THUMB_CAPABLE
32 select CPU_TLB_V4WT if MMU 33 select CPU_TLB_V4WT if MMU
33 help 34 help
34 A 32-bit RISC processor with 8kByte Cache, Write Buffer and 35 A 32-bit RISC processor with 8kByte Cache, Write Buffer and
@@ -46,6 +47,7 @@ config CPU_ARM740T
46 select CPU_CACHE_V4 47 select CPU_CACHE_V4
47 select CPU_CP15_MPU 48 select CPU_CP15_MPU
48 select CPU_PABRT_LEGACY 49 select CPU_PABRT_LEGACY
50 select CPU_THUMB_CAPABLE
49 help 51 help
50 A 32-bit RISC processor with 8KB cache or 4KB variants, 52 A 32-bit RISC processor with 8KB cache or 4KB variants,
51 write buffer and MPU(Protection Unit) built around 53 write buffer and MPU(Protection Unit) built around
@@ -79,6 +81,7 @@ config CPU_ARM920T
79 select CPU_COPY_V4WB if MMU 81 select CPU_COPY_V4WB if MMU
80 select CPU_CP15_MMU 82 select CPU_CP15_MMU
81 select CPU_PABRT_LEGACY 83 select CPU_PABRT_LEGACY
84 select CPU_THUMB_CAPABLE
82 select CPU_TLB_V4WBI if MMU 85 select CPU_TLB_V4WBI if MMU
83 help 86 help
84 The ARM920T is licensed to be produced by numerous vendors, 87 The ARM920T is licensed to be produced by numerous vendors,
@@ -97,6 +100,7 @@ config CPU_ARM922T
97 select CPU_COPY_V4WB if MMU 100 select CPU_COPY_V4WB if MMU
98 select CPU_CP15_MMU 101 select CPU_CP15_MMU
99 select CPU_PABRT_LEGACY 102 select CPU_PABRT_LEGACY
103 select CPU_THUMB_CAPABLE
100 select CPU_TLB_V4WBI if MMU 104 select CPU_TLB_V4WBI if MMU
101 help 105 help
102 The ARM922T is a version of the ARM920T, but with smaller 106 The ARM922T is a version of the ARM920T, but with smaller
@@ -116,6 +120,7 @@ config CPU_ARM925T
116 select CPU_COPY_V4WB if MMU 120 select CPU_COPY_V4WB if MMU
117 select CPU_CP15_MMU 121 select CPU_CP15_MMU
118 select CPU_PABRT_LEGACY 122 select CPU_PABRT_LEGACY
123 select CPU_THUMB_CAPABLE
119 select CPU_TLB_V4WBI if MMU 124 select CPU_TLB_V4WBI if MMU
120 help 125 help
121 The ARM925T is a mix between the ARM920T and ARM926T, but with 126 The ARM925T is a mix between the ARM920T and ARM926T, but with
@@ -134,6 +139,7 @@ config CPU_ARM926T
134 select CPU_COPY_V4WB if MMU 139 select CPU_COPY_V4WB if MMU
135 select CPU_CP15_MMU 140 select CPU_CP15_MMU
136 select CPU_PABRT_LEGACY 141 select CPU_PABRT_LEGACY
142 select CPU_THUMB_CAPABLE
137 select CPU_TLB_V4WBI if MMU 143 select CPU_TLB_V4WBI if MMU
138 help 144 help
139 This is a variant of the ARM920. It has slightly different 145 This is a variant of the ARM920. It has slightly different
@@ -170,6 +176,7 @@ config CPU_ARM940T
170 select CPU_CACHE_VIVT 176 select CPU_CACHE_VIVT
171 select CPU_CP15_MPU 177 select CPU_CP15_MPU
172 select CPU_PABRT_LEGACY 178 select CPU_PABRT_LEGACY
179 select CPU_THUMB_CAPABLE
173 help 180 help
174 ARM940T is a member of the ARM9TDMI family of general- 181 ARM940T is a member of the ARM9TDMI family of general-
175 purpose microprocessors with MPU and separate 4KB 182 purpose microprocessors with MPU and separate 4KB
@@ -188,6 +195,7 @@ config CPU_ARM946E
188 select CPU_CACHE_VIVT 195 select CPU_CACHE_VIVT
189 select CPU_CP15_MPU 196 select CPU_CP15_MPU
190 select CPU_PABRT_LEGACY 197 select CPU_PABRT_LEGACY
198 select CPU_THUMB_CAPABLE
191 help 199 help
192 ARM946E-S is a member of the ARM9E-S family of high- 200 ARM946E-S is a member of the ARM9E-S family of high-
193 performance, 32-bit system-on-chip processor solutions. 201 performance, 32-bit system-on-chip processor solutions.
@@ -206,6 +214,7 @@ config CPU_ARM1020
206 select CPU_COPY_V4WB if MMU 214 select CPU_COPY_V4WB if MMU
207 select CPU_CP15_MMU 215 select CPU_CP15_MMU
208 select CPU_PABRT_LEGACY 216 select CPU_PABRT_LEGACY
217 select CPU_THUMB_CAPABLE
209 select CPU_TLB_V4WBI if MMU 218 select CPU_TLB_V4WBI if MMU
210 help 219 help
211 The ARM1020 is the 32K cached version of the ARM10 processor, 220 The ARM1020 is the 32K cached version of the ARM10 processor,
@@ -225,6 +234,7 @@ config CPU_ARM1020E
225 select CPU_COPY_V4WB if MMU 234 select CPU_COPY_V4WB if MMU
226 select CPU_CP15_MMU 235 select CPU_CP15_MMU
227 select CPU_PABRT_LEGACY 236 select CPU_PABRT_LEGACY
237 select CPU_THUMB_CAPABLE
228 select CPU_TLB_V4WBI if MMU 238 select CPU_TLB_V4WBI if MMU
229 239
230# ARM1022E 240# ARM1022E
@@ -236,6 +246,7 @@ config CPU_ARM1022
236 select CPU_COPY_V4WB if MMU # can probably do better 246 select CPU_COPY_V4WB if MMU # can probably do better
237 select CPU_CP15_MMU 247 select CPU_CP15_MMU
238 select CPU_PABRT_LEGACY 248 select CPU_PABRT_LEGACY
249 select CPU_THUMB_CAPABLE
239 select CPU_TLB_V4WBI if MMU 250 select CPU_TLB_V4WBI if MMU
240 help 251 help
241 The ARM1022E is an implementation of the ARMv5TE architecture 252 The ARM1022E is an implementation of the ARMv5TE architecture
@@ -254,6 +265,7 @@ config CPU_ARM1026
254 select CPU_COPY_V4WB if MMU # can probably do better 265 select CPU_COPY_V4WB if MMU # can probably do better
255 select CPU_CP15_MMU 266 select CPU_CP15_MMU
256 select CPU_PABRT_LEGACY 267 select CPU_PABRT_LEGACY
268 select CPU_THUMB_CAPABLE
257 select CPU_TLB_V4WBI if MMU 269 select CPU_TLB_V4WBI if MMU
258 help 270 help
259 The ARM1026EJ-S is an implementation of the ARMv5TEJ architecture 271 The ARM1026EJ-S is an implementation of the ARMv5TEJ architecture
@@ -302,6 +314,7 @@ config CPU_XSCALE
302 select CPU_CACHE_VIVT 314 select CPU_CACHE_VIVT
303 select CPU_CP15_MMU 315 select CPU_CP15_MMU
304 select CPU_PABRT_LEGACY 316 select CPU_PABRT_LEGACY
317 select CPU_THUMB_CAPABLE
305 select CPU_TLB_V4WBI if MMU 318 select CPU_TLB_V4WBI if MMU
306 319
307# XScale Core Version 3 320# XScale Core Version 3
@@ -312,6 +325,7 @@ config CPU_XSC3
312 select CPU_CACHE_VIVT 325 select CPU_CACHE_VIVT
313 select CPU_CP15_MMU 326 select CPU_CP15_MMU
314 select CPU_PABRT_LEGACY 327 select CPU_PABRT_LEGACY
328 select CPU_THUMB_CAPABLE
315 select CPU_TLB_V4WBI if MMU 329 select CPU_TLB_V4WBI if MMU
316 select IO_36 330 select IO_36
317 331
@@ -324,6 +338,7 @@ config CPU_MOHAWK
324 select CPU_COPY_V4WB if MMU 338 select CPU_COPY_V4WB if MMU
325 select CPU_CP15_MMU 339 select CPU_CP15_MMU
326 select CPU_PABRT_LEGACY 340 select CPU_PABRT_LEGACY
341 select CPU_THUMB_CAPABLE
327 select CPU_TLB_V4WBI if MMU 342 select CPU_TLB_V4WBI if MMU
328 343
329# Feroceon 344# Feroceon
@@ -335,6 +350,7 @@ config CPU_FEROCEON
335 select CPU_COPY_FEROCEON if MMU 350 select CPU_COPY_FEROCEON if MMU
336 select CPU_CP15_MMU 351 select CPU_CP15_MMU
337 select CPU_PABRT_LEGACY 352 select CPU_PABRT_LEGACY
353 select CPU_THUMB_CAPABLE
338 select CPU_TLB_FEROCEON if MMU 354 select CPU_TLB_FEROCEON if MMU
339 355
340config CPU_FEROCEON_OLD_ID 356config CPU_FEROCEON_OLD_ID
@@ -367,6 +383,7 @@ config CPU_V6
367 select CPU_CP15_MMU 383 select CPU_CP15_MMU
368 select CPU_HAS_ASID if MMU 384 select CPU_HAS_ASID if MMU
369 select CPU_PABRT_V6 385 select CPU_PABRT_V6
386 select CPU_THUMB_CAPABLE
370 select CPU_TLB_V6 if MMU 387 select CPU_TLB_V6 if MMU
371 388
372# ARMv6k 389# ARMv6k
@@ -381,6 +398,7 @@ config CPU_V6K
381 select CPU_CP15_MMU 398 select CPU_CP15_MMU
382 select CPU_HAS_ASID if MMU 399 select CPU_HAS_ASID if MMU
383 select CPU_PABRT_V6 400 select CPU_PABRT_V6
401 select CPU_THUMB_CAPABLE
384 select CPU_TLB_V6 if MMU 402 select CPU_TLB_V6 if MMU
385 403
386# ARMv7 404# ARMv7
@@ -396,6 +414,7 @@ config CPU_V7
396 select CPU_CP15_MPU if !MMU 414 select CPU_CP15_MPU if !MMU
397 select CPU_HAS_ASID if MMU 415 select CPU_HAS_ASID if MMU
398 select CPU_PABRT_V7 416 select CPU_PABRT_V7
417 select CPU_THUMB_CAPABLE
399 select CPU_TLB_V7 if MMU 418 select CPU_TLB_V7 if MMU
400 419
401# ARMv7M 420# ARMv7M
@@ -410,11 +429,17 @@ config CPU_V7M
410 429
411config CPU_THUMBONLY 430config CPU_THUMBONLY
412 bool 431 bool
432 select CPU_THUMB_CAPABLE
413 # There are no CPUs available with MMU that don't implement an ARM ISA: 433 # There are no CPUs available with MMU that don't implement an ARM ISA:
414 depends on !MMU 434 depends on !MMU
415 help 435 help
416 Select this if your CPU doesn't support the 32 bit ARM instructions. 436 Select this if your CPU doesn't support the 32 bit ARM instructions.
417 437
438config CPU_THUMB_CAPABLE
439 bool
440 help
441 Select this if your CPU can support Thumb mode.
442
418# Figure out what processor architecture version we should be using. 443# Figure out what processor architecture version we should be using.
419# This defines the compiler instruction set which depends on the machine type. 444# This defines the compiler instruction set which depends on the machine type.
420config CPU_32v3 445config CPU_32v3
@@ -655,11 +680,7 @@ config ARCH_DMA_ADDR_T_64BIT
655 680
656config ARM_THUMB 681config ARM_THUMB
657 bool "Support Thumb user binaries" if !CPU_THUMBONLY 682 bool "Support Thumb user binaries" if !CPU_THUMBONLY
658 depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || \ 683 depends on CPU_THUMB_CAPABLE
659 CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || \
660 CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || \
661 CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || \
662 CPU_V7 || CPU_FEROCEON || CPU_V7M
663 default y 684 default y
664 help 685 help
665 Say Y if you want to include kernel support for running user space 686 Say Y if you want to include kernel support for running user space
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index e8698241ece9..b3dea80715b4 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -14,6 +14,7 @@ endif
14 14
15obj-$(CONFIG_ARM_PTDUMP) += dump.o 15obj-$(CONFIG_ARM_PTDUMP) += dump.o
16obj-$(CONFIG_MODULES) += proc-syms.o 16obj-$(CONFIG_MODULES) += proc-syms.o
17obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o
17 18
18obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o 19obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o
19obj-$(CONFIG_HIGHMEM) += highmem.o 20obj-$(CONFIG_HIGHMEM) += highmem.o
diff --git a/arch/arm/mm/cache-uniphier.c b/arch/arm/mm/cache-uniphier.c
index dfe97b409916..f57b080b6fd4 100644
--- a/arch/arm/mm/cache-uniphier.c
+++ b/arch/arm/mm/cache-uniphier.c
@@ -15,6 +15,7 @@
15 15
16#define pr_fmt(fmt) "uniphier: " fmt 16#define pr_fmt(fmt) "uniphier: " fmt
17 17
18#include <linux/bitops.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/io.h> 20#include <linux/io.h>
20#include <linux/log2.h> 21#include <linux/log2.h>
@@ -71,8 +72,7 @@
71 * @ctrl_base: virtual base address of control registers 72 * @ctrl_base: virtual base address of control registers
72 * @rev_base: virtual base address of revision registers 73 * @rev_base: virtual base address of revision registers
73 * @op_base: virtual base address of operation registers 74 * @op_base: virtual base address of operation registers
74 * @way_present_mask: each bit specifies if the way is present 75 * @way_mask: each bit specifies if the way is present
75 * @way_locked_mask: each bit specifies if the way is locked
76 * @nsets: number of associativity sets 76 * @nsets: number of associativity sets
77 * @line_size: line size in bytes 77 * @line_size: line size in bytes
78 * @range_op_max_size: max size that can be handled by a single range operation 78 * @range_op_max_size: max size that can be handled by a single range operation
@@ -83,8 +83,7 @@ struct uniphier_cache_data {
83 void __iomem *rev_base; 83 void __iomem *rev_base;
84 void __iomem *op_base; 84 void __iomem *op_base;
85 void __iomem *way_ctrl_base; 85 void __iomem *way_ctrl_base;
86 u32 way_present_mask; 86 u32 way_mask;
87 u32 way_locked_mask;
88 u32 nsets; 87 u32 nsets;
89 u32 line_size; 88 u32 line_size;
90 u32 range_op_max_size; 89 u32 range_op_max_size;
@@ -234,17 +233,13 @@ static void __uniphier_cache_enable(struct uniphier_cache_data *data, bool on)
234 writel_relaxed(val, data->ctrl_base + UNIPHIER_SSCC); 233 writel_relaxed(val, data->ctrl_base + UNIPHIER_SSCC);
235} 234}
236 235
237static void __init __uniphier_cache_set_locked_ways( 236static void __init __uniphier_cache_set_active_ways(
238 struct uniphier_cache_data *data, 237 struct uniphier_cache_data *data)
239 u32 way_mask)
240{ 238{
241 unsigned int cpu; 239 unsigned int cpu;
242 240
243 data->way_locked_mask = way_mask & data->way_present_mask;
244
245 for_each_possible_cpu(cpu) 241 for_each_possible_cpu(cpu)
246 writel_relaxed(~data->way_locked_mask & data->way_present_mask, 242 writel_relaxed(data->way_mask, data->way_ctrl_base + 4 * cpu);
247 data->way_ctrl_base + 4 * cpu);
248} 243}
249 244
250static void uniphier_cache_maint_range(unsigned long start, unsigned long end, 245static void uniphier_cache_maint_range(unsigned long start, unsigned long end,
@@ -307,7 +302,7 @@ static void __init uniphier_cache_enable(void)
307 302
308 list_for_each_entry(data, &uniphier_cache_list, list) { 303 list_for_each_entry(data, &uniphier_cache_list, list) {
309 __uniphier_cache_enable(data, true); 304 __uniphier_cache_enable(data, true);
310 __uniphier_cache_set_locked_ways(data, 0); 305 __uniphier_cache_set_active_ways(data);
311 } 306 }
312} 307}
313 308
@@ -382,8 +377,8 @@ static int __init __uniphier_cache_init(struct device_node *np,
382 goto err; 377 goto err;
383 } 378 }
384 379
385 data->way_present_mask = 380 data->way_mask = GENMASK(cache_size / data->nsets / data->line_size - 1,
386 ((u32)1 << cache_size / data->nsets / data->line_size) - 1; 381 0);
387 382
388 data->ctrl_base = of_iomap(np, 0); 383 data->ctrl_base = of_iomap(np, 0);
389 if (!data->ctrl_base) { 384 if (!data->ctrl_base) {
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index e309a5e2c935..63eabb06f9f1 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -870,6 +870,9 @@ static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
870 vma->vm_end - vma->vm_start, 870 vma->vm_end - vma->vm_start,
871 vma->vm_page_prot); 871 vma->vm_page_prot);
872 } 872 }
873#else
874 ret = vm_iomap_memory(vma, vma->vm_start,
875 (vma->vm_end - vma->vm_start));
873#endif /* CONFIG_MMU */ 876#endif /* CONFIG_MMU */
874 877
875 return ret; 878 return ret;
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
index 9fe8e241335c..21192d6eda40 100644
--- a/arch/arm/mm/dump.c
+++ b/arch/arm/mm/dump.c
@@ -18,6 +18,7 @@
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19 19
20#include <asm/fixmap.h> 20#include <asm/fixmap.h>
21#include <asm/memory.h>
21#include <asm/pgtable.h> 22#include <asm/pgtable.h>
22 23
23struct addr_marker { 24struct addr_marker {
@@ -31,8 +32,8 @@ static struct addr_marker address_markers[] = {
31 { 0, "vmalloc() Area" }, 32 { 0, "vmalloc() Area" },
32 { VMALLOC_END, "vmalloc() End" }, 33 { VMALLOC_END, "vmalloc() End" },
33 { FIXADDR_START, "Fixmap Area" }, 34 { FIXADDR_START, "Fixmap Area" },
34 { CONFIG_VECTORS_BASE, "Vectors" }, 35 { VECTORS_BASE, "Vectors" },
35 { CONFIG_VECTORS_BASE + PAGE_SIZE * 2, "Vectors End" }, 36 { VECTORS_BASE + PAGE_SIZE * 2, "Vectors End" },
36 { -1, NULL }, 37 { -1, NULL },
37}; 38};
38 39
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 3cced8455727..f1e6190aa7ea 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -327,6 +327,12 @@ void flush_dcache_page(struct page *page)
327 if (page == ZERO_PAGE(0)) 327 if (page == ZERO_PAGE(0))
328 return; 328 return;
329 329
330 if (!cache_ops_need_broadcast() && cache_is_vipt_nonaliasing()) {
331 if (test_bit(PG_dcache_clean, &page->flags))
332 clear_bit(PG_dcache_clean, &page->flags);
333 return;
334 }
335
330 mapping = page_mapping(page); 336 mapping = page_mapping(page);
331 337
332 if (!cache_ops_need_broadcast() && 338 if (!cache_ops_need_broadcast() &&
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 4be0bee4c357..bf4d3bc41a7a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -27,6 +27,7 @@
27#include <asm/cp15.h> 27#include <asm/cp15.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/memblock.h> 29#include <asm/memblock.h>
30#include <asm/memory.h>
30#include <asm/prom.h> 31#include <asm/prom.h>
31#include <asm/sections.h> 32#include <asm/sections.h>
32#include <asm/setup.h> 33#include <asm/setup.h>
@@ -227,41 +228,59 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
227 return phys; 228 return phys;
228} 229}
229 230
230void __init arm_memblock_init(const struct machine_desc *mdesc) 231static void __init arm_initrd_init(void)
231{ 232{
232 /* Register the kernel text, kernel data and initrd with memblock. */
233#ifdef CONFIG_XIP_KERNEL
234 memblock_reserve(__pa(_sdata), _end - _sdata);
235#else
236 memblock_reserve(__pa(_stext), _end - _stext);
237#endif
238#ifdef CONFIG_BLK_DEV_INITRD 233#ifdef CONFIG_BLK_DEV_INITRD
234 phys_addr_t start;
235 unsigned long size;
236
239 /* FDT scan will populate initrd_start */ 237 /* FDT scan will populate initrd_start */
240 if (initrd_start && !phys_initrd_size) { 238 if (initrd_start && !phys_initrd_size) {
241 phys_initrd_start = __virt_to_phys(initrd_start); 239 phys_initrd_start = __virt_to_phys(initrd_start);
242 phys_initrd_size = initrd_end - initrd_start; 240 phys_initrd_size = initrd_end - initrd_start;
243 } 241 }
242
244 initrd_start = initrd_end = 0; 243 initrd_start = initrd_end = 0;
245 if (phys_initrd_size && 244
246 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { 245 if (!phys_initrd_size)
246 return;
247
248 /*
249 * Round the memory region to page boundaries as per free_initrd_mem()
250 * This allows us to detect whether the pages overlapping the initrd
251 * are in use, but more importantly, reserves the entire set of pages
252 * as we don't want these pages allocated for other purposes.
253 */
254 start = round_down(phys_initrd_start, PAGE_SIZE);
255 size = phys_initrd_size + (phys_initrd_start - start);
256 size = round_up(size, PAGE_SIZE);
257
258 if (!memblock_is_region_memory(start, size)) {
247 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n", 259 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n",
248 (u64)phys_initrd_start, phys_initrd_size); 260 (u64)start, size);
249 phys_initrd_start = phys_initrd_size = 0; 261 return;
250 } 262 }
251 if (phys_initrd_size && 263
252 memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) { 264 if (memblock_is_region_reserved(start, size)) {
253 pr_err("INITRD: 0x%08llx+0x%08lx overlaps in-use memory region - disabling initrd\n", 265 pr_err("INITRD: 0x%08llx+0x%08lx overlaps in-use memory region - disabling initrd\n",
254 (u64)phys_initrd_start, phys_initrd_size); 266 (u64)start, size);
255 phys_initrd_start = phys_initrd_size = 0; 267 return;
256 } 268 }
257 if (phys_initrd_size) {
258 memblock_reserve(phys_initrd_start, phys_initrd_size);
259 269
260 /* Now convert initrd to virtual addresses */ 270 memblock_reserve(start, size);
261 initrd_start = __phys_to_virt(phys_initrd_start); 271
262 initrd_end = initrd_start + phys_initrd_size; 272 /* Now convert initrd to virtual addresses */
263 } 273 initrd_start = __phys_to_virt(phys_initrd_start);
274 initrd_end = initrd_start + phys_initrd_size;
264#endif 275#endif
276}
277
278void __init arm_memblock_init(const struct machine_desc *mdesc)
279{
280 /* Register the kernel text, kernel data and initrd with memblock. */
281 memblock_reserve(__pa(KERNEL_START), KERNEL_END - KERNEL_START);
282
283 arm_initrd_init();
265 284
266 arm_mm_memblock_reserve(); 285 arm_mm_memblock_reserve();
267 286
@@ -521,8 +540,7 @@ void __init mem_init(void)
521 " .data : 0x%p" " - 0x%p" " (%4td kB)\n" 540 " .data : 0x%p" " - 0x%p" " (%4td kB)\n"
522 " .bss : 0x%p" " - 0x%p" " (%4td kB)\n", 541 " .bss : 0x%p" " - 0x%p" " (%4td kB)\n",
523 542
524 MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + 543 MLK(VECTORS_BASE, VECTORS_BASE + PAGE_SIZE),
525 (PAGE_SIZE)),
526#ifdef CONFIG_HAVE_TCM 544#ifdef CONFIG_HAVE_TCM
527 MLK(DTCM_OFFSET, (unsigned long) dtcm_end), 545 MLK(DTCM_OFFSET, (unsigned long) dtcm_end),
528 MLK(ITCM_OFFSET, (unsigned long) itcm_end), 546 MLK(ITCM_OFFSET, (unsigned long) itcm_end),
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 4001dd15818d..4e016d7f37b3 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1152,13 +1152,12 @@ early_param("vmalloc", early_vmalloc);
1152 1152
1153phys_addr_t arm_lowmem_limit __initdata = 0; 1153phys_addr_t arm_lowmem_limit __initdata = 0;
1154 1154
1155void __init sanity_check_meminfo(void) 1155void __init adjust_lowmem_bounds(void)
1156{ 1156{
1157 phys_addr_t memblock_limit = 0; 1157 phys_addr_t memblock_limit = 0;
1158 int highmem = 0;
1159 u64 vmalloc_limit; 1158 u64 vmalloc_limit;
1160 struct memblock_region *reg; 1159 struct memblock_region *reg;
1161 bool should_use_highmem = false; 1160 phys_addr_t lowmem_limit = 0;
1162 1161
1163 /* 1162 /*
1164 * Let's use our own (unoptimized) equivalent of __pa() that is 1163 * Let's use our own (unoptimized) equivalent of __pa() that is
@@ -1172,43 +1171,18 @@ void __init sanity_check_meminfo(void)
1172 for_each_memblock(memory, reg) { 1171 for_each_memblock(memory, reg) {
1173 phys_addr_t block_start = reg->base; 1172 phys_addr_t block_start = reg->base;
1174 phys_addr_t block_end = reg->base + reg->size; 1173 phys_addr_t block_end = reg->base + reg->size;
1175 phys_addr_t size_limit = reg->size;
1176 1174
1177 if (reg->base >= vmalloc_limit) 1175 if (reg->base < vmalloc_limit) {
1178 highmem = 1; 1176 if (block_end > lowmem_limit)
1179 else 1177 /*
1180 size_limit = vmalloc_limit - reg->base; 1178 * Compare as u64 to ensure vmalloc_limit does
1181 1179 * not get truncated. block_end should always
1182 1180 * fit in phys_addr_t so there should be no
1183 if (!IS_ENABLED(CONFIG_HIGHMEM) || cache_is_vipt_aliasing()) { 1181 * issue with assignment.
1184 1182 */
1185 if (highmem) { 1183 lowmem_limit = min_t(u64,
1186 pr_notice("Ignoring RAM at %pa-%pa (!CONFIG_HIGHMEM)\n", 1184 vmalloc_limit,
1187 &block_start, &block_end); 1185 block_end);
1188 memblock_remove(reg->base, reg->size);
1189 should_use_highmem = true;
1190 continue;
1191 }
1192
1193 if (reg->size > size_limit) {
1194 phys_addr_t overlap_size = reg->size - size_limit;
1195
1196 pr_notice("Truncating RAM at %pa-%pa",
1197 &block_start, &block_end);
1198 block_end = vmalloc_limit;
1199 pr_cont(" to -%pa", &block_end);
1200 memblock_remove(vmalloc_limit, overlap_size);
1201 should_use_highmem = true;
1202 }
1203 }
1204
1205 if (!highmem) {
1206 if (block_end > arm_lowmem_limit) {
1207 if (reg->size > size_limit)
1208 arm_lowmem_limit = vmalloc_limit;
1209 else
1210 arm_lowmem_limit = block_end;
1211 }
1212 1186
1213 /* 1187 /*
1214 * Find the first non-pmd-aligned page, and point 1188 * Find the first non-pmd-aligned page, and point
@@ -1227,14 +1201,13 @@ void __init sanity_check_meminfo(void)
1227 if (!IS_ALIGNED(block_start, PMD_SIZE)) 1201 if (!IS_ALIGNED(block_start, PMD_SIZE))
1228 memblock_limit = block_start; 1202 memblock_limit = block_start;
1229 else if (!IS_ALIGNED(block_end, PMD_SIZE)) 1203 else if (!IS_ALIGNED(block_end, PMD_SIZE))
1230 memblock_limit = arm_lowmem_limit; 1204 memblock_limit = lowmem_limit;
1231 } 1205 }
1232 1206
1233 } 1207 }
1234 } 1208 }
1235 1209
1236 if (should_use_highmem) 1210 arm_lowmem_limit = lowmem_limit;
1237 pr_notice("Consider using a HIGHMEM enabled kernel.\n");
1238 1211
1239 high_memory = __va(arm_lowmem_limit - 1) + 1; 1212 high_memory = __va(arm_lowmem_limit - 1) + 1;
1240 1213
@@ -1248,6 +1221,18 @@ void __init sanity_check_meminfo(void)
1248 if (!memblock_limit) 1221 if (!memblock_limit)
1249 memblock_limit = arm_lowmem_limit; 1222 memblock_limit = arm_lowmem_limit;
1250 1223
1224 if (!IS_ENABLED(CONFIG_HIGHMEM) || cache_is_vipt_aliasing()) {
1225 if (memblock_end_of_DRAM() > arm_lowmem_limit) {
1226 phys_addr_t end = memblock_end_of_DRAM();
1227
1228 pr_notice("Ignoring RAM at %pa-%pa\n",
1229 &memblock_limit, &end);
1230 pr_notice("Consider using a HIGHMEM enabled kernel.\n");
1231
1232 memblock_remove(memblock_limit, end - memblock_limit);
1233 }
1234 }
1235
1251 memblock_set_current_limit(memblock_limit); 1236 memblock_set_current_limit(memblock_limit);
1252} 1237}
1253 1238
@@ -1437,11 +1422,7 @@ static void __init kmap_init(void)
1437static void __init map_lowmem(void) 1422static void __init map_lowmem(void)
1438{ 1423{
1439 struct memblock_region *reg; 1424 struct memblock_region *reg;
1440#ifdef CONFIG_XIP_KERNEL 1425 phys_addr_t kernel_x_start = round_down(__pa(KERNEL_START), SECTION_SIZE);
1441 phys_addr_t kernel_x_start = round_down(__pa(_sdata), SECTION_SIZE);
1442#else
1443 phys_addr_t kernel_x_start = round_down(__pa(_stext), SECTION_SIZE);
1444#endif
1445 phys_addr_t kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE); 1426 phys_addr_t kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);
1446 1427
1447 /* Map all the lowmem memory banks. */ 1428 /* Map all the lowmem memory banks. */
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 2740967727e2..3b5c7aaf9c76 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12 12
13#include <asm/cacheflush.h> 13#include <asm/cacheflush.h>
14#include <asm/cp15.h>
14#include <asm/sections.h> 15#include <asm/sections.h>
15#include <asm/page.h> 16#include <asm/page.h>
16#include <asm/setup.h> 17#include <asm/setup.h>
@@ -22,6 +23,8 @@
22 23
23#include "mm.h" 24#include "mm.h"
24 25
26unsigned long vectors_base;
27
25#ifdef CONFIG_ARM_MPU 28#ifdef CONFIG_ARM_MPU
26struct mpu_rgn_info mpu_rgn_info; 29struct mpu_rgn_info mpu_rgn_info;
27 30
@@ -85,7 +88,7 @@ static unsigned long irbar_read(void)
85} 88}
86 89
87/* MPU initialisation functions */ 90/* MPU initialisation functions */
88void __init sanity_check_meminfo_mpu(void) 91void __init adjust_lowmem_bounds_mpu(void)
89{ 92{
90 phys_addr_t phys_offset = PHYS_OFFSET; 93 phys_addr_t phys_offset = PHYS_OFFSET;
91 phys_addr_t aligned_region_size, specified_mem_size, rounded_mem_size; 94 phys_addr_t aligned_region_size, specified_mem_size, rounded_mem_size;
@@ -274,19 +277,64 @@ void __init mpu_setup(void)
274 } 277 }
275} 278}
276#else 279#else
277static void sanity_check_meminfo_mpu(void) {} 280static void adjust_lowmem_bounds_mpu(void) {}
278static void __init mpu_setup(void) {} 281static void __init mpu_setup(void) {}
279#endif /* CONFIG_ARM_MPU */ 282#endif /* CONFIG_ARM_MPU */
280 283
284#ifdef CONFIG_CPU_CP15
285#ifdef CONFIG_CPU_HIGH_VECTOR
286static unsigned long __init setup_vectors_base(void)
287{
288 unsigned long reg = get_cr();
289
290 set_cr(reg | CR_V);
291 return 0xffff0000;
292}
293#else /* CONFIG_CPU_HIGH_VECTOR */
294/* Write exception base address to VBAR */
295static inline void set_vbar(unsigned long val)
296{
297 asm("mcr p15, 0, %0, c12, c0, 0" : : "r" (val) : "cc");
298}
299
300/*
301 * Security extensions, bits[7:4], permitted values,
302 * 0b0000 - not implemented, 0b0001/0b0010 - implemented
303 */
304static inline bool security_extensions_enabled(void)
305{
306 return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
307}
308
309static unsigned long __init setup_vectors_base(void)
310{
311 unsigned long base = 0, reg = get_cr();
312
313 set_cr(reg & ~CR_V);
314 if (security_extensions_enabled()) {
315 if (IS_ENABLED(CONFIG_REMAP_VECTORS_TO_RAM))
316 base = CONFIG_DRAM_BASE;
317 set_vbar(base);
318 } else if (IS_ENABLED(CONFIG_REMAP_VECTORS_TO_RAM)) {
319 if (CONFIG_DRAM_BASE != 0)
320 pr_err("Security extensions not enabled, vectors cannot be remapped to RAM, vectors base will be 0x00000000\n");
321 }
322
323 return base;
324}
325#endif /* CONFIG_CPU_HIGH_VECTOR */
326#endif /* CONFIG_CPU_CP15 */
327
281void __init arm_mm_memblock_reserve(void) 328void __init arm_mm_memblock_reserve(void)
282{ 329{
283#ifndef CONFIG_CPU_V7M 330#ifndef CONFIG_CPU_V7M
331 vectors_base = IS_ENABLED(CONFIG_CPU_CP15) ? setup_vectors_base() : 0;
284 /* 332 /*
285 * Register the exception vector page. 333 * Register the exception vector page.
286 * some architectures which the DRAM is the exception vector to trap, 334 * some architectures which the DRAM is the exception vector to trap,
287 * alloc_page breaks with error, although it is not NULL, but "0." 335 * alloc_page breaks with error, although it is not NULL, but "0."
288 */ 336 */
289 memblock_reserve(CONFIG_VECTORS_BASE, 2 * PAGE_SIZE); 337 memblock_reserve(vectors_base, 2 * PAGE_SIZE);
290#else /* ifndef CONFIG_CPU_V7M */ 338#else /* ifndef CONFIG_CPU_V7M */
291 /* 339 /*
292 * There is no dedicated vector page on V7-M. So nothing needs to be 340 * There is no dedicated vector page on V7-M. So nothing needs to be
@@ -295,10 +343,10 @@ void __init arm_mm_memblock_reserve(void)
295#endif 343#endif
296} 344}
297 345
298void __init sanity_check_meminfo(void) 346void __init adjust_lowmem_bounds(void)
299{ 347{
300 phys_addr_t end; 348 phys_addr_t end;
301 sanity_check_meminfo_mpu(); 349 adjust_lowmem_bounds_mpu();
302 end = memblock_end_of_DRAM(); 350 end = memblock_end_of_DRAM();
303 high_memory = __va(end - 1) + 1; 351 high_memory = __va(end - 1) + 1;
304 memblock_set_current_limit(end); 352 memblock_set_current_limit(end);
@@ -310,7 +358,7 @@ void __init sanity_check_meminfo(void)
310 */ 358 */
311void __init paging_init(const struct machine_desc *mdesc) 359void __init paging_init(const struct machine_desc *mdesc)
312{ 360{
313 early_trap_init((void *)CONFIG_VECTORS_BASE); 361 early_trap_init((void *)vectors_base);
314 mpu_setup(); 362 mpu_setup();
315 bootmem_init(); 363 bootmem_init();
316} 364}
diff --git a/arch/arm/mm/physaddr.c b/arch/arm/mm/physaddr.c
new file mode 100644
index 000000000000..02e60f495608
--- /dev/null
+++ b/arch/arm/mm/physaddr.c
@@ -0,0 +1,57 @@
1#include <linux/bug.h>
2#include <linux/export.h>
3#include <linux/types.h>
4#include <linux/mmdebug.h>
5#include <linux/mm.h>
6
7#include <asm/sections.h>
8#include <asm/memory.h>
9#include <asm/fixmap.h>
10#include <asm/dma.h>
11
12#include "mm.h"
13
14static inline bool __virt_addr_valid(unsigned long x)
15{
16 /*
17 * high_memory does not get immediately defined, and there
18 * are early callers of __pa() against PAGE_OFFSET
19 */
20 if (!high_memory && x >= PAGE_OFFSET)
21 return true;
22
23 if (high_memory && x >= PAGE_OFFSET && x < (unsigned long)high_memory)
24 return true;
25
26 /*
27 * MAX_DMA_ADDRESS is a virtual address that may not correspond to an
28 * actual physical address. Enough code relies on __pa(MAX_DMA_ADDRESS)
29 * that we just need to work around it and always return true.
30 */
31 if (x == MAX_DMA_ADDRESS)
32 return true;
33
34 return false;
35}
36
37phys_addr_t __virt_to_phys(unsigned long x)
38{
39 WARN(!__virt_addr_valid(x),
40 "virt_to_phys used for non-linear address: %pK (%pS)\n",
41 (void *)x, (void *)x);
42
43 return __virt_to_phys_nodebug(x);
44}
45EXPORT_SYMBOL(__virt_to_phys);
46
47phys_addr_t __phys_addr_symbol(unsigned long x)
48{
49 /* This is bounds checking against the kernel image only.
50 * __pa_symbol should only be used on kernel symbol addresses.
51 */
52 VIRTUAL_BUG_ON(x < (unsigned long)KERNEL_START ||
53 x > (unsigned long)KERNEL_END);
54
55 return __pa_symbol_nodebug(x);
56}
57EXPORT_SYMBOL(__phys_addr_symbol);
diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c
index 82bd00af5cc3..268aae45b514 100644
--- a/drivers/mtd/devices/lart.c
+++ b/drivers/mtd/devices/lart.c
@@ -75,18 +75,18 @@ static char module_name[] = "lart";
75 75
76/* blob */ 76/* blob */
77#define NUM_BLOB_BLOCKS FLASH_NUMBLOCKS_16m_PARAM 77#define NUM_BLOB_BLOCKS FLASH_NUMBLOCKS_16m_PARAM
78#define BLOB_START 0x00000000 78#define PART_BLOB_START 0x00000000
79#define BLOB_LEN (NUM_BLOB_BLOCKS * FLASH_BLOCKSIZE_PARAM) 79#define PART_BLOB_LEN (NUM_BLOB_BLOCKS * FLASH_BLOCKSIZE_PARAM)
80 80
81/* kernel */ 81/* kernel */
82#define NUM_KERNEL_BLOCKS 7 82#define NUM_KERNEL_BLOCKS 7
83#define KERNEL_START (BLOB_START + BLOB_LEN) 83#define PART_KERNEL_START (PART_BLOB_START + PART_BLOB_LEN)
84#define KERNEL_LEN (NUM_KERNEL_BLOCKS * FLASH_BLOCKSIZE_MAIN) 84#define PART_KERNEL_LEN (NUM_KERNEL_BLOCKS * FLASH_BLOCKSIZE_MAIN)
85 85
86/* initial ramdisk */ 86/* initial ramdisk */
87#define NUM_INITRD_BLOCKS 24 87#define NUM_INITRD_BLOCKS 24
88#define INITRD_START (KERNEL_START + KERNEL_LEN) 88#define PART_INITRD_START (PART_KERNEL_START + PART_KERNEL_LEN)
89#define INITRD_LEN (NUM_INITRD_BLOCKS * FLASH_BLOCKSIZE_MAIN) 89#define PART_INITRD_LEN (NUM_INITRD_BLOCKS * FLASH_BLOCKSIZE_MAIN)
90 90
91/* 91/*
92 * See section 4.0 in "3 Volt Fast Boot Block Flash Memory" Intel Datasheet 92 * See section 4.0 in "3 Volt Fast Boot Block Flash Memory" Intel Datasheet
@@ -587,20 +587,20 @@ static struct mtd_partition lart_partitions[] = {
587 /* blob */ 587 /* blob */
588 { 588 {
589 .name = "blob", 589 .name = "blob",
590 .offset = BLOB_START, 590 .offset = PART_BLOB_START,
591 .size = BLOB_LEN, 591 .size = PART_BLOB_LEN,
592 }, 592 },
593 /* kernel */ 593 /* kernel */
594 { 594 {
595 .name = "kernel", 595 .name = "kernel",
596 .offset = KERNEL_START, /* MTDPART_OFS_APPEND */ 596 .offset = PART_KERNEL_START, /* MTDPART_OFS_APPEND */
597 .size = KERNEL_LEN, 597 .size = PART_KERNEL_LEN,
598 }, 598 },
599 /* initial ramdisk / file system */ 599 /* initial ramdisk / file system */
600 { 600 {
601 .name = "file system", 601 .name = "file system",
602 .offset = INITRD_START, /* MTDPART_OFS_APPEND */ 602 .offset = PART_INITRD_START, /* MTDPART_OFS_APPEND */
603 .size = INITRD_LEN, /* MTDPART_SIZ_FULL */ 603 .size = PART_INITRD_LEN, /* MTDPART_SIZ_FULL */
604 } 604 }
605}; 605};
606#define NUM_PARTITIONS ARRAY_SIZE(lart_partitions) 606#define NUM_PARTITIONS ARRAY_SIZE(lart_partitions)