Skip to contentSkip to conversation

I-pipe patch for linux 2.6.19 on ARM.

Xenomai-core Gilles Chanteperdrix 2 participants 7 messages Jan 30, 2007 – Feb 6, 2007

Subsystems (16)
lore
Share & tools
lore
#0 lore raw

Hi,

here comes the I-pipe patch for linux 2.6.19 on ARM. In addition to the upgrade to linux 2.6.19, the AT91 port is improved:
- it waits for the console to be enabled or about 2 minutes before panicing if the configured frequency is wrong;
- the timer counter used as time source is chosen when configuring the kernel;
- it uses the kernel clock interface in order to enable the timer counter clock instead of tweaking directly the registers.

I have not tested the other ports, so, please test the patch on the ARM you use if you can.

Signature · 1 line
                                                 Gilles Chanteperdrix
Makefile +4 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/Makefile ipipe-2.6.19-arm/Makefile
@@ -491,6 +491,10 @@ endif
 
 include $(srctree)/arch/$(ARCH)/Makefile
 
+ifdef CONFIG_IPIPE_TRACE_MCOUNT
+CFLAGS          += -pg
+endif
+
 ifdef CONFIG_FRAME_POINTER
 CFLAGS		+= -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,)
 else
arch/arm/Kconfig +2 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/Kconfig ipipe-2.6.19-arm/arch/arm/Kconfig
@@ -487,6 +487,8 @@ config LOCAL_TIMERS
 	  accounting to be spread across the timer interval, preventing a
 	  "thundering herd" at every timer tick.
 
+source "kernel/ipipe/Kconfig"
+
 config PREEMPT
 	bool "Preemptible Kernel (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
arch/arm/boot/compressed/head.S +10 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/boot/compressed/head.S ipipe-2.6.19-arm/arch/arm/boot/compressed/head.S
@@ -833,6 +833,16 @@ memdump:	mov	r12, r0
 		mov	pc, r10
 #endif
 
+#ifdef CONFIG_IPIPE_TRACE_MCOUNT
+                .text
+                .align 0
+                .type mcount %function
+                .global mcount
+mcount:
+		mov pc, lr	@ just return
+#endif
+
+
 reloc_end:
 
 		.align
arch/arm/kernel/Makefile +2 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/kernel/Makefile ipipe-2.6.19-arm/arch/arm/kernel/Makefile
@@ -20,6 +20,8 @@ obj-$(CONFIG_ISA_DMA)		+= dma-isa.o
 obj-$(CONFIG_PCI)		+= bios32.o isa.o
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_OABI_COMPAT)	+= sys_oabi-compat.o
+obj-$(CONFIG_IPIPE)		+= ipipe.o
+obj-$(CONFIG_IPIPE_TRACE_MCOUNT)	+= ipipe-mcount.o
 
 obj-$(CONFIG_CRUNCH)		+= crunch.o crunch-bits.o
 AFLAGS_crunch-bits.o		:= -Wa,-mcpu=ep9312
arch/arm/kernel/entry-armv.S +60 -2

129 lines not on this page · raw message

arch/arm/kernel/entry-common.S +57 -9

116 lines not on this page · raw message

arch/arm/kernel/entry-header.S +9 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/kernel/entry-header.S ipipe-2.6.19-arm/arch/arm/kernel/entry-header.S
@@ -49,6 +49,15 @@
 #endif
 	.endm
 
