Commit 5b617454 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/clock: pipeline: abstract clock, timer access services

Dovetail exports integrated services for proxying the host tick, which
requires no specific interface for managing the hardware timer beyond
the common clockevents interface.

Likewise, the monotonic and realtime clocks can be read directly from
the out-of-band stage via the regular kernel calls available from NMI
context (ktime_get_mono_fast_ns(), ktime_get_real_fast()).

Move the related support to the I-pipe section, we won't need it for
Dovetail.

No functional change is introduced.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 7953a63e
......@@ -20,6 +20,7 @@
#define _COBALT_KERNEL_CLOCK_H
#include <pipeline/pipeline.h>
#include <pipeline/clock.h>
#include <cobalt/kernel/list.h>
#include <cobalt/kernel/vfile.h>
#include <cobalt/uapi/kernel/types.h>
......@@ -31,6 +32,7 @@
struct xnsched;
struct xntimerdata;
struct timex;
struct xnclock_gravity {
unsigned long irq;
......@@ -128,9 +130,7 @@ xnticks_t xnclock_core_read_monotonic(void);
static inline xnticks_t xnclock_core_read_raw(void)
{
unsigned long long t;
ipipe_read_tsc(t);
return t;
return pipeline_read_cycle_counter();
}
/* We use the Linux defaults */
......
/*
* SPDX-License-Identifier: GPL-2.0
*/
#ifndef _COBALT_KERNEL_IPIPE_CLOCK_H
#define _COBALT_KERNEL_IPIPE_CLOCK_H
#include <linux/ipipe_tickdev.h>
static inline u64 pipeline_read_cycle_counter(void)
{
u64 t;
ipipe_read_tsc(t);
return t;
}
static inline void pipeline_set_timer_shot(unsigned long cycles)
{
ipipe_timer_set(cycles);
}
static inline const char *pipeline_timer_name(void)
{
return ipipe_timer_name();
}
static inline const char *pipeline_clock_name(void)
{
return ipipe_clock_name();
}
#endif /* !_COBALT_KERNEL_IPIPE_CLOCK_H */
......@@ -18,7 +18,6 @@
*/
#include <linux/percpu.h>
#include <linux/errno.h>
#include <linux/ipipe_tickdev.h>
#include <cobalt/kernel/sched.h>
#include <cobalt/kernel/timer.h>
#include <cobalt/kernel/clock.h>
......@@ -222,7 +221,7 @@ void xnclock_core_local_shot(struct xnsched *sched)
xntrace_tick((unsigned)delay);
ipipe_timer_set(delay);
pipeline_set_timer_shot(delay);
}
#ifdef CONFIG_SMP
......@@ -507,7 +506,7 @@ void print_core_clock_status(struct xnclock *clock,
#endif /* CONFIG_XENO_OPT_WATCHDOG */
xnvfile_printf(it, "%8s: timer=%s, clock=%s\n",
"devices", ipipe_timer_name(), ipipe_clock_name());
"devices", pipeline_timer_name(), pipeline_clock_name());
xnvfile_printf(it, "%8s: %s\n", "watchdog", wd_status);
xnvfile_printf(it, "%8s: %Lu\n", "setup",
xnclock_ticks_to_ns(&nkclock, nktimerlat));
......
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