Skip to contentSkip to conversation

adeos-ipipe-2.6.18-ppc-1.4-00.patch, first version

Xenomai-core Applied Wolfgang Grandegger 2 participants 6 messages Sep 24, 2006 – Oct 14, 2006

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

Hi Philippe,

attached you will find a first version of the PPC ADEOS-IPipe patch for Linux 2.6.18 (from kernel.org) for review. I have also included a commented log file with more information on the porting of adeos-ipipe-2.6.14-ppc-1.4-00 to Linux 2.6.18. It works with a recent version of Xenomai.

The patch currently only supports devices in the "arch/ppc" tree with the option "CONFIG_PPC_MERGE" not set. Porting the "arch/powerpc" tree requires further effort and I need a test system as well. Puh, let's hope that the merge ppc -> powerpc will be completed soon.

The idle loop is not yet working for 6xx and I have disabled it for this reason (check arch/powerpc/kernel/idle.c). It needs further debugging. I hope to find more time beginning of October.

I have tested the patch on some AMCC 4xx system, on a MPC 8560 (85xx) and MPC 834x (6xx). I have also not yet tested the IPIPE tracer.

Wolfgang.

Porting adeos-ipipe-2.6.14-ppc-1.4-00.patch to linux-2.6.18
===========================================================

------------------------------------
Applying patch and resolving rejects:
------------------------------------

patching file drivers/pci/msi.c
Hunk #1 succeeded at 164 (offset 18 lines).
Hunk #2 succeeded at 224 with fuzz 2.
misordered hunks! output would be garbled
Hunk #3 FAILED at 242.
Hunk #4 succeeded at 272 with fuzz 2 (offset 16 lines).
1 out of 4 hunks FAILED -- saving rejects to file drivers/pci/msi.c.rej

*** OK ***

patching file include/linux/hardirq.h
Hunk #1 FAILED at 87.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/hardirq.h.rej

*** OK ***

patching file include/linux/ipipe.h
patching file include/linux/linkage.h
Hunk #1 succeeded at 60 (offset 9 lines).
patching file include/linux/preempt.h
Hunk #1 FAILED at 13.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/preempt.h.rej

*** OK ***

patching file include/linux/sched.h
Hunk #1 FAILED at 4.
Hunk #2 succeeded at 149 (offset 21 lines).
Hunk #3 FAILED at 842.
Hunk #4 FAILED at 896.
3 out of 4 hunks FAILED -- saving rejects to file include/linux/sched.h.rej

*** OK ***

patching file init/Kconfig
Hunk #1 succeeded at 66 (offset -3 lines).
patching file init/main.c
Hunk #1 FAILED at 487.
Hunk #2 succeeded at 665 with fuzz 2 (offset 49 lines). 1 out of 2 hunks FAILED -- saving rejects to file init/main.c.rej

*** Not absolutely sure if ipipe_init() is at the right place ***

patching file kernel/Makefile
Hunk #1 FAILED at 32.
1 out of 1 hunk FAILED -- saving rejects to file kernel/Makefile.rej

*** OK ***

patching file kernel/exit.c
Hunk #1 FAILED at 846.
1 out of 1 hunk FAILED -- saving rejects to file kernel/exit.c.rej

*** OK ***

patching file kernel/fork.c
Hunk #1 succeeded at 375 with fuzz 2 (offset 3 lines). Hunk #2 FAILED at 1157.
1 out of 2 hunks FAILED -- saving rejects to file kernel/fork.c.rej

*** OK ***

patching file kernel/ipipe/Kconfig
patching file kernel/ipipe/Makefile
patching file kernel/ipipe/core.c
patching file kernel/ipipe/generic.c
patching file kernel/irq/handle.c
Hunk #1 FAILED at 81.
Hunk #2 FAILED at 128.
2 out of 2 hunks FAILED -- saving rejects to file kernel/irq/handle.c.rej

*** OK ***

patching file kernel/printk.c
Hunk #1 succeeded at 488 with fuzz 1 (offset -19 lines). patching file kernel/sched.c
Hunk #1 succeeded at 1373 (offset 219 lines).
Hunk #2 succeeded at 1572 (offset 16 lines).
Hunk #3 FAILED at 2873.
Hunk #4 succeeded at 3268 (offset 392 lines).
Hunk #5 succeeded at 3019 (offset -2 lines).
Hunk #6 succeeded at 3428 with fuzz 1 (offset 392 lines). Hunk #7 succeeded at 3052 (offset -3 lines).
Hunk #8 succeeded at 4144 (offset 456 lines).
Hunk #9 succeeded at 6445 (offset 779 lines).
1 out of 9 hunks FAILED -- saving rejects to file kernel/sched.c.rej

*** OK ***

patching file kernel/signal.c
Hunk #1 succeeded at 499 (offset -102 lines).
patching file lib/smp_processor_id.c
Hunk #1 succeeded at 13 (offset 1 line).
patching file lib/spinlock_debug.c
Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n]
Skipping patch.
7 out of 7 hunks ignored -- saving rejects to file lib/spinlock_debug.c.rej

*** OK ***

patching file mm/vmalloc.c
Hunk #1 succeeded at 19 (offset 1 line).
Hunk #2 succeeded at 148 with fuzz 2 (offset -1 lines).
patching file arch/ppc/Kconfig
Hunk #1 succeeded at 950 (offset 33 lines).
patching file arch/ppc/kernel/Makefile
Hunk #1 FAILED at 29.
1 out of 1 hunk FAILED -- saving rejects to file arch/ppc/kernel/Makefile.rej

*** OK ***

patching file arch/ppc/kernel/entry.S
Hunk #1 FAILED at 144.
Hunk #2 succeeded at 213 (offset 2 lines).
Hunk #3 succeeded at 288 (offset -7 lines).
Hunk #4 succeeded at 690 (offset -13 lines).
Hunk #5 succeeded at 737 (offset -7 lines).
Hunk #6 FAILED at 1078.
2 out of 6 hunks FAILED -- saving rejects to file arch/ppc/kernel/entry.S.rej

*** OK, might be worth checking ***

patching file arch/ppc/kernel/head.S
Hunk #1 succeeded at 295 (offset -40 lines). Hunk #2 succeeded at 402 with fuzz 1 (offset -49 lines). Hunk #3 succeeded at 440 with fuzz 2 (offset -40 lines). patching file arch/ppc/kernel/head_44x.S
Hunk #1 succeeded at 427 (offset -3 lines). patching file arch/ppc/kernel/head_4xx.S
Hunk #1 succeeded at 228 (offset -1 lines). Hunk #3 succeeded at 444 (offset -1 lines). patching file arch/ppc/kernel/head_8xx.S
Hunk #1 succeeded at 186 (offset -3 lines). Hunk #3 succeeded at 268 with fuzz 2 (offset -3 lines). patching file arch/ppc/kernel/head_booke.h
Hunk #2 succeeded at 351 with fuzz 2.
patching file arch/ppc/kernel/head_fsl_booke.S Hunk #1 succeeded at 526 (offset -2 lines). can't find file to patch at input line 3317 Perhaps you used the wrong -p or --strip option? The text leading up to this was:
--------------------------
|--- 2.6.14/arch/ppc/kernel/idle.c 2005-10-28 02:02:08.000000000 +0200
|+++ 2.6.14-ipipe/arch/ppc/kernel/idle.c 2005-10-31 10:15:17.000000000 +0100
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
3 out of 3 hunks ignored

*** arch/powerpc/kernel/idle.c is now used. ***
*** More comments are at the end of this file.

patching file arch/ppc/kernel/ipipe-core.c
patching file arch/ppc/kernel/ipipe-root.c
patching file arch/ppc/kernel/traps.c
Hunk #1 succeeded at 233 (offset -3 lines).
Hunk #2 succeeded at 398 with fuzz 2.
Hunk #3 succeeded at 404 with fuzz 2 (offset -3 lines).
Hunk #5 succeeded at 564 (offset -3 lines).
Hunk #7 succeeded at 715 with fuzz 1 (offset -3 lines).
Hunk #9 succeeded at 756 (offset -3 lines).
Hunk #11 succeeded at 809 (offset -3 lines).
Hunk #12 succeeded at 854 (offset 11 lines).
Hunk #13 succeeded at 864 (offset -3 lines).
Hunk #14 succeeded at 940 (offset 11 lines).
patching file arch/ppc/mm/fault.c
Hunk #1 succeeded at 113 (offset -3 lines).
patching file arch/ppc/platforms/83xx/mpc834x_sys.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file arch/ppc/platforms/83xx/mpc834x_sys.h.rej

*** OK, file does not require patching any more ***

patching file arch/ppc/platforms/85xx/mpc85xx_ads_common.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file arch/ppc/platforms/85xx/mpc85xx_ads_common.h.rej

*** OK, file does not require patching any more ***

patching file arch/ppc/platforms/85xx/sbc85xx.h
Hunk #1 succeeded at 15 with fuzz 2 (offset -3 lines).
patching file arch/ppc/platforms/85xx/stx_gp3.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file arch/ppc/platforms/85xx/stx_gp3.h.rej

*** OK, file does not require patching any more ***

can't find file to patch at input line 4307
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- 2.6.14/arch/ppc/platforms/pmac_pic.c 2005-10-28 02:02:08.000000000 +0200
|+++ 2.6.14-ipipe/arch/ppc/platforms/pmac_pic.c 2006-07-18 17:59:11.000000000 +0200
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored

*** OK, file does not exist any more in the arch/ppc tree ***

patching file arch/ppc/syslib/open_pic.c
Hunk #1 succeeded at 821 (offset 1 line).
patching file arch/ppc/syslib/ppc4xx_pic.c~

*** File removed ***

patching file arch/ppc/syslib/ppc8xx_pic.c
Hunk #1 succeeded at 46 (offset -2 lines).

*** File arch/ppc/syslib/ppc8xx_pic.c does not need patching *** *** Should be corrected in other patch versions as well!!!

can't find file to patch at input line 4603
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- 2.6.14/include/asm-ppc/hw_irq.h 2005-10-28 02:02:08.000000000 +0200
|+++ 2.6.14-ipipe/include/asm-ppc/hw_irq.h 2006-03-27 23:10:46.000000000 +0200
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
3 out of 3 hunks ignored

*** OK, file is now in include/asm-powerpc. *** *** Complex modifications! I reorganized things a bit***

patching file include/asm-ppc/ipipe.h
patching file include/asm-ppc/mmu_context.h
Hunk #1 FAILED at 149.
Hunk #2 succeeded at 164 (offset 4 lines).
Hunk #3 succeeded at 193 (offset -2 lines).
1 out of 3 hunks FAILED -- saving rejects to file include/asm-ppc/mmu_context.h.rej

*** OK ***

patching file include/asm-ppc/pgalloc.h
Hunk #1 succeeded at 39 (offset -1 lines).

-------------------------------------
Further fixes to get the kernel built:
-------------------------------------

*** include/asm-ppc/ipipe.h

There are some weared include cross dependencies, e.g. due to "linux/radix-tree.h" included in "arch/ppc/include/asm/irq.h". I have fixed iz be deleting some include statements. Check for "#ifdef FIXME".

*** arch/ppc/kernel/ipipe-root.c

    Due to the gerneric IRQ layer, desc->handler has been replaced
    with desc->chip.

*** include/asm-powerpc/irq.h

Supressed "#include <linux/radix-tree.h>" to resolve the include dependency problems already mentioned above.

*** kernel/sched.c

replace "prio_array_t" with "struct prio_array" and "runqueue_t" with "struct rq".