+	.macro slow_restore_user_regs
+	ldr	r1, [sp, #S_PSR]		@ get calling cpsr
+	ldr	lr, [sp, #S_PC]!		@ get pc
+	msr	spsr_cxsf, r1			@ save in spsr_svc
+	ldmdb	sp, {r0 - lr}^			@ get calling r1 - lr
+	mov	r0, r0
+	add	sp, sp, #S_FRAME_SIZE - S_PC
+	movs	pc, lr				@ return & move spsr_svc into cpsr
+	.endm
 
 /*
  * These are the registers used in the syscall handler, and allow us to
arch/arm/kernel/ipipe-mcount.S +40 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/kernel/ipipe-mcount.S ipipe-2.6.19-arm/arch/arm/kernel/ipipe-mcount.S
@@ -0,0 +1,40 @@
+/*
+ *  linux/arch/arm/kernel/ipipe-mcount.S
+ *
+ *  Copyright (C) 2006 Sebastian Smolorz <[email protected]>, emlix GmbH
+ */
+
+#include <linux/config.h>
+
+#ifdef CONFIG_FRAME_POINTER
+
+	.text
+	.align 0
+	.type mcount %function
+	.global mcount
+
+mcount:
+
+	ldr	ip, =ipipe_trace_enable	@ leave early, if disabled
+	ldr	ip, [ip]
+	cmp	ip, #0
+	moveq	pc,lr
+
+	mov	ip,  sp
+	stmdb   sp!, {r0 - r3, fp, ip, lr, pc}	@ create stack frame
+
+	mov	r3, #0			@ no additional value (v)
+	ldr	r2, [fp, #-4]		@ get lr (the return address
+					@ of the caller of the
+					@ instrumented function)
+	mov	r1, lr			@ get lr - (the return address
+					@ of the instrumented function)
+	mov	r0, #0			@ IPIPE_TRACE_FN
+
+	sub	fp, ip, #4		@ point fp at this frame
+
+	bl	__ipipe_trace
+
+	ldmdb   fp, {r0 - r3, fp, sp, pc}	@ pop entry frame and return
+
+#endif
arch/arm/kernel/ipipe.c +507 -0

507 lines not on this page · raw message

arch/arm/kernel/irq.c +2 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/kernel/irq.c ipipe-2.6.19-arm/arch/arm/kernel/irq.c
@@ -125,8 +125,10 @@ asmlinkage void asm_do_IRQ(unsigned int 
 
 	desc_handle_irq(irq, desc);
 
+#ifndef CONFIG_IPIPE
 	/* AT91 specific workaround */
 	irq_finish(irq);
+#endif /* !CONFIG_IPIPE */
 
 	irq_exit();
 	set_irq_regs(old_regs);
arch/arm/kernel/process.c +7 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/kernel/process.c ipipe-2.6.19-arm/arch/arm/kernel/process.c
@@ -125,6 +125,12 @@ static void default_idle(void)
 		local_irq_disable();
 		if (!need_resched()) {
 			timer_dyn_reprogram();
+#ifdef CONFIG_IPIPE
+			__ipipe_unstall_root();
+#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
+			ipipe_trace_end(0x8000000E);
+#endif /* CONFIG_IPIPE_TRACE_IRQSOFF */
+#endif /* CONFIG_IPIPE */
 			arch_idle();
 		}
 		local_irq_enable();
@@ -153,6 +159,7 @@ void cpu_idle(void)
 
 		if (!idle)
 			idle = default_idle;
+ 		ipipe_suspend_domain();
 		leds_event(led_idle_start);
 		while (!need_resched())
 			idle();
arch/arm/kernel/ptrace.c +4 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/kernel/ptrace.c ipipe-2.6.19-arm/arch/arm/kernel/ptrace.c
@@ -485,6 +485,10 @@ void ptrace_break(struct task_struct *ts
 
 static int break_trap(struct pt_regs *regs, unsigned int instr)
 {
+
+	if (ipipe_trap_notify(IPIPE_TRAP_BREAK,regs))
+		return 0;
+
 	ptrace_break(current, regs);
 	return 0;
 }
arch/arm/kernel/traps.c +3 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/kernel/traps.c ipipe-2.6.19-arm/arch/arm/kernel/traps.c
@@ -306,6 +306,9 @@ asmlinkage void do_undefinstr(struct pt_
 	}
 	spin_unlock_irq(&undef_lock);
 
+	if (ipipe_trap_notify(IPIPE_TRAP_UNDEFINSTR,regs))
+		return;
+
 #ifdef CONFIG_DEBUG_USER
 	if (user_debug & UDBG_UNDEFINED) {
 		printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
arch/arm/mach-at91rm9200/Kconfig +18 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/mach-at91rm9200/Kconfig ipipe-2.6.19-arm/arch/arm/mach-at91rm9200/Kconfig
@@ -82,6 +82,24 @@ config MACH_KAFA
 	help
 	  Select this if you are using Sperry-Sun's KAFA board.
 
+config IPIPE_AT91_TC
+	depends on IPIPE
+	int "AT91 TC used as time base"
+	default 0
+	help
+	When Adeos interrupt pipeline is enabled, TC0 is used by default
+	as time base, but you can use TC1 or TC2 by setting this variable to 1
+	or 2. This should only be needed to avoid conflicts with other drivers.
+
+config IPIPE_AT91_MCK
+	depends on IPIPE
+	int "AT91 Master clock Frequency"
+	default 46080000
+	help
+	When Adeos interrupt pipeline is enabled, AT91 timer is based on
+	the AT91 master clock, whose frequency need hence to be known at
+	compilation time.
+
 endif
 
 # ----------------------------------------------------------
arch/arm/mach-at91rm9200/at91rm9200.c +7 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/mach-at91rm9200/at91rm9200.c ipipe-2.6.19-arm/arch/arm/mach-at91rm9200/at91rm9200.c
@@ -51,6 +51,13 @@ static struct map_desc at91rm9200_io_des
 		.length		= SZ_16K,
 		.type		= MT_DEVICE,
 	}, {
+#ifdef CONFIG_IPIPE
+		.virtual	= AT91_VA_BASE_TCB0,
+		.pfn		= __phys_to_pfn(AT91RM9200_BASE_TCB0),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+        }, {
+#endif /* CONFIG_IPIPE */
 		.virtual	= AT91_SRAM_VIRT_BASE,
 		.pfn		= __phys_to_pfn(AT91RM9200_SRAM_BASE),
 		.length		= AT91RM9200_SRAM_SIZE,
arch/arm/mach-at91rm9200/at91rm9200_time.c +265 -1

288 lines not on this page · raw message

arch/arm/mach-at91rm9200/gpio.c +55 -0

77 lines not on this page · raw message

arch/arm/mach-integrator/core.c +116 -48

221 lines not on this page · raw message

arch/arm/mach-integrator/integrator_cp.c +33 -1
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/mach-integrator/integrator_cp.c ipipe-2.6.19-arm/arch/arm/mach-integrator/integrator_cp.c
@@ -2,6 +2,7 @@
  *  linux/arch/arm/mach-integrator/integrator_cp.c
  *
  *  Copyright (C) 2003 Deep Blue Solutions Ltd
+ *  Copyright (C) 2005 Stelian Pop.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,6 +20,7 @@
 #include <linux/amba/bus.h>
 #include <linux/amba/kmi.h>
 #include <linux/amba/clcd.h>
+#include <linux/ipipe.h>
 
 #include <asm/hardware.h>
 #include <asm/io.h>
@@ -222,6 +224,31 @@ sic_handle_irq(unsigned int irq, struct 
 	} while (status);
 }
 
+#ifdef CONFIG_IPIPE
+void __ipipe_mach_demux_irq(unsigned irq, struct pt_regs *regs)
+{
+	unsigned long status = sic_readl(INTCP_VA_SIC_BASE + IRQ_STATUS);
+	struct irqdesc *desc_unused = irq_desc + irq;
+	unsigned irq_unused = irq;
+
+	if (status == 0) {
+		do_bad_IRQ(irq, desc_unused);
+		return;
+	}
+
+	do {
+		irq = ffs(status) - 1;
+		status &= ~(1 << irq);
+
+		irq += IRQ_SIC_START;
+
+		__ipipe_handle_irq(irq, regs);
+	} while (status);
+
+	desc_unused->chip->unmask(irq_unused);
+}
+#endif /* CONFIG_IPIPE */
+
 static void __init intcp_init_irq(void)
 {
 	unsigned int i;
@@ -568,9 +595,14 @@ static void __init intcp_init(void)
 
 #define TIMER_CTRL_IE	(1 << 5)			/* Interrupt Enable */
 
+#ifdef CONFIG_IPIPE
+unsigned int __ipipe_mach_ticks_per_jiffy = 1000000 * TICKS_PER_uSEC / HZ;
+EXPORT_SYMBOL(__ipipe_mach_ticks_per_jiffy);
+#endif
+
 static void __init intcp_timer_init(void)
 {
-	integrator_time_init(1000000 / HZ, TIMER_CTRL_IE);
+	integrator_time_init(1000000 * TICKS_PER_uSEC / HZ, TIMER_CTRL_IE);
 }
 
 static struct sys_timer cp_timer = {
arch/arm/mach-pxa/irq.c +37 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/mach-pxa/irq.c ipipe-2.6.19-arm/arch/arm/mach-pxa/irq.c
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/ptrace.h>
+#include <linux/ipipe.h>
 
 #include <asm/hardware.h>
 #include <asm/irq.h>
@@ -216,6 +217,42 @@ static void pxa_gpio_demux_handler(unsig
 	} while (loop);
 }
 
+#ifdef CONFIG_IPIPE
+void __ipipe_mach_demux_irq(unsigned irq, struct pt_regs *regs)
+{
+	struct irqdesc *desc_unused = irq_desc + irq;
+	unsigned irq_unused = irq;
+	unsigned int i, mask[4];
+	int loop;
+
+	do {
+		loop = 0;
+
+		mask[0] = GEDR0 & ~3;
+		mask[1] = GEDR1;
+		mask[2] = GEDR2;
+#if PXA_LAST_GPIO < 96
+		i = 3;
+#else /* PXA_LAST_GPIO >= 96 */
+		mask[3] = GEDR3;
+		i = 4;
+#endif /* PXA_LAST_GPIO >= 96 */
+		for (; i; i--) {
+			loop |= mask[i - 1];
+			while (mask[i - 1]) {
+				irq = fls(mask[i - 1]) - 1;
+				mask[i - 1] &= ~(1 << irq);
+				irq = IRQ_GPIO((i - 1) * 32 + irq);
+
+				__ipipe_handle_irq(irq, regs);
+			}
+		}
+	} while (loop);
+
+	desc_unused->chip->unmask(irq_unused);
+}
+#endif /* CONFIG_IPIPE */
+
 static void pxa_ack_muxed_gpio(unsigned int irq)
 {
 	int gpio = irq - IRQ_GPIO(2) + 2;
arch/arm/mach-pxa/time.c +119 -0

161 lines not on this page · raw message

arch/arm/mach-s3c2410/irq.c +88 -1

119 lines not on this page · raw message

arch/arm/mach-s3c2410/s3c2440-irq.c +31 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/mach-s3c2410/s3c2440-irq.c ipipe-2.6.19-arm/arch/arm/mach-s3c2410/s3c2440-irq.c
@@ -3,6 +3,8 @@
  * Copyright (c) 2003,2004 Simtec Electronics
  *	Ben Dooks <[email protected]>
  *
+ * Copyright (C) 2006 Sebastian Smolorz <[email protected]>, emlix GmbH
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -25,6 +27,7 @@
 #include <linux/ioport.h>
 #include <linux/ptrace.h>
 #include <linux/sysdev.h>
+#include <linux/ipipe.h>
 
 #include <asm/hardware.h>
 #include <asm/irq.h>
@@ -96,6 +99,34 @@ static struct irqchip s3c_irq_wdtac97 = 
 	.ack	    = s3c_irq_wdtac97_ack,
 };
 
+#ifdef CONFIG_IPIPE
+void __ipipe_s3c_irq_demux_wdtac97(unsigned int subsrc, struct pt_regs *regs)
+{
+	subsrc >>= 13;
+	subsrc &= 3;
+
+	if (subsrc != 0) {
+		if (subsrc & 1)
+			__ipipe_handle_irq(IRQ_S3C2440_WDT, regs);
+		if (subsrc & 2)
+			__ipipe_handle_irq(IRQ_S3C2440_AC97, regs);
+	}
+}
+
+void __ipipe_s3c_irq_demux_cam(unsigned int subsrc, struct pt_regs *regs)
+{
+	subsrc >>= 11;
+	subsrc &= 3;
+
+	if (subsrc != 0) {
+		if (subsrc & 1)
+			__ipipe_handle_irq(IRQ_S3C2440_CAM_C, regs);
+		if (subsrc & 2)
+			__ipipe_handle_irq(IRQ_S3C2440_CAM_P, regs);
+	}
+}
+#endif /* CONFIG_IPIPE */
+
 static int s3c2440_irq_add(struct sys_device *sysdev)
 {
 	unsigned int irqno;
arch/arm/mach-s3c2410/time.c +149 -47

288 lines not on this page · raw message

arch/arm/mach-sa1100/irq.c +32 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/mach-sa1100/irq.c ipipe-2.6.19-arm/arch/arm/mach-sa1100/irq.c
@@ -16,6 +16,7 @@
 #include <linux/ioport.h>
 #include <linux/ptrace.h>
 #include <linux/sysdev.h>
+#include <linux/ipipe.h>
 
 #include <asm/hardware.h>
 #include <asm/mach/irq.h>
@@ -137,6 +138,37 @@ sa1100_high_gpio_handler(unsigned int ir
 	} while (mask);
 }
 
+#ifdef CONFIG_IPIPE
+void __ipipe_mach_demux_irq(unsigned irq, struct pt_regs *regs)
+{
+	struct irqdesc *desc_unused = irq_desc + irq;
+	unsigned irq_unused = irq;
+	unsigned int mask;
+
+	mask = GEDR & 0xfffff800;
+	do {
+		/*
+		 * clear down all currently active IRQ sources.
+		 * We will be processing them all.
+		 */
+		GEDR = mask;
+
+		irq = IRQ_GPIO11;
+		mask >>= 11;
+		do {
+			if (mask & 1)
+				__ipipe_handle_irq(irq, regs);
+			mask >>= 1;
+			irq++;
+		} while (mask);
+
+		mask = GEDR & 0xfffff800;
+	} while (mask);
+
+	desc_unused->chip->unmask(irq_unused);
+}
+#endif /* CONFIG_IPIPE */
+
 /*
  * Like GPIO0 to 10, GPIO11-27 IRQs need to be handled specially.
  * In addition, the IRQs are all collected up into one bit in the
arch/arm/mach-sa1100/time.c +116 -0

157 lines not on this page · raw message

arch/arm/mm/fault.c +16 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/arch/arm/mm/fault.c ipipe-2.6.19-arm/arch/arm/mm/fault.c
@@ -223,6 +223,9 @@ do_page_fault(unsigned long addr, unsign
 	struct mm_struct *mm;
 	int fault, sig, code;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_ACCESS,regs))
+		return 0;
+
 	tsk = current;
 	mm  = tsk->mm;
 
@@ -351,6 +354,9 @@ do_translation_fault(unsigned long addr,
 	return 0;
 
 bad_area:
+	if (ipipe_trap_notify(IPIPE_TRAP_ACCESS,regs))
+		return 0;
+
 	do_bad_area(addr, fsr, regs);
 	return 0;
 }
@@ -362,6 +368,10 @@ bad_area:
 static int
 do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
 {
+
+	if (ipipe_trap_notify(IPIPE_TRAP_SECTION,regs))
+		return 0;
+
 	do_bad_area(addr, fsr, regs);
 	return 0;
 }
@@ -372,6 +382,9 @@ do_sect_fault(unsigned long addr, unsign
 static int
 do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_DABT,regs))
+		return 0;
+
 	return 1;
 }
 
@@ -447,6 +460,9 @@ do_DataAbort(unsigned long addr, unsigne
 	if (!inf->fn(addr, fsr, regs))
 		return;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_UNKNOWN,regs))
+		return;
+
 	printk(KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n",
 		inf->name, fsr, addr);
 
drivers/pci/htirq.c +1 -1
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/drivers/pci/htirq.c ipipe-2.6.19-arm/drivers/pci/htirq.c
@@ -21,7 +21,7 @@
  * With multiple simultaneous hypertransport irq devices it might pay
  * to make this more fine grained.  But start with simple, stupid, and correct.
  */
-static DEFINE_SPINLOCK(ht_irq_lock);
+static IPIPE_DEFINE_SPINLOCK(ht_irq_lock);
 
 struct ht_irq_cfg {
 	struct pci_dev *dev;
include/asm-arm/arch-at91rm9200/hardware.h +3 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-at91rm9200/hardware.h ipipe-2.6.19-arm/include/asm-arm/arch-at91rm9200/hardware.h
@@ -39,6 +39,9 @@
 #define AT91_VA_BASE_TWI	AT91_IO_P2V(AT91RM9200_BASE_TWI)
 #define AT91_VA_BASE_MCI	AT91_IO_P2V(AT91RM9200_BASE_MCI)
 #define AT91_VA_BASE_UDP	AT91_IO_P2V(AT91RM9200_BASE_UDP)
+#ifdef CONFIG_IPIPE
+#define AT91_VA_BASE_TCB0       AT91_IO_P2V(AT91RM9200_BASE_TCB0)
+#endif /* CONFIG_IPIPE */
 
  /* Internal SRAM is mapped below the IO devices */
 #define AT91_SRAM_VIRT_BASE	(AT91_IO_VIRT_BASE - AT91RM9200_SRAM_SIZE)
include/asm-arm/arch-at91rm9200/irqs.h +8 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-at91rm9200/irqs.h ipipe-2.6.19-arm/include/asm-arm/arch-at91rm9200/irqs.h
@@ -39,4 +39,12 @@
  */
 #define	NR_IRQS		(NR_AIC_IRQS + (4 * 32))
 
+#if defined(CONFIG_IPIPE) && !defined(__ASSEMBLY__)
+extern unsigned __ipipe_at91_gpio_banks;
+
+#define __ipipe_mach_irq_mux_p(irq) \
+	((unsigned) (irq - AT91RM9200_ID_PIOA) < __ipipe_at91_gpio_banks)
+
+#endif /* CONFIG_IPIPE && !__ASSEMBLY__ */
+
 #endif
include/asm-arm/arch-at91rm9200/timex.h +4 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-at91rm9200/timex.h ipipe-2.6.19-arm/include/asm-arm/arch-at91rm9200/timex.h
@@ -23,6 +23,10 @@
 
 #include <asm/hardware.h>
 
+#ifndef CONFIG_IPIPE
 #define CLOCK_TICK_RATE		(AT91_SLOW_CLOCK)
+#else /* !CONFIG_IPIPE */
+#define CLOCK_TICK_RATE         (CONFIG_IPIPE_AT91_MCK / 32)
+#endif /* !CONFIG_IPIPE */
 
 #endif
include/asm-arm/arch-integrator/entry-macro.S +5 -1
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-integrator/entry-macro.S ipipe-2.6.19-arm/include/asm-arm/arch-integrator/entry-macro.S
@@ -22,7 +22,11 @@
 		teq	\irqstat, #0
 		ldreq	\irqstat, [\base, #(INTEGRATOR_HDR_IC_OFFSET+IRQ_STATUS)]
 		moveq	\irqnr, #IRQ_CIC_START
-
+#ifdef CONFIG_IPIPE
+		tst	\irqstat, #0x00000040			@ check IRQ_TIMERINT1 first
+		movne	\irqnr, #6
+		bne	1003f
+#endif /* CONFIG_IPIPE */
 1001:		tst	\irqstat, #15
 		bne	1002f
 		add	\irqnr, \irqnr, #4
include/asm-arm/arch-integrator/irqs.h +3 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-integrator/irqs.h ipipe-2.6.19-arm/include/asm-arm/arch-integrator/irqs.h
@@ -80,3 +80,6 @@
 
 #define NR_IRQS                         47
 
+#ifdef CONFIG_IPIPE
+#define __ipipe_mach_irq_mux_p(irq) ((irq) == IRQ_CP_CPPLDINT)
+#endif /* CONFIG_IPIPE */
include/asm-arm/arch-integrator/platform.h +7 -2
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-integrator/platform.h ipipe-2.6.19-arm/include/asm-arm/arch-integrator/platform.h
@@ -26,7 +26,7 @@
  * 	NOTE: This is a multi-hosted header file for use with uHAL and
  * 	      supported debuggers.
  *
- * 	$Id: platform.s,v 1.32 2000/02/18 10:51:39 asims Exp $
+ * 	$Id: platform.h,v 1.2 2006/02/20 13:54:22 rpm Exp $
  *
  * ***********************************************************************/
 
@@ -436,7 +436,7 @@
  *  Timer definitions
  *
  *  Only use timer 1 & 2
- *  (both run at 24MHz and will need the clock divider set to 16).
+ *  (both run at 1MHZ on /CP and at 24MHz on /AP)
  *
  *  Timer 0 runs at bus frequency and therefore could vary and currently
  *  uHAL can't handle that.
@@ -449,7 +449,12 @@
 
 #define MAX_TIMER                       2
 #define MAX_PERIOD                      699050
+
+#ifdef CONFIG_ARCH_INTEGRATOR_CP
+#define TICKS_PER_uSEC                  1
+#else
 #define TICKS_PER_uSEC                  24
+#endif
 
 /*
  *  These are useconds NOT ticks.
include/asm-arm/arch-integrator/timex.h +2 -2
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-integrator/timex.h ipipe-2.6.19-arm/include/asm-arm/arch-integrator/timex.h
@@ -21,6 +21,6 @@
  */
 
 /*
- * ??
+ * Timer rate
  */
-#define CLOCK_TICK_RATE		(50000000 / 16)
+#define CLOCK_TICK_RATE		(1000000)
include/asm-arm/arch-pxa/irqs.h +4 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-pxa/irqs.h ipipe-2.6.19-arm/include/asm-arm/arch-pxa/irqs.h
@@ -72,6 +72,10 @@
 			((i) - IRQ_GPIO(2) + 2)
 #define IRQ_TO_GPIO(i)	(((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i))
 
+#ifdef CONFIG_IPIPE
+#define __ipipe_mach_irq_mux_p(irq) ((irq) == IRQ_GPIO_2_x)
+#endif /* CONFIG_IPIPE */
+
 #if defined(CONFIG_PXA25x)
 #define PXA_LAST_GPIO	84
 #elif defined(CONFIG_PXA27x)
include/asm-arm/arch-s3c2410/irqs.h +24 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-s3c2410/irqs.h ipipe-2.6.19-arm/include/asm-arm/arch-s3c2410/irqs.h
@@ -3,6 +3,8 @@
  * Copyright (c) 2003-2005 Simtec Electronics
  *   Ben Dooks <[email protected]>
  *
+ * Copyright (C) 2006 Sebastian Smolorz <[email protected]>, emlix GmbH
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -116,4 +118,26 @@
 #define NR_IRQS (IRQ_S3C2440_AC97+1)
 
 
+#ifdef CONFIG_IPIPE
+#define __ipipe_irqbit(irq)	(1 << ((irq) - S3C2410_CPUIRQ_OFFSET))
+
+#ifdef CONFIG_CPU_S3C2440
+#define __ipipe_muxed_irqmask	(__ipipe_irqbit(IRQ_UART0)	|	\
+				 __ipipe_irqbit(IRQ_UART1)	|	\
+				 __ipipe_irqbit(IRQ_UART2)	|	\
+				 __ipipe_irqbit(IRQ_ADCPARENT)	|	\
+				 __ipipe_irqbit(IRQ_WDT)	|	\
+				 __ipipe_irqbit(IRQ_CAM))
+#else /* !CONFIG_CPU_S3C2440 */
+#define __ipipe_muxed_irqmask	(__ipipe_irqbit(IRQ_UART0)	|	\
+				 __ipipe_irqbit(IRQ_UART1)	|	\
+				 __ipipe_irqbit(IRQ_UART2)	|	\
+				 __ipipe_irqbit(IRQ_ADCPARENT))
+#endif /* CONFIG_CPU_S3C2440 */
+
+#define __ipipe_mach_irq_mux_p(irq)	((irq) <= IRQ_ADCPARENT  &&	\
+					 (__ipipe_irqbit(irq) &		\
+					  __ipipe_muxed_irqmask))
+#endif /* CONFIG_IPIPE */
+
 #endif /* __ASM_ARCH_IRQ_H */
include/asm-arm/arch-sa1100/irqs.h +4 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/arch-sa1100/irqs.h ipipe-2.6.19-arm/include/asm-arm/arch-sa1100/irqs.h
@@ -144,6 +144,10 @@
 #define IRQ_LOCOMO_SPI_OVRN	(IRQ_BOARD_END + 20)
 #define IRQ_LOCOMO_SPI_TEND	(IRQ_BOARD_END + 21)
 
+#ifdef CONFIG_IPIPE
+#define __ipipe_mach_irq_mux_p(irq) ((irq) == IRQ_GPIO11_27)
+#endif /* CONFIG_IPIPE */
+
 /*
  * Figure out the MAX IRQ number.
  *
include/asm-arm/atomic.h +8 -8
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/atomic.h ipipe-2.6.19-arm/include/asm-arm/atomic.h
@@ -128,10 +128,10 @@ static inline int atomic_add_return(int 
 	unsigned long flags;
 	int val;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	val = v->counter;
 	v->counter = val += i;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 
 	return val;
 }
@@ -141,10 +141,10 @@ static inline int atomic_sub_return(int 
 	unsigned long flags;
 	int val;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	val = v->counter;
 	v->counter = val -= i;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 
 	return val;
 }
@@ -154,11 +154,11 @@ static inline int atomic_cmpxchg(atomic_
 	int ret;
 	unsigned long flags;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	ret = v->counter;
 	if (likely(ret == old))
 		v->counter = new;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 
 	return ret;
 }
@@ -167,9 +167,9 @@ static inline void atomic_clear_mask(uns
 {
 	unsigned long flags;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	*addr &= ~mask;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 }
 
 #endif /* __LINUX_ARM_ARCH__ */
include/asm-arm/bitops.h +12 -12
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/bitops.h ipipe-2.6.19-arm/include/asm-arm/bitops.h
@@ -37,9 +37,9 @@ static inline void ____atomic_set_bit(un
 
 	p += bit >> 5;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	*p |= mask;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 }
 
 static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long *p)
@@ -49,9 +49,9 @@ static inline void ____atomic_clear_bit(
 
 	p += bit >> 5;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	*p &= ~mask;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 }
 
 static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned long *p)
@@ -61,9 +61,9 @@ static inline void ____atomic_change_bit
 
 	p += bit >> 5;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	*p ^= mask;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 }
 
 static inline int
@@ -75,10 +75,10 @@ ____atomic_test_and_set_bit(unsigned int
 
 	p += bit >> 5;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	res = *p;
 	*p = res | mask;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 
 	return res & mask;
 }
@@ -92,10 +92,10 @@ ____atomic_test_and_clear_bit(unsigned i
 
 	p += bit >> 5;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	res = *p;
 	*p = res & ~mask;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 
 	return res & mask;
 }
@@ -109,10 +109,10 @@ ____atomic_test_and_change_bit(unsigned 
 
 	p += bit >> 5;
 
-	raw_local_irq_save(flags);
+	local_irq_save_hw(flags);
 	res = *p;
 	*p = res ^ mask;
-	raw_local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 
 	return res & mask;
 }
include/asm-arm/ipipe.h +207 -0

207 lines not on this page · raw message

include/asm-arm/irqflags.h +106 -18

36 lines not on this page · raw message

include/asm-arm/mmu_context.h +4 -1
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/mmu_context.h ipipe-2.6.19-arm/include/asm-arm/mmu_context.h

Lines of this file are not shown. View the raw message.

include/asm-arm/pgalloc.h +5 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/pgalloc.h ipipe-2.6.19-arm/include/asm-arm/pgalloc.h

Lines of this file are not shown. View the raw message.

include/asm-arm/system.h +4 -4
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/asm-arm/system.h ipipe-2.6.19-arm/include/asm-arm/system.h

Lines of this file are not shown. View the raw message.

include/linux/hardirq.h +2 -2
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/linux/hardirq.h ipipe-2.6.19-arm/include/linux/hardirq.h

Lines of this file are not shown. View the raw message.

include/linux/ipipe.h +710 -0

710 lines not on this page · raw message

include/linux/ipipe_trace.h +44 -0

44 lines not on this page · raw message

include/linux/irq.h +6 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/linux/irq.h ipipe-2.6.19-arm/include/linux/irq.h

Lines of this file are not shown. View the raw message.

include/linux/linkage.h +4 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/linux/linkage.h ipipe-2.6.19-arm/include/linux/linkage.h

Lines of this file are not shown. View the raw message.

include/linux/preempt.h +31 -16

47 lines not on this page · raw message

include/linux/sched.h +16 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/linux/sched.h ipipe-2.6.19-arm/include/linux/sched.h

Lines of this file are not shown. View the raw message.

include/linux/spinlock.h +114 -13

127 lines not on this page · raw message

include/linux/spinlock_types.h +14 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/include/linux/spinlock_types.h ipipe-2.6.19-arm/include/linux/spinlock_types.h

Lines of this file are not shown. View the raw message.

init/Kconfig +1 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/init/Kconfig ipipe-2.6.19-arm/init/Kconfig

Lines of this file are not shown. View the raw message.

init/main.c +7 -1
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/init/main.c ipipe-2.6.19-arm/init/main.c

Lines of this file are not shown. View the raw message.

kernel/Makefile +1 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/kernel/Makefile ipipe-2.6.19-arm/kernel/Makefile

Lines of this file are not shown. View the raw message.

kernel/exit.c +1 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/kernel/exit.c ipipe-2.6.19-arm/kernel/exit.c

Lines of this file are not shown. View the raw message.

kernel/fork.c +10 -1
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/kernel/fork.c ipipe-2.6.19-arm/kernel/fork.c

Lines of this file are not shown. View the raw message.

kernel/ipipe/Kconfig +6 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/kernel/ipipe/Kconfig ipipe-2.6.19-arm/kernel/ipipe/Kconfig

Lines of this file are not shown. View the raw message.

kernel/ipipe/Kconfig.debug +69 -0

69 lines not on this page · raw message

kernel/ipipe/Makefile +3 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/kernel/ipipe/Makefile ipipe-2.6.19-arm/kernel/ipipe/Makefile

Lines of this file are not shown. View the raw message.

kernel/ipipe/core.c +1425 -0

1,425 lines not on this page · raw message

kernel/ipipe/tracer.c +1244 -0

1,244 lines not on this page · raw message

kernel/irq/chip.c +112 -0

112 lines not on this page · raw message

kernel/printk.c +73 -0

73 lines not on this page · raw message

kernel/sched.c +70 -3

73 lines not on this page · raw message

kernel/signal.c +1 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/kernel/signal.c ipipe-2.6.19-arm/kernel/signal.c

Lines of this file are not shown. View the raw message.

kernel/spinlock.c +2 -2
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/kernel/spinlock.c ipipe-2.6.19-arm/kernel/spinlock.c

Lines of this file are not shown. View the raw message.

lib/Kconfig.debug +2 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/lib/Kconfig.debug ipipe-2.6.19-arm/lib/Kconfig.debug

Lines of this file are not shown. View the raw message.

lib/ioremap.c +2 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/lib/ioremap.c ipipe-2.6.19-arm/lib/ioremap.c

Lines of this file are not shown. View the raw message.

lib/smp_processor_id.c +5 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/lib/smp_processor_id.c ipipe-2.6.19-arm/lib/smp_processor_id.c

Lines of this file are not shown. View the raw message.

lib/spinlock_debug.c +18 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/lib/spinlock_debug.c ipipe-2.6.19-arm/lib/spinlock_debug.c

Lines of this file are not shown. View the raw message.

mm/vmalloc.c +5 -0
diff -x '*~' -x '*.orig' -x '*.rej' -Naurdp linux-2.6.19/mm/vmalloc.c ipipe-2.6.19-arm/mm/vmalloc.c

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 11 lines · Gilles Chanteperdrix

Hi,

here comes the I-pipe patch for linux 2.6.19 on ARM. In addition to the upgrade to linux 2.6.19, the AT91 port is improved:
- it waits for the console to be enabled or about 2 minutes before panicing if the configured frequency is wrong;
- the timer counter used as time source is chosen when configuring the kernel;
- it uses the kernel clock interface in order to enable the timer counter clock instead of tweaking directly the registers.

A few more words about this patch; I had to reduce the list of files included in asm-arm/ipipe.h and include linux/irq.h in kernel/ipipe/core.c otherwise the kernel did not compile with CONFIG_PREEMPT enabled. There are a few new enable_irq in entry-armv.S and I was not sure what to do about them, so I simply leaved them.

Signature · 1 line
                                                 Gilles Chanteperdrix
#5 lore raw
In reply to Gilles Chanteperdrix

Gilles,

Quoted 2 lines

here comes the I-pipe patch for linux 2.6.19 on ARM. In addition to the upgrade to linux 2.6.19, the AT91 port is improved:

Thanks very much.

Quoted 2 lines

I have not tested the other ports, so, please test the patch on the ARM you use if you can.

Did you actually try this patch against a vanilla 2.6.19 + 2.6.19-at91.patch.gz?

a) it does not apply cleanly. failing in
arch/arm/mach-at91rm9200/at91rm9200.c and
include/asm-arm/arch-at91rm9200/hardware.h

b) asm/arch/at91rm9200_tc.h is called asm/arch/at91_tc.h now

arch/arm/mach-at91rm9200/at91rm9200_time.c +1 -1
@@ -38,7 +38,7 @@ static unsigned long last_crtr;
 #include <linux/clk.h>
 #include <linux/console.h>
 #include <linux/module.h>
-#include <asm/arch/at91rm9200_tc.h>
+#include <asm/arch/at91_tc.h>
 #include "clock.h"
 
 #ifdef CONFIG_NO_IDLE_HZ

c) Kernel with adoes-ipipe compiles (after fixing the above), but xenomai does not compile and bails out with

arch/arm/xenomai/hal.c: In function `rthal_irq_host_request':
arch/arm/xenomai/hal.c:115: warning: passing arg 2 of `request_irq' from incompatible pointer type
arch/arm/xenomai/hal.c: In function `rthal_irq_enable':
arch/arm/xenomai/hal.c:144: error: structure has no member named disable_depth' arch/arm/xenomai/hal.c: In function rthal_irq_disable':
arch/arm/xenomai/hal.c:156: error: structure has no member named `disable_depth'

--
Steven

#6 lore raw
Quoted 7 lines · Steven Scholz

Gilles,

Quoted 2 lines

here comes the I-pipe patch for linux 2.6.19 on ARM. In addition to the upgrade to linux 2.6.19, the AT91 port is improved:

