Xenomai on 2.6.17 ppc
Subsystems (10)
I have a custom mpc5200 Board with needs patches to get Linux running on it. But those Patches are only available for 2.6.17. Before i try to backport those patches i just wanted to ask if there is a way to run Xenomai on 2.6.17 for ppc.
Regards,
Syed Amer Gilani
Quoted 4 lines · Syed Amer Gilani
I have a custom mpc5200 Board with needs patches to get Linux running on it. But those Patches are only available for 2.6.17. Before i try to backport those patches i just wanted to ask if there is a way to run Xenomai on 2.6.17 for ppc.
I posted a commented ADEOS-IPIPE patch for 2.6.18 for PPC end of last week (see https://mail.gna.org/public/adeos-main/2006-09/msg00009.html). Unfortunately, the PowerPC Linux kernel is a fast moving target these day due to the merge ppc, ppc64 -> powerpc and there are a few significant changes between 2.6.17 and 2.6.18, IIRC. But it's still worth a try.
Wolfgang.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Syed Amer Gilani
2006/9/27, Wolfgang Grandegger <[email protected]>:
Quoted 6 lines
I posted a commented ADEOS-IPIPE patch for 2.6.18 for PPC end of last week (see https://mail.gna.org/public/adeos-main/2006-09/msg00009.html).
Unfortunately, the PowerPC Linux kernel is a fast moving target these day due to the merge ppc, ppc64 -> powerpc and there are a few significant changes between 2.6.17 and 2.6.18, IIRC. But it's still worth a try.I already saw that and thought about using it. But you also say later
(https://mail.gna.org/public/adeos-main/2006-09/msg00012.html) that it wont work for mpc52xx and that's what i need :)
I realized, that the differences to Linux 2.6.18 are quite small and non critical. Attached is a ADEOS-IPIPE patch for Linux 2.6.17, which should work on your MPC5200 as well (the idle loop problem for 6xx is solved). Would be nice if you could test the patch and report the results. It's difficult these days to get a 2.6.x kernel built and booted on an MPC5200 :-(.
Note: this patch requires another small fix for Xenomai (see attachment). Philippe, could you please apply it? TIA.
Wolfgang.
+ diff -u xenomai/include/asm-powerpc/atomic.h.2.6.18 xenomai/include/asm-powerpc/atomic.h
include/asm-powerpc/atomic.h renamed from include/asm-powerpc/atomic.h.2.6.18 +2 -2
@@ -30,9 +30,9 @@#include <asm/atomic.h> #include <asm/system.h> -#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,18 ) +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,15 )#define atomic_xchg (ptr,v) xchg(ptr,v) -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */ +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) */ #define xnarch_memory_barrier () smp_mb()#ifdef CONFIG_PPC64
+ diff -u linux-2.6.17/arch/powerpc/kernel/idle.c.ORIG linux-2.6.17/arch/powerpc/kernel/idle.c
arch/powerpc/kernel/idle.c renamed from arch/powerpc/kernel/idle.c.ORIG +9 -0
@@ -52,6 +52,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 );
@@ -60,13 +61,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.17/arch/powerpc/kernel/irq.c.ORIG linux-2.6.17/arch/powerpc/kernel/irq.c
arch/powerpc/kernel/irq.c renamed from arch/powerpc/kernel/irq.c.ORIG +4 -0
@@ -66,7 +66,11 @@EXPORT_SYMBOL (__irq_offset_value);#endif +#ifdef CONFIG_IPIPE +int ppc_spurious_interrupts; +#else /* !CONFIG_IPIPE */ static int ppc_spurious_interrupts; +#endif /* CONFIG_IPIPE */ #ifdef CONFIG_PPC32 #define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
+ diff -u linux-2.6.17/arch/ppc/Kconfig.ORIG linux-2.6.17/arch/ppc/Kconfig
arch/ppc/Kconfig renamed from arch/ppc/Kconfig.ORIG +2 -0
@@ -946,6 +946,8 @@ depends on SMP default "4" +source "kernel/ipipe/Kconfig" + config HIGHMEM bool "High memory support"
+ diff -u linux-2.6.17/arch/ppc/kernel/entry.S.ORIG linux-2.6.17/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.17/arch/ppc/kernel/head_44x.S.ORIG linux-2.6.17/arch/ppc/kernel/head_44x.S
arch/ppc/kernel/head_44x.S renamed from arch/ppc/kernel/head_44x.S.ORIG +5 -1
@@ -428,7 +428,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.17/arch/ppc/kernel/head_4xx.S.ORIG linux-2.6.17/arch/ppc/kernel/head_4xx.S
arch/ppc/kernel/head_4xx.S renamed from arch/ppc/kernel/head_4xx.S.ORIG +14 -0
@@ -229,6 +229,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)
@@ -397,7 +403,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)
@@ -435,7 +445,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.17/arch/ppc/kernel/head_8xx.S.ORIG linux-2.6.17/arch/ppc/kernel/head_8xx.S
arch/ppc/kernel/head_8xx.S renamed from arch/ppc/kernel/head_8xx.S.ORIG +13 -0
@@ -187,6 +187,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, \
@@ -239,7 +244,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
@@ -260,7 +269,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.17/arch/ppc/kernel/head_booke.h.ORIG linux-2.6.17/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.17/arch/ppc/kernel/head_fsl_booke.S.ORIG linux-2.6.17/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
@@ -527,7 +527,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.17/arch/ppc/kernel/head.S.ORIG linux-2.6.17/arch/ppc/kernel/head.S
arch/ppc/kernel/head.S renamed from arch/ppc/kernel/head.S.ORIG +14 -0
@@ -296,6 +296,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)
@@ -357,7 +363,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
@@ -382,7 +392,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.17/arch/ppc/kernel/ipipe-core.c.ORIG linux-2.6.17/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.17/arch/ppc/kernel/ipipe-root.c.ORIG linux-2.6.17/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.17/arch/ppc/kernel/Makefile.ORIG linux-2.6.17/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.17/arch/ppc/kernel/traps.c.ORIG linux-2.6.17/arch/ppc/kernel/traps.c
arch/ppc/kernel/traps.c renamed from arch/ppc/kernel/traps.c.ORIG +33 -0
@@ -234,6 +234,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);
@@ -393,6 +396,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 );
@@ -400,6 +405,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 );
@@ -407,6 +414,8 @@void RunModeException (struct pt_regs *regs) { +if (ipipe_trap_notify (IPIPE_TRAP_RM ,regs)) +return ;_exception (SIGTRAP , regs,0 ,0 ); }
@@ -556,6 +565,8 @@ {if (single_stepping (regs)) {clear_single_step (regs); +if (ipipe_trap_notify (IPIPE_TRAP_SSTEP ,regs)) +return ;_exception (SIGTRAP , regs,TRAP_TRACE ,0 ); } }
@@ -625,6 +636,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)
@@ -702,6 +716,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 );
@@ -717,6 +733,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))
@@ -739,6 +757,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);
@@ -759,6 +779,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)) {
@@ -787,6 +810,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)) {
@@ -827,6 +852,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,
@@ -848,6 +876,8 @@ {int err; +if (ipipe_trap_notify (IPIPE_TRAP_ALTASSIST ,regs)) +return ;preempt_disable ();if (regs->msr &MSR_VEC )giveup_altivec (current);
@@ -908,6 +938,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.17/arch/ppc/mm/fault.c.ORIG linux-2.6.17/arch/ppc/mm/fault.c
arch/ppc/mm/fault.c renamed from arch/ppc/mm/fault.c.ORIG +3 -0
@@ -114,6 +114,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.17/arch/ppc/platforms/85xx/sbc85xx.h.ORIG linux-2.6.17/arch/ppc/platforms/85xx/sbc85xx.h
arch/ppc/platforms/85xx/sbc85xx.h renamed from arch/ppc/platforms/85xx/sbc85xx.h.ORIG +0 -1
@@ -16,7 +16,6 @@#include <linux/config.h> #include <linux/init.h> -#include <linux/seq_file.h> #include <asm/ppcboot.h> #define BOARD_CCSRBAR ((uint)0xff700000)
+ diff -u linux-2.6.17/arch/ppc/syslib/open_pic.c.ORIG linux-2.6.17/arch/ppc/syslib/open_pic.c
arch/ppc/syslib/open_pic.c renamed from arch/ppc/syslib/open_pic.c.ORIG +2 -2
@@ -819,7 +819,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
@@ -830,7 +830,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.17/drivers/pci/msi.c.ORIG linux-2.6.17/drivers/pci/msi.c
drivers/pci/msi.c renamed from drivers/pci/msi.c.ORIG +18 -3
@@ -151,6 +151,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;
@@ -214,7 +229,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 };
@@ -230,7 +245,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 };
@@ -246,7 +261,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.17/include/asm-powerpc/hw_irq.h.ORIG linux-2.6.17/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.17/include/asm-ppc/ipipe.h.ORIG linux-2.6.17/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.17/include/asm-ppc/mmu_context.h.ORIG linux-2.6.17/include/asm-ppc/mmu_context.h
include/asm-ppc/mmu_context.h renamed from include/asm-ppc/mmu_context.h.ORIG +11 -1
@@ -149,7 +149,10 @@*/ static inline void destroy_context (struct mm_struct *mm) { +unsigned long flags; +preempt_disable (); +local_irq_save_hw_cond (flags);if (mm->context !=NO_CONTEXT ) {clear_bit (mm->context, context_map); mm->context =NO_CONTEXT ;
@@ -157,6 +160,7 @@atomic_inc (&nr_free_contexts);#endif } +local_irq_restore_hw_cond (flags);preempt_enable (); }
@@ -189,7 +193,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.17/include/asm-ppc/pgalloc.h.ORIG linux-2.6.17/include/asm-ppc/pgalloc.h
include/asm-ppc/pgalloc.h renamed from include/asm-ppc/pgalloc.h.ORIG +5 -0
@@ -40,5 +40,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.17/include/linux/hardirq.h.ORIG linux-2.6.17/include/linux/hardirq.h
include/linux/hardirq.h renamed from include/linux/hardirq.h.ORIG +13 -0
@@ -87,8 +87,21 @@# define synchronize_irq (irq) barrier()#endif +#ifdef CONFIG_IPIPE +#define nmi_enter () \ +do { \ + if (ipipe_current_domain == ipipe_root_domain) \ + irq_enter() \ +} while(0) +#define nmi_exit () \ +do { \ + if (ipipe_current_domain == ipipe_root_domain) \ + sub_preempt_count(HARDIRQ_OFFSET) \ +} while(0) +#else /* !CONFIG_IPIPE */ #define nmi_enter () irq_enter()#define nmi_exit () sub_preempt_count(HARDIRQ_OFFSET) +#endif /* CONFIG_IPIPE */ struct task_struct ;
+ diff -u linux-2.6.17/include/linux/ipipe.h.ORIG linux-2.6.17/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.17/include/linux/linkage.h.ORIG linux-2.6.17/include/linux/linkage.h
include/linux/linkage.h renamed from include/linux/linkage.h.ORIG +4 -0
@@ -61,4 +61,8 @@#define fastcall#endif +#ifndef notrace +#define notrace __attribute__((no_instrument_function)) +#endif +#endif
+ diff -u linux-2.6.17/include/linux/preempt.h.ORIG linux-2.6.17/include/linux/preempt.h
include/linux/preempt.h renamed from include/linux/preempt.h.ORIG +23 -6
@@ -27,22 +27,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.17/include/linux/sched.h.ORIG linux-2.6.17/include/linux/sched.h
include/linux/sched.h renamed from include/linux/sched.h.ORIG +14 -0
@@ -23,6 +23,7 @@#include <asm/mmu.h> #include <asm/cputime.h> +#include <linux/ipipe.h> #include <linux/smp.h> #include <linux/sem.h> #include <linux/signal.h>
@@ -131,6 +132,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)
@@ -888,6 +896,9 @@* cache last used pipe for splice */ struct pipe_inode_info *splice_pipe; +#ifdef CONFIG_IPIPE +void *ptd[IPIPE_ROOT_NPTDKEYS ]; +#endif };static inline pid_t process_group (struct task_struct *tsk)
@@ -948,6 +959,9 @@#define PF_SPREAD_PAGE 0x04000000/* Spread page cache over cpuset */ #define PF_SPREAD_SLAB 0x08000000/* Spread some slab caches over cpuset */ #define PF_MEMPOLICY 0x10000000/* Non-default NUMA mempolicy */ +#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.17/init/Kconfig.ORIG linux-2.6.17/init/Kconfig
init/Kconfig renamed from init/Kconfig.ORIG +1 -0
@@ -58,6 +58,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.17/init/main.c.ORIG linux-2.6.17/init/main.c
init/main.c renamed from init/main.c.ORIG +6 -0
@@ -490,6 +490,11 @@hrtimers_init ();softirq_init ();time_init (); +/* +* We need to wait for the interrupt and time subsystems to be +* initialized before enabling the pipeline. +*/ +ipipe_init ();/* * HACK ALERT! This is early. We're enabling the console before
@@ -623,6 +628,7 @@#ifdef CONFIG_SYSCTL sysctl_init ();#endif +ipipe_init_proc ();do_initcalls (); }
+ diff -u linux-2.6.17/kernel/exit.c.ORIG linux-2.6.17/kernel/exit.c
kernel/exit.c renamed from kernel/exit.c.ORIG +1 -0
@@ -905,6 +905,7 @@#endif if (unlikely (tsk->audit_context))audit_free (tsk); +ipipe_exit_notify (tsk);exit_mm (tsk);exit_sem (tsk);
+ diff -u linux-2.6.17/kernel/fork.c.ORIG linux-2.6.17/kernel/fork.c
kernel/fork.c renamed from kernel/fork.c.ORIG +10 -0
@@ -369,6 +369,7 @@void mmput (struct mm_struct *mm) {if (atomic_dec_and_test (&mm->mm_users)) { +ipipe_cleanup_notify (mm);exit_aio (mm);exit_mmap (mm);if (!list_empty (&mm->mmlist)) {
@@ -1214,6 +1215,15 @@spin_unlock (¤t->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.17/kernel/ipipe/core.c.ORIG linux-2.6.17/kernel/ipipe/core.c
kernel/ipipe/core.c renamed from kernel/ipipe/core.c.ORIG +1059 -0
315 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
+ diff -u linux-2.6.17/kernel/ipipe/generic.c.ORIG linux-2.6.17/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.17/kernel/ipipe/Kconfig.ORIG linux-2.6.17/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.17/kernel/ipipe/Makefile.ORIG linux-2.6.17/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.17/kernel/irq/handle.c.ORIG linux-2.6.17/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.17/kernel/Makefile.ORIG linux-2.6.17/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.17/kernel/printk.c.ORIG linux-2.6.17/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.17/kernel/sched.c.ORIG linux-2.6.17/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.17/kernel/signal.c.ORIG linux-2.6.17/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.17/lib/smp_processor_id.c.ORIG linux-2.6.17/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.17/mm/vmalloc.c.ORIG linux-2.6.17/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.
2006/9/30, Wolfgang Grandegger <[email protected]>:
Quoted 9 lines
I realized, that the differences to Linux 2.6.18 are quite small and non critical. Attached is a ADEOS-IPIPE patch for Linux 2.6.17, which should work on your MPC5200 as well (the idle loop problem for 6xx is solved). Would be nice if you could test the patch and report the results. It's difficult these days to get a 2.6.x kernel built and booted on an MPC5200 :-(.
Note: this patch requires another small fix for Xenomai (see attachment). Philippe, could you please apply it? TIA.
Thank you for the 2.6.17 patch, but unfortunately it did not work. I had problems with both patches. The xenomai patch expected 2 lines in the source that are not in the original xenomai sources. But i patched it manual.
The Kernel Patch does not work with the prepare-kernel script. It stops with:
grep: /home/amg/linux-2.6.17/include/asm-powerpc/ipipe.h: No such file or directoryprepare-kernel.sh: /home/amg/linux-2.6.17 has no Adeos support for powerpc
ipipe.h is in asm-ppc so i think it has something to do with the ppc -> powerpc merge.
So i patched is manually. But in menuconfig the xenomai entries are missing so i could not activate it to test it.
Syed Amer Gilani
Quoted 8 lines · Syed Amer Gilani
2006/9/30, Wolfgang Grandegger <[email protected]>:
Quoted 7 lines
I realized, that the differences to Linux 2.6.18 are quite small and non critical. Attached is a ADEOS-IPIPE patch for Linux 2.6.17, which should work on your MPC5200 as well (the idle loop problem for 6xx is solved). Would be nice if you could test the patch and report the results. It's difficult these days to get a 2.6.x kernel built and booted on an MPC5200 :-(.
Quoted 7 lines
Quoted 2 lines
Note: this patch requires another small fix for Xenomai (see attachment). Philippe, could you please apply it? TIA.
Thank you for the 2.6.17 patch, but unfortunately it did not work. I had problems with both patches. The xenomai patch expected 2 lines in the source that are not in the original xenomai sources. But i patched it manual.
What version of Xenomai did you use? You need the head of SVN trunk (or take the snapshot):
$ svn co http://svn.gna.org/svn/xenomai/trunk xenomai $ wget http://svn.gna.org/daily/xenomai-snapshot.tar.gz
Quoted 5 lines
The Kernel Patch does not work with the prepare-kernel script. It stops with:
grep:
/home/amg/linux-2.6.17/include/asm-powerpc/ipipe.h: No such file or directoryprepare-kernel.sh:/home/amg/linux-2.6.17has no Adeos support for powerpc
See above. And with a recent version of Xenomai you have to use --arch=ppc (-arch=powerpc does not work any more for the ppc tree).
Quoted 4 lines
ipipe.his in asm-ppc so i think it has something to do with the ppc -> powerpc merge.
So i patched is manually. But in menuconfig the xenomai entries are missing so i could not activate it to test it.
Likely you do just not use a recent version of Xenomai 2.3.x. It is working with my setup.
Wolfgang.
Quoted 3 lines
Syed Amer Gilani
2006/10/2, Wolfgang Grandegger <[email protected]>:
Quoted 2 lines
Likely you do just not use a recent version of Xenomai 2.3.x. It is working with my setup.
That's right. I used the latest stable version. I will try it later with the trunk.
Philippe Gerum
AppliedQuoted 9 lines · Wolfgang Grandegger
I realized, that the differences to Linux 2.6.18 are quite small and non critical. Attached is a ADEOS-IPIPE patch for Linux 2.6.17, which should work on your MPC5200 as well (the idle loop problem for 6xx is solved). Would be nice if you could test the patch and report the results. It's difficult these days to get a 2.6.x kernel built and booted on an MPC5200 :-(.
Note: this patch requires another small fix for Xenomai (see attachment). Philippe, could you please apply it? TIA.
Applied, thanks.
Signature · 1 line
Philippe.
2006/9/30, Wolfgang Grandegger <[email protected]>:
Quoted 29 lines
Quoted 11 lines · Syed Amer Gilani
2006/9/27, Wolfgang Grandegger <[email protected]>:
Quoted 6 lines
I posted a commented ADEOS-IPIPE patch for 2.6.18 for PPC end of last week (see https://mail.gna.org/public/adeos-main/2006-09/msg00009.html).
Unfortunately, the PowerPC Linux kernel is a fast moving target these day due to the merge ppc, ppc64 -> powerpc and there are a few significant changes between 2.6.17 and 2.6.18, IIRC. But it's still worth a try.I already saw that and thought about using it. But you also say later
(https://mail.gna.org/public/adeos-main/2006-09/msg00012.html) that it wont work for mpc52xx and that's what i need :)I realized, that the differences to Linux 2.6.18 are quite small and non critical. Attached is a ADEOS-IPIPE patch for Linux 2.6.17, which should work on your MPC5200 as well (the idle loop problem for 6xx is solved). Would be nice if you could test the patch and report the results. It's difficult these days to get a 2.6.x kernel built and booted on an MPC5200 :-(.
Note: this patch requires another small fix for Xenomai (see attachment). Philippe, could you please apply it? TIA.
Wolfgang.
2006/9/30, Wolfgang Grandegger <[email protected]>:
Quoted 20 lines
Quoted 11 lines · Syed Amer Gilani
2006/9/27, Wolfgang Grandegger <[email protected]>:
Quoted 6 lines
I posted a commented ADEOS-IPIPE patch for 2.6.18 for PPC end of last week (see https://mail.gna.org/public/adeos-main/2006-09/msg00009.html).
Unfortunately, the PowerPC Linux kernel is a fast moving target these day due to the merge ppc, ppc64 -> powerpc and there are a few significant changes between 2.6.17 and 2.6.18, IIRC. But it's still worth a try.I already saw that and thought about using it. But you also say later
(https://mail.gna.org/public/adeos-main/2006-09/msg00012.html) that it wont work for mpc52xx and that's what i need :)I realized, that the differences to Linux 2.6.18 are quite small and non critical. Attached is a ADEOS-IPIPE patch for Linux 2.6.17, which should work on your MPC5200 as well (the idle loop problem for 6xx is solved). Would be nice if you could test the patch and report the results. It's difficult these days to get a 2.6.x kernel built and booted on an MPC5200 :-(.
Quoted 2 lines
Note: this patch requires another small fix for Xenomai (see attachment). Philippe, could you please apply it? TIA.
First sorry for the empty Mail, this damn send button is so easily hit ...
The Patch applied fine and the Kernel compiled without Problems. Booting it on the mpc5200 went also fine. But beyond that i cant tell you if everything works in order, because is just started to use xenomai.
Quoted 22 lines · Syed Amer Gilani
2006/9/30, Wolfgang Grandegger <[email protected]>:
Quoted 21 lines
Quoted 3 lines · Syed Amer Gilani
2006/9/27, Wolfgang Grandegger <[email protected]>:
Quoted 2 lines
I posted a commented ADEOS-IPIPE patch for 2.6.18 for PPC end of last week (see
https://mail.gna.org/public/adeos-main/2006-09/msg00009.html).
Quoted 8 lines
Quoted 4 lines
Unfortunately, the PowerPC Linux kernel is a fast moving target these day due to the merge ppc, ppc64 -> powerpc and there are a few significant changes between 2.6.17 and 2.6.18, IIRC. But it's still worth a try.
I already saw that and thought about using it. But you also say later
(https://mail.gna.org/public/adeos-main/2006-09/msg00012.html) that it wont work for mpc52xx and that's what i need :)I realized, that the differences to Linux 2.6.18 are quite small and non critical. Attached is a ADEOS-IPIPE patch for Linux 2.6.17, which should work on your MPC5200 as well (the idle loop problem for 6xx is solved). Would be nice if you could test the patch and report the results. It's difficult these days to get a 2.6.x kernel built and booted on an MPC5200 :-(.
Quoted 4 lines
Quoted 2 lines
Note: this patch requires another small fix for Xenomai (see attachment). Philippe, could you please apply it? TIA.
First sorry for the empty Mail, this damn send button is so easily hit ...
Nice to hear.
Quoted 4 lines
The Patch applied fine and the Kernel compiled without Problems. Booting it on the mpc5200 went also fine. But beyond that i cant tell you if everything works in order, because is just started to use xenomai.
OK, then happy testing.
Are the Linux 2.6.17 patches for the MPC5200 you mentioned earlier available somewhere? I would like to do some RT-Socket-CAN tests with MSCAN under Linux 2.6 but so far, I didn't succeed to make a usable kernel :-(.
Thanks.
Wolfgang.
2006/10/5, Wolfgang Grandegger <[email protected]>:
Quoted 4 lines
Are the Linux 2.6.17 patches for the MPC5200 you mentioned earlier available somewhere? I would like to do some RT-Socket-CAN tests with MSCAN under Linux 2.6 but so far, I didn't succeed to make a usable kernel :-(.
http://www.pengutronix.de/oselas/bsp/phytec/index_de.html#phyCORE-MPC5200B
They are developed for this specific Board, i don't know if they work on slightly different Hardware. This Package is meant to be used with Ptxdist, but when you untar it you will find the kernel patches in the kernel-patches-target Directory.
Quoted 6 lines · Syed Amer Gilani
2006/10/5, Wolfgang Grandegger <[email protected]>:
Quoted 4 lines
Are the Linux 2.6.17 patches for the MPC5200 you mentioned earlier available somewhere? I would like to do some RT-Socket-CAN tests with MSCAN under Linux 2.6 but so far, I didn't succeed to make a usable kernel :-(.
Quoted 6 lines
http://www.pengutronix.de/oselas/bsp/phytec/index_de.html#phyCORE-MPC5200B
They are developed for this specific Board, i don't know if they work on slightly different Hardware. This Package is meant to be used with Ptxdist, but when you untar it you will find the kernel patches in the kernel-patches-target Directory.
Cool, I got Linux 2.6.17 booted on my Iccecube board. Thanks to you and Pengutronix.
Wolfgang.