*** arch/powerpc/kernel/irq.c

"ppc_spurious_interrupts" is now static in this file. We should think about handling spurious interrupts in the IPIPE IRQ part (an appropriate listing in /proc/xenomai/irq). There is no hurry, as the merge PPC to PowerPC is going on :-(.

----------------------------
Further remarks and comments:
----------------------------

The patch currently only supports devices in the "arch/ppc" tree with the option "CONFIG_PPC_MERGE" not set. Porting the "arch/powerpc" requires further effort.

Test status: I have tested the patch on some AMCC 4xx system, on a MPC 8560 (85xx) and MPC 834x (6xx). I have not yet tested the IPIPE tracer.

The idle loop is not yet working for 6xx and I have disabled it for this reason (check arch/powerpc/kernel/idle.c). It needs further debugging when time permits.

+ diff -u linux-2.6.18/arch/powerpc/kernel/idle.c.ORIG linux-2.6.18/arch/powerpc/kernel/idle.c

arch/powerpc/kernel/idle.c renamed from arch/powerpc/kernel/idle.c.ORIG +11 -0
@@ -51,23 +51,34 @@
 	while (1) {
 		while (!need_resched() && !cpu_should_die()) {
 			ppc64_runlatch_off();
+			ipipe_suspend_domain();
 
 			if (ppc_md.power_save) {
+#ifndef CONFIG_IPIPE
 				clear_thread_flag(TIF_POLLING_NRFLAG);
 				/*
 				 * smp_mb is so clearing of TIF_POLLING_NRFLAG
 				 * is ordered w.r.t. need_resched() test.
 				 */
 				smp_mb();
+#ifdef CONFIG_IPIPE
+				local_irq_disable_hw();
+#else /* !CONFIG_IPIPE */
 				local_irq_disable();
+#endif /* CONFIG_IPIPE */
 
 				/* check again after disabling irqs */
 				if (!need_resched() && !cpu_should_die())
 					ppc_md.power_save();
 
+#ifdef CONFIG_IPIPE
+				local_irq_enable_hw();
+#else /* !CONFIG_IPIPE */
 				local_irq_enable();
+#endif /* CONFIG_IPIPE */
 				set_thread_flag(TIF_POLLING_NRFLAG);
 
+#endif /* CONFIG_IPIPE */
 			} else {
 				/*
 				 * Go into low thread priority and possibly

+ diff -u linux-2.6.18/arch/powerpc/kernel/irq.c.ORIG linux-2.6.18/arch/powerpc/kernel/irq.c

arch/powerpc/kernel/irq.c renamed from arch/powerpc/kernel/irq.c.ORIG +4 -0
@@ -68,7 +68,11 @@
 #endif
 
 int __irq_offset_value;
+#ifdef CONFIG_IPIPE
+int ppc_spurious_interrupts;
+#else /* !CONFIG_IPIPE */
 static int ppc_spurious_interrupts;
+#endif /* CONFIG_IPIPE */
 
 #ifdef CONFIG_PPC32
 EXPORT_SYMBOL(__irq_offset_value);

+ diff -u linux-2.6.18/arch/ppc/Kconfig.ORIG linux-2.6.18/arch/ppc/Kconfig

arch/ppc/Kconfig renamed from arch/ppc/Kconfig.ORIG +2 -0
@@ -950,6 +950,8 @@
 	depends on SMP
 	default "4"
 
+source "kernel/ipipe/Kconfig"
+
 config HIGHMEM
 	bool "High memory support"
 

+ diff -u linux-2.6.18/arch/ppc/kernel/entry.S.ORIG linux-2.6.18/arch/ppc/kernel/entry.S

arch/ppc/kernel/entry.S renamed from arch/ppc/kernel/entry.S.ORIG +92 -0

137 lines not on this page · raw message

+ diff -u linux-2.6.18/arch/ppc/kernel/head_44x.S.ORIG linux-2.6.18/arch/ppc/kernel/head_44x.S

arch/ppc/kernel/head_44x.S renamed from arch/ppc/kernel/head_44x.S.ORIG +5 -1
@@ -427,7 +427,11 @@
 	INSTRUCTION_STORAGE_EXCEPTION
 
 	/* External Input Interrupt */
-	EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x0500, ExternalInput, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
+ 	EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 	/* Alignment Interrupt */
 	ALIGNMENT_EXCEPTION

+ diff -u linux-2.6.18/arch/ppc/kernel/head_4xx.S.ORIG linux-2.6.18/arch/ppc/kernel/head_4xx.S

arch/ppc/kernel/head_4xx.S renamed from arch/ppc/kernel/head_4xx.S.ORIG +14 -0
@@ -228,6 +228,12 @@
 	EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, NOCOPY, transfer_to_handler_full, \
 			  ret_from_except_full)
 
+#ifdef CONFIG_IPIPE
+#define EXC_XFER_IPIPE(n, hdlr)		\
+	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
+			  __ipipe_ret_from_except)
+#endif /* CONFIG_IPIPE */
+
 #define EXC_XFER_LITE(n, hdlr)		\
 	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
 			  ret_from_except)
@@ -396,7 +402,11 @@
 	EXC_XFER_EE_LITE(0x400, handle_page_fault)
 
 /* 0x0500 - External Interrupt Exception */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x0500, HardwareInterrupt, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x0500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 /* 0x0600 - Alignment Exception */
 	START_EXCEPTION(0x0600, Alignment)
@@ -434,7 +444,11 @@
 	lis	r0,TSR_PIS@h
 	mtspr	SPRN_TSR,r0		/* Clear the PIT exception */
 	addi	r3,r1,STACK_FRAME_OVERHEAD
+#ifdef CONFIG_IPIPE
+	EXC_XFER_IPIPE(0x1000, __ipipe_grab_timer)
+#else /* !CONFIG_IPIPE */
 	EXC_XFER_LITE(0x1000, timer_interrupt)
+#endif /* CONFIG_IPIPE */
 
 #if 0
 /* NOTE:

+ diff -u linux-2.6.18/arch/ppc/kernel/head_8xx.S.ORIG linux-2.6.18/arch/ppc/kernel/head_8xx.S

arch/ppc/kernel/head_8xx.S renamed from arch/ppc/kernel/head_8xx.S.ORIG +13 -0
@@ -186,6 +186,11 @@
 #define EXC_XFER_STD(n, hdlr)		\
 	EXC_XFER_TEMPLATE(n, hdlr, n, NOCOPY, transfer_to_handler_full,	\
 			  ret_from_except_full)
+#ifdef CONFIG_IPIPE
+#define EXC_XFER_IPIPE(n, hdlr)		\
+	EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
+			  __ipipe_ret_from_except)
+#endif /* CONFIG_IPIPE */
 
 #define EXC_XFER_LITE(n, hdlr)		\
 	EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
@@ -238,7 +243,11 @@
 	EXC_XFER_EE_LITE(0x400, handle_page_fault)
 
 /* External interrupt */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x500, HardwareInterrupt, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 /* Alignment exception */
 	. = 0x600
@@ -259,7 +268,11 @@
 	EXCEPTION(0x800, FPUnavailable, unknown_exception, EXC_XFER_STD)
 
 /* Decrementer */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x900, Decrementer, __ipipe_grab_timer, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x900, Decrementer, timer_interrupt, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 	EXCEPTION(0xa00, Trap_0a, unknown_exception, EXC_XFER_EE)
 	EXCEPTION(0xb00, Trap_0b, unknown_exception, EXC_XFER_EE)

+ diff -u linux-2.6.18/arch/ppc/kernel/head_booke.h.ORIG linux-2.6.18/arch/ppc/kernel/head_booke.h

arch/ppc/kernel/head_booke.h renamed from arch/ppc/kernel/head_booke.h.ORIG +16 -0
@@ -187,6 +187,12 @@
 	EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, NOCOPY, transfer_to_handler_full, \
 			  ret_from_except_full)
 
+#ifdef CONFIG_IPIPE
+#define EXC_XFER_IPIPE(n, hdlr)		\
+	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
+			  __ipipe_ret_from_except)
+#endif /* CONFIG_IPIPE */
+
 #define EXC_XFER_LITE(n, hdlr)		\
 	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
 			  ret_from_except)
@@ -345,6 +351,15 @@
 	addi	r3,r1,STACK_FRAME_OVERHEAD;				      \
 	EXC_XFER_STD(0x0700, program_check_exception)
 
+#ifdef CONFIG_IPIPE
+#define DECREMENTER_EXCEPTION						      \
+	START_EXCEPTION(Decrementer)					      \
+	NORMAL_EXCEPTION_PROLOG;					      \
+	lis     r0,TSR_DIS@h;           /* Setup the DEC interrupt mask */    \
+	mtspr   SPRN_TSR,r0;		/* Clear the DEC interrupt */	      \
+	addi    r3,r1,STACK_FRAME_OVERHEAD;				      \
+	EXC_XFER_IPIPE(0x0900, __ipipe_grab_timer)
+#else /* !CONFIG_IPIPE */
 #define DECREMENTER_EXCEPTION						      \
 	START_EXCEPTION(Decrementer)					      \
 	NORMAL_EXCEPTION_PROLOG;					      \
@@ -352,6 +367,7 @@
 	mtspr   SPRN_TSR,r0;		/* Clear the DEC interrupt */	      \
 	addi    r3,r1,STACK_FRAME_OVERHEAD;				      \
 	EXC_XFER_LITE(0x0900, timer_interrupt)
+#endif /* CONFIG_IPIPE */
 
 #define FP_UNAVAILABLE_EXCEPTION					      \
 	START_EXCEPTION(FloatingPointUnavailable)			      \

+ diff -u linux-2.6.18/arch/ppc/kernel/head_fsl_booke.S.ORIG linux-2.6.18/arch/ppc/kernel/head_fsl_booke.S

arch/ppc/kernel/head_fsl_booke.S renamed from arch/ppc/kernel/head_fsl_booke.S.ORIG +4 -0
@@ -526,7 +526,11 @@
 	INSTRUCTION_STORAGE_EXCEPTION
 
 	/* External Input Interrupt */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x0500, ExternalInput, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 	/* Alignment Interrupt */
 	ALIGNMENT_EXCEPTION

+ diff -u linux-2.6.18/arch/ppc/kernel/head.S.ORIG linux-2.6.18/arch/ppc/kernel/head.S

arch/ppc/kernel/head.S renamed from arch/ppc/kernel/head.S.ORIG +14 -0
@@ -295,6 +295,12 @@
 	EXC_XFER_TEMPLATE(n, hdlr, n, NOCOPY, transfer_to_handler_full,	\
 			  ret_from_except_full)
 
+#ifdef CONFIG_IPIPE
+#define EXC_XFER_IPIPE(n, hdlr)		\
+	EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
+			  __ipipe_ret_from_except)
+#endif /* CONFIG_IPIPE */
+
 #define EXC_XFER_LITE(n, hdlr)		\
 	EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
 			  ret_from_except)
@@ -356,7 +362,11 @@
 	EXC_XFER_EE_LITE(0x400, handle_page_fault)
 
 /* External interrupt */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x500, HardwareInterrupt, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 /* Alignment exception */
 	. = 0x600
@@ -381,7 +391,11 @@
 	EXC_XFER_EE_LITE(0x800, kernel_fp_unavailable_exception)
 
 /* Decrementer */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x900, Decrementer, __ipipe_grab_timer, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x900, Decrementer, timer_interrupt, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 	EXCEPTION(0xa00, Trap_0a, unknown_exception, EXC_XFER_EE)
 	EXCEPTION(0xb00, Trap_0b, unknown_exception, EXC_XFER_EE)

+ diff -u linux-2.6.18/arch/ppc/kernel/ipipe-core.c.ORIG linux-2.6.18/arch/ppc/kernel/ipipe-core.c

arch/ppc/kernel/ipipe-core.c renamed from arch/ppc/kernel/ipipe-core.c.ORIG +265 -0

265 lines not on this page · raw message

+ diff -u linux-2.6.18/arch/ppc/kernel/ipipe-root.c.ORIG linux-2.6.18/arch/ppc/kernel/ipipe-root.c

arch/ppc/kernel/ipipe-root.c renamed from arch/ppc/kernel/ipipe-root.c.ORIG +498 -0

498 lines not on this page · raw message

+ diff -u linux-2.6.18/arch/ppc/kernel/Makefile.ORIG linux-2.6.18/arch/ppc/kernel/Makefile

arch/ppc/kernel/Makefile renamed from arch/ppc/kernel/Makefile.ORIG +2 -0
@@ -17,6 +17,8 @@
 obj-$(CONFIG_RAPIDIO)		+= rio.o
 obj-$(CONFIG_KGDB)		+= ppc-stub.o
 obj-$(CONFIG_SMP)		+= smp.o smp-tbsync.o
+obj-$(CONFIG_IPIPE)		+= ipipe-core.o ipipe-root.o
+obj-$(CONFIG_IPIPE_TRACE)	+= ipipe-mcount.o
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o
 
 ifndef CONFIG_MATH_EMULATION

+ diff -u linux-2.6.18/arch/ppc/kernel/traps.c.ORIG linux-2.6.18/arch/ppc/kernel/traps.c

arch/ppc/kernel/traps.c renamed from arch/ppc/kernel/traps.c.ORIG +33 -0
@@ -233,6 +233,9 @@
 {
 	unsigned long reason = get_mc_reason(regs);
 
+	if (ipipe_trap_notify(IPIPE_TRAP_MCE,regs))
+	    	return;
+
 	if (user_mode(regs)) {
 		regs->msr |= MSR_RI;
 		_exception(SIGBUS, regs, BUS_ADRERR, regs->nip);
@@ -392,6 +395,8 @@
 
 void unknown_exception(struct pt_regs *regs)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_UNKNOWN,regs))
+	    	return;
 	printk("Bad trap at PC: %lx, MSR: %lx, vector=%lx    %s\n",
 	       regs->nip, regs->msr, regs->trap, print_tainted());
 	_exception(SIGTRAP, regs, 0, 0);
@@ -399,6 +404,8 @@
 
 void instruction_breakpoint_exception(struct pt_regs *regs)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_IABR,regs))
+	    	return;
 	if (debugger_iabr_match(regs))
 		return;
 	_exception(SIGTRAP, regs, TRAP_BRKPT, 0);
@@ -406,6 +413,8 @@
 
 void RunModeException(struct pt_regs *regs)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_RM,regs))
+	    	return;
 	_exception(SIGTRAP, regs, 0, 0);
 }
 
@@ -555,6 +564,8 @@
 {
 	if (single_stepping(regs)) {
 		clear_single_step(regs);
+		if (ipipe_trap_notify(IPIPE_TRAP_SSTEP,regs))
+		    return;
 		_exception(SIGTRAP, regs, TRAP_TRACE, 0);
 	}
 }
@@ -624,6 +635,9 @@
 	unsigned int reason = get_reason(regs);
 	extern int do_mathemu(struct pt_regs *regs);
 
+	if (ipipe_trap_notify(IPIPE_TRAP_PCE,regs))
+	    	return;
+
 #ifdef CONFIG_MATH_EMULATION
 	/* (reason & REASON_ILLEGAL) would be the obvious thing here,
 	 * but there seems to be a hardware bug on the 405GP (RevD)
@@ -701,6 +715,8 @@
 void single_step_exception(struct pt_regs *regs)
 {
 	regs->msr &= ~(MSR_SE | MSR_BE);  /* Turn off 'trace' bits */
+	if (ipipe_trap_notify(IPIPE_TRAP_SSTEP,regs))
+	    	return;
 	if (debugger_sstep(regs))
 		return;
 	_exception(SIGTRAP, regs, TRAP_TRACE, 0);
@@ -716,6 +732,8 @@
 		emulate_single_step(regs);
 		return;
 	}
+	if (ipipe_trap_notify(IPIPE_TRAP_ALIGNMENT,regs))
+	    	return;
 	if (fixed == -EFAULT) {
 		/* fixed == -EFAULT means the operand address was bad */
 		if (user_mode(regs))
@@ -738,6 +756,8 @@
 
 void nonrecoverable_exception(struct pt_regs *regs)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_NREC,regs))
+	    	return;
 	printk(KERN_ERR "Non-recoverable exception at PC=%lx MSR=%lx\n",
 	       regs->nip, regs->msr);
 	debugger(regs);
@@ -758,6 +778,9 @@
 	extern int Soft_emulate_8xx(struct pt_regs *);
 	int errcode;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_SOFTEMU,regs))
+	    	return;
+
 	CHECK_FULL_REGS(regs);
 
 	if (!user_mode(regs)) {
@@ -786,6 +809,8 @@
 
 void DebugException(struct pt_regs *regs, unsigned long debug_status)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_DEBUG,regs))
+	    	return;
 	if (debug_status & DBSR_IC) {	/* instruction completion */
 		regs->msr &= ~MSR_DE;
 		if (user_mode(regs)) {
@@ -826,6 +851,9 @@
 {
 	static int kernel_altivec_count;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_ALTUNAVAIL,regs))
+	    	return;
+
 #ifndef CONFIG_ALTIVEC
 	if (user_mode(regs)) {
 		/* A user program has executed an altivec instruction,
@@ -847,6 +875,8 @@
 {
 	int err;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_ALTASSIST,regs))
+	    	return;
 	preempt_disable();
 	if (regs->msr & MSR_VEC)
 		giveup_altivec(current);
@@ -907,6 +937,9 @@
 	int fpexc_mode;
 	int code = 0;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_SPE,regs))
+	    	return;
+
 	spefscr = current->thread.spefscr;
 	fpexc_mode = current->thread.fpexc_mode;
 

+ diff -u linux-2.6.18/arch/ppc/mm/fault.c.ORIG linux-2.6.18/arch/ppc/mm/fault.c

arch/ppc/mm/fault.c renamed from arch/ppc/mm/fault.c.ORIG +3 -0
@@ -113,6 +113,9 @@
 		is_write = error_code & 0x02000000;
 #endif /* CONFIG_4xx || CONFIG_BOOKE */
 
+	if (ipipe_trap_notify(IPIPE_TRAP_ACCESS,regs))
+	    	return 0;
+
 #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
 	if (debugger_fault_handler && TRAP(regs) == 0x300) {
 		debugger_fault_handler(regs);

+ diff -u linux-2.6.18/arch/ppc/platforms/85xx/sbc85xx.h.ORIG linux-2.6.18/arch/ppc/platforms/85xx/sbc85xx.h

arch/ppc/platforms/85xx/sbc85xx.h renamed from arch/ppc/platforms/85xx/sbc85xx.h.ORIG +0 -1
@@ -15,7 +15,6 @@
 #define __PLATFORMS_85XX_SBC85XX_H__
 
 #include <linux/init.h>
-#include <linux/seq_file.h>
 #include <asm/ppcboot.h>
 
 #define BOARD_CCSRBAR		((uint)0xff700000)

+ diff -u linux-2.6.18/arch/ppc/syslib/open_pic.c.ORIG linux-2.6.18/arch/ppc/syslib/open_pic.c

arch/ppc/syslib/open_pic.c renamed from arch/ppc/syslib/open_pic.c.ORIG +2 -2
@@ -821,7 +821,7 @@
  */
 static void openpic_ack_irq(unsigned int irq_nr)
 {
-#ifdef __SLOW_VERSION__
+#if defined(__SLOW_VERSION__) || defined(CONFIG_IPIPE)
 	openpic_disable_irq(irq_nr);
 	openpic_eoi();
 #else
@@ -832,7 +832,7 @@
 
 static void openpic_end_irq(unsigned int irq_nr)
 {
-#ifdef __SLOW_VERSION__
+#if defined(__SLOW_VERSION__) || defined(CONFIG_IPIPE)
 	if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
 	    && irq_desc[irq_nr].action)
 		openpic_enable_irq(irq_nr);

+ diff -u linux-2.6.18/drivers/pci/msi.c.ORIG linux-2.6.18/drivers/pci/msi.c

drivers/pci/msi.c renamed from drivers/pci/msi.c.ORIG +18 -3
@@ -164,6 +164,21 @@
 	msi_set_mask_bit(vector, 0);
 }
 
+#ifdef CONFIG_IPIPE
+static void ack_MSI_irq_w_maskbit(unsigned int vector)
+{
+    mask_MSI_irq(vector);
+    __ack_APIC_irq();
+}
+static void ack_MSI_irq_wo_maskbit(unsigned int vector)
+{
+    __ack_APIC_irq();
+}
+#else /* !CONFIG_IPIPE */
+#define ack_MSI_irq_wo_maskbit  do_nothing
+#define ack_MSI_irq_w_maskbit   mask_MSI_irq
+#endif /* CONFIG_IPIPE */
+
 static unsigned int startup_msi_irq_wo_maskbit(unsigned int vector)
 {
 	struct msi_desc *entry;
@@ -227,7 +242,7 @@
 	.shutdown	= shutdown_msi_irq,
 	.enable		= unmask_MSI_irq,
 	.disable	= mask_MSI_irq,
-	.ack		= mask_MSI_irq,
+	.ack		= ack_MSI_irq_w_maskbit,
 	.end		= end_msi_irq_w_maskbit,
 	.set_affinity	= set_msi_affinity
 };
@@ -243,7 +258,7 @@
 	.shutdown	= shutdown_msi_irq,
 	.enable		= unmask_MSI_irq,
 	.disable	= mask_MSI_irq,
-	.ack		= mask_MSI_irq,
+	.ack		= ack_MSI_irq_w_maskbit,
 	.end		= end_msi_irq_w_maskbit,
 	.set_affinity	= set_msi_affinity
 };
@@ -259,7 +274,7 @@
 	.shutdown	= shutdown_msi_irq,
 	.enable		= do_nothing,
 	.disable	= do_nothing,
-	.ack		= do_nothing,
+	.ack		= ack_MSI_irq_wo_maskbit,
 	.end		= end_msi_irq_wo_maskbit,
 	.set_affinity	= set_msi_affinity
 };

+ diff -u linux-2.6.18/include/asm-powerpc/hw_irq.h.ORIG linux-2.6.18/include/asm-powerpc/hw_irq.h

include/asm-powerpc/hw_irq.h renamed from include/asm-powerpc/hw_irq.h.ORIG +162 -0

174 lines not on this page · raw message

+ diff -u linux-2.6.18/include/asm-powerpc/irq.h.ORIG linux-2.6.18/include/asm-powerpc/irq.h

include/asm-powerpc/irq.h renamed from include/asm-powerpc/irq.h.ORIG +2 -0
@@ -12,7 +12,9 @@
 #include <linux/config.h>
 #include <linux/threads.h>
 #include <linux/list.h>
+#ifdef CONFIG_PPC_MERGE
 #include <linux/radix-tree.h>
+#endif
 
 #include <asm/types.h>
 #include <asm/atomic.h>

+ diff -u linux-2.6.18/include/asm-ppc/ipipe.h.ORIG linux-2.6.18/include/asm-ppc/ipipe.h

include/asm-ppc/ipipe.h renamed from include/asm-ppc/ipipe.h.ORIG +222 -0

222 lines not on this page · raw message

+ diff -u linux-2.6.18/include/asm-ppc/mmu_context.h.ORIG linux-2.6.18/include/asm-ppc/mmu_context.h

include/asm-ppc/mmu_context.h renamed from include/asm-ppc/mmu_context.h.ORIG +11 -1
@@ -153,7 +153,10 @@
  */
 static inline void destroy_context(struct mm_struct *mm)
 {
+	unsigned long flags;
+
 	preempt_disable();
+	local_irq_save_hw_cond(flags);
 	if (mm->context.id != NO_CONTEXT) {
 		clear_bit(mm->context.id, context_map);
 		mm->context.id = NO_CONTEXT;
@@ -161,6 +164,7 @@
 		atomic_inc(&nr_free_contexts);
 #endif
 	}
+ 	local_irq_restore_hw_cond(flags);
 	preempt_enable();
 }
 
@@ -193,7 +197,13 @@
  * After we have set current->mm to a new value, this activates
  * the context for the new mm so we see the new mappings.
  */
-#define activate_mm(active_mm, mm)   switch_mm(active_mm, mm, current)
+#define activate_mm(active_mm, mm)   \
+do { \
+	unsigned long flags; \
+	local_irq_save_hw_cond(flags); \
+	switch_mm(active_mm, mm, current); \
+	local_irq_restore_hw_cond(flags);	   \
+} while(0)
 
 extern void mmu_context_init(void);
 

+ diff -u linux-2.6.18/include/asm-ppc/pgalloc.h.ORIG linux-2.6.18/include/asm-ppc/pgalloc.h

include/asm-ppc/pgalloc.h renamed from include/asm-ppc/pgalloc.h.ORIG +5 -0
@@ -39,5 +39,10 @@
 
 #define check_pgt_cache()	do { } while (0)
 
+static inline void set_pgdir(unsigned long address, pgd_t entry)
+{
+    /* nop */
+}
+
 #endif /* _PPC_PGALLOC_H */
 #endif /* __KERNEL__ */

+ diff -u linux-2.6.18/include/linux/hardirq.h.ORIG linux-2.6.18/include/linux/hardirq.h

include/linux/hardirq.h renamed from include/linux/hardirq.h.ORIG +13 -0
@@ -123,7 +123,20 @@
  */
 extern void irq_exit(void);
 
+#ifdef CONFIG_IPIPE
+#define nmi_enter() \
+do { \
+    if (ipipe_current_domain == ipipe_root_domain) \
+	{ lockdep_off(); irq_enter(); } \
+} while(0)
+#define nmi_exit() \
+do { \
+    if (ipipe_current_domain == ipipe_root_domain) \
+	{ __irq_exit(); lockdep_on(); } \
+} while(0)
+#else /* !CONFIG_IPIPE */
 #define nmi_enter()		do { lockdep_off(); irq_enter(); } while (0)
 #define nmi_exit()		do { __irq_exit(); lockdep_on(); } while (0)
+#endif /* CONFIG_IPIPE */
 
 #endif /* LINUX_HARDIRQ_H */

+ diff -u linux-2.6.18/include/linux/ipipe.h.ORIG linux-2.6.18/include/linux/ipipe.h

include/linux/ipipe.h renamed from include/linux/ipipe.h.ORIG +764 -0

764 lines not on this page · raw message

+ diff -u linux-2.6.18/include/linux/linkage.h.ORIG linux-2.6.18/include/linux/linkage.h

include/linux/linkage.h renamed from include/linux/linkage.h.ORIG +4 -0
@@ -60,4 +60,8 @@
 #define fastcall
 #endif
 
+#ifndef notrace
+#define notrace		__attribute__((no_instrument_function))
+#endif
+
 #endif

+ diff -u linux-2.6.18/include/linux/preempt.h.ORIG linux-2.6.18/include/linux/preempt.h

include/linux/preempt.h renamed from include/linux/preempt.h.ORIG +23 -6
@@ -26,22 +26,39 @@
 
 asmlinkage void preempt_schedule(void);
 
+#ifdef CONFIG_IPIPE
+
+#include <asm/ipipe.h>
+
+extern struct ipipe_domain *ipipe_percpu_domain[], *ipipe_root_domain;
+
+#define ipipe_preempt_guard()	(ipipe_percpu_domain[ipipe_processor_id()] == ipipe_root_domain)
+#else
+#define ipipe_preempt_guard()	1
+#endif
+
 #define preempt_disable() \
 do { \
-	inc_preempt_count(); \
-	barrier(); \
+	if (ipipe_preempt_guard()) { \
+		inc_preempt_count(); \
+		barrier(); \
+	} \
 } while (0)
 
 #define preempt_enable_no_resched() \
 do { \
-	barrier(); \
-	dec_preempt_count(); \
+	if (ipipe_preempt_guard()) { \
+		barrier(); \
+		dec_preempt_count(); \
+	} \
 } while (0)
 
 #define preempt_check_resched() \
 do { \
-	if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
-		preempt_schedule(); \
+	if (ipipe_preempt_guard()) { \
+		if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
+			preempt_schedule(); \
+	} \
 } while (0)
 
 #define preempt_enable() \

+ diff -u linux-2.6.18/include/linux/sched.h.ORIG linux-2.6.18/include/linux/sched.h

include/linux/sched.h renamed from include/linux/sched.h.ORIG +14 -0
@@ -41,6 +41,7 @@
 
 #include <asm/param.h>	/* for HZ */
 
+#include <linux/ipipe.h>
 #include <linux/capability.h>
 #include <linux/threads.h>
 #include <linux/kernel.h>
@@ -148,6 +149,13 @@
 #define EXIT_DEAD		32
 /* in tsk->state again */
 #define TASK_NONINTERACTIVE	64
+#ifdef CONFIG_IPIPE
+#define TASK_ATOMICSWITCH	512
+#define TASK_NOWAKEUP          1024
+#else  /* !CONFIG_IPIPE */
+#define TASK_ATOMICSWITCH	0
+#define TASK_NOWAKEUP          0
+#endif /* CONFIG_IPIPE */
 
 #define __set_task_state(tsk, state_value)		\
 	do { (tsk)->state = (state_value); } while (0)
@@ -996,6 +1004,9 @@
 #ifdef	CONFIG_TASK_DELAY_ACCT
 	struct task_delay_info *delays;
 #endif
+#ifdef CONFIG_IPIPE
+	void *ptd[IPIPE_ROOT_NPTDKEYS];
+#endif
 };
 
 static inline pid_t process_group(struct task_struct *tsk)
@@ -1056,6 +1067,9 @@
 #define PF_SPREAD_SLAB	0x02000000	/* Spread some slab caches over cpuset */
 #define PF_MEMPOLICY	0x10000000	/* Non-default NUMA mempolicy */
 #define PF_MUTEX_TESTER	0x20000000	/* Thread belongs to the rt mutex tester */
+#ifdef CONFIG_IPIPE
+#define PF_EVNOTIFY	0x40000000	/* Notify other domains about internal events */
+#endif /* CONFIG_IPIPE */
 
 /*
  * Only the _current_ task can read/write to tsk->flags, but other

+ diff -u linux-2.6.18/init/Kconfig.ORIG linux-2.6.18/init/Kconfig

init/Kconfig renamed from init/Kconfig.ORIG +1 -0
@@ -66,6 +66,7 @@
 
 config LOCALVERSION
 	string "Local version - append to kernel release"
+	default "-ipipe"
 	help
 	  Append an extra string to the end of your kernel version.
 	  This will show up when you type uname, for example.

+ diff -u linux-2.6.18/init/main.c.ORIG linux-2.6.18/init/main.c

init/main.c renamed from init/main.c.ORIG +6 -0
@@ -512,6 +512,11 @@
 	softirq_init();
 	timekeeping_init();
 	time_init();
+	/*
+	 * We need to wait for the interrupt and time subsystems to be
+	 * initialized before enabling the pipeline.
+	 */
+	ipipe_init();
 	profile_init();
 	if (!irqs_disabled())
 		printk("start_kernel(): bug: interrupts were enabled early\n");
@@ -660,6 +665,7 @@
 #ifdef CONFIG_SYSCTL
 	sysctl_init();
 #endif
+	ipipe_init_proc();
 
 	do_initcalls();
 }

+ diff -u linux-2.6.18/kernel/exit.c.ORIG linux-2.6.18/kernel/exit.c

kernel/exit.c renamed from kernel/exit.c.ORIG +1 -0
@@ -909,6 +909,7 @@
 	taskstats_exit_send(tsk, tidstats, group_dead, mycpu);
 	taskstats_exit_free(tidstats);
 
+	ipipe_exit_notify(tsk);
 	exit_mm(tsk);
 
 	if (group_dead)

+ diff -u linux-2.6.18/kernel/fork.c.ORIG linux-2.6.18/kernel/fork.c

kernel/fork.c renamed from kernel/fork.c.ORIG +10 -0
@@ -375,6 +375,7 @@
 	might_sleep();
 
 	if (atomic_dec_and_test(&mm->mm_users)) {
+		ipipe_cleanup_notify(mm);
 		exit_aio(mm);
 		exit_mmap(mm);
 		if (!list_empty(&mm->mmlist)) {
@@ -1249,6 +1250,15 @@
 	spin_unlock(&current->sighand->siglock);
 	write_unlock_irq(&tasklist_lock);
 	proc_fork_connector(p);
+#ifdef CONFIG_IPIPE
+	{
+		int k;
+		
+		for (k = 0; k < IPIPE_ROOT_NPTDKEYS; k++)
+			p->ptd[k] = NULL;
+	}
+#endif /* CONFIG_IPIPE */
+ 
 	return p;
 
 bad_fork_cleanup_namespace:

+ diff -u linux-2.6.18/kernel/ipipe/core.c.ORIG linux-2.6.18/kernel/ipipe/core.c

kernel/ipipe/core.c renamed from kernel/ipipe/core.c.ORIG +1059 -0

312 lines not on this page · raw message

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

+ diff -u linux-2.6.18/kernel/ipipe/generic.c.ORIG linux-2.6.18/kernel/ipipe/generic.c

kernel/ipipe/generic.c renamed from kernel/ipipe/generic.c.ORIG +424 -0

424 lines not on this page · raw message

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

+ diff -u linux-2.6.18/kernel/ipipe/Kconfig.ORIG linux-2.6.18/kernel/ipipe/Kconfig

kernel/ipipe/Kconfig renamed from kernel/ipipe/Kconfig.ORIG +6 -0

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

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

+ diff -u linux-2.6.18/kernel/ipipe/Makefile.ORIG linux-2.6.18/kernel/ipipe/Makefile

kernel/ipipe/Makefile renamed from kernel/ipipe/Makefile.ORIG +3 -0

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

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

+ diff -u linux-2.6.18/kernel/irq/handle.c.ORIG linux-2.6.18/kernel/irq/handle.c

kernel/irq/handle.c renamed from kernel/irq/handle.c.ORIG +15 -0

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

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

+ diff -u linux-2.6.18/kernel/Makefile.ORIG linux-2.6.18/kernel/Makefile

kernel/Makefile renamed from kernel/Makefile.ORIG +1 -0

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

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

+ diff -u linux-2.6.18/kernel/printk.c.ORIG linux-2.6.18/kernel/printk.c

kernel/printk.c renamed from kernel/printk.c.ORIG +73 -0

73 lines not on this page · raw message

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

+ diff -u linux-2.6.18/kernel/sched.c.ORIG linux-2.6.18/kernel/sched.c

kernel/sched.c renamed from kernel/sched.c.ORIG +69 -3

72 lines not on this page · raw message

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

+ diff -u linux-2.6.18/kernel/signal.c.ORIG linux-2.6.18/kernel/signal.c

kernel/signal.c renamed from kernel/signal.c.ORIG +1 -0

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

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

+ diff -u linux-2.6.18/lib/smp_processor_id.c.ORIG linux-2.6.18/lib/smp_processor_id.c

lib/smp_processor_id.c renamed from lib/smp_processor_id.c.ORIG +5 -0

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

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

+ diff -u linux-2.6.18/mm/vmalloc.c.ORIG linux-2.6.18/mm/vmalloc.c

mm/vmalloc.c renamed from mm/vmalloc.c.ORIG +5 -0

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 8 lines · Wolfgang Grandegger

Hi Philippe,

attached you will find a first version of the PPC ADEOS-IPipe patch for Linux 2.6.18 (from kernel.org) for review. I have also included a commented log file with more information on the porting of adeos-ipipe-2.6.14-ppc-1.4-00 to Linux 2.6.18. It works with a recent version of Xenomai.

Thanks, at first sight, this looks good. I don't see any obvious problem in the tracer code either. Anyway, I will play with it asap.

Quoted 8 lines

The patch currently only supports devices in the "arch/ppc" tree with the option "CONFIG_PPC_MERGE" not set. Porting the "arch/powerpc" tree requires further effort and I need a test system as well. Puh, let's hope that the merge ppc -> powerpc will be completed soon.

The idle loop is not yet working for 6xx and I have disabled it for this reason (check arch/powerpc/kernel/idle.c). It needs further debugging. I hope to find more time beginning of October.

Ok, thanks. Btw, returning from NAP on 6xx is done through an exception, right? If so, maybe we have a problem with this particular exception/interrupt branching directly to transfer_to_handler_full (i.e. the vanilla way) without being known from the Adeos pipeline, albeit it should? (red blinking warning: this is just a wild guess).

Quoted 3 lines

I have tested the patch on some AMCC 4xx system, on a MPC 8560 (85xx) and MPC 834x (6xx). I have also not yet tested the IPIPE tracer.

I'll give it a try too on a mpc52xx. Thanks again.

Signature · 1 line
Philippe.
#2 lore raw
Quoted 8 lines · Philippe Gerum
Quoted 4 lines · Wolfgang Grandegger

Hi Philippe,

attached you will find a first version of the PPC ADEOS-IPipe patch for Linux 2.6.18 (from kernel.org) for review. I have also included a commented log file with more information on the porting of adeos-ipipe-2.6.14-ppc-1.4-00 to Linux 2.6.18. It works with a recent version of Xenomai.

Thanks, at first sight, this looks good. I don't see any obvious problem in the tracer code either. Anyway, I will play with it asap.

OK, I wanted to have it under SVN control asap (the IPIPE version increased twice during the last weeks).

Quoted 1 line
Quoted 1 line

The patch currently only supports dev

ices in the "arch/ppc" tree with

Quoted 11 lines
Quoted 5 lines

the option "CONFIG_PPC_MERGE" not set. Porting the "arch/powerpc" tree requires further effort and I need a test system as well. Puh, let's hope that the merge ppc -> powerpc will be completed soon.

The idle loop is not yet working for 6xx and I have disabled it for this reason (check arch/powerpc/kernel/idle.c). It needs further debugging. I hope to find more time beginning of October.

Ok, thanks. Btw, returning from NAP on 6xx is done through an exception, right? If so, maybe we have a problem with this particular exception/interrupt branching directly to transfer_to_handler_full (i.e. the vanilla way) without being known from the Adeos pipeline, albeit it should? (red blinking warning: this is just a wild guess).

It actually does a doze. Napping can be switched on via procfs. So far, I understood that the decrementer exception will wakeup the CPU but I'm going to check the code and doc more carefully. An it did work with 2.6.14.

Quoted 3 lines
Quoted 1 line

I have tested the patch on some AMCC 4xx system, on a MPC 8560 (85xx) and MPC 834x (6xx). I have also not yet tested the IPIPE tracer.

I'll give it a try too on a mpc52xx. Thanks again.

Unfortunately, the port for this CPU is broken, again ;-(. At least I did not get my Icecube-Board up and running.

Thanks.

Wolfgang.

#3 lore raw
In reply to Philippe Gerum

Hi Philippe,

Quoted 15 lines · Philippe Gerum
Quoted 4 lines · Wolfgang Grandegger

Hi Philippe,

attached you will find a first version of the PPC ADEOS-IPipe patch for Linux 2.6.18 (from kernel.org) for review. I have also included a commented log file with more information on the porting of adeos-ipipe-2.6.14-ppc-1.4-00 to Linux 2.6.18. It works with a recent version of Xenomai.

Thanks, at first sight, this looks good. I don't see any obvious problem in the tracer code either. Anyway, I will play with it asap.

Quoted 5 lines

The patch currently only supports devices in the "arch/ppc" tree with the option "CONFIG_PPC_MERGE" not set. Porting the "arch/powerpc" tree requires further effort and I need a test system as well. Puh, let's hope that the merge ppc -> powerpc will be completed soon.

The idle loop is not yet working for 6xx and I have disabled it for this reason (check arch/powerpc/kernel/idle.c). It needs further debugging. I hope to find more time beginning of October.

Quoted 5 lines

Ok, thanks. Btw, returning from NAP on 6xx is done through an exception, right? If so, maybe we have a problem with this particular exception/interrupt branching directly to transfer_to_handler_full (i.e. the vanilla way) without being known from the Adeos pipeline, albeit it should? (red blinking warning: this is just a wild guess).

Attached is a revised patch including a fix for remaining problem in the 6xx idle loop mentioned above. The bug was here (diff to old patch):

-+++ linux-2.6.18/arch/ppc/kernel/entry.S
++++ linux-2.6.18/arch/ppc/kernel/entry.S
@@ -132,8 +132,23 @@
* check for stack overflow
*/
@@ -78,9 +73,9 @@

 +      &current->thread_info to &current->thread, which is coarser
 +      than the vanilla implementation, but likely sensitive enough
 +      to catch overflows soon enough though.*/
-+      addi    r11,r9,THREAD
++      addi    r12,r9,THREAD
 +      cmplw   0,r1,r9
-+      cmplw   1,r1,r11
++      cmplw   1,r1,r12
 +      crand   1,1,4
 +      bgt-    stack_ovf               /* if r9 < r1 < r9+THREAD */

+#else /* CONFIG_IPIPE */

I accidentally used r11 for the above logic, which is in fact used in power_save_6xx_restore:

_GLOBAL(power_save_6xx_restore)

        lwz     r9,_LINK(r11)         /* interrupted in ppc6xx_idle: */
        stw     r9,_NIP(r11)          /* make it do a blr */
Quoted 3 lines
Quoted 1 line

I have tested the patch on some AMCC 4xx system, on a MPC 8560 (85xx) and MPC 834x (6xx). I have also not yet tested the IPIPE tracer.

I'll give it a try too on a mpc52xx. Thanks again.

With this patch, Xenomai works now fine on my MPC834x (6xx) as well.

Wolfgang.

+ diff -u linux-2.6.18/arch/powerpc/kernel/idle.c.ORIG linux-2.6.18/arch/powerpc/kernel/idle.c

arch/powerpc/kernel/idle.c renamed from arch/powerpc/kernel/idle.c.ORIG +9 -0
@@ -51,6 +51,7 @@
 	while (1) {
 		while (!need_resched() && !cpu_should_die()) {
 			ppc64_runlatch_off();
+			ipipe_suspend_domain();
 
 			if (ppc_md.power_save) {
 				clear_thread_flag(TIF_POLLING_NRFLAG);
@@ -59,13 +60,21 @@
 				 * is ordered w.r.t. need_resched() test.
 				 */
 				smp_mb();
+#ifdef CONFIG_IPIPE
+				local_irq_disable_hw();
+#else /* !CONFIG_IPIPE */
 				local_irq_disable();
+#endif /* CONFIG_IPIPE */
 
 				/* check again after disabling irqs */
 				if (!need_resched() && !cpu_should_die())
 					ppc_md.power_save();
 
+#ifdef CONFIG_IPIPE
+				local_irq_enable_hw();
+#else /* !CONFIG_IPIPE */
 				local_irq_enable();
+#endif /* CONFIG_IPIPE */
 				set_thread_flag(TIF_POLLING_NRFLAG);
 
 			} else {

+ diff -u linux-2.6.18/arch/powerpc/kernel/irq.c.ORIG linux-2.6.18/arch/powerpc/kernel/irq.c

arch/powerpc/kernel/irq.c renamed from arch/powerpc/kernel/irq.c.ORIG +4 -0
@@ -68,7 +68,11 @@
 #endif
 
 int __irq_offset_value;
+#ifdef CONFIG_IPIPE
+int ppc_spurious_interrupts;
+#else /* !CONFIG_IPIPE */
 static int ppc_spurious_interrupts;
+#endif /* CONFIG_IPIPE */
 
 #ifdef CONFIG_PPC32
 EXPORT_SYMBOL(__irq_offset_value);

+ diff -u linux-2.6.18/arch/ppc/Kconfig.ORIG linux-2.6.18/arch/ppc/Kconfig

arch/ppc/Kconfig renamed from arch/ppc/Kconfig.ORIG +2 -0
@@ -950,6 +950,8 @@
 	depends on SMP
 	default "4"
 
+source "kernel/ipipe/Kconfig"
+
 config HIGHMEM
 	bool "High memory support"
 

+ diff -u linux-2.6.18/arch/ppc/kernel/entry.S.ORIG linux-2.6.18/arch/ppc/kernel/entry.S

arch/ppc/kernel/entry.S renamed from arch/ppc/kernel/entry.S.ORIG +92 -0

137 lines not on this page · raw message

+ diff -u linux-2.6.18/arch/ppc/kernel/head_44x.S.ORIG linux-2.6.18/arch/ppc/kernel/head_44x.S

arch/ppc/kernel/head_44x.S renamed from arch/ppc/kernel/head_44x.S.ORIG +5 -1
@@ -427,7 +427,11 @@
 	INSTRUCTION_STORAGE_EXCEPTION
 
 	/* External Input Interrupt */
-	EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x0500, ExternalInput, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
+ 	EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 	/* Alignment Interrupt */
 	ALIGNMENT_EXCEPTION

+ diff -u linux-2.6.18/arch/ppc/kernel/head_4xx.S.ORIG linux-2.6.18/arch/ppc/kernel/head_4xx.S

arch/ppc/kernel/head_4xx.S renamed from arch/ppc/kernel/head_4xx.S.ORIG +14 -0
@@ -228,6 +228,12 @@
 	EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, NOCOPY, transfer_to_handler_full, \
 			  ret_from_except_full)
 
+#ifdef CONFIG_IPIPE
+#define EXC_XFER_IPIPE(n, hdlr)		\
+	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
+			  __ipipe_ret_from_except)
+#endif /* CONFIG_IPIPE */
+
 #define EXC_XFER_LITE(n, hdlr)		\
 	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
 			  ret_from_except)
@@ -396,7 +402,11 @@
 	EXC_XFER_EE_LITE(0x400, handle_page_fault)
 
 /* 0x0500 - External Interrupt Exception */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x0500, HardwareInterrupt, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x0500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 /* 0x0600 - Alignment Exception */
 	START_EXCEPTION(0x0600, Alignment)
@@ -434,7 +444,11 @@
 	lis	r0,TSR_PIS@h
 	mtspr	SPRN_TSR,r0		/* Clear the PIT exception */
 	addi	r3,r1,STACK_FRAME_OVERHEAD
+#ifdef CONFIG_IPIPE
+	EXC_XFER_IPIPE(0x1000, __ipipe_grab_timer)
+#else /* !CONFIG_IPIPE */
 	EXC_XFER_LITE(0x1000, timer_interrupt)
+#endif /* CONFIG_IPIPE */
 
 #if 0
 /* NOTE:

+ diff -u linux-2.6.18/arch/ppc/kernel/head_8xx.S.ORIG linux-2.6.18/arch/ppc/kernel/head_8xx.S

arch/ppc/kernel/head_8xx.S renamed from arch/ppc/kernel/head_8xx.S.ORIG +13 -0
@@ -186,6 +186,11 @@
 #define EXC_XFER_STD(n, hdlr)		\
 	EXC_XFER_TEMPLATE(n, hdlr, n, NOCOPY, transfer_to_handler_full,	\
 			  ret_from_except_full)
+#ifdef CONFIG_IPIPE
+#define EXC_XFER_IPIPE(n, hdlr)		\
+	EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
+			  __ipipe_ret_from_except)
+#endif /* CONFIG_IPIPE */
 
 #define EXC_XFER_LITE(n, hdlr)		\
 	EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
@@ -238,7 +243,11 @@
 	EXC_XFER_EE_LITE(0x400, handle_page_fault)
 
 /* External interrupt */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x500, HardwareInterrupt, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 /* Alignment exception */
 	. = 0x600
@@ -259,7 +268,11 @@
 	EXCEPTION(0x800, FPUnavailable, unknown_exception, EXC_XFER_STD)
 
 /* Decrementer */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x900, Decrementer, __ipipe_grab_timer, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x900, Decrementer, timer_interrupt, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 	EXCEPTION(0xa00, Trap_0a, unknown_exception, EXC_XFER_EE)
 	EXCEPTION(0xb00, Trap_0b, unknown_exception, EXC_XFER_EE)

+ diff -u linux-2.6.18/arch/ppc/kernel/head_booke.h.ORIG linux-2.6.18/arch/ppc/kernel/head_booke.h

arch/ppc/kernel/head_booke.h renamed from arch/ppc/kernel/head_booke.h.ORIG +16 -0
@@ -187,6 +187,12 @@
 	EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, NOCOPY, transfer_to_handler_full, \
 			  ret_from_except_full)
 
+#ifdef CONFIG_IPIPE
+#define EXC_XFER_IPIPE(n, hdlr)		\
+	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
+			  __ipipe_ret_from_except)
+#endif /* CONFIG_IPIPE */
+
 #define EXC_XFER_LITE(n, hdlr)		\
 	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
 			  ret_from_except)
@@ -345,6 +351,15 @@
 	addi	r3,r1,STACK_FRAME_OVERHEAD;				      \
 	EXC_XFER_STD(0x0700, program_check_exception)
 
+#ifdef CONFIG_IPIPE
+#define DECREMENTER_EXCEPTION						      \
+	START_EXCEPTION(Decrementer)					      \
+	NORMAL_EXCEPTION_PROLOG;					      \
+	lis     r0,TSR_DIS@h;           /* Setup the DEC interrupt mask */    \
+	mtspr   SPRN_TSR,r0;		/* Clear the DEC interrupt */	      \
+	addi    r3,r1,STACK_FRAME_OVERHEAD;				      \
+	EXC_XFER_IPIPE(0x0900, __ipipe_grab_timer)
+#else /* !CONFIG_IPIPE */
 #define DECREMENTER_EXCEPTION						      \
 	START_EXCEPTION(Decrementer)					      \
 	NORMAL_EXCEPTION_PROLOG;					      \
@@ -352,6 +367,7 @@
 	mtspr   SPRN_TSR,r0;		/* Clear the DEC interrupt */	      \
 	addi    r3,r1,STACK_FRAME_OVERHEAD;				      \
 	EXC_XFER_LITE(0x0900, timer_interrupt)
+#endif /* CONFIG_IPIPE */
 
 #define FP_UNAVAILABLE_EXCEPTION					      \
 	START_EXCEPTION(FloatingPointUnavailable)			      \

+ diff -u linux-2.6.18/arch/ppc/kernel/head_fsl_booke.S.ORIG linux-2.6.18/arch/ppc/kernel/head_fsl_booke.S

arch/ppc/kernel/head_fsl_booke.S renamed from arch/ppc/kernel/head_fsl_booke.S.ORIG +4 -0
@@ -526,7 +526,11 @@
 	INSTRUCTION_STORAGE_EXCEPTION
 
 	/* External Input Interrupt */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x0500, ExternalInput, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 	/* Alignment Interrupt */
 	ALIGNMENT_EXCEPTION

+ diff -u linux-2.6.18/arch/ppc/kernel/head.S.ORIG linux-2.6.18/arch/ppc/kernel/head.S

arch/ppc/kernel/head.S renamed from arch/ppc/kernel/head.S.ORIG +14 -0
@@ -295,6 +295,12 @@
 	EXC_XFER_TEMPLATE(n, hdlr, n, NOCOPY, transfer_to_handler_full,	\
 			  ret_from_except_full)
 
+#ifdef CONFIG_IPIPE
+#define EXC_XFER_IPIPE(n, hdlr)		\
+	EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
+			  __ipipe_ret_from_except)
+#endif /* CONFIG_IPIPE */
+
 #define EXC_XFER_LITE(n, hdlr)		\
 	EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
 			  ret_from_except)
@@ -356,7 +362,11 @@
 	EXC_XFER_EE_LITE(0x400, handle_page_fault)
 
 /* External interrupt */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x500, HardwareInterrupt, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 /* Alignment exception */
 	. = 0x600
@@ -381,7 +391,11 @@
 	EXC_XFER_EE_LITE(0x800, kernel_fp_unavailable_exception)
 
 /* Decrementer */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x900, Decrementer, __ipipe_grab_timer, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x900, Decrementer, timer_interrupt, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 	EXCEPTION(0xa00, Trap_0a, unknown_exception, EXC_XFER_EE)
 	EXCEPTION(0xb00, Trap_0b, unknown_exception, EXC_XFER_EE)

+ diff -u linux-2.6.18/arch/ppc/kernel/ipipe-core.c.ORIG linux-2.6.18/arch/ppc/kernel/ipipe-core.c

arch/ppc/kernel/ipipe-core.c renamed from arch/ppc/kernel/ipipe-core.c.ORIG +265 -0

265 lines not on this page · raw message

+ diff -u linux-2.6.18/arch/ppc/kernel/ipipe-root.c.ORIG linux-2.6.18/arch/ppc/kernel/ipipe-root.c

arch/ppc/kernel/ipipe-root.c renamed from arch/ppc/kernel/ipipe-root.c.ORIG +498 -0

498 lines not on this page · raw message

+ diff -u linux-2.6.18/arch/ppc/kernel/Makefile.ORIG linux-2.6.18/arch/ppc/kernel/Makefile

arch/ppc/kernel/Makefile renamed from arch/ppc/kernel/Makefile.ORIG +2 -0
@@ -17,6 +17,8 @@
 obj-$(CONFIG_RAPIDIO)		+= rio.o
 obj-$(CONFIG_KGDB)		+= ppc-stub.o
 obj-$(CONFIG_SMP)		+= smp.o smp-tbsync.o
+obj-$(CONFIG_IPIPE)		+= ipipe-core.o ipipe-root.o
+obj-$(CONFIG_IPIPE_TRACE)	+= ipipe-mcount.o
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o
 
 ifndef CONFIG_MATH_EMULATION

+ diff -u linux-2.6.18/arch/ppc/kernel/traps.c.ORIG linux-2.6.18/arch/ppc/kernel/traps.c

arch/ppc/kernel/traps.c renamed from arch/ppc/kernel/traps.c.ORIG +33 -0
@@ -233,6 +233,9 @@
 {
 	unsigned long reason = get_mc_reason(regs);
 
+	if (ipipe_trap_notify(IPIPE_TRAP_MCE,regs))
+	    	return;
+
 	if (user_mode(regs)) {
 		regs->msr |= MSR_RI;
 		_exception(SIGBUS, regs, BUS_ADRERR, regs->nip);
@@ -392,6 +395,8 @@
 
 void unknown_exception(struct pt_regs *regs)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_UNKNOWN,regs))
+	    	return;
 	printk("Bad trap at PC: %lx, MSR: %lx, vector=%lx    %s\n",
 	       regs->nip, regs->msr, regs->trap, print_tainted());
 	_exception(SIGTRAP, regs, 0, 0);
@@ -399,6 +404,8 @@
 
 void instruction_breakpoint_exception(struct pt_regs *regs)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_IABR,regs))
+	    	return;
 	if (debugger_iabr_match(regs))
 		return;
 	_exception(SIGTRAP, regs, TRAP_BRKPT, 0);
@@ -406,6 +413,8 @@
 
 void RunModeException(struct pt_regs *regs)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_RM,regs))
+	    	return;
 	_exception(SIGTRAP, regs, 0, 0);
 }
 
@@ -555,6 +564,8 @@
 {
 	if (single_stepping(regs)) {
 		clear_single_step(regs);
+		if (ipipe_trap_notify(IPIPE_TRAP_SSTEP,regs))
+		    return;
 		_exception(SIGTRAP, regs, TRAP_TRACE, 0);
 	}
 }
@@ -624,6 +635,9 @@
 	unsigned int reason = get_reason(regs);
 	extern int do_mathemu(struct pt_regs *regs);
 
+	if (ipipe_trap_notify(IPIPE_TRAP_PCE,regs))
+	    	return;
+
 #ifdef CONFIG_MATH_EMULATION
 	/* (reason & REASON_ILLEGAL) would be the obvious thing here,
 	 * but there seems to be a hardware bug on the 405GP (RevD)
@@ -701,6 +715,8 @@
 void single_step_exception(struct pt_regs *regs)
 {
 	regs->msr &= ~(MSR_SE | MSR_BE);  /* Turn off 'trace' bits */
+	if (ipipe_trap_notify(IPIPE_TRAP_SSTEP,regs))
+	    	return;
 	if (debugger_sstep(regs))
 		return;
 	_exception(SIGTRAP, regs, TRAP_TRACE, 0);
@@ -716,6 +732,8 @@
 		emulate_single_step(regs);
 		return;
 	}
+	if (ipipe_trap_notify(IPIPE_TRAP_ALIGNMENT,regs))
+	    	return;
 	if (fixed == -EFAULT) {
 		/* fixed == -EFAULT means the operand address was bad */
 		if (user_mode(regs))
@@ -738,6 +756,8 @@
 
 void nonrecoverable_exception(struct pt_regs *regs)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_NREC,regs))
+	    	return;
 	printk(KERN_ERR "Non-recoverable exception at PC=%lx MSR=%lx\n",
 	       regs->nip, regs->msr);
 	debugger(regs);
@@ -758,6 +778,9 @@
 	extern int Soft_emulate_8xx(struct pt_regs *);
 	int errcode;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_SOFTEMU,regs))
+	    	return;
+
 	CHECK_FULL_REGS(regs);
 
 	if (!user_mode(regs)) {
@@ -786,6 +809,8 @@
 
 void DebugException(struct pt_regs *regs, unsigned long debug_status)
 {
+	if (ipipe_trap_notify(IPIPE_TRAP_DEBUG,regs))
+	    	return;
 	if (debug_status & DBSR_IC) {	/* instruction completion */
 		regs->msr &= ~MSR_DE;
 		if (user_mode(regs)) {
@@ -826,6 +851,9 @@
 {
 	static int kernel_altivec_count;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_ALTUNAVAIL,regs))
+	    	return;
+
 #ifndef CONFIG_ALTIVEC
 	if (user_mode(regs)) {
 		/* A user program has executed an altivec instruction,
@@ -847,6 +875,8 @@
 {
 	int err;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_ALTASSIST,regs))
+	    	return;
 	preempt_disable();
 	if (regs->msr & MSR_VEC)
 		giveup_altivec(current);
@@ -907,6 +937,9 @@
 	int fpexc_mode;
 	int code = 0;
 
+	if (ipipe_trap_notify(IPIPE_TRAP_SPE,regs))
+	    	return;
+
 	spefscr = current->thread.spefscr;
 	fpexc_mode = current->thread.fpexc_mode;
 

+ diff -u linux-2.6.18/arch/ppc/mm/fault.c.ORIG linux-2.6.18/arch/ppc/mm/fault.c

arch/ppc/mm/fault.c renamed from arch/ppc/mm/fault.c.ORIG +3 -0
@@ -113,6 +113,9 @@
 		is_write = error_code & 0x02000000;
 #endif /* CONFIG_4xx || CONFIG_BOOKE */
 
+	if (ipipe_trap_notify(IPIPE_TRAP_ACCESS,regs))
+	    	return 0;
+
 #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
 	if (debugger_fault_handler && TRAP(regs) == 0x300) {
 		debugger_fault_handler(regs);

+ diff -u linux-2.6.18/arch/ppc/platforms/85xx/sbc85xx.h.ORIG linux-2.6.18/arch/ppc/platforms/85xx/sbc85xx.h

arch/ppc/platforms/85xx/sbc85xx.h renamed from arch/ppc/platforms/85xx/sbc85xx.h.ORIG +0 -1
@@ -15,7 +15,6 @@
 #define __PLATFORMS_85XX_SBC85XX_H__
 
 #include <linux/init.h>
-#include <linux/seq_file.h>
 #include <asm/ppcboot.h>
 
 #define BOARD_CCSRBAR		((uint)0xff700000)

+ diff -u linux-2.6.18/arch/ppc/syslib/open_pic.c.ORIG linux-2.6.18/arch/ppc/syslib/open_pic.c

arch/ppc/syslib/open_pic.c renamed from arch/ppc/syslib/open_pic.c.ORIG +2 -2
@@ -821,7 +821,7 @@
  */
 static void openpic_ack_irq(unsigned int irq_nr)
 {
-#ifdef __SLOW_VERSION__
+#if defined(__SLOW_VERSION__) || defined(CONFIG_IPIPE)
 	openpic_disable_irq(irq_nr);
 	openpic_eoi();
 #else
@@ -832,7 +832,7 @@
 
 static void openpic_end_irq(unsigned int irq_nr)
 {
-#ifdef __SLOW_VERSION__
+#if defined(__SLOW_VERSION__) || defined(CONFIG_IPIPE)
 	if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
 	    && irq_desc[irq_nr].action)
 		openpic_enable_irq(irq_nr);

+ diff -u linux-2.6.18/drivers/pci/msi.c.ORIG linux-2.6.18/drivers/pci/msi.c

drivers/pci/msi.c renamed from drivers/pci/msi.c.ORIG +18 -3
@@ -164,6 +164,21 @@
 	msi_set_mask_bit(vector, 0);
 }
 
+#ifdef CONFIG_IPIPE
+static void ack_MSI_irq_w_maskbit(unsigned int vector)
+{
+    mask_MSI_irq(vector);
+    __ack_APIC_irq();
+}
+static void ack_MSI_irq_wo_maskbit(unsigned int vector)
+{
+    __ack_APIC_irq();
+}
+#else /* !CONFIG_IPIPE */
+#define ack_MSI_irq_wo_maskbit  do_nothing
+#define ack_MSI_irq_w_maskbit   mask_MSI_irq
+#endif /* CONFIG_IPIPE */
+
 static unsigned int startup_msi_irq_wo_maskbit(unsigned int vector)
 {
 	struct msi_desc *entry;
@@ -227,7 +242,7 @@
 	.shutdown	= shutdown_msi_irq,
 	.enable		= unmask_MSI_irq,
 	.disable	= mask_MSI_irq,
-	.ack		= mask_MSI_irq,
+	.ack		= ack_MSI_irq_w_maskbit,
 	.end		= end_msi_irq_w_maskbit,
 	.set_affinity	= set_msi_affinity
 };
@@ -243,7 +258,7 @@
 	.shutdown	= shutdown_msi_irq,
 	.enable		= unmask_MSI_irq,
 	.disable	= mask_MSI_irq,
-	.ack		= mask_MSI_irq,
+	.ack		= ack_MSI_irq_w_maskbit,
 	.end		= end_msi_irq_w_maskbit,
 	.set_affinity	= set_msi_affinity
 };
@@ -259,7 +274,7 @@
 	.shutdown	= shutdown_msi_irq,
 	.enable		= do_nothing,
 	.disable	= do_nothing,
-	.ack		= do_nothing,
+	.ack		= ack_MSI_irq_wo_maskbit,
 	.end		= end_msi_irq_wo_maskbit,
 	.set_affinity	= set_msi_affinity
 };

+ diff -u linux-2.6.18/include/asm-powerpc/hw_irq.h.ORIG linux-2.6.18/include/asm-powerpc/hw_irq.h

include/asm-powerpc/hw_irq.h renamed from include/asm-powerpc/hw_irq.h.ORIG +162 -0

174 lines not on this page · raw message

+ diff -u linux-2.6.18/include/asm-powerpc/irq.h.ORIG linux-2.6.18/include/asm-powerpc/irq.h

include/asm-powerpc/irq.h renamed from include/asm-powerpc/irq.h.ORIG +2 -0
@@ -12,7 +12,9 @@
 #include <linux/config.h>
 #include <linux/threads.h>
 #include <linux/list.h>
+#ifdef CONFIG_PPC_MERGE
 #include <linux/radix-tree.h>
+#endif
 
 #include <asm/types.h>
 #include <asm/atomic.h>

+ diff -u linux-2.6.18/include/asm-ppc/ipipe.h.ORIG linux-2.6.18/include/asm-ppc/ipipe.h

include/asm-ppc/ipipe.h renamed from include/asm-ppc/ipipe.h.ORIG +222 -0

222 lines not on this page · raw message

+ diff -u linux-2.6.18/include/asm-ppc/mmu_context.h.ORIG linux-2.6.18/include/asm-ppc/mmu_context.h

include/asm-ppc/mmu_context.h renamed from include/asm-ppc/mmu_context.h.ORIG +11 -1
@@ -153,7 +153,10 @@
  */
 static inline void destroy_context(struct mm_struct *mm)
 {
+	unsigned long flags;
+
 	preempt_disable();
+	local_irq_save_hw_cond(flags);
 	if (mm->context.id != NO_CONTEXT) {
 		clear_bit(mm->context.id, context_map);
 		mm->context.id = NO_CONTEXT;
@@ -161,6 +164,7 @@
 		atomic_inc(&nr_free_contexts);
 #endif
 	}
+ 	local_irq_restore_hw_cond(flags);
 	preempt_enable();
 }
 
@@ -193,7 +197,13 @@
  * After we have set current->mm to a new value, this activates
  * the context for the new mm so we see the new mappings.
  */
-#define activate_mm(active_mm, mm)   switch_mm(active_mm, mm, current)
+#define activate_mm(active_mm, mm)   \
+do { \
+	unsigned long flags; \
+	local_irq_save_hw_cond(flags); \
+	switch_mm(active_mm, mm, current); \
+	local_irq_restore_hw_cond(flags);	   \
+} while(0)
 
 extern void mmu_context_init(void);
 

+ diff -u linux-2.6.18/include/asm-ppc/pgalloc.h.ORIG linux-2.6.18/include/asm-ppc/pgalloc.h

include/asm-ppc/pgalloc.h renamed from include/asm-ppc/pgalloc.h.ORIG +5 -0
@@ -39,5 +39,10 @@
 
 #define check_pgt_cache()	do { } while (0)
 
+static inline void set_pgdir(unsigned long address, pgd_t entry)
+{
+    /* nop */
+}
+
 #endif /* _PPC_PGALLOC_H */
 #endif /* __KERNEL__ */

+ diff -u linux-2.6.18/include/linux/hardirq.h.ORIG linux-2.6.18/include/linux/hardirq.h

include/linux/hardirq.h renamed from include/linux/hardirq.h.ORIG +13 -0
@@ -123,7 +123,20 @@
  */
 extern void irq_exit(void);
 
+#ifdef CONFIG_IPIPE
+#define nmi_enter() \
+do { \
+    if (ipipe_current_domain == ipipe_root_domain) \
+	{ lockdep_off(); irq_enter(); } \
+} while(0)
+#define nmi_exit() \
+do { \
+    if (ipipe_current_domain == ipipe_root_domain) \
+	{ __irq_exit(); lockdep_on(); } \
+} while(0)
+#else /* !CONFIG_IPIPE */
 #define nmi_enter()		do { lockdep_off(); irq_enter(); } while (0)
 #define nmi_exit()		do { __irq_exit(); lockdep_on(); } while (0)
+#endif /* CONFIG_IPIPE */
 
 #endif /* LINUX_HARDIRQ_H */

+ diff -u linux-2.6.18/include/linux/ipipe.h.ORIG linux-2.6.18/include/linux/ipipe.h

include/linux/ipipe.h renamed from include/linux/ipipe.h.ORIG +764 -0

764 lines not on this page · raw message

+ diff -u linux-2.6.18/include/linux/linkage.h.ORIG linux-2.6.18/include/linux/linkage.h

include/linux/linkage.h renamed from include/linux/linkage.h.ORIG +4 -0
@@ -60,4 +60,8 @@
 #define fastcall
 #endif
 
+#ifndef notrace
+#define notrace		__attribute__((no_instrument_function))
+#endif
+
 #endif

+ diff -u linux-2.6.18/include/linux/preempt.h.ORIG linux-2.6.18/include/linux/preempt.h

include/linux/preempt.h renamed from include/linux/preempt.h.ORIG +23 -6
@@ -26,22 +26,39 @@
 
 asmlinkage void preempt_schedule(void);
 
+#ifdef CONFIG_IPIPE
+
+#include <asm/ipipe.h>
+
+extern struct ipipe_domain *ipipe_percpu_domain[], *ipipe_root_domain;
+
+#define ipipe_preempt_guard()	(ipipe_percpu_domain[ipipe_processor_id()] == ipipe_root_domain)
+#else
+#define ipipe_preempt_guard()	1
+#endif
+
 #define preempt_disable() \
 do { \
-	inc_preempt_count(); \
-	barrier(); \
+	if (ipipe_preempt_guard()) { \
+		inc_preempt_count(); \
+		barrier(); \
+	} \
 } while (0)
 
 #define preempt_enable_no_resched() \
 do { \
-	barrier(); \
-	dec_preempt_count(); \
+	if (ipipe_preempt_guard()) { \
+		barrier(); \
+		dec_preempt_count(); \
+	} \
 } while (0)
 
 #define preempt_check_resched() \
 do { \
-	if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
-		preempt_schedule(); \
+	if (ipipe_preempt_guard()) { \
+		if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
+			preempt_schedule(); \
+	} \
 } while (0)
 
 #define preempt_enable() \

+ diff -u linux-2.6.18/include/linux/sched.h.ORIG linux-2.6.18/include/linux/sched.h

include/linux/sched.h renamed from include/linux/sched.h.ORIG +14 -0
@@ -41,6 +41,7 @@
 
 #include <asm/param.h>	/* for HZ */
 
+#include <linux/ipipe.h>
 #include <linux/capability.h>
 #include <linux/threads.h>
 #include <linux/kernel.h>
@@ -148,6 +149,13 @@
 #define EXIT_DEAD		32
 /* in tsk->state again */
 #define TASK_NONINTERACTIVE	64
+#ifdef CONFIG_IPIPE
+#define TASK_ATOMICSWITCH	512
+#define TASK_NOWAKEUP          1024
+#else  /* !CONFIG_IPIPE */
+#define TASK_ATOMICSWITCH	0
+#define TASK_NOWAKEUP          0
+#endif /* CONFIG_IPIPE */
 
 #define __set_task_state(tsk, state_value)		\
 	do { (tsk)->state = (state_value); } while (0)
@@ -996,6 +1004,9 @@
 #ifdef	CONFIG_TASK_DELAY_ACCT
 	struct task_delay_info *delays;
 #endif
+#ifdef CONFIG_IPIPE
+	void *ptd[IPIPE_ROOT_NPTDKEYS];
+#endif
 };
 
 static inline pid_t process_group(struct task_struct *tsk)
@@ -1056,6 +1067,9 @@
 #define PF_SPREAD_SLAB	0x02000000	/* Spread some slab caches over cpuset */
 #define PF_MEMPOLICY	0x10000000	/* Non-default NUMA mempolicy */
 #define PF_MUTEX_TESTER	0x20000000	/* Thread belongs to the rt mutex tester */
+#ifdef CONFIG_IPIPE
+#define PF_EVNOTIFY	0x40000000	/* Notify other domains about internal events */
+#endif /* CONFIG_IPIPE */
 
 /*
  * Only the _current_ task can read/write to tsk->flags, but other

+ diff -u linux-2.6.18/init/Kconfig.ORIG linux-2.6.18/init/Kconfig

init/Kconfig renamed from init/Kconfig.ORIG +1 -0
@@ -66,6 +66,7 @@
 
 config LOCALVERSION
 	string "Local version - append to kernel release"
+	default "-ipipe"
 	help
 	  Append an extra string to the end of your kernel version.
 	  This will show up when you type uname, for example.

+ diff -u linux-2.6.18/init/main.c.ORIG linux-2.6.18/init/main.c

init/main.c renamed from init/main.c.ORIG +6 -0
@@ -512,6 +512,11 @@
 	softirq_init();
 	timekeeping_init();
 	time_init();
+	/*
+	 * We need to wait for the interrupt and time subsystems to be
+	 * initialized before enabling the pipeline.
+	 */
+	ipipe_init();
 	profile_init();
 	if (!irqs_disabled())
 		printk("start_kernel(): bug: interrupts were enabled early\n");
@@ -660,6 +665,7 @@
 #ifdef CONFIG_SYSCTL
 	sysctl_init();
 #endif
+	ipipe_init_proc();
 
 	do_initcalls();
 }

+ diff -u linux-2.6.18/kernel/exit.c.ORIG linux-2.6.18/kernel/exit.c

kernel/exit.c renamed from kernel/exit.c.ORIG +1 -0
@@ -909,6 +909,7 @@
 	taskstats_exit_send(tsk, tidstats, group_dead, mycpu);
 	taskstats_exit_free(tidstats);
 
+	ipipe_exit_notify(tsk);
 	exit_mm(tsk);
 
 	if (group_dead)

+ diff -u linux-2.6.18/kernel/fork.c.ORIG linux-2.6.18/kernel/fork.c

kernel/fork.c renamed from kernel/fork.c.ORIG +10 -0
@@ -375,6 +375,7 @@
 	might_sleep();
 
 	if (atomic_dec_and_test(&mm->mm_users)) {
+		ipipe_cleanup_notify(mm);
 		exit_aio(mm);
 		exit_mmap(mm);
 		if (!list_empty(&mm->mmlist)) {
@@ -1249,6 +1250,15 @@
 	spin_unlock(&current->sighand->siglock);
 	write_unlock_irq(&tasklist_lock);
 	proc_fork_connector(p);
+#ifdef CONFIG_IPIPE
+	{
+		int k;
+		
+		for (k = 0; k < IPIPE_ROOT_NPTDKEYS; k++)
+			p->ptd[k] = NULL;
+	}
+#endif /* CONFIG_IPIPE */
+ 
 	return p;
 
 bad_fork_cleanup_namespace:

+ diff -u linux-2.6.18/kernel/ipipe/core.c.ORIG linux-2.6.18/kernel/ipipe/core.c

kernel/ipipe/core.c renamed from kernel/ipipe/core.c.ORIG +1059 -0

318 lines not on this page · raw message

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

+ diff -u linux-2.6.18/kernel/ipipe/generic.c.ORIG linux-2.6.18/kernel/ipipe/generic.c

kernel/ipipe/generic.c renamed from kernel/ipipe/generic.c.ORIG +424 -0

424 lines not on this page · raw message

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

+ diff -u linux-2.6.18/kernel/ipipe/Kconfig.ORIG linux-2.6.18/kernel/ipipe/Kconfig

kernel/ipipe/Kconfig renamed from kernel/ipipe/Kconfig.ORIG +6 -0

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

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

+ diff -u linux-2.6.18/kernel/ipipe/Makefile.ORIG linux-2.6.18/kernel/ipipe/Makefile

kernel/ipipe/Makefile renamed from kernel/ipipe/Makefile.ORIG +3 -0

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

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

+ diff -u linux-2.6.18/kernel/irq/handle.c.ORIG linux-2.6.18/kernel/irq/handle.c

kernel/irq/handle.c renamed from kernel/irq/handle.c.ORIG +15 -0

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

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

+ diff -u linux-2.6.18/kernel/Makefile.ORIG linux-2.6.18/kernel/Makefile

kernel/Makefile renamed from kernel/Makefile.ORIG +1 -0

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

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

+ diff -u linux-2.6.18/kernel/printk.c.ORIG linux-2.6.18/kernel/printk.c

kernel/printk.c renamed from kernel/printk.c.ORIG +73 -0

73 lines not on this page · raw message

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

+ diff -u linux-2.6.18/kernel/sched.c.ORIG linux-2.6.18/kernel/sched.c

kernel/sched.c renamed from kernel/sched.c.ORIG +69 -3

72 lines not on this page · raw message

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

+ diff -u linux-2.6.18/kernel/signal.c.ORIG linux-2.6.18/kernel/signal.c

kernel/signal.c renamed from kernel/signal.c.ORIG +1 -0

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

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

+ diff -u linux-2.6.18/lib/smp_processor_id.c.ORIG linux-2.6.18/lib/smp_processor_id.c

lib/smp_processor_id.c renamed from lib/smp_processor_id.c.ORIG +5 -0

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

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

+ diff -u linux-2.6.18/mm/vmalloc.c.ORIG linux-2.6.18/mm/vmalloc.c

mm/vmalloc.c renamed from mm/vmalloc.c.ORIG +5 -0

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.

#4 lore raw
Quoted 52 lines · Wolfgang Grandegger

Hi Philippe,

Quoted 22 lines · Philippe Gerum
Quoted 8 lines · Wolfgang Grandegger

Hi Philippe,

attached you will find a first version of the PPC ADEOS-IPipe patch for Linux 2.6.18 (from kernel.org) for review. I have also included a commented log file with more information on the porting of adeos-ipipe-2.6.14-ppc-1.4-00 to Linux 2.6.18. It works with a recent version of Xenomai.

Thanks, at first sight, this looks good. I don't see any obvious problem in the tracer code either. Anyway, I will play with it asap.

Quoted 8 lines

The patch currently only supports devices in the "arch/ppc" tree with the option "CONFIG_PPC_MERGE" not set. Porting the "arch/powerpc" tree requires further effort and I need a test system as well. Puh, let's hope that the merge ppc -> powerpc will be completed soon.

The idle loop is not yet working for 6xx and I have disabled it for this reason (check arch/powerpc/kernel/idle.c). It needs further debugging. I hope to find more time beginning of October.

Quoted 5 lines

Ok, thanks. Btw, returning from NAP on 6xx is done through an exception, right? If so, maybe we have a problem with this particular exception/interrupt branching directly to transfer_to_handler_full (i.e. the vanilla way) without being known from the Adeos pipeline, albeit it should? (red blinking warning: this is just a wild guess).

Attached is a revised patch including a fix for remaining problem in the 6xx idle loop mentioned above. The bug was here (diff to old patch):

-+++ linux-2.6.18/arch/ppc/kernel/entry.S
++++ linux-2.6.18/arch/ppc/kernel/entry.S
@@ -132,8 +132,23 @@
* check for stack overflow
*/

(quoted diff) +2 -2
@@ -78,9 +73,9 @@
  +      &current->thread_info to &current->thread, which is coarser
  +      than the vanilla implementation, but likely sensitive enough
  +      to catch overflows soon enough though.*/
-+      addi    r11,r9,THREAD
++      addi    r12,r9,THREAD
  +      cmplw   0,r1,r9
-+      cmplw   1,r1,r11
++      cmplw   1,r1,r12
  +      crand   1,1,4
  +      bgt-    stack_ovf               /* if r9 < r1 < r9+THREAD */
  +#else /* CONFIG_IPIPE */
Quoted 2 lines

I accidentally used r11 for the above logic, which is in fact used in power_save_6xx_restore:

Gasp. Hopefully, one day, we will not have to work around the dual stack model anymore, because even Xenomai kernel threads will be based on regular Linux TCBs. Thanks for the patch.

Signature · 1 line
Philippe.
#5 lore raw
In reply to Wolfgang Grandegger
Quoted 25 lines · Wolfgang Grandegger

Hi Philippe,

Quoted 22 lines · Philippe Gerum
Quoted 8 lines · Wolfgang Grandegger

Hi Philippe,

attached you will find a first version of the PPC ADEOS-IPipe patch for Linux 2.6.18 (from kernel.org) for review. I have also included a commented log file with more information on the porting of adeos-ipipe-2.6.14-ppc-1.4-00 to Linux 2.6.18. It works with a recent version of Xenomai.

Thanks, at first sight, this looks good. I don't see any obvious problem in the tracer code either. Anyway, I will play with it asap.

Quoted 8 lines

The patch currently only supports devices in the "arch/ppc" tree with the option "CONFIG_PPC_MERGE" not set. Porting the "arch/powerpc" tree requires further effort and I need a test system as well. Puh, let's hope that the merge ppc -> powerpc will be completed soon.

The idle loop is not yet working for 6xx and I have disabled it for this reason (check arch/powerpc/kernel/idle.c). It needs further debugging. I hope to find more time beginning of October.

Quoted 8 lines
Quoted 5 lines

Ok, thanks. Btw, returning from NAP on 6xx is done through an exception, right? If so, maybe we have a problem with this particular exception/interrupt branching directly to transfer_to_handler_full (i.e. the vanilla way) without being known from the Adeos pipeline, albeit it should? (red blinking warning: this is just a wild guess).

Attached is a revised patch including a fix for remaining problem in the 6xx idle loop mentioned above. The bug was here (diff to old patch):

Merged, thanks.

Signature · 1 line
Philippe.