Commit 433bd805 authored by Andy Lutomirski's avatar Andy Lutomirski Committed by H. Peter Anvin

clocksource: Replace vread with generic arch data

The vread field was bloating struct clocksource everywhere except
x86_64, and I want to change the way this works on x86_64, so let's
split it out into per-arch data.

Cc: x86@kernel.org
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: linux-ia64@vger.kernel.org
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndy Lutomirski <luto@mit.edu>
Link: http://lkml.kernel.org/r/3ae5ec76a168eaaae63f08a2a1060b91aa0b7759.1310563276.git.luto@mit.eduSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 7f79ad15
/* x86-specific clocksource additions */
#ifndef _ASM_X86_CLOCKSOURCE_H
#define _ASM_X86_CLOCKSOURCE_H
#ifdef CONFIG_X86_64
#define __ARCH_HAS_CLOCKSOURCE_DATA
struct arch_clocksource_data {
cycle_t (*vread)(void);
};
#endif /* CONFIG_X86_64 */
#endif /* _ASM_X86_CLOCKSOURCE_H */
...@@ -753,7 +753,7 @@ static struct clocksource clocksource_hpet = { ...@@ -753,7 +753,7 @@ static struct clocksource clocksource_hpet = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
.resume = hpet_resume_counter, .resume = hpet_resume_counter,
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
.vread = vread_hpet, .archdata = { .vread = vread_hpet },
#endif #endif
}; };
......
...@@ -777,7 +777,7 @@ static struct clocksource clocksource_tsc = { ...@@ -777,7 +777,7 @@ static struct clocksource clocksource_tsc = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS | .flags = CLOCK_SOURCE_IS_CONTINUOUS |
CLOCK_SOURCE_MUST_VERIFY, CLOCK_SOURCE_MUST_VERIFY,
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
.vread = vread_tsc, .archdata = { .vread = vread_tsc },
#endif #endif
}; };
......
...@@ -74,7 +74,7 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm, ...@@ -74,7 +74,7 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags); write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags);
/* copy vsyscall data */ /* copy vsyscall data */
vsyscall_gtod_data.clock.vread = clock->vread; vsyscall_gtod_data.clock.vread = clock->archdata.vread;
vsyscall_gtod_data.clock.cycle_last = clock->cycle_last; vsyscall_gtod_data.clock.cycle_last = clock->cycle_last;
vsyscall_gtod_data.clock.mask = clock->mask; vsyscall_gtod_data.clock.mask = clock->mask;
vsyscall_gtod_data.clock.mult = mult; vsyscall_gtod_data.clock.mult = mult;
......
/*
* Architectures should override this file to add private userspace
* clock magic if needed.
*/
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
typedef u64 cycle_t; typedef u64 cycle_t;
struct clocksource; struct clocksource;
#include <asm/clocksource.h>
/** /**
* struct cyclecounter - hardware abstraction for a free running counter * struct cyclecounter - hardware abstraction for a free running counter
* Provides completely state-free accessors to the underlying hardware. * Provides completely state-free accessors to the underlying hardware.
...@@ -153,7 +155,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc, ...@@ -153,7 +155,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
* @shift: cycle to nanosecond divisor (power of two) * @shift: cycle to nanosecond divisor (power of two)
* @max_idle_ns: max idle time permitted by the clocksource (nsecs) * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
* @flags: flags describing special properties * @flags: flags describing special properties
* @vread: vsyscall based read * @archdata: arch-specific data
* @suspend: suspend function for the clocksource, if necessary * @suspend: suspend function for the clocksource, if necessary
* @resume: resume function for the clocksource, if necessary * @resume: resume function for the clocksource, if necessary
*/ */
...@@ -175,10 +177,14 @@ struct clocksource { ...@@ -175,10 +177,14 @@ struct clocksource {
#else #else
#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0) #define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
#endif #endif
#ifdef __ARCH_HAS_CLOCKSOURCE_DATA
struct arch_clocksource_data archdata;
#endif
const char *name; const char *name;
struct list_head list; struct list_head list;
int rating; int rating;
cycle_t (*vread)(void);
int (*enable)(struct clocksource *cs); int (*enable)(struct clocksource *cs);
void (*disable)(struct clocksource *cs); void (*disable)(struct clocksource *cs);
unsigned long flags; unsigned long flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment