Commit 25afa133 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/arm: ipipe: remove obsolete calibration handler

Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 9466bfd1
......@@ -19,13 +19,8 @@
*/
#include <linux/mm.h>
#include <linux/ipipe_tickdev.h>
#include <cobalt/kernel/arith.h>
#include <asm/cacheflush.h>
#include <asm/xenomai/machine.h>
#define CALIBRATION_LOOPS 10
static void mach_arm_prefault(struct vm_area_struct *vma)
{
unsigned long addr;
......@@ -43,59 +38,6 @@ static void mach_arm_prefault(struct vm_area_struct *vma)
}
}
static unsigned long mach_arm_calibrate(void)
{
unsigned long delay = (cobalt_pipeline.timer_freq + HZ / 2) / HZ;
unsigned long long start, end, sum = 0, sum_sq = 0;
unsigned long result, flags, tsc_lat;
long long diff;
int i, j;
flags = ipipe_critical_enter(NULL);
/*
* Hw interrupts off, other CPUs quiesced, no migration
* possible. We can now fiddle with the timer chip (per-cpu
* local or global, ipipe_timer_set() will handle this
* transparently).
*/
ipipe_read_tsc(start);
barrier();
ipipe_read_tsc(end);
tsc_lat = end - start;
barrier();
for (i = 0; i < CALIBRATION_LOOPS; i++) {
flush_cache_all();
for (j = 0; j < CALIBRATION_LOOPS; j++) {
ipipe_read_tsc(start);
barrier();
ipipe_timer_set(delay);
barrier();
ipipe_read_tsc(end);
diff = end - start - tsc_lat;
if (diff > 0) {
sum += diff;
sum_sq += diff * diff;
}
}
}
ipipe_critical_exit(flags);
/* Use average + standard deviation as timer programming latency. */
do_div(sum, CALIBRATION_LOOPS * CALIBRATION_LOOPS);
do_div(sum_sq, CALIBRATION_LOOPS * CALIBRATION_LOOPS);
result = sum + int_sqrt(sum_sq - sum * sum) + 1;
/*
* Reset the max trace, since it contains the calibration time
* now.
*/
ipipe_trace_max_reset();
return result;
}
static const char *const fault_labels[] = {
[IPIPE_TRAP_ACCESS] = "Data or instruction access",
[IPIPE_TRAP_SECTION] = "Section fault",
......@@ -116,7 +58,6 @@ struct cobalt_machine cobalt_machine = {
.init = NULL,
.late_init = NULL,
.cleanup = NULL,
.calibrate = mach_arm_calibrate,
.prefault = mach_arm_prefault,
.fault_labels = fault_labels,
};
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