Module: xenomai-2.6
Branch: master
Commit: 37d5b9ca42495716bbabfb7dc75b1514f44e9611
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=37d5b9ca42495716bbabfb7dc75b1514f44e9611

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Jan  7 15:19:24 2012 +0100

hal, nucleus: introduce support for pipeline core IPIs

The new pipeline core exposes only two specialized IPIs to domains
aside of the lock barrier IPI (IPIPE_CRITICAL_IPI), namely
IPIPE_HRTIMER_IPI and IPIPE_RESCHEDULE_IPI.

All the architecture ports are now using either these IPIs, or
IPIPE_SERVICE_IPI{0,1} in legacy mode.

---

 include/asm-arm/hal.h          |    2 +-
 include/asm-generic/bits/pod.h |    4 ++--
 include/asm-generic/hal.h      |   16 ++++++++--------
 include/asm-generic/system.h   |    5 ++---
 include/asm-powerpc/hal.h      |   11 ++++++++++-
 include/asm-x86/hal_32.h       |   13 ++++++++++---
 include/asm-x86/hal_64.h       |   19 ++++++++++++-------
 ksrc/nucleus/intr.c            |   19 ++++++++++++-------
 8 files changed, 57 insertions(+), 32 deletions(-)

diff --git a/include/asm-arm/hal.h b/include/asm-arm/hal.h
index e3ceebd..a9a09bb 100644
--- a/include/asm-arm/hal.h
+++ b/include/asm-arm/hal.h
@@ -152,7 +152,7 @@ static inline __attribute_const__ unsigned long ffnz 
(unsigned long ul)
 #endif /* RTHAL_TIMER_IRQ */
 
 #ifndef RTHAL_TIMER_IPI
-#define RTHAL_TIMER_IPI RTHAL_SERVICE_IPI3
+#define RTHAL_TIMER_IPI RTHAL_HRTIMER_IPI
 #endif /* RTHAL_TIMER_IPI */
 
 #ifdef __IPIPE_FEATURE_SYSINFO_V2
