LTTng for ST40 kernel 2.6.23.1

"Giuseppe Cavallaro" <[email protected]> Tue, 30 Oct 2007 15:44:37 +0100
Newsgroups gmane.linux.kernel.tracing
Message-ID <[email protected]>
Hi Mathieu,
I've applied LTTng  (0.10.0-pre7) against the STLinux kernel
2.6.23.1<http://2.6.23.1>(for SH4 architecture).
I've had to add the ltt_add_timestamp function (patch attached) in order to
build kernel/timer.c.
I'm going to start testing LTTng on my target... so I'll let you know!

Regards,
  Giuseppe

_______________________________________________
Ltt-dev mailing list
[email protected]
http://listserv.shafik.org/mailman/listinfo/ltt-dev
lttng-timestamp-sh_new.patch (text/x-diff, 2 KB)
This patch adds the timestamping mechanism in the ltt.h arch header file.
The new timestamp functions use the TMU channel 1.

This code only works if the TMU channel 1 is initialized during the kernel boot

From: Giuseppe Cavallaro <[email protected]>
Signed-off-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: Mathieu Desnoyers <[email protected]>

--- /dev/null	2007-10-24 15:55:45.303163180 +0200
+++ linux-2.6.23.1/include/asm-sh/ltt.h	2007-10-29 22:54:22.000000000 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2007, Giuseppe Cavallaro <[email protected]>
+ *                     Mathieu Desnoyers <[email protected]>
+ *
+ * SuperH definitions for tracing system
+ */
+
+#ifndef _ASM_SH_LTT_H
+#define _ASM_SH_LTT_H
+
+#include <linux/ltt-core.h>
+#include <asm/timer.h>
+#include <asm/clock.h>
+
+#define LTT_HAS_TSC
+
+u64 ltt_heartbeat_read_synthetic_tsc(void);
+
+static inline u32 ltt_get_timestamp32(void)
+{
+	return get_cycles();
+}
+
+static inline u64 ltt_get_timestamp64(void)
+{
+	return ltt_heartbeat_read_synthetic_tsc();
+}
+
+static inline void ltt_add_timestamp(unsigned long ticks)
+{ }
+
+static inline unsigned int ltt_frequency(void)
+{
+	unsigned long rate;
+	struct clk *tmu1_clk;
+
+	tmu1_clk = clk_get(NULL, "tmu1_clk");
+	rate = (clk_get_rate(tmu1_clk));
+
+	return (unsigned int)(rate);
+}
+
+static inline u32 ltt_freq_scale(void)
+{
+	return 1;
+}
+
+#endif /* _ASM_SH_LTT_H */
--- linux-2.6.23.1/include/asm-sh/timex.h.orig	2007-10-29 22:53:50.000000000 +0100
+++ linux-2.6.23.1/include/asm-sh/timex.h	2007-10-29 22:54:14.000000000 +0100
@@ -5,13 +5,20 @@
  */
 #ifndef __ASM_SH_TIMEX_H
 #define __ASM_SH_TIMEX_H
+#ifdef CONFIG_LTT
+#include <asm/cpu/timer.h>
+#include <asm/io.h>
+#endif
 
-#define CLOCK_TICK_RATE		(CONFIG_SH_PCLK_FREQ / 4) /* Underlying HZ */
+#define CLOCK_TICK_RATE		(HZ * 100000UL)
 
 typedef unsigned long long cycles_t;
 
 static __inline__ cycles_t get_cycles (void)
 {
+#ifdef CONFIG_LTT
+	return (0xffffffff - ctrl_inl(TMU1_TCNT));
+#endif
 	return 0;
 }