Quoted 8 lines

Thanks very much.

Quoted 2 lines

I have not tested the other ports, so, please test the patch on the ARM you use if you can.

Did you actually try this patch against a vanilla 2.6.19 + 2.6.19-at91.patch.gz?

No, the patch is intended to be used with a vanilla 2.6.19, this make the I-pipe patch for ARM much easier to maintain.

Quoted 2 lines

c) Kernel with adoes-ipipe compiles (after fixing the above), but xenomai does not compile and bails out with

You must get recent xenomai sources from svn trunk or v2.3.x branch.

Signature · 1 line
                                                 Gilles Chanteperdrix
#2 lore raw
In reply to Gilles Chanteperdrix

Gilles,

Quoted 2 lines
Quoted 2 lines

here comes the I-pipe patch for linux 2.6.19 on ARM. In addition to the upgrade to linux 2.6.19, the AT91 port is improved:

Using vanilla 2.6.19, your new patch and xenomai from SVN as of yesterday the test programm "latency" hangs randomly after a while ...

Did you test with "latency"?

Thanks.

Signature · 1 line
Steven
#3 lore raw
Quoted 11 lines · Steven Scholz

Gilles,

Quoted 2 lines
Quoted 2 lines

here comes the I-pipe patch for linux 2.6.19 on ARM. In addition to the upgrade to linux 2.6.19, the AT91 port is improved:

Using vanilla 2.6.19, your new patch and xenomai from SVN as of yesterday the test programm "latency" hangs randomly after a while ...

Did you test with "latency"?

Yes, latency hangs if the period is too small. latency -p 1000 runs fine.

Signature · 1 line
                                                 Gilles Chanteperdrix
#4 lore raw
In reply to Steven Scholz
Quoted 11 lines · Steven Scholz

Gilles,

Quoted 2 lines
Quoted 2 lines

here comes the I-pipe patch for linux 2.6.19 on ARM. In addition to the upgrade to linux 2.6.19, the AT91 port is improved:

Using vanilla 2.6.19, your new patch and xenomai from SVN as of yesterday the test programm "latency" hangs randomly after a while ...

Did you test with "latency"?

If you have a JTAG probe and are able to trace what the processor is doing when latency hangs, I am interested.

Signature · 1 line
                                                 Gilles Chanteperdrix