Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58daf18c authored by Russell King's avatar Russell King
Browse files

Merge branch 'clksrc' into devel

Conflicts:
	arch/arm/mach-vexpress/v2m.c
	arch/arm/plat-omap/counter_32k.c
	arch/arm/plat-versatile/Makefile
parents aa312be1 0af85dda
Loading
Loading
Loading
Loading
+22 −4
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@ config ARM
	select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
	select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
	select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
	select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
	select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
	select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
	select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL)
	select HAVE_GENERIC_DMA_COHERENT
	select HAVE_GENERIC_DMA_COHERENT
	select HAVE_KERNEL_GZIP
	select HAVE_KERNEL_GZIP
	select HAVE_KERNEL_LZO
	select HAVE_KERNEL_LZO
@@ -38,6 +39,9 @@ config HAVE_PWM
config SYS_SUPPORTS_APM_EMULATION
config SYS_SUPPORTS_APM_EMULATION
	bool
	bool


config HAVE_SCHED_CLOCK
	bool

config GENERIC_GPIO
config GENERIC_GPIO
	bool
	bool


@@ -233,6 +237,7 @@ config ARCH_REALVIEW
	bool "ARM Ltd. RealView family"
	bool "ARM Ltd. RealView family"
	select ARM_AMBA
	select ARM_AMBA
	select COMMON_CLKDEV
	select COMMON_CLKDEV
	select HAVE_SCHED_CLOCK
	select ICST
	select ICST
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select ARCH_WANT_OPTIONAL_GPIOLIB
	select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -247,6 +252,7 @@ config ARCH_VERSATILE
	select ARM_AMBA
	select ARM_AMBA
	select ARM_VIC
	select ARM_VIC
	select COMMON_CLKDEV
	select COMMON_CLKDEV
	select HAVE_SCHED_CLOCK
	select ICST
	select ICST
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select ARCH_WANT_OPTIONAL_GPIOLIB
	select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -263,6 +269,7 @@ config ARCH_VEXPRESS
	select COMMON_CLKDEV
	select COMMON_CLKDEV
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select HAVE_CLK
	select HAVE_CLK
	select HAVE_SCHED_CLOCK
	select ICST
	select ICST
	select PLAT_VERSATILE
	select PLAT_VERSATILE
	help
	help
@@ -434,6 +441,7 @@ config ARCH_IXP4XX
	select CPU_XSCALE
	select CPU_XSCALE
	select GENERIC_GPIO
	select GENERIC_GPIO
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select HAVE_SCHED_CLOCK
	select DMABOUNCE if PCI
	select DMABOUNCE if PCI
	help
	help
	  Support for Intel's IXP4XX (XScale) family of processors.
	  Support for Intel's IXP4XX (XScale) family of processors.
@@ -509,6 +517,7 @@ config ARCH_MMP
	select ARCH_REQUIRE_GPIOLIB
	select ARCH_REQUIRE_GPIOLIB
	select COMMON_CLKDEV
	select COMMON_CLKDEV
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select HAVE_SCHED_CLOCK
	select TICK_ONESHOT
	select TICK_ONESHOT
	select PLAT_PXA
	select PLAT_PXA
	select SPARSE_IRQ
	select SPARSE_IRQ
@@ -565,6 +574,7 @@ config ARCH_TEGRA
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select GENERIC_GPIO
	select GENERIC_GPIO
	select HAVE_CLK
	select HAVE_CLK
	select HAVE_SCHED_CLOCK
	select COMMON_CLKDEV
	select COMMON_CLKDEV
	select ARCH_HAS_BARRIERS if CACHE_L2X0
	select ARCH_HAS_BARRIERS if CACHE_L2X0
	select ARCH_HAS_CPUFREQ
	select ARCH_HAS_CPUFREQ
@@ -588,6 +598,7 @@ config ARCH_PXA
	select COMMON_CLKDEV
	select COMMON_CLKDEV
	select ARCH_REQUIRE_GPIOLIB
	select ARCH_REQUIRE_GPIOLIB
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select HAVE_SCHED_CLOCK
	select TICK_ONESHOT
	select TICK_ONESHOT
	select PLAT_PXA
	select PLAT_PXA
	select SPARSE_IRQ
	select SPARSE_IRQ
@@ -636,6 +647,7 @@ config ARCH_SA1100
	select CPU_FREQ
	select CPU_FREQ
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select HAVE_CLK
	select HAVE_CLK
	select HAVE_SCHED_CLOCK
	select TICK_ONESHOT
	select TICK_ONESHOT
	select ARCH_REQUIRE_GPIOLIB
	select ARCH_REQUIRE_GPIOLIB
	help
	help
