Skip to content

Commit d6099ae

Browse files
committed
Merge branch 'fixes' of git://git.linaro.org/people/rmk/linux-arm
Pull ARM fixes from Russell King: "Some more ARM fixes, nothing particularly major here. The biggest change is to fix the SMP_ON_UP code so that it works with TI's Aegis cores" * 'fixes' of git://git.linaro.org/people/rmk/linux-arm: ARM: 7851/1: check for number of arguments in syscall_get/set_arguments() ARM: 7846/1: Update SMP_ON_UP code to detect A9MPCore with 1 CPU devices ARM: 7845/1: sharpsl_param.c: fix invalid memory access for pxa devices ARM: 7843/1: drop asm/types.h from generic-y ARM: 7842/1: MCPM: don't explode if invoked without being initialized first
2 parents 4b60667 + 3c1532d commit d6099ae

File tree

6 files changed

+44
-9
lines changed

6 files changed

+44
-9
lines changed

arch/arm/common/mcpm_entry.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ void mcpm_cpu_power_down(void)
5151
{
5252
phys_reset_t phys_reset;
5353

54-
BUG_ON(!platform_ops);
54+
if (WARN_ON_ONCE(!platform_ops || !platform_ops->power_down))
55+
return;
5556
BUG_ON(!irqs_disabled());
5657

5758
/*
@@ -93,7 +94,8 @@ void mcpm_cpu_suspend(u64 expected_residency)
9394
{
9495
phys_reset_t phys_reset;
9596

96-
BUG_ON(!platform_ops);
97+
if (WARN_ON_ONCE(!platform_ops || !platform_ops->suspend))
98+
return;
9799
BUG_ON(!irqs_disabled());
98100

99101
/* Very similar to mcpm_cpu_power_down() */

arch/arm/common/sharpsl_param.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/module.h>
1616
#include <linux/string.h>
1717
#include <asm/mach/sharpsl_param.h>
18+
#include <asm/memory.h>
1819

1920
/*
2021
* Certain hardware parameters determined at the time of device manufacture,
@@ -25,8 +26,10 @@
2526
*/
2627
#ifdef CONFIG_ARCH_SA1100
2728
#define PARAM_BASE 0xe8ffc000
29+
#define param_start(x) (void *)(x)
2830
#else
2931
#define PARAM_BASE 0xa0000a00
32+
#define param_start(x) __va(x)
3033
#endif
3134
#define MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a )
3235

@@ -41,7 +44,7 @@ EXPORT_SYMBOL(sharpsl_param);
4144

4245
void sharpsl_save_param(void)
4346
{
44-
memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info));
47+
memcpy(&sharpsl_param, param_start(PARAM_BASE), sizeof(struct sharpsl_param_info));
4548

4649
if (sharpsl_param.comadj_keyword != COMADJ_MAGIC)
4750
sharpsl_param.comadj=-1;

arch/arm/include/asm/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ generic-y += termbits.h
3131
generic-y += termios.h
3232
generic-y += timex.h
3333
generic-y += trace_clock.h
34-
generic-y += types.h
3534
generic-y += unaligned.h

arch/arm/include/asm/mcpm.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ int mcpm_cpu_power_up(unsigned int cpu, unsigned int cluster);
7676
*
7777
* This must be called with interrupts disabled.
7878
*
79-
* This does not return. Re-entry in the kernel is expected via
80-
* mcpm_entry_point.
79+
* On success this does not return. Re-entry in the kernel is expected
80+
* via mcpm_entry_point.
81+
*
82+
* This will return if mcpm_platform_register() has not been called
83+
* previously in which case the caller should take appropriate action.
8184
*/
8285
void mcpm_cpu_power_down(void);
8386

@@ -98,8 +101,11 @@ void mcpm_cpu_power_down(void);
98101
*
99102
* This must be called with interrupts disabled.
100103
*
101-
* This does not return. Re-entry in the kernel is expected via
102-
* mcpm_entry_point.
104+
* On success this does not return. Re-entry in the kernel is expected
105+
* via mcpm_entry_point.
106+
*
107+
* This will return if mcpm_platform_register() has not been called
108+
* previously in which case the caller should take appropriate action.
103109
*/
104110
void mcpm_cpu_suspend(u64 expected_residency);
105111

arch/arm/include/asm/syscall.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ static inline void syscall_get_arguments(struct task_struct *task,
5757
unsigned int i, unsigned int n,
5858
unsigned long *args)
5959
{
60+
if (n == 0)
61+
return;
62+
6063
if (i + n > SYSCALL_MAX_ARGS) {
6164
unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
6265
unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
@@ -81,6 +84,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
8184
unsigned int i, unsigned int n,
8285
const unsigned long *args)
8386
{
87+
if (n == 0)
88+
return;
89+
8490
if (i + n > SYSCALL_MAX_ARGS) {
8591
pr_warning("%s called with max args %d, handling only %d\n",
8692
__func__, i + n, SYSCALL_MAX_ARGS);

arch/arm/kernel/head.S

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,26 @@ __fixup_smp:
487487
mrc p15, 0, r0, c0, c0, 5 @ read MPIDR
488488
and r0, r0, #0xc0000000 @ multiprocessing extensions and
489489
teq r0, #0x80000000 @ not part of a uniprocessor system?
490-
moveq pc, lr @ yes, assume SMP
490+
bne __fixup_smp_on_up @ no, assume UP
491+
492+
@ Core indicates it is SMP. Check for Aegis SOC where a single
493+
@ Cortex-A9 CPU is present but SMP operations fault.
494+
mov r4, #0x41000000
495+
orr r4, r4, #0x0000c000
496+
orr r4, r4, #0x00000090
497+
teq r3, r4 @ Check for ARM Cortex-A9
498+
movne pc, lr @ Not ARM Cortex-A9,
499+
500+
@ If a future SoC *does* use 0x0 as the PERIPH_BASE, then the
501+
@ below address check will need to be #ifdef'd or equivalent
502+
@ for the Aegis platform.
503+
mrc p15, 4, r0, c15, c0 @ get SCU base address
504+
teq r0, #0x0 @ '0' on actual UP A9 hardware
505+
beq __fixup_smp_on_up @ So its an A9 UP
506+
ldr r0, [r0, #4] @ read SCU Config
507+
and r0, r0, #0x3 @ number of CPUs
508+
teq r0, #0x0 @ is 1?
509+
movne pc, lr
491510

492511
__fixup_smp_on_up:
493512
adr r0, 1f

0 commit comments

Comments
 (0)