Skip to content

Commit 91b006d

Browse files
author
Russell King
committed
Merge branches 'audit', 'delay', 'fixes', 'misc' and 'sta2x11' into for-linus
6 parents 28a33cb + ad72254 + d0a533b + ff081e0 + 339ca09 + cb70706 commit 91b006d

69 files changed

Lines changed: 964 additions & 754 deletions

Some content is hidden

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

‎arch/arm/Kconfig‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ config ARM
4545
select GENERIC_SMP_IDLE_THREAD
4646
select KTIME_SCALAR
4747
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
48+
select GENERIC_STRNCPY_FROM_USER
49+
select GENERIC_STRNLEN_USER
50+
select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN
4851
help
4952
The ARM series is a line of low-power-consumption RISC chip designs
5053
licensed by ARM Ltd and targeted at embedded applications and
@@ -1961,6 +1964,25 @@ config ARM_ATAG_DTB_COMPAT
19611964
bootloaders, this option allows zImage to extract the information
19621965
from the ATAG list and store it at run time into the appended DTB.
19631966

1967+
choice
1968+
prompt "Kernel command line type" if ARM_ATAG_DTB_COMPAT
1969+
default ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER
1970+
1971+
config ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER
1972+
bool "Use bootloader kernel arguments if available"
1973+
help
1974+
Uses the command-line options passed by the boot loader instead of
1975+
the device tree bootargs property. If the boot loader doesn't provide
1976+
any, the device tree bootargs property will be used.
1977+
1978+
config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND
1979+
bool "Extend with bootloader kernel arguments"
1980+
help
1981+
The command-line arguments provided by the boot loader will be
1982+
appended to the the device tree bootargs property.
1983+
1984+
endchoice
1985+
19641986
config CMDLINE
19651987
string "Default kernel command string"
19661988
default ""

‎arch/arm/Kconfig.debug‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,4 +369,13 @@ config ARM_KPROBES_TEST
369369
help
370370
Perform tests of kprobes API and instruction set simulation.
371371

372+
config PID_IN_CONTEXTIDR
373+
bool "Write the current PID to the CONTEXTIDR register"
374+
depends on CPU_COPY_V6
375+
help
376+
Enabling this option causes the kernel to write the current PID to
377+
the PROCID field of the CONTEXTIDR register, at the expense of some
378+
additional instructions during context switch. Say Y here only if you
379+
are planning to use hardware trace tools with this kernel.
380+
372381
endmenu

‎arch/arm/Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#
1111
# Copyright (C) 1995-2001 by Russell King
1212

13+
# Ensure linker flags are correct
14+
LDFLAGS :=
15+
1316
LDFLAGS_vmlinux :=-p --no-undefined -X
1417
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
1518
LDFLAGS_vmlinux += --be8

‎arch/arm/boot/compressed/atags_to_fdt.c‎

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#include <asm/setup.h>
22
#include <libfdt.h>
33

