[Xenomai-git] Philippe Gerum : powerpc: upgrade legacy I-pipe support to 2.4.25-ppc-2. 2-01

2009-08-11 Thread GIT version control
Module: xenomai-2.4
Branch: master
Commit: 76c6f2d6d1902ac3f87670034dedce438d9e4285
URL:
http://git.xenomai.org/?p=xenomai-2.4.git;a=commit;h=76c6f2d6d1902ac3f87670034dedce438d9e4285

Author: Philippe Gerum 
Date:   Tue Aug 11 12:00:14 2009 +0200

powerpc: upgrade legacy I-pipe support to 2.4.25-ppc-2.2-01

---

 ...ch => adeos-ipipe-2.4.25-ppc-DENX-2.2-01.patch} |  198 +---
 1 files changed, 174 insertions(+), 24 deletions(-)

diff --git a/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.2-01.patch
similarity index 96%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.2-01.patch
index ca9a892..3615f71 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.2-01.patch
@@ -1,14 +1,15 @@
 diff --git a/arch/ppc/config.in b/arch/ppc/config.in
-index 08c6c40..133e8d8 100644
+index 08c6c40..32a937c 100644
 --- a/arch/ppc/config.in
 +++ b/arch/ppc/config.in
-@@ -892,6 +892,11 @@ else
+@@ -892,6 +892,12 @@ else
fi
  fi
  
 +bool 'Interrupt pipeline' CONFIG_IPIPE
 +if [ "$CONFIG_IPIPE" = "y" ]; then
 +  bool 'Check for illicit cross-domain calls' CONFIG_IPIPE_DEBUG_CONTEXT
++  bool 'Detect soft lockup' CONFIG_IPIPE_DEBUG_SOFTLOCK
 +fi
 +
  bool 'Networking support' CONFIG_NET
