Skip to content

Commit d4f4cf7

Browse files
committed
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 ...
2 parents f89db78 + 17a870b commit d4f4cf7

File tree

75 files changed

+382
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+382
-214
lines changed

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ config ARM
22
bool
33
default y
44
select ARCH_CLOCKSOURCE_DATA
5+
select ARCH_HAS_DEBUG_VIRTUAL
56
select ARCH_HAS_DEVMEM_IS_ALLOWED
67
select ARCH_HAS_ELF_RANDOMIZE
78
select ARCH_HAS_SET_MEMORY

arch/arm/Kconfig-nommu

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ config PROCESSOR_ID
3434
used instead of the auto-probing which utilizes the register.
3535

3636
config REMAP_VECTORS_TO_RAM
37-
bool 'Install vectors to the beginning of RAM' if DRAM_BASE
38-
depends on DRAM_BASE
37+
bool 'Install vectors to the beginning of RAM'
3938
help
4039
The kernel needs to change the hardware exception vectors.
4140
In nommu mode, the hardware exception vectors are normally

arch/arm/boot/compressed/decompress.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extern void error(char *);
3232

3333
/* Not needed, but used in some headers pulled in by decompressors */
3434
extern char * strstr(const char * s1, const char *s2);
35+
extern size_t strlen(const char *s);
3536

3637
#ifdef CONFIG_KERNEL_GZIP
3738
#include "../../../../lib/decompress_inflate.c"

arch/arm/common/mcpm_entry.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ extern unsigned long mcpm_entry_vectors[MAX_NR_CLUSTERS][MAX_CPUS_PER_CLUSTER];
144144

145145
void mcpm_set_entry_vector(unsigned cpu, unsigned cluster, void *ptr)
146146
{
147-
unsigned long val = ptr ? virt_to_phys(ptr) : 0;
147+
unsigned long val = ptr ? __pa_symbol(ptr) : 0;
148148
mcpm_entry_vectors[cluster][cpu] = val;
149149
sync_cache_w(&mcpm_entry_vectors[cluster][cpu]);
150150
}
@@ -299,8 +299,8 @@ void mcpm_cpu_power_down(void)
299299
* the kernel as if the power_up method just had deasserted reset
300300
* on the CPU.
301301
*/
302-
phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset);
303-
phys_reset(virt_to_phys(mcpm_entry_point));
302+
phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
303+
phys_reset(__pa_symbol(mcpm_entry_point));
304304

305305
/* should never get here */
306306
BUG();
@@ -388,8 +388,8 @@ static int __init nocache_trampoline(unsigned long _arg)
388388
__mcpm_outbound_leave_critical(cluster, CLUSTER_DOWN);
389389
__mcpm_cpu_down(cpu, cluster);
390390

391-
phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset);
392-
phys_reset(virt_to_phys(mcpm_entry_point));
391+
phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
392+
phys_reset(__pa_symbol(mcpm_entry_point));
393393
BUG();
394394
}
395395

@@ -449,7 +449,7 @@ int __init mcpm_sync_init(
449449
sync_cache_w(&mcpm_sync);
450450

451451
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);
453453
sync_cache_w(&mcpm_power_up_setup_phys);
454454
}
455455

arch/arm/include/asm/hardware/cache-uniphier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#ifndef __CACHE_UNIPHIER_H
1717
#define __CACHE_UNIPHIER_H
1818

19-
#include <linux/types.h>
19+
#include <linux/errno.h>
2020

2121
#ifdef CONFIG_CACHE_UNIPHIER
2222
int uniphier_cache_init(void);

arch/arm/include/asm/memory.h

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,15 @@
8383
#define IOREMAP_MAX_ORDER 24
8484
#endif
8585

86+
#define VECTORS_BASE UL(0xffff0000)
87+
8688
#else /* CONFIG_MMU */
8789

