Skip to content

Commit

Permalink
sched_clock: Make ARM's sched_clock generic for all architectures
Browse files Browse the repository at this point in the history
Nothing about the sched_clock implementation in the ARM port is
specific to the architecture. Generalize the code so that other
architectures can use it by selecting GENERIC_SCHED_CLOCK.

Signed-off-by: Stephen Boyd <[email protected]>
[jstultz: Merge minor collisions with other patches in my tree]
Signed-off-by: John Stultz <[email protected]>
  • Loading branch information
bebarino authored and johnstultz-work committed Jun 12, 2013
1 parent ffbfb5e commit 38ff87f
Show file tree
Hide file tree
Showing 36 changed files with 45 additions and 38 deletions.
1 change: 1 addition & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ config ARM
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
select GENERIC_PCI_IOMAP
select GENERIC_SCHED_CLOCK
select GENERIC_SMP_IDLE_THREAD
select GENERIC_IDLE_POLL_SETUP
select GENERIC_STRNCPY_FROM_USER
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/common/timer-sp.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/sched_clock.h>

#include <asm/sched_clock.h>
#include <asm/hardware/arm_timer.h>
#include <asm/hardware/timer-sp.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CFLAGS_REMOVE_return_address.o = -pg
# Object file lists.

obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \
process.o ptrace.o return_address.o sched_clock.o \
process.o ptrace.o return_address.o \
setup.o signal.o stacktrace.o sys_arm.o time.o traps.o

obj-$(CONFIG_ATAGS) += atags_parse.o
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/arch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/sched_clock.h>

#include <asm/delay.h>
#include <asm/sched_clock.h>

#include <clocksource/arm_arch_timer.h>

Expand Down
4 changes: 1 addition & 3 deletions arch/arm/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#include <linux/timer.h>
#include <linux/clocksource.h>
#include <linux/irq.h>
#include <linux/sched_clock.h>

#include <asm/thread_info.h>
#include <asm/sched_clock.h>
#include <asm/stacktrace.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
Expand Down Expand Up @@ -120,6 +120,4 @@ void __init time_init(void)
machine_desc->init_time();
else
clocksource_of_init();

sched_clock_postinit();
}
2 changes: 1 addition & 1 deletion arch/arm/mach-davinci/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/sched_clock.h>

#include <asm/sched_clock.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include <linux/clockchips.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/sched_clock.h>

#include <asm/sched_clock.h>
#include <asm/mach/time.h>

#include "common.h"
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-integrator/integrator_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <linux/stat.h>
#include <linux/sys_soc.h>
#include <linux/termios.h>
#include <linux/sched_clock.h>
#include <video/vga.h>

#include <mach/hardware.h>
Expand All @@ -49,7 +50,6 @@
#include <asm/setup.h>
#include <asm/param.h> /* HZ */
#include <asm/mach-types.h>
#include <asm/sched_clock.h>

#include <mach/lm.h>
#include <mach/irqs.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-ixp4xx/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/export.h>
#include <linux/gpio.h>
#include <linux/cpu.h>
#include <linux/sched_clock.h>

#include <mach/udc.h>
#include <mach/hardware.h>
Expand All @@ -38,7 +39,6 @@
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/irq.h>
#include <asm/sched_clock.h>
#include <asm/system_misc.h>

#include <asm/mach/map.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mmp/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/sched_clock.h>

#include <asm/sched_clock.h>
#include <mach/addr-map.h>
#include <mach/regs-timers.h>
#include <mach/regs-apbc.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-msm/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/sched_clock.h>

#include <asm/mach/time.h>
#include <asm/localtimer.h>
#include <asm/sched_clock.h>

#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap1/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
#include <linux/clocksource.h>
#include <linux/clockchips.h>
#include <linux/io.h>
#include <linux/sched_clock.h>

#include <asm/irq.h>
#include <asm/sched_clock.h>

#include <mach/hardware.h>
#include <asm/mach/irq.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/platform_data/dmtimer-omap.h>
#include <linux/sched_clock.h>

#include <asm/mach/time.h>
#include <asm/smp_twd.h>
#include <asm/sched_clock.h>

#include "omap_hwmod.h"
#include "omap_device.h"
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-pxa/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/clockchips.h>
#include <linux/sched_clock.h>

#include <asm/div64.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
#include <asm/sched_clock.h>
#include <mach/regs-ost.h>
#include <mach/irqs.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-sa1100/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include <linux/irq.h>
#include <linux/timex.h>
#include <linux/clockchips.h>
#include <linux/sched_clock.h>

#include <asm/mach/time.h>
#include <asm/sched_clock.h>
#include <mach/hardware.h>
#include <mach/irqs.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-u300/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/irq.h>
#include <linux/sched_clock.h>

#include <mach/hardware.h>
#include <mach/irqs.h>

/* Generic stuff */
#include <asm/sched_clock.h>
#include <asm/mach/map.h>
#include <asm/mach/time.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-iop/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <linux/clocksource.h>
#include <linux/clockchips.h>
#include <linux/export.h>
#include <linux/sched_clock.h>
#include <mach/hardware.h>
#include <asm/irq.h>
#include <asm/sched_clock.h>
#include <asm/uaccess.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-omap/counter_32k.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/clocksource.h>
#include <linux/sched_clock.h>

