aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@mit.edu>2011-07-13 09:24:13 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2011-07-13 14:23:12 -0400
commit433bd805e5fd2c731b3a9025b034f066272d336e (patch)
tree3c319294f98d048146ba1b082241aee197c7d0cf
parent7f79ad15f33cf4968cafb0e3d2beba427de01d3a (diff)
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: Andy Lutomirski <luto@mit.edu> Link: http://lkml.kernel.org/r/3ae5ec76a168eaaae63f08a2a1060b91aa0b7759.1310563276.git.luto@mit.edu Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--arch/x86/include/asm/clocksource.h16
-rw-r--r--arch/x86/kernel/hpet.c2
-rw-r--r--arch/x86/kernel/tsc.c2
-rw-r--r--arch/x86/kernel/vsyscall_64.c2
-rw-r--r--include/asm-generic/clocksource.h4
-rw-r--r--include/linux/clocksource.h10
6 files changed, 31 insertions, 5 deletions
diff --git a/arch/x86/include/asm/clocksource.h b/arch/x86/include/asm/clocksource.h
new file mode 100644
index 000000000000..a5df33f614c9
--- /dev/null
+++ b/arch/x86/include/asm/clocksource.h
@@ -0,0 +1,16 @@
1/* x86-specific clocksource additions */
2
3#ifndef _ASM_X86_CLOCKSOURCE_H
4#define _ASM_X86_CLOCKSOURCE_H
5
6#ifdef CONFIG_X86_64
7
8#define __ARCH_HAS_CLOCKSOURCE_DATA
9
10struct arch_clocksource_data {
11 cycle_t (*vread)(void);
12};
13
14#endif /* CONFIG_X86_64 */
15
16#endif /* _ASM_X86_CLOCKSOURCE_H */
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index e9f5605e4748..0e07257bb389 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -753,7 +753,7 @@ static struct clocksource clocksource_hpet = {
753 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 753 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
754 .resume = hpet_resume_counter, 754 .resume = hpet_resume_counter,
755#ifdef CONFIG_X86_64 755#ifdef CONFIG_X86_64
756 .vread = vread_hpet, 756 .archdata = { .vread = vread_hpet },
757#endif 757#endif
758}; 758};
759 759
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 6cc6922262af..e7a74b889ab3 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -777,7 +777,7 @@ static struct clocksource clocksource_tsc = {
777 .flags = CLOCK_SOURCE_IS_CONTINUOUS | 777 .flags = CLOCK_SOURCE_IS_CONTINUOUS |
778 CLOCK_SOURCE_MUST_VERIFY, 778 CLOCK_SOURCE_MUST_VERIFY,
779#ifdef CONFIG_X86_64 779#ifdef CONFIG_X86_64
780 .vread = vread_tsc, 780 .archdata = { .vread = vread_tsc },
781#endif 781#endif
782}; 782};
783 783
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index a262400c3479..12d488fd95d9 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -74,7 +74,7 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
74 write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags); 74 write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags);
75 75
76 /* copy vsyscall data */ 76 /* copy vsyscall data */
77 vsyscall_gtod_data.clock.vread = clock->vread; 77 vsyscall_gtod_data.clock.vread = clock->archdata.vread;
78 vsyscall_gtod_data.clock.cycle_last = clock->cycle_last; 78 vsyscall_gtod_data.clock.cycle_last = clock->cycle_last;
79 vsyscall_gtod_data.clock.mask = clock->mask; 79 vsyscall_gtod_data.clock.mask = clock->mask;
80 vsyscall_gtod_data.clock.mult = mult; 80 vsyscall_gtod_data.clock.mult = mult;
diff --git a/include/asm-generic/clocksource.h b/include/asm-generic/clocksource.h
new file mode 100644
index 000000000000..0a462d3fb05e
--- /dev/null
+++ b/include/asm-generic/clocksource.h
@@ -0,0 +1,4 @@
1/*
2 * Architectures should override this file to add private userspace
3 * clock magic if needed.
4 */
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index d4646b48dc4a..0fb83c224471 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -22,6 +22,8 @@
22typedef u64 cycle_t; 22typedef u64 cycle_t;
23struct clocksource; 23struct clocksource;
24 24
25#include <asm/clocksource.h>
26
25/** 27/**
26 * struct cyclecounter - hardware abstraction for a free running counter 28 * struct cyclecounter - hardware abstraction for a free running counter
27 * Provides completely state-free accessors to the underlying hardware. 29 * Provides completely state-free accessors to the underlying hardware.
@@ -153,7 +155,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
153 * @shift: cycle to nanosecond divisor (power of two) 155 * @shift: cycle to nanosecond divisor (power of two)
154 * @max_idle_ns: max idle time permitted by the clocksource (nsecs) 156 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
155 * @flags: flags describing special properties 157 * @flags: flags describing special properties
156 * @vread: vsyscall based read 158 * @archdata: arch-specific data
157 * @suspend: suspend function for the clocksource, if necessary 159 * @suspend: suspend function for the clocksource, if necessary
158 * @resume: resume function for the clocksource, if necessary 160 * @resume: resume function for the clocksource, if necessary
159 */ 161 */
@@ -175,10 +177,14 @@ struct clocksource {
175#else 177#else
176#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0) 178#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
177#endif 179#endif
180
181#ifdef __ARCH_HAS_CLOCKSOURCE_DATA
182 struct arch_clocksource_data archdata;
183#endif
184
178 const char *name; 185 const char *name;
179 struct list_head list; 186 struct list_head list;
180 int rating; 187 int rating;
181 cycle_t (*vread)(void);
182 int (*enable)(struct clocksource *cs); 188 int (*enable)(struct clocksource *cs);
183 void (*disable)(struct clocksource *cs); 189 void (*disable)(struct clocksource *cs);
184 unsigned long flags; 190 unsigned long flags;