@@ -782,6 +794,7 @@ config ARCH_U300
	bool "ST-Ericsson U300 Series"
	bool "ST-Ericsson U300 Series"
	depends on MMU
	depends on MMU
	select CPU_ARM926T
	select CPU_ARM926T
	select HAVE_SCHED_CLOCK
	select HAVE_TCM
	select HAVE_TCM
	select ARM_AMBA
	select ARM_AMBA
	select ARM_VIC
	select ARM_VIC
@@ -830,6 +843,7 @@ config ARCH_OMAP
	select ARCH_REQUIRE_GPIOLIB
	select ARCH_REQUIRE_GPIOLIB
	select ARCH_HAS_CPUFREQ
	select ARCH_HAS_CPUFREQ
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select HAVE_SCHED_CLOCK
	select ARCH_HAS_HOLES_MEMORYMODEL
	select ARCH_HAS_HOLES_MEMORYMODEL
	help
	help
	  Support for TI's OMAP platform (OMAP1/2/3/4).
	  Support for TI's OMAP platform (OMAP1/2/3/4).
@@ -983,9 +997,11 @@ config ARCH_ACORN
config PLAT_IOP
config PLAT_IOP
	bool
	bool
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select HAVE_SCHED_CLOCK


config PLAT_ORION
config PLAT_ORION
	bool
	bool
	select HAVE_SCHED_CLOCK


config PLAT_PXA
config PLAT_PXA
	bool
	bool
@@ -1213,9 +1229,10 @@ config SMP
	depends on GENERIC_CLOCKEVENTS
	depends on GENERIC_CLOCKEVENTS
	depends on REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP || \
	depends on REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP || \
		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
		 ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4
		 ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \
		 ARCH_MSM_SCORPIONMP
	select USE_GENERIC_SMP_HELPERS
	select USE_GENERIC_SMP_HELPERS
	select HAVE_ARM_SCU
	select HAVE_ARM_SCU if !ARCH_MSM_SCORPIONMP
	help
	help
	  This enables support for systems with more than one CPU. If you have
	  This enables support for systems with more than one CPU. If you have
	  a system with only one CPU, like most personal computers, say N. If
	  a system with only one CPU, like most personal computers, say N. If
@@ -1290,6 +1307,7 @@ config NR_CPUS
config HOTPLUG_CPU
config HOTPLUG_CPU
	bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
	bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
	depends on SMP && HOTPLUG && EXPERIMENTAL
	depends on SMP && HOTPLUG && EXPERIMENTAL
	depends on !ARCH_MSM
	help
	help
	  Say Y here to experiment with turning CPUs off and on.  CPUs
	  Say Y here to experiment with turning CPUs off and on.  CPUs
	  can be controlled through /sys/devices/system/cpu.
	  can be controlled through /sys/devices/system/cpu.
@@ -1298,7 +1316,7 @@ config LOCAL_TIMERS
	bool "Use local timer interrupts"
	bool "Use local timer interrupts"
	depends on SMP
	depends on SMP
	default y
	default y
	select HAVE_ARM_TWD
	select HAVE_ARM_TWD if !ARCH_MSM_SCORPIONMP
	help
	help
	  Enable support for local timers on SMP platforms, rather then the
	  Enable support for local timers on SMP platforms, rather then the
	  legacy IPI broadcast method.  Local timers allows the system
	  legacy IPI broadcast method.  Local timers allows the system
+1 −1
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ config STRICT_DEVMEM
config FRAME_POINTER
config FRAME_POINTER
	bool
	bool
	depends on !THUMB2_KERNEL
	depends on !THUMB2_KERNEL
	default y if !ARM_UNWIND
	default y if !ARM_UNWIND || FUNCTION_GRAPH_TRACER
	help
	help
	  If you say N here, the resulting kernel will be slightly smaller and
	  If you say N here, the resulting kernel will be slightly smaller and
	  faster. However, if neither FRAME_POINTER nor ARM_UNWIND are enabled,
	  faster. However, if neither FRAME_POINTER nor ARM_UNWIND are enabled,
+1 −3
Original line number Original line Diff line number Diff line
@@ -44,7 +44,6 @@ static struct clocksource clocksource_sp804 = {
	.rating		= 200,
	.rating		= 200,
	.read		= sp804_read,
	.read		= sp804_read,
	.mask		= CLOCKSOURCE_MASK(32),
	.mask		= CLOCKSOURCE_MASK(32),
	.shift		= 20,
	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
};
};


@@ -61,8 +60,7 @@ void __init sp804_clocksource_init(void __iomem *base)
	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
		clksrc_base + TIMER_CTRL);
		clksrc_base + TIMER_CTRL);


	cs->mult = clocksource_khz2mult(TIMER_FREQ_KHZ, cs->shift);
	clocksource_register_khz(cs, TIMER_FREQ_KHZ);
	clocksource_register(cs);
}
}




+118 −0
Original line number Original line Diff line number Diff line
/*
 * sched_clock.h: support for extending counters to full 64-bit ns counter
 *
 * 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.
 */
#ifndef ASM_SCHED_CLOCK
#define ASM_SCHED_CLOCK

#include <linux/kernel.h>
#include <linux/types.h>

struct clock_data {
	u64 epoch_ns;
	u32 epoch_cyc;
	u32 epoch_cyc_copy;
	u32 mult;
	u32 shift;
};

#define DEFINE_CLOCK_DATA(name)	struct clock_data name

static inline u64 cyc_to_ns(u64 cyc, u32 mult, u32 shift)
{
	return (cyc * mult) >> shift;
}

/*
 * Atomically update the sched_clock epoch.  Your update callback will
 * be called from a timer before the counter wraps - read the current
 * counter value, and call this function to safely move the epochs
 * forward.  Only use this from the update callback.
 */
static inline void update_sched_clock(struct clock_data *cd, u32 cyc, u32 mask)
{
	unsigned long flags;
	u64 ns = cd->epoch_ns +
		cyc_to_ns((cyc - cd->epoch_cyc) & mask, cd->mult, cd->shift);

	/*
	 * Write epoch_cyc and epoch_ns in a way that the update is
	 * detectable in cyc_to_fixed_sched_clock().
	 */
	raw_local_irq_save(flags);
	cd->epoch_cyc = cyc;
	smp_wmb();
	cd->epoch_ns = ns;
	smp_wmb();
	cd->epoch_cyc_copy = cyc;
	raw_local_irq_restore(flags);
}

/*
 * If your clock rate is known at compile time, using this will allow
 * you to optimize the mult/shift loads away.  This is paired with
 * init_fixed_sched_clock() to ensure that your mult/shift are correct.
 */
static inline unsigned long long cyc_to_fixed_sched_clock(struct clock_data *cd,
	u32 cyc, u32 mask, u32 mult, u32 shift)
{
	u64 epoch_ns;
	u32 epoch_cyc;

	/*
	 * Load the epoch_cyc and epoch_ns atomically.  We do this by
	 * ensuring that we always write epoch_cyc, epoch_ns and
	 * epoch_cyc_copy in strict order, and read them in strict order.
	 * If epoch_cyc and epoch_cyc_copy are not equal, then we're in
	 * the middle of an update, and we should repeat the load.
	 */
	do {
		epoch_cyc = cd->epoch_cyc;
		smp_rmb();
		epoch_ns = cd->epoch_ns;
		smp_rmb();
	} while (epoch_cyc != cd->epoch_cyc_copy);

	return epoch_ns + cyc_to_ns((cyc - epoch_cyc) & mask, mult, shift);
}

/*
 * Otherwise, you need to use this, which will obtain the mult/shift
 * from the clock_data structure.  Use init_sched_clock() with this.
 */
static inline unsigned long long cyc_to_sched_clock(struct clock_data *cd,
	u32 cyc, u32 mask)
{
	return cyc_to_fixed_sched_clock(cd, cyc, mask, cd->mult, cd->shift);
}

/*
 * Initialize the clock data - calculate the appropriate multiplier
 * and shift.  Also setup a timer to ensure that the epoch is refreshed
 * at the appropriate time interval, which will call your update
 * handler.
 */
void init_sched_clock(struct clock_data *, void (*)(void),
	unsigned int, unsigned long);

/*
 * Use this initialization function rather than init_sched_clock() if
 * you're using cyc_to_fixed_sched_clock, which will warn if your
 * constants are incorrect.
 */
static inline void init_fixed_sched_clock(struct clock_data *cd,
	void (*update)(void), unsigned int bits, unsigned long rate,
	u32 mult, u32 shift)
{
	init_sched_clock(cd, update, bits, rate);
	if (cd->mult != mult || cd->shift != shift) {
		pr_crit("sched_clock: wrong multiply/shift: %u>>%u vs calculated %u>>%u\n"
			"sched_clock: fix multiply/shift to avoid scheduler hiccups\n",
			mult, shift, cd->mult, cd->shift);
	}
}

#endif
+5 −0
Original line number Original line Diff line number Diff line
@@ -63,6 +63,11 @@
#include <asm/outercache.h>
#include <asm/outercache.h>


#define __exception	__attribute__((section(".exception.text")))
#define __exception	__attribute__((section(".exception.text")))
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
#define __exception_irq_entry	__irq_entry
#else
#define __exception_irq_entry	__exception
#endif


struct thread_info;
struct thread_info;
struct task_struct;
struct task_struct;
Loading