#include <asm/mach/time.h>
#include <asm/sched_clock.h>

#include <plat/counter-32k.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-orion/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <linux/clockchips.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <asm/sched_clock.h>
#include <linux/sched_clock.h>

/*
* MBus bridge block registers.
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-samsung/samsung-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
#include <linux/clk.h>
#include <linux/clockchips.h>
#include <linux/platform_device.h>
#include <linux/sched_clock.h>

#include <asm/smp_twd.h>
#include <asm/mach/time.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/sched_clock.h>

#include <mach/map.h>
#include <plat/devs.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-versatile/sched-clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/
#include <linux/kernel.h>
#include <linux/io.h>
#include <linux/sched_clock.h>

#include <asm/sched_clock.h>
#include <plat/sched_clock.h>

static void __iomem *ctr;
Expand Down
2 changes: 1 addition & 1 deletion drivers/clocksource/bcm2835_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <linux/of_platform.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/sched_clock.h>

#include <asm/sched_clock.h>
#include <asm/irq.h>

#define REG_CONTROL 0x00
Expand Down
3 changes: 1 addition & 2 deletions drivers/clocksource/clksrc-dbx500-prcmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
*/
#include <linux/clockchips.h>
#include <linux/clksrc-dbx500-prcmu.h>

#include <asm/sched_clock.h>
#include <linux/sched_clock.h>

#define RATE_32K 32768

Expand Down
3 changes: 1 addition & 2 deletions drivers/clocksource/dw_apb_timer_of.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>

#include <asm/sched_clock.h>
#include <linux/sched_clock.h>

static void timer_get_base_and_rate(struct device_node *np,
void __iomem **base, u32 *rate)
Expand Down
2 changes: 1 addition & 1 deletion drivers/clocksource/mxs_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/stmp_device.h>
#include <linux/sched_clock.h>

#include <asm/mach/time.h>
#include <asm/sched_clock.h>

/*
* There are 2 versions of the timrot on Freescale MXS-based SoCs.
Expand Down
2 changes: 1 addition & 1 deletion drivers/clocksource/nomadik-mtu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/platform_data/clocksource-nomadik-mtu.h>
#include <linux/sched_clock.h>
#include <asm/mach/time.h>
#include <asm/sched_clock.h>

/*
* The MTU device hosts four different counters, with 4 set of
Expand Down
2 changes: 1 addition & 1 deletion drivers/clocksource/samsung_pwm_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/sched_clock.h>

#include <clocksource/samsung_pwm.h>

#include <asm/sched_clock.h>

/*
* Clocksource driver
Expand Down
2 changes: 1 addition & 1 deletion drivers/clocksource/tegra20_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
#include <linux/io.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/sched_clock.h>

#include <asm/mach/time.h>
#include <asm/smp_twd.h>
#include <asm/sched_clock.h>

#define RTC_SECONDS 0x08
#define RTC_SHADOW_SECONDS 0x0c
Expand Down
2 changes: 1 addition & 1 deletion drivers/clocksource/time-armada-370-xp.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include <linux/of_address.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/sched_clock.h>

#include <asm/sched_clock.h>
#include <asm/localtimer.h>
#include <linux/percpu.h>
/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/clocksource/timer-marco.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
#include <asm/sched_clock.h>
#include <linux/sched_clock.h>
#include <asm/localtimer.h>
#include <asm/mach/time.h>

Expand Down
2 changes: 1 addition & 1 deletion drivers/clocksource/timer-prima2.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
#include <asm/sched_clock.h>
#include <linux/sched_clock.h>
#include <asm/mach/time.h>

#define SIRFSOC_TIMER_COUNTER_LO 0x0000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef ASM_SCHED_CLOCK
#define ASM_SCHED_CLOCK
#ifndef LINUX_SCHED_CLOCK
#define LINUX_SCHED_CLOCK

#ifdef CONFIG_GENERIC_SCHED_CLOCK
extern void sched_clock_postinit(void);
#else
static inline void sched_clock_postinit(void) { }
#endif

extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);

extern unsigned long long (*sched_clock_func)(void);
Expand Down
3 changes: 3 additions & 0 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,9 @@ config LOG_BUF_SHIFT
config HAVE_UNSTABLE_SCHED_CLOCK
bool

config GENERIC_SCHED_CLOCK
bool

#
# For architectures that want to enable the support for NUMA-affine scheduler
# balancing logic:
Expand Down
2 changes: 2 additions & 0 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include <linux/ptrace.h>
#include <linux/blkdev.h>
#include <linux/elevator.h>
#include <linux/sched_clock.h>

#include <asm/io.h>
#include <asm/bugs.h>
Expand Down Expand Up @@ -555,6 +556,7 @@ asmlinkage void __init start_kernel(void)
softirq_init();
timekeeping_init();
time_init();
sched_clock_postinit();
profile_init();
call_function_init();
WARN(!irqs_disabled(), "Interrupts were enabled early\n");
Expand Down
Loading

0 comments on commit 38ff87f

Please sign in to comment.