Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
6de92920
Commit
6de92920
authored
Jan 04, 2019
by
Russell King
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit 'smp-hotplug^{/omap2}' into for-linus
parents
97b6f89f
07a496de
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
73 additions
and
177 deletions
+73
-177
arch/arm/mach-omap2/omap-smp.c
arch/arm/mach-omap2/omap-smp.c
+0
-20
arch/arm/mach-realview/Makefile
arch/arm/mach-realview/Makefile
+0
-1
arch/arm/mach-realview/hotplug.c
arch/arm/mach-realview/hotplug.c
+0
-111
arch/arm/mach-realview/hotplug.h
arch/arm/mach-realview/hotplug.h
+0
-1
arch/arm/mach-realview/platsmp-dt.c
arch/arm/mach-realview/platsmp-dt.c
+7
-1
arch/arm/mach-vexpress/Makefile
arch/arm/mach-vexpress/Makefile
+0
-1
arch/arm/mach-vexpress/core.h
arch/arm/mach-vexpress/core.h
+0
-2
arch/arm/mach-vexpress/platsmp.c
arch/arm/mach-vexpress/platsmp.c
+7
-0
arch/arm/plat-versatile/Makefile
arch/arm/plat-versatile/Makefile
+1
-0
arch/arm/plat-versatile/headsmp.S
arch/arm/plat-versatile/headsmp.S
+1
-1
arch/arm/plat-versatile/hotplug.c
arch/arm/plat-versatile/hotplug.c
+22
-25
arch/arm/plat-versatile/include/plat/platsmp.h
arch/arm/plat-versatile/include/plat/platsmp.h
+2
-0
arch/arm/plat-versatile/platsmp.c
arch/arm/plat-versatile/platsmp.c
+33
-14
No files found.
arch/arm/mach-omap2/omap-smp.c
View file @
6de92920
...
...
@@ -69,8 +69,6 @@ static const struct omap_smp_config omap5_cfg __initconst = {
.
startup_addr
=
omap5_secondary_startup
,
};
static
DEFINE_SPINLOCK
(
boot_lock
);
void
__iomem
*
omap4_get_scu_base
(
void
)
{
return
cfg
.
scu_base
;
...
...
@@ -173,12 +171,6 @@ static void omap4_secondary_init(unsigned int cpu)
/* Enable ACR to allow for ICUALLU workaround */
omap5_secondary_harden_predictor
();
}
/*
* Synchronise with the boot thread.
*/
spin_lock
(
&
boot_lock
);
spin_unlock
(
&
boot_lock
);
}
static
int
omap4_boot_secondary
(
unsigned
int
cpu
,
struct
task_struct
*
idle
)
...
...
@@ -187,12 +179,6 @@ static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle)
static
bool
booted
;
static
struct
powerdomain
*
cpu1_pwrdm
;
/*
* Set synchronisation state between this boot processor
* and the secondary one
*/
spin_lock
(
&
boot_lock
);
/*
* Update the AuxCoreBoot0 with boot state for secondary core.
* omap4_secondary_startup() routine will hold the secondary core till
...
...
@@ -266,12 +252,6 @@ static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle)
arch_send_wakeup_ipi_mask
(
cpumask_of
(
cpu
));
/*
* Now the secondary core is starting up let it run its
* calibrations, then wait for it to finish
*/
spin_unlock
(
&
boot_lock
);
return
0
;
}
...
...
arch/arm/mach-realview/Makefile
View file @
6de92920
...
...
@@ -5,4 +5,3 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/arch/arm/plat-versatile/inc
obj-y
+=
realview-dt.o
obj-$(CONFIG_SMP)
+=
platsmp-dt.o
obj-$(CONFIG_HOTPLUG_CPU)
+=
hotplug.o
arch/arm/mach-realview/hotplug.c
deleted
100644 → 0
View file @
97b6f89f
/*
* linux/arch/arm/mach-realview/hotplug.c
*
* Copyright (C) 2002 ARM Ltd.
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/smp.h>
#include <asm/cp15.h>
#include <asm/smp_plat.h>
static
inline
void
cpu_enter_lowpower
(
void
)
{
unsigned
int
v
;
asm
volatile
(
" mcr p15, 0, %1, c7, c5, 0
\n
"
" mcr p15, 0, %1, c7, c10, 4
\n
"
/*
* Turn off coherency
*/
" mrc p15, 0, %0, c1, c0, 1
\n
"
" bic %0, %0, #0x20
\n
"
" mcr p15, 0, %0, c1, c0, 1
\n
"
" mrc p15, 0, %0, c1, c0, 0
\n
"
" bic %0, %0, %2
\n
"
" mcr p15, 0, %0, c1, c0, 0
\n
"
:
"=&r"
(
v
)
:
"r"
(
0
),
"Ir"
(
CR_C
)
:
"cc"
);
}
static
inline
void
cpu_leave_lowpower
(
void
)
{
unsigned
int
v
;
asm
volatile
(
"mrc p15, 0, %0, c1, c0, 0
\n
"
" orr %0, %0, %1
\n
"
" mcr p15, 0, %0, c1, c0, 0
\n
"
" mrc p15, 0, %0, c1, c0, 1
\n
"
" orr %0, %0, #0x20
\n
"
" mcr p15, 0, %0, c1, c0, 1
\n
"
:
"=&r"
(
v
)
:
"Ir"
(
CR_C
)
:
"cc"
);
}
static
inline
void
platform_do_lowpower
(
unsigned
int
cpu
,
int
*
spurious
)
{
/*
* there is no power-control hardware on this platform, so all
* we can do is put the core into WFI; this is safe as the calling
* code will have already disabled interrupts
*/
for
(;;)
{
/*
* here's the WFI
*/
asm
(
".word 0xe320f003
\n
"
:
:
:
"memory"
,
"cc"
);
if
(
pen_release
==
cpu_logical_map
(
cpu
))
{
/*
* OK, proper wakeup, we're done
*/
break
;
}
/*
* Getting here, means that we have come out of WFI without
* having been woken up - this shouldn't happen
*
* Just note it happening - when we're woken, we can report
* its occurrence.
*/
(
*
spurious
)
++
;
}
}
/*
* platform-specific code to shutdown a CPU
*
* Called with IRQs disabled
*/
void
realview_cpu_die
(
unsigned
int
cpu
)
{
int
spurious
=
0
;
/*
* we're ready for shutdown now, so do it
*/
cpu_enter_lowpower
();
platform_do_lowpower
(
cpu
,
&
spurious
);
/*
* bring this CPU back into the world of cache
* coherency, and then restore interrupts
*/
cpu_leave_lowpower
();
if
(
spurious
)
pr_warn
(
"CPU%u: %u spurious wakeup calls
\n
"
,
cpu
,
spurious
);
}
arch/arm/mach-realview/hotplug.h
deleted
100644 → 0
View file @
97b6f89f
void
realview_cpu_die
(
unsigned
int
cpu
);
arch/arm/mach-realview/platsmp-dt.c
View file @
6de92920
...
...
@@ -17,7 +17,6 @@
#include <asm/smp_scu.h>
#include <plat/platsmp.h>
#include "hotplug.h"
#define REALVIEW_SYS_FLAGSSET_OFFSET 0x30
...
...
@@ -79,6 +78,13 @@ static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
__pa_symbol
(
versatile_secondary_startup
));
}
#ifdef CONFIG_HOTPLUG_CPU
static
void
realview_cpu_die
(
unsigned
int
cpu
)
{
return
versatile_immitation_cpu_die
(
cpu
,
0x20
);
}
#endif
static
const
struct
smp_operations
realview_dt_smp_ops
__initconst
=
{
.
smp_prepare_cpus
=
realview_smp_prepare_cpus
,
.
smp_secondary_init
=
versatile_secondary_init
,
...
...
arch/arm/mach-vexpress/Makefile
View file @
6de92920
...
...
@@ -15,6 +15,5 @@ obj-$(CONFIG_ARCH_VEXPRESS_TC2_PM) += tc2_pm.o
CFLAGS_tc2_pm.o
+=
-march
=
armv7-a
CFLAGS_REMOVE_tc2_pm.o
=
-pg
obj-$(CONFIG_SMP)
+=
platsmp.o
obj-$(CONFIG_HOTPLUG_CPU)
+=
hotplug.o
obj-$(CONFIG_ARCH_MPS2)
+=
v2m-mps2.o
arch/arm/mach-vexpress/core.h
View file @
6de92920
bool
vexpress_smp_init_ops
(
void
);
extern
const
struct
smp_operations
vexpress_smp_dt_ops
;
extern
void
vexpress_cpu_die
(
unsigned
int
cpu
);
arch/arm/mach-vexpress/platsmp.c
View file @
6de92920
...
...
@@ -82,6 +82,13 @@ static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
vexpress_flags_set
(
__pa_symbol
(
versatile_secondary_startup
));
}
#ifdef CONFIG_HOTPLUG_CPU
static
void
vexpress_cpu_die
(
unsigned
int
cpu
)
{
versatile_immitation_cpu_die
(
cpu
,
0x40
);
}
#endif
const
struct
smp_operations
vexpress_smp_dt_ops
__initconst
=
{
.
smp_prepare_cpus
=
vexpress_smp_dt_prepare_cpus
,
.
smp_secondary_init
=
versatile_secondary_init
,
...
...
arch/arm/plat-versatile/Makefile
View file @
6de92920
...
...
@@ -2,3 +2,4 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK)
+=
sched-clock.o
obj-$(CONFIG_SMP)
+=
headsmp.o platsmp.o
obj-$(CONFIG_HOTPLUG_CPU)
+=
hotplug.o
arch/arm/plat-versatile/headsmp.S
View file @
6de92920
...
...
@@ -37,5 +37,5 @@ pen: ldr r7, [r6]
.
align
1
:
.
long
.
.
long
pen
_release
.
long
versatile_cpu
_release
ENDPROC
(
versatile_secondary_startup
)
arch/arm/
mach-vexpress
/hotplug.c
→
arch/arm/
plat-versatile
/hotplug.c
View file @
6de92920
/*
* linux/arch/arm/mach-realview/hotplug.c
*
* Copyright (C) 2002 ARM Ltd.
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This hotplug implementation is _specific_ to the situation found on
* ARM development platforms where there is _no_ possibility of actually
* taking a CPU offline, resetting it, or otherwise. Real platforms must
* NOT copy this code.
*/
#include <linux/kernel.h>
#include <linux/errno.h>
...
...
@@ -15,9 +18,9 @@
#include <asm/smp_plat.h>
#include <asm/cp15.h>
#include
"core.h"
#include
<plat/platsmp.h>
static
inline
void
cpu_enter_lowpower
(
void
)
static
inline
void
versatile_immitation_enter_lowpower
(
unsigned
int
actrl_mask
)
{
unsigned
int
v
;
...
...
@@ -34,11 +37,11 @@ static inline void cpu_enter_lowpower(void)
" bic %0, %0, %2
\n
"
" mcr p15, 0, %0, c1, c0, 0
\n
"
:
"=&r"
(
v
)
:
"r"
(
0
),
"Ir"
(
CR_C
),
"Ir"
(
0x40
)
:
"r"
(
0
),
"Ir"
(
CR_C
),
"Ir"
(
actrl_mask
)
:
"cc"
);
}
static
inline
void
cpu_leave_lowpower
(
void
)
static
inline
void
versatile_immitation_leave_lowpower
(
unsigned
int
actrl_mask
)
{
unsigned
int
v
;
...
...
@@ -50,21 +53,23 @@ static inline void cpu_leave_lowpower(void)
" orr %0, %0, %2
\n
"
" mcr p15, 0, %0, c1, c0, 1
\n
"
:
"=&r"
(
v
)
:
"Ir"
(
CR_C
),
"Ir"
(
0x40
)
:
"Ir"
(
CR_C
),
"Ir"
(
actrl_mask
)
:
"cc"
);
}
static
inline
void
platform
_do_lowpower
(
unsigned
int
cpu
,
int
*
spurious
)
static
inline
void
versatile_immitation
_do_lowpower
(
unsigned
int
cpu
,
int
*
spurious
)
{
/*
* there is no power-control hardware on this platform, so all
* we can do is put the core into WFI; this is safe as the calling
* code will have already disabled interrupts
* code will have already disabled interrupts.
*
* This code should not be used outside Versatile platforms.
*/
for
(;;)
{
wfi
();
if
(
pen
_release
==
cpu_logical_map
(
cpu
))
{
if
(
versatile_cpu
_release
==
cpu_logical_map
(
cpu
))
{
/*
* OK, proper wakeup, we're done
*/
...
...
@@ -83,25 +88,17 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
}
/*
* platform-specific code to shutdown a CPU
*
*
Called with IRQs disabled
* platform-specific code to shutdown a CPU
.
*
This code supports immitation-style CPU hotplug for Versatile/Realview/
*
Versatile Express platforms that are unable to do real CPU hotplug.
*/
void
ve
xpress_cpu_die
(
unsigned
int
cpu
)
void
ve
rsatile_immitation_cpu_die
(
unsigned
int
cpu
,
unsigned
int
actrl_mask
)
{
int
spurious
=
0
;
/*
* we're ready for shutdown now, so do it
*/
cpu_enter_lowpower
();
platform_do_lowpower
(
cpu
,
&
spurious
);
/*
* bring this CPU back into the world of cache
* coherency, and then restore interrupts
*/
cpu_leave_lowpower
();
versatile_immitation_enter_lowpower
(
actrl_mask
);
versatile_immitation_do_lowpower
(
cpu
,
&
spurious
);
versatile_immitation_leave_lowpower
(
actrl_mask
);
if
(
spurious
)
pr_warn
(
"CPU%u: %u spurious wakeup calls
\n
"
,
cpu
,
spurious
);
...
...
arch/arm/plat-versatile/include/plat/platsmp.h
View file @
6de92920
...
...
@@ -8,7 +8,9 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
extern
volatile
int
versatile_cpu_release
;
extern
void
versatile_secondary_startup
(
void
);
extern
void
versatile_secondary_init
(
unsigned
int
cpu
);
extern
int
versatile_boot_secondary
(
unsigned
int
cpu
,
struct
task_struct
*
idle
);
void
versatile_immitation_cpu_die
(
unsigned
int
cpu
,
unsigned
int
actrl_mask
);
arch/arm/plat-versatile/platsmp.c
View file @
6de92920
...
...
@@ -7,6 +7,11 @@
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This code is specific to the hardware found on ARM Realview and
* Versatile Express platforms where the CPUs are unable to be individually
* woken, and where there is no way to hot-unplug CPUs. Real platforms
* should not copy this code.
*/
#include <linux/init.h>
#include <linux/errno.h>
...
...
@@ -21,18 +26,32 @@
#include <plat/platsmp.h>
/*
* Write pen_release in a way that is guaranteed to be visible to all
* observers, irrespective of whether they're taking part in coherency
* versatile_cpu_release controls the release of CPUs from the holding
* pen in headsmp.S, which exists because we are not always able to
* control the release of individual CPUs from the board firmware.
* Production platforms do not need this.
*/
volatile
int
versatile_cpu_release
=
-
1
;
/*
* Write versatile_cpu_release in a way that is guaranteed to be visible to
* all observers, irrespective of whether they're taking part in coherency
* or not. This is necessary for the hotplug code to work reliably.
*/
static
void
write_pen
_release
(
int
val
)
static
void
versatile_write_cpu
_release
(
int
val
)
{
pen
_release
=
val
;
versatile_cpu
_release
=
val
;
smp_wmb
();
sync_cache_w
(
&
pen
_release
);
sync_cache_w
(
&
versatile_cpu
_release
);
}
static
DEFINE_SPINLOCK
(
boot_lock
);
/*
* versatile_lock exists to avoid running the loops_per_jiffy delay loop
* calibrations on the secondary CPU while the requesting CPU is using
* the limited-bandwidth bus - which affects the calibration value.
* Production platforms do not need this.
*/
static
DEFINE_RAW_SPINLOCK
(
versatile_lock
);
void
versatile_secondary_init
(
unsigned
int
cpu
)
{
...
...
@@ -40,13 +59,13 @@ void versatile_secondary_init(unsigned int cpu)
* let the primary processor know we're out of the
* pen, then head off into the C entry point
*/
write_pen
_release
(
-
1
);
versatile_write_cpu
_release
(
-
1
);
/*
* Synchronise with the boot thread.
*/
spin_lock
(
&
boot
_lock
);
spin_unlock
(
&
boot
_lock
);
raw_spin_lock
(
&
versatile
_lock
);
raw_spin_unlock
(
&
versatile
_lock
);
}
int
versatile_boot_secondary
(
unsigned
int
cpu
,
struct
task_struct
*
idle
)
...
...
@@ -57,7 +76,7 @@ int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
* Set synchronisation state between this boot processor
* and the secondary one
*/
spin_lock
(
&
boot
_lock
);
raw_spin_lock
(
&
versatile
_lock
);
/*
* This is really belt and braces; we hold unintended secondary
...
...
@@ -65,7 +84,7 @@ int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
* since we haven't sent them a soft interrupt, they shouldn't
* be there.
*/
write_pen
_release
(
cpu_logical_map
(
cpu
));
versatile_write_cpu
_release
(
cpu_logical_map
(
cpu
));
/*
* Send the secondary CPU a soft interrupt, thereby causing
...
...
@@ -77,7 +96,7 @@ int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
timeout
=
jiffies
+
(
1
*
HZ
);
while
(
time_before
(
jiffies
,
timeout
))
{
smp_rmb
();
if
(
pen
_release
==
-
1
)
if
(
versatile_cpu
_release
==
-
1
)
break
;
udelay
(
10
);
...
...
@@ -87,7 +106,7 @@ int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
* now the secondary core is starting up let it run its
* calibrations, then wait for it to finish
*/
spin_unlock
(
&
boot
_lock
);
raw_spin_unlock
(
&
versatile
_lock
);
return
pen
_release
!=
-
1
?
-
ENOSYS
:
0
;
return
versatile_cpu
_release
!=
-
1
?
-
ENOSYS
:
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment