Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257296
b: refs/heads/master
c: 433bd80
h: refs/heads/master
v: v3
  • Loading branch information
Andy Lutomirski authored and H. Peter Anvin committed Jul 13, 2011
1 parent 0d32b52 commit bc3e8bf
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7f79ad15f33cf4968cafb0e3d2beba427de01d3a
refs/heads/master: 433bd805e5fd2c731b3a9025b034f066272d336e
16 changes: 16 additions & 0 deletions trunk/arch/x86/include/asm/clocksource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* 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 */
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/hpet.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ static struct clocksource clocksource_hpet = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
.resume = hpet_resume_counter,
#ifdef CONFIG_X86_64
.vread = vread_hpet,
.archdata = { .vread = vread_hpet },
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ static struct clocksource clocksource_tsc = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS |
CLOCK_SOURCE_MUST_VERIFY,
#ifdef CONFIG_X86_64
.vread = vread_tsc,
.archdata = { .vread = vread_tsc },
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/vsyscall_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags);

/* 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.mask = clock->mask;
vsyscall_gtod_data.clock.mult = mult;
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/asm-generic/clocksource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
* Architectures should override this file to add private userspace
* clock magic if needed.
*/
10 changes: 8 additions & 2 deletions trunk/include/linux/clocksource.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
typedef u64 cycle_t;
struct clocksource;

#include <asm/clocksource.h>

/**
* struct cyclecounter - hardware abstraction for a free running counter
* Provides completely state-free accessors to the underlying hardware.
Expand Down Expand Up @@ -153,7 +155,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
* @shift: cycle to nanosecond divisor (power of two)
* @max_idle_ns: max idle time permitted by the clocksource (nsecs)
* @flags: flags describing special properties
* @vread: vsyscall based read
* @archdata: arch-specific data
* @suspend: suspend function for the clocksource, if necessary
* @resume: resume function for the clocksource, if necessary
*/
Expand All @@ -175,10 +177,14 @@ struct clocksource {
#else
#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
#endif

#ifdef __ARCH_HAS_CLOCKSOURCE_DATA
struct arch_clocksource_data archdata;
#endif

const char *name;
struct list_head list;
int rating;
cycle_t (*vread)(void);
int (*enable)(struct clocksource *cs);
void (*disable)(struct clocksource *cs);
unsigned long flags;
Expand Down

0 comments on commit bc3e8bf

Please sign in to comment.