@@ -401,10 +402,10 @@ index 2ee19ac..5d85ee6 100644
  struct hw_interrupt_type ipic = {
 diff --git a/arch/ppc/kernel/ipipe.c b/arch/ppc/kernel/ipipe.c
 new file mode 100644
-index 000..c08400d
+index 000..d7e600e
 --- /dev/null
 +++ b/arch/ppc/kernel/ipipe.c
-@@ -0,0 +1,405 @@
+@@ -0,0 +1,433 @@
 +/* -*- linux-c -*-
 + * linux/arch/ppc/kernel/ipipe.c
 + *
@@ -458,6 +459,12 @@ index 000..c08400d
 +
 +#define DECREMENTER_MAX   0x7fff
 +
++/* Current reload value for the decrementer. */
++unsigned long __ipipe_decr_ticks;
++
++/* Next tick date (timebase value). */
++DEFINE_PER_CPU(unsigned long long, __ipipe_decr_next);
++
 +/*
 + * ipipe_critical_enter() -- Grab the superlock excluding all CPUs
 + * but the current one from a critical section. This lock is used when
@@ -494,6 +501,8 @@ index 000..c08400d
 +  if (virq != IPIPE_TIMER_VIRQ)
 +  panic("I-pipe: cannot reserve timer virq #%d (got #%d)",
 +IPIPE_TIMER_VIRQ, virq);
++
++  __ipipe_decr_ticks = tb_ticks_per_jiffy;
 +}
 +
 +void __ipipe_end_irq(unsigned irq)
@@ -546,6 +555,8 @@ index 000..c08400d
 +   &__ipipe_do_timer, NULL,
 +   NULL, IPIPE_HANDLE_MASK | IPIPE_PASS_MASK);
 +
++  per_cpu(__ipipe_decr_next, ipipe_processor_id()) = 
__ipipe_read_timebase() + get_dec();
++
 +  ipipe_critical_exit(flags);
 +}
 +
@@ -743,6 +754,22 @@ index 000..c08400d
 +  else
 +  __ipipe_handle_irq(IPIPE_TIMER_VIRQ, NULL);
 +
++#ifndef CONFIG_40x
++  if (__ipipe_decr_ticks != tb_ticks_per_jiffy) {
++  unsigned long long next_date, now;
++  int cpuid = ipipe_processor_id();
++
++  next_date = per_cpu(__ipipe_decr_next, cpuid);
++
++  while ((now = __ipipe_read_timebase()) >= next_date)
++  next_date += __ipipe_decr_ticks;
++
++  set_dec(next_date - now);
++
++  per_cpu(__ipipe_decr_next, cpuid) = next_date;
++  }
++#endif/* !CONFIG_40x */
++
 +  if (ipd == &ipipe_root) {
 +  if (!test_bit(IPIPE_STALL_FLAG, &ipipe_root_cpudom_var(status)))
 +  return 1;
@@ -810,6 +837,8 @@ index 000..c08400d
 +EXPORT_SYMBOL_GPL(print_backtrace);
 +EXPORT_SYMBOL_GPL(ioremap_bot);
 +EXPORT_SYMBOL_GPL(vmalloc_start);
++EXPORT_SYMBOL(__ipipe_decr_ticks);
++EXPORT_PER_CPU_SYMBOL(__ipipe_decr_next);
 diff --git a/arch/ppc/kernel/irq.c b/arch/ppc/kernel/irq.c
 index 8c9f63d..2558665 100644
 --- a/arch/ppc/kernel/irq.c
@@ -1040,7 +1069,7 @@ index d90d323..513c65d 100644
  EXPORT_SYMBOL(timer_interrupt);
  EXPORT_SYMBOL(do_IRQ_intercept);
 diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
-index b78fee1..05b9286 100644
+index b78fee1..d39f5d7 100644
 --- a/arch/ppc/kernel/process.c
 +++ b/arch/ppc/kernel/process.c
 @@ -211,7 +211,7 @@ _switch_to(struct task_struct *prev, struct task_struct 
*new,
@@ -1052,16 +1081,22 @@ index b78fee1..05b9286 100644
  
__save_flags(s);
__cli();
-@@ -276,7 +276,9 @@ _switch_to(struct task_struct *prev, struct task_struct 
*new,
+@@ -219,6 +219,7 @@ _switch_to(struct task_struct *prev, struct task_struct 
*new,
+   check_stack(prev);
+   check_stack(new);
  #endif
-   new_thread = &new->thread;
-   old_thread = ¤t->thread;
 +  local_irq_save_hw_cond(flags);
+ 
+ #ifdef CONFIG_SMP
+   /* avoid complexity of lazy save/restore of fpu
+@@ -278,6 +279,7 @@ _switch_to(struct task_struct *p

[Xenomai-git] Philippe Gerum : powerpc: upgrade legacy I-pipe support to 2.4.25-ppc-2. 2-01

2009-08-11 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: eba673b5378d9c88267be7653b6d0fb5319f39c1
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=eba673b5378d9c88267be7653b6d0fb5319f39c1

Author: Philippe Gerum 
Date:   Tue Aug 11 11:59:42 2009 +0200

powerpc: upgrade legacy I-pipe support to 2.4.25-ppc-2.2-01

---

 ...ch => adeos-ipipe-2.4.25-ppc-DENX-2.2-01.patch} |  198 +---
 1 files changed, 174 insertions(+), 24 deletions(-)

diff --git a/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.2-01.patch
similarity index 96%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.2-01.patch
index ca9a892..3615f71 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.2-01.patch
@@ -1,14 +1,15 @@
 diff --git a/arch/ppc/config.in b/arch/ppc/config.in
-index 08c6c40..133e8d8 100644
+index 08c6c40..32a937c 100644
 --- a/arch/ppc/config.in
 +++ b/arch/ppc/config.in
-@@ -892,6 +892,11 @@ else
+@@ -892,6 +892,12 @@ else
fi
  fi
  
 +bool 'Interrupt pipeline' CONFIG_IPIPE
 +if [ "$CONFIG_IPIPE" = "y" ]; then
 +  bool 'Check for illicit cross-domain calls' CONFIG_IPIPE_DEBUG_CONTEXT
++  bool 'Detect soft lockup' CONFIG_IPIPE_DEBUG_SOFTLOCK
 +fi
 +
  bool 'Networking support' CONFIG_NET
@@ -401,10 +402,10 @@ index 2ee19ac..5d85ee6 100644
  struct hw_interrupt_type ipic = {
 diff --git a/arch/ppc/kernel/ipipe.c b/arch/ppc/kernel/ipipe.c
 new file mode 100644
-index 000..c08400d
+index 000..d7e600e
 --- /dev/null
 +++ b/arch/ppc/kernel/ipipe.c
-@@ -0,0 +1,405 @@
+@@ -0,0 +1,433 @@
 +/* -*- linux-c -*-
 + * linux/arch/ppc/kernel/ipipe.c
 + *
@@ -458,6 +459,12 @@ index 000..c08400d
 +
 +#define DECREMENTER_MAX   0x7fff
 +
++/* Current reload value for the decrementer. */
++unsigned long __ipipe_decr_ticks;
++
++/* Next tick date (timebase value). */
++DEFINE_PER_CPU(unsigned long long, __ipipe_decr_next);
++
 +/*
 + * ipipe_critical_enter() -- Grab the superlock excluding all CPUs
 + * but the current one from a critical section. This lock is used when
@@ -494,6 +501,8 @@ index 000..c08400d
 +  if (virq != IPIPE_TIMER_VIRQ)
 +  panic("I-pipe: cannot reserve timer virq #%d (got #%d)",
 +IPIPE_TIMER_VIRQ, virq);
++
++  __ipipe_decr_ticks = tb_ticks_per_jiffy;
 +}
 +
 +void __ipipe_end_irq(unsigned irq)
@@ -546,6 +555,8 @@ index 000..c08400d
 +   &__ipipe_do_timer, NULL,
 +   NULL, IPIPE_HANDLE_MASK | IPIPE_PASS_MASK);
 +
++  per_cpu(__ipipe_decr_next, ipipe_processor_id()) = 
__ipipe_read_timebase() + get_dec();
++
 +  ipipe_critical_exit(flags);
 +}
 +
@@ -743,6 +754,22 @@ index 000..c08400d
 +  else
 +  __ipipe_handle_irq(IPIPE_TIMER_VIRQ, NULL);
 +
++#ifndef CONFIG_40x
++  if (__ipipe_decr_ticks != tb_ticks_per_jiffy) {
++  unsigned long long next_date, now;
++  int cpuid = ipipe_processor_id();
++
++  next_date = per_cpu(__ipipe_decr_next, cpuid);
++
++  while ((now = __ipipe_read_timebase()) >= next_date)
++  next_date += __ipipe_decr_ticks;
++
++  set_dec(next_date - now);
++
++  per_cpu(__ipipe_decr_next, cpuid) = next_date;
++  }
++#endif/* !CONFIG_40x */
++
 +  if (ipd == &ipipe_root) {
 +  if (!test_bit(IPIPE_STALL_FLAG, &ipipe_root_cpudom_var(status)))
 +  return 1;
@@ -810,6 +837,8 @@ index 000..c08400d
 +EXPORT_SYMBOL_GPL(print_backtrace);
 +EXPORT_SYMBOL_GPL(ioremap_bot);
 +EXPORT_SYMBOL_GPL(vmalloc_start);
++EXPORT_SYMBOL(__ipipe_decr_ticks);
++EXPORT_PER_CPU_SYMBOL(__ipipe_decr_next);
 diff --git a/arch/ppc/kernel/irq.c b/arch/ppc/kernel/irq.c
 index 8c9f63d..2558665 100644
 --- a/arch/ppc/kernel/irq.c
@@ -1040,7 +1069,7 @@ index d90d323..513c65d 100644
  EXPORT_SYMBOL(timer_interrupt);
  EXPORT_SYMBOL(do_IRQ_intercept);
 diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
-index b78fee1..05b9286 100644
+index b78fee1..d39f5d7 100644
 --- a/arch/ppc/kernel/process.c
 +++ b/arch/ppc/kernel/process.c
 @@ -211,7 +211,7 @@ _switch_to(struct task_struct *prev, struct task_struct 
*new,
@@ -1052,16 +1081,22 @@ index b78fee1..05b9286 100644
  
__save_flags(s);
__cli();
-@@ -276,7 +276,9 @@ _switch_to(struct task_struct *prev, struct task_struct 
*new,
+@@ -219,6 +219,7 @@ _switch_to(struct task_struct *prev, struct task_struct 
*new,
+   check_stack(prev);
+   check_stack(new);
  #endif
-   new_thread = &new->thread;
-   old_thread = ¤t->thread;
 +  local_irq_save_hw_cond(flags);
+ 
+ #ifdef CONFIG_SMP
+   /* avoid complexity of lazy save/restore of fpu
+@@ -278,6 +279,7 @@ _switch_to(struct task_struct