4+
#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND)
5+
#define do_extend_cmdline 1
6+
#else
7+
#define do_extend_cmdline 0
8+
#endif
9+
410
static int node_offset(void *fdt, const char *node_path)
511
{
612
int offset = fdt_path_offset(fdt, node_path);
@@ -36,6 +42,48 @@ static int setprop_cell(void *fdt, const char *node_path,
3642
return fdt_setprop_cell(fdt, offset, property, val);
3743
}
3844

45+
static const void *getprop(const void *fdt, const char *node_path,
46+
const char *property, int *len)
47+
{
48+
int offset = fdt_path_offset(fdt, node_path);
49+
50+
if (offset == -FDT_ERR_NOTFOUND)
51+
return NULL;
52+
53+
return fdt_getprop(fdt, offset, property, len);
54+
}
55+
56+
static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
57+
{
58+
char cmdline[COMMAND_LINE_SIZE];
59+
const char *fdt_bootargs;
60+
char *ptr = cmdline;
61+
int len = 0;
62+
63+
/* copy the fdt command line into the buffer */
64+
fdt_bootargs = getprop(fdt, "/chosen", "bootargs", &len);
65+
if (fdt_bootargs)
66+
if (len < COMMAND_LINE_SIZE) {
67+
memcpy(ptr, fdt_bootargs, len);
68+
/* len is the length of the string
69+
* including the NULL terminator */
70+
ptr += len - 1;
71+
}
72+
73+
/* and append the ATAG_CMDLINE */
74+
if (fdt_cmdline) {
75+
len = strlen(fdt_cmdline);
76+
if (ptr - cmdline + len + 2 < COMMAND_LINE_SIZE) {
77+
*ptr++ = ' ';
78+
memcpy(ptr, fdt_cmdline, len);
79+
ptr += len;
80+
}
81+
}
82+
*ptr = '\0';
83+
84+
setprop_string(fdt, "/chosen", "bootargs", cmdline);
85+
}
86+
3987
/*
4088
* Convert and fold provided ATAGs into the provided FDT.
4189
*
@@ -72,8 +120,18 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
72120

73121
for_each_tag(atag, atag_list) {
74122
if (atag->hdr.tag == ATAG_CMDLINE) {
75-
setprop_string(fdt, "/chosen", "bootargs",
76-
atag->u.cmdline.cmdline);
123+
/* Append the ATAGS command line to the device tree
124+
* command line.
125+
* NB: This means that if the same parameter is set in
126+
* the device tree and in the tags, the one from the
127+
* tags will be chosen.
128+
*/
129+
if (do_extend_cmdline)
130+
merge_fdt_bootargs(fdt,
131+
atag->u.cmdline.cmdline);
132+
else
133+
setprop_string(fdt, "/chosen", "bootargs",
134+
atag->u.cmdline.cmdline);
77135
} else if (atag->hdr.tag == ATAG_MEM) {
78136
if (memcount >= sizeof(mem_reg_property)/4)
79137
continue;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#ifndef __ASMARM_ARCH_TIMER_H
22
#define __ASMARM_ARCH_TIMER_H
33

4+
#include <asm/errno.h>
5+
46
#ifdef CONFIG_ARM_ARCH_TIMER
7+
#define ARCH_HAS_READ_CURRENT_TIMER
58
int arch_timer_of_register(void);
69
int arch_timer_sched_clock_init(void);
710
#else

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

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,22 @@
66
#ifndef __ASM_ARM_DELAY_H
77
#define __ASM_ARM_DELAY_H
88

9+
#include <asm/memory.h>
910
#include <asm/param.h> /* HZ */
1011

11-
extern void __delay(int loops);
12+
#define MAX_UDELAY_MS 2
13+
#define UDELAY_MULT ((UL(2199023) * HZ) >> 11)
14+
#define UDELAY_SHIFT 30
15+
16+
#ifndef __ASSEMBLY__
17+
18+
extern struct arm_delay_ops {
19+
void (*delay)(unsigned long);
20+
void (*const_udelay)(unsigned long);
21+
void (*udelay)(unsigned long);
22+
} arm_delay_ops;
23+
24+
#define __delay(n) arm_delay_ops.delay(n)
1225

1326
/*
1427
* This function intentionally does not exist; if you see references to
@@ -23,22 +36,27 @@ extern void __bad_udelay(void);
2336
* division by multiplication: you don't have to worry about
2437
* loss of precision.
2538
*
26-
* Use only for very small delays ( < 1 msec). Should probably use a
39+
* Use only for very small delays ( < 2 msec). Should probably use a
2740
* lookup table, really, as the multiplications take much too long with
2841
* short delays. This is a "reasonable" implementation, though (and the
2942
* first constant multiplications gets optimized away if the delay is
3043
* a constant)
3144
*/
32-
extern void __udelay(unsigned long usecs);
33-
extern void __const_udelay(unsigned long);
34-
35-
#define MAX_UDELAY_MS 2
45+
#define __udelay(n) arm_delay_ops.udelay(n)
46+
#define __const_udelay(n) arm_delay_ops.const_udelay(n)
3647

3748
#define udelay(n) \
3849
(__builtin_constant_p(n) ? \
3950
((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \
40-
__const_udelay((n) * ((2199023U*HZ)>>11))) : \
51+
__const_udelay((n) * UDELAY_MULT)) : \
4152
__udelay(n))
4253

54+
/* Loop-based definitions for assembly code. */
55+
extern void __loop_delay(unsigned long loops);
56+
extern void __loop_udelay(unsigned long usecs);
57+
extern void __loop_const_udelay(unsigned long);
58+
59+
#endif /* __ASSEMBLY__ */
60+
4361
#endif /* defined(_ARM_DELAY_H) */
4462

0 commit comments

Comments
 (0)