提交 4f37a68c 编写于 作者: M Martin Schwidefsky 提交者: Thomas Gleixner

s390: Use direct ktime path for s390 clockevent device

The clock comparator on s390 uses the same format as the TOD clock.
If the value in the clock comparator is smaller than the current TOD
value an interrupt is pending. Use the CLOCK_EVT_FEAT_KTIME feature
to get the unmodified ktime of the next clockevent expiration and
use it to program the clock comparator without querying the TOD clock.
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
Cc: john stultz <johnstul@us.ibm.com>
Link: http://lkml.kernel.org/r/20110823133143.153017933@de.ibm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 65516f8a
...@@ -109,10 +109,14 @@ static void fixup_clock_comparator(unsigned long long delta) ...@@ -109,10 +109,14 @@ static void fixup_clock_comparator(unsigned long long delta)
set_clock_comparator(S390_lowcore.clock_comparator); set_clock_comparator(S390_lowcore.clock_comparator);
} }
static int s390_next_event(unsigned long delta, static int s390_next_ktime(ktime_t expires,
struct clock_event_device *evt) struct clock_event_device *evt)
{ {
S390_lowcore.clock_comparator = get_clock() + delta; s64 nsecs;
nsecs = ktime_to_ns(ktime_sub(expires, ktime_get_monotonic_offset()));
do_div(nsecs, 125);
S390_lowcore.clock_comparator = TOD_UNIX_EPOCH + (nsecs << 9);
set_clock_comparator(S390_lowcore.clock_comparator); set_clock_comparator(S390_lowcore.clock_comparator);
return 0; return 0;
} }
...@@ -137,14 +141,15 @@ void init_cpu_timer(void) ...@@ -137,14 +141,15 @@ void init_cpu_timer(void)
cpu = smp_processor_id(); cpu = smp_processor_id();
cd = &per_cpu(comparators, cpu); cd = &per_cpu(comparators, cpu);
cd->name = "comparator"; cd->name = "comparator";
cd->features = CLOCK_EVT_FEAT_ONESHOT; cd->features = CLOCK_EVT_FEAT_ONESHOT |
CLOCK_EVT_FEAT_KTIME;
cd->mult = 16777; cd->mult = 16777;
cd->shift = 12; cd->shift = 12;
cd->min_delta_ns = 1; cd->min_delta_ns = 1;
cd->max_delta_ns = LONG_MAX; cd->max_delta_ns = LONG_MAX;
cd->rating = 400; cd->rating = 400;
cd->cpumask = cpumask_of(cpu); cd->cpumask = cpumask_of(cpu);
cd->set_next_event = s390_next_event; cd->set_next_ktime = s390_next_ktime;
cd->set_mode = s390_set_mode; cd->set_mode = s390_set_mode;
clockevents_register_device(cd); clockevents_register_device(cd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册