diff --git a/include/asm-generic/bits/pod.h b/include/asm-generic/bits/pod.h
index c2c9f31..a6be0dc 100644
--- a/include/asm-generic/bits/pod.h
+++ b/include/asm-generic/bits/pod.h
@@ -157,7 +157,7 @@ static void xnarch_switch_htick_mode(enum clock_event_mode 
mode, struct clock_ev
 static inline int xnarch_hook_ipi (void (*handler)(void))
 {
     return rthal_virtualize_irq(&rthal_domain,
-                               RTHAL_SERVICE_IPI0,
+                               RTHAL_RESCHEDULE_IPI,
                                (rthal_irq_handler_t) handler,
                                NULL,
                                NULL,
@@ -167,7 +167,7 @@ static inline int xnarch_hook_ipi (void (*handler)(void))
 static inline int xnarch_release_ipi (void)
 {
     return rthal_virtualize_irq(&rthal_domain,
-                               RTHAL_SERVICE_IPI0,
+                               RTHAL_RESCHEDULE_IPI,
                                NULL,
                                NULL,
                                NULL,
diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 0318988..9672f96 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -58,15 +58,15 @@
 #define rthal_virtual_irq_p(irq)       ((irq) >= RTHAL_VIRQ_BASE && \
                                        (irq) < RTHAL_NR_IRQS)
 
-#define RTHAL_SERVICE_IPI0     IPIPE_SERVICE_IPI0
-#define RTHAL_SERVICE_VECTOR0  IPIPE_SERVICE_VECTOR0
-#define RTHAL_SERVICE_IPI1     IPIPE_SERVICE_IPI1
-#define RTHAL_SERVICE_VECTOR1  IPIPE_SERVICE_VECTOR1
-#define RTHAL_SERVICE_IPI2     IPIPE_SERVICE_IPI2
-#define RTHAL_SERVICE_VECTOR2  IPIPE_SERVICE_VECTOR2
-#define RTHAL_SERVICE_IPI3     IPIPE_SERVICE_IPI3
-#define RTHAL_SERVICE_VECTOR3  IPIPE_SERVICE_VECTOR3
+#ifdef CONFIG_IPIPE_CORE
+#define RTHAL_HRTIMER_IPI      IPIPE_HRTIMER_IPI
+#define RTHAL_RESCHEDULE_IPI   IPIPE_RESCHEDULE_IPI
 #define RTHAL_CRITICAL_IPI     IPIPE_CRITICAL_IPI
+#else
+#define RTHAL_HRTIMER_IPI      IPIPE_SERVICE_IPI0
+#define RTHAL_RESCHEDULE_IPI   IPIPE_SERVICE_IPI1
+#define RTHAL_CRITICAL_IPI     IPIPE_CRITICAL_IPI
+#endif
 
 enum rthal_ktimer_mode { /* <!> Must follow enum clock_event_mode */
        KTIMER_MODE_UNUSED = 0,
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
index 9881236..7627bf7 100644
--- a/include/asm-generic/system.h
+++ b/include/asm-generic/system.h
@@ -404,7 +404,7 @@ static inline void xnlock_put_irqrestore(xnlock_t *lock, 
spl_t flags)
 static inline void xnarch_send_ipi(xnarch_cpumask_t cpumask)
 {
 #ifdef CONFIG_SMP
-       rthal_send_ipi(RTHAL_SERVICE_IPI0, cpumask);
+       rthal_send_ipi(RTHAL_RESCHEDULE_IPI, cpumask);
 #endif /* !CONFIG_SMP */
 }
 
@@ -429,9 +429,8 @@ static inline int xnlock_is_owner(xnlock_t *lock)
 #define DEFINE_XNLOCK(lock)
 #define DEFINE_PRIVATE_XNLOCK(lock)
 
-static inline int xnarch_send_ipi (xnarch_cpumask_t cpumask)
+static inline void xnarch_send_ipi (xnarch_cpumask_t cpumask)
 {
-       return 0;
 }
 
 #endif /* !(CONFIG_SMP || XENO_DEBUG(XNLOCK)) */
diff --git a/include/asm-powerpc/hal.h b/include/asm-powerpc/hal.h
index 2c5cdf8..016a3c4 100644
--- a/include/asm-powerpc/hal.h
+++ b/include/asm-powerpc/hal.h
@@ -57,8 +57,17 @@ static inline __attribute_const__ unsigned long 
ffnz(unsigned long ul)
 
 #define RTHAL_TIMER_IRQ                IPIPE_TIMER_VIRQ
 #ifdef CONFIG_SMP
-#define RTHAL_TIMER_IPI                IPIPE_SERVICE_IPI3
+#define RTHAL_TIMER_IPI                RTHAL_HRTIMER_IPI
+#ifndef CONFIG_IPIPE_CORE
+/*
+ * RTHAL_HOST_TIMER_IPI is only needed with old kernels with no
+ * support for generic clock events. So either we have a legacy kernel
+ * with a legacy pipeline, or we are running over a recent pipeline
+ * core (i.e. >= linux kernel 3.1) therefore we do have generic clock
+ * events, which means we don't need the host timer IPI.
+ */
 #define RTHAL_HOST_TIMER_IPI   IPIPE_SERVICE_IPI4
+#endif
 #endif /* CONFIG_SMP */
 
 #define DECREMENTER_MAX                0x7fffffff
diff --git a/include/asm-x86/hal_32.h b/include/asm-x86/hal_32.h
index 9a707d0..34ac10d 100644
--- a/include/asm-x86/hal_32.h
+++ b/include/asm-x86/hal_32.h
@@ -87,7 +87,9 @@ static inline __attribute_const__ unsigned long ffnz(unsigned 
long ul)
 #include <asm/fixmap.h>
 #include <asm/apic.h>
 #endif /* CONFIG_X86_LOCAL_APIC */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
+#include <linux/i8253.h>
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 #include <asm/i8253.h>
 #endif
 #include <asm/msr.h>
@@ -95,8 +97,13 @@ static inline __attribute_const__ unsigned long 
ffnz(unsigned long ul)
 #include <asm/xenomai/smi.h>
 
 #ifdef CONFIG_X86_LOCAL_APIC
-#define RTHAL_APIC_TIMER_VECTOR        RTHAL_SERVICE_VECTOR3
-#define RTHAL_APIC_TIMER_IPI   RTHAL_SERVICE_IPI3
+#ifdef CONFIG_IPIPE_CORE
+#define RTHAL_HRTIMER_VECTOR   IPIPE_HRTIMER_VECTOR
+#else
+#define RTHAL_HRTIMER_VECTOR   IPIPE_SERVICE_VECTOR0
+#endif
+#define RTHAL_APIC_TIMER_VECTOR        RTHAL_HRTIMER_VECTOR
+#define RTHAL_APIC_TIMER_IPI   RTHAL_HRTIMER_IPI
 #define RTHAL_APIC_ICOUNT      ((RTHAL_TIMER_FREQ + HZ/2)/HZ)
 #define RTHAL_TIMER_IRQ                RTHAL_APIC_TIMER_IPI
 #define RTHAL_HOST_TICK_IRQ    ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR)
diff --git a/include/asm-x86/hal_64.h b/include/asm-x86/hal_64.h
index c58556f..b6d083e 100644
--- a/include/asm-x86/hal_64.h
+++ b/include/asm-x86/hal_64.h
@@ -49,13 +49,18 @@ static inline __attribute_const__ unsigned long 
ffnz(unsigned long ul)
 #include <asm/xenomai/atomic.h>
 #include <asm/xenomai/smi.h>
 
-#define RTHAL_APIC_TIMER_VECTOR                RTHAL_SERVICE_VECTOR3
-#define RTHAL_APIC_TIMER_IPI           RTHAL_SERVICE_IPI3
-#define RTHAL_APIC_ICOUNT              ((RTHAL_TIMER_FREQ + HZ/2)/HZ)
-#define RTHAL_TIMER_IRQ                        RTHAL_APIC_TIMER_IPI
-#define RTHAL_NMICLK_FREQ              RTHAL_CPU_FREQ
-#define RTHAL_HOST_TICK_IRQ            
ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR)
-#define RTHAL_BCAST_TICK_IRQ           0
+#ifdef CONFIG_IPIPE_CORE
+#define RTHAL_HRTIMER_VECTOR   IPIPE_HRTIMER_VECTOR
+#else
+#define RTHAL_HRTIMER_VECTOR   IPIPE_SERVICE_VECTOR0
+#endif
+#define RTHAL_APIC_TIMER_VECTOR        RTHAL_HRTIMER_VECTOR
+#define RTHAL_APIC_TIMER_IPI   RTHAL_HRTIMER_IPI
+#define RTHAL_APIC_ICOUNT      ((RTHAL_TIMER_FREQ + HZ/2)/HZ)
+#define RTHAL_TIMER_IRQ                RTHAL_APIC_TIMER_IPI
+#define RTHAL_NMICLK_FREQ      RTHAL_CPU_FREQ
+#define RTHAL_HOST_TICK_IRQ    ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR)
+#define RTHAL_BCAST_TICK_IRQ   0
 
 static inline void rthal_grab_control(void)
 {
diff --git a/ksrc/nucleus/intr.c b/ksrc/nucleus/intr.c
index 370e71e..2955eb7 100644
--- a/ksrc/nucleus/intr.c
+++ b/ksrc/nucleus/intr.c
@@ -988,17 +988,22 @@ static inline int format_irq_proc(unsigned int irq,
        if (irq == XNARCH_TIMER_IRQ) {
                xnvfile_puts(it, "         [timer]");
                return 0;
+       }
+
+       switch (irq) {
 #ifdef CONFIG_SMP
-       } else if (irq >= RTHAL_SERVICE_IPI0 && irq <= RTHAL_SERVICE_IPI3) {
-               xnvfile_printf(it, "         [IPI%d]", irq - 
RTHAL_SERVICE_IPI0);
+       case RTHAL_RESCHEDULE_IPI:
+               xnvfile_puts(it, "         [reschedule]");
                return 0;
-       } else if (irq == RTHAL_CRITICAL_IPI) {
-               xnvfile_puts(it, "         [critical sync]");
+       case RTHAL_CRITICAL_IPI:
+               xnvfile_puts(it, "         [sync]");
                return 0;
 #endif /* CONFIG_SMP */
-       } else  if (rthal_virtual_irq_p(irq)) {
-               xnvfile_puts(it, "         [virtual]");
-               return 0;
+       default:
+               if (rthal_virtual_irq_p(irq)) {
+                       xnvfile_puts(it, "         [virtual]");
+                       return 0;
+               }
        }
 
        xnlock_get_irqsave(&intrlock, s);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to