Skip to content

Commit

Permalink
Merge branch 'for-rmk/arch-timer-cleanups' of git://linux-arm.org/lin…
Browse files Browse the repository at this point in the history
…ux-mr into devel-stable

Please pull these arch_timer cleanups I've been holding onto for a while.
They're the same as my last posting [1], but have been rebased to v3.10-rc3.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2013-May/170602.html
-- Mark Rutland
  • Loading branch information
Russell King committed Jun 18, 2013
2 parents 3fbd55e + 3f71be2 commit fd8957a
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 43 deletions.
9 changes: 0 additions & 9 deletions arch/arm/include/asm/arch_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,6 @@ static inline u32 arch_timer_get_cntfrq(void)
return val;
}

static inline u64 arch_counter_get_cntpct(void)
{
u64 cval;

isb();
asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval));
return cval;
}

static inline u64 arch_counter_get_cntvct(void)
{
u64 cval;
Expand Down
7 changes: 7 additions & 0 deletions arch/arm/kernel/hyp-stub.S
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ THUMB( orr r7, #(1 << 30) ) @ HSCTLR.TE
mrc p15, 4, r7, c14, c1, 0 @ CNTHCTL
orr r7, r7, #3 @ PL1PCEN | PL1PCTEN
mcr p15, 4, r7, c14, c1, 0 @ CNTHCTL
mov r7, #0
mcrr p15, 4, r7, r7, c14 @ CNTVOFF

@ Disable virtual timer in case it was counting
mrc p15, 0, r7, c14, c3, 1 @ CNTV_CTL
bic r7, #1 @ Clear ENABLE
mcr p15, 0, r7, c14, c3, 1 @ CNTV_CTL
1:
#endif

Expand Down
4 changes: 4 additions & 0 deletions arch/arm/kvm/interrupts_head.S
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,10 @@ vcpu .req r0 @ vcpu pointer always in r0
add r5, vcpu, r4
strd r2, r3, [r5]

@ Ensure host CNTVCT == CNTPCT
mov r2, #0
mcrr p15, 4, r2, r2, c14 @ CNTVOFF

1:
#endif
@ Allow physical timer/counter access for the host
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-exynos/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ config SOC_EXYNOS5440
default y
depends on ARCH_EXYNOS5
select ARCH_HAS_OPP
select ARM_ARCH_TIMER
select HAVE_ARM_ARCH_TIMER
select AUTO_ZRELADDR
select PINCTRL
select PINCTRL_EXYNOS5440
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-shmobile/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ config ARCH_R8A73A4
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARM_GIC
select CPU_V7
select ARM_ARCH_TIMER
select HAVE_ARM_ARCH_TIMER
select SH_CLK_CPG
select RENESAS_IRQC

Expand Down Expand Up @@ -56,7 +56,7 @@ config ARCH_R8A7790
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARM_GIC
select CPU_V7
select ARM_ARCH_TIMER
select HAVE_ARM_ARCH_TIMER
select SH_CLK_CPG
select RENESAS_IRQC

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-tegra/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ config ARCH_TEGRA_3x_SOC

config ARCH_TEGRA_114_SOC
bool "Enable support for Tegra114 family"
select ARM_ARCH_TIMER
select HAVE_ARM_ARCH_TIMER
select ARM_GIC
select ARM_L1_CACHE_SHIFT_6
select CPU_FREQ_TABLE if CPU_FREQ
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-virt/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ config ARCH_VIRT
bool "Dummy Virtual Machine" if ARCH_MULTI_V7
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARM_GIC
select ARM_ARCH_TIMER
select HAVE_ARM_ARCH_TIMER
select ARM_PSCI
select HAVE_SMP
select CPU_V7
Expand Down
10 changes: 0 additions & 10 deletions arch/arm64/include/asm/arch_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,6 @@ static inline void __cpuinit arch_counter_set_user_access(void)
asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
}

static inline u64 arch_counter_get_cntpct(void)
{
u64 cval;

isb();
asm volatile("mrs %0, cntpct_el0" : "=r" (cval));

return cval;
}

static inline u64 arch_counter_get_cntvct(void)
{
u64 cval;
Expand Down
23 changes: 5 additions & 18 deletions drivers/clocksource/arm_arch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,19 @@ u32 arch_timer_get_rate(void)
return arch_timer_rate;
}

/*
* Some external users of arch_timer_read_counter (e.g. sched_clock) may try to
* call it before it has been initialised. Rather than incur a performance
* penalty checking for initialisation, provide a default implementation that
* won't lead to time appearing to jump backwards.
*/
static u64 arch_timer_read_zero(void)
u64 arch_timer_read_counter(void)
{
return 0;
return arch_counter_get_cntvct();
}

u64 (*arch_timer_read_counter)(void) = arch_timer_read_zero;

static cycle_t arch_counter_read(struct clocksource *cs)
{
return arch_timer_read_counter();
return arch_counter_get_cntvct();
}

static cycle_t arch_counter_read_cc(const struct cyclecounter *cc)
{
return arch_timer_read_counter();
return arch_counter_get_cntvct();
}

static struct clocksource clocksource_counter = {
Expand Down Expand Up @@ -287,7 +279,7 @@ static int __init arch_timer_register(void)
cyclecounter.mult = clocksource_counter.mult;
cyclecounter.shift = clocksource_counter.shift;
timecounter_init(&timecounter, &cyclecounter,
arch_counter_get_cntpct());
arch_counter_get_cntvct());

if (arch_timer_use_virtual) {
ppi = arch_timer_ppi[VIRT_PPI];
Expand Down Expand Up @@ -376,11 +368,6 @@ static void __init arch_timer_init(struct device_node *np)
}
}

if (arch_timer_use_virtual)
arch_timer_read_counter = arch_counter_get_cntvct;
else
arch_timer_read_counter = arch_counter_get_cntpct;

arch_timer_register();
arch_timer_arch_init();
}
Expand Down
2 changes: 1 addition & 1 deletion include/clocksource/arm_arch_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifdef CONFIG_ARM_ARCH_TIMER

extern u32 arch_timer_get_rate(void);
extern u64 (*arch_timer_read_counter)(void);
extern u64 arch_timer_read_counter(void);
extern struct timecounter *arch_timer_get_timecounter(void);

#else
Expand Down

0 comments on commit fd8957a

Please sign in to comment.