90+
#ifndef __ASSEMBLY__
91+
extern unsigned long vectors_base;
92+
#define VECTORS_BASE vectors_base
93+
#endif
94+
8895
/*
8996
* The limitation of user task size can grow up to the end of free ram region.
9097
* It is difficult to define and perhaps will never meet the original meaning
@@ -111,6 +118,13 @@
111118

112119
#endif /* !CONFIG_MMU */
113120

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+
114128
/*
115129
* We fix the TCM memories max 32 KiB ITCM resp DTCM at these
116130
* locations
@@ -206,7 +220,7 @@ extern const void *__pv_table_begin, *__pv_table_end;
206220
: "r" (x), "I" (__PV_BITS_31_24) \
207221
: "cc")
208222

209-
static inline phys_addr_t __virt_to_phys(unsigned long x)
223+
static inline phys_addr_t __virt_to_phys_nodebug(unsigned long x)
210224
{
211225
phys_addr_t t;
212226

@@ -238,7 +252,7 @@ static inline unsigned long __phys_to_virt(phys_addr_t x)
238252
#define PHYS_OFFSET PLAT_PHYS_OFFSET
239253
#define PHYS_PFN_OFFSET ((unsigned long)(PHYS_OFFSET >> PAGE_SHIFT))
240254

241-
static inline phys_addr_t __virt_to_phys(unsigned long x)
255+
static inline phys_addr_t __virt_to_phys_nodebug(unsigned long x)
242256
{
243257
return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET;
244258
}
@@ -254,6 +268,16 @@ static inline unsigned long __phys_to_virt(phys_addr_t x)
254268
((((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) + \
255269
PHYS_PFN_OFFSET)
256270

271+
#define __pa_symbol_nodebug(x) __virt_to_phys_nodebug((x))
272+
273+
#ifdef CONFIG_DEBUG_VIRTUAL
274+
extern phys_addr_t __virt_to_phys(unsigned long x);
275+
extern 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+
257281
/*
258282
* These are *only* valid on the kernel direct mapped RAM memory.
259283
* Note: Drivers should NOT use these. They are the wrong
@@ -276,6 +300,7 @@ static inline void *phys_to_virt(phys_addr_t x)
276300
* Drivers should NOT use these either.
277301
*/
278302
#define __pa(x) __virt_to_phys((unsigned long)(x))
303+
#define __pa_symbol(x) __phys_addr_symbol(RELOC_HIDE((unsigned long)(x), 0))
279304
#define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x)))
280305
#define pfn_to_kaddr(pfn) __va((phys_addr_t)(pfn) << PAGE_SHIFT)
281306

arch/arm/include/asm/pgtable-nommu.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ typedef pte_t *pte_addr_t;
6363
/*
6464
* Mark the prot value as uncacheable and unbufferable.
6565
*/
66-
#define pgprot_noncached(prot) __pgprot(0)
67-
#define pgprot_writecombine(prot) __pgprot(0)
68-
#define pgprot_dmacoherent(prot) __pgprot(0)
66+
#define pgprot_noncached(prot) (prot)
67+
#define pgprot_writecombine(prot) (prot)
68+
#define pgprot_dmacoherent(prot) (prot)
6969

7070

7171
/*

arch/arm/kernel/head-nommu.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,6 @@ __after_proc_init:
151151
#endif
152152
#ifdef CONFIG_CPU_ICACHE_DISABLE
153153
bic r0, r0, #CR_I
154-
#endif
155-
#ifdef CONFIG_CPU_HIGH_VECTOR
156-
orr r0, r0, #CR_V
157-
#else
158-
bic r0, r0, #CR_V
159154
#endif
160155
mcr p15, 0, r0, c1, c0, 0 @ write control reg
161156
#elif defined (CONFIG_CPU_V7M)

arch/arm/kernel/module.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,17 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
155155
break;
156156

157157
case R_ARM_PREL31:
158-
offset = *(u32 *)loc + sym->st_value - loc;
159-
*(u32 *)loc = offset & 0x7fffffff;
158+
offset = (*(s32 *)loc << 1) >> 1; /* sign extend */
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;
160169
break;
161170

162171
case R_ARM_MOVW_ABS_NC:

arch/arm/kernel/setup.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ __setup("fpe=", fpe_setup);
8181
extern void init_default_cache_policy(unsigned long);
8282
extern void paging_init(const struct machine_desc *desc);
8383
extern void early_paging_init(const struct machine_desc *);
84-
extern void sanity_check_meminfo(void);
84+
extern void adjust_lowmem_bounds(void);
8585
extern enum reboot_mode reboot_mode;
8686
extern void setup_dma_zone(const struct machine_desc *desc);
8787

@@ -1093,8 +1093,14 @@ void __init setup_arch(char **cmdline_p)
10931093
setup_dma_zone(mdesc);
10941094
xen_early_init();
10951095
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();
10971101
arm_memblock_init(mdesc);
1102+
/* Memory may have been removed so recalculate the bounds. */
1103+
adjust_lowmem_bounds();
10981104

10991105
early_ioremap_reset();
11001106

0 commit comments

Comments
 (0)