Module: xenomai-3
Branch: wip/prioceil
Commit: 31c62a9ebf6c2e6b6642a4134eaeb56a7db09890
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=31c62a9ebf6c2e6b6642a4134eaeb56a7db09890

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Mar 13 12:06:51 2016 +0100

cobalt/arm: upgrade I-pipe support

---

 ...rm-10.patch => ipipe-core-3.10.32-arm-11.patch} |  106 +++++++----
 ...rm-12.patch => ipipe-core-3.14.44-arm-15.patch} |  197 +++++++++++++-------
 ...-arm-6.patch => ipipe-core-3.18.20-arm-8.patch} |   71 ++++---
 ...8-arm-1.patch => ipipe-core-4.1.18-arm-2.patch} |   45 ++---
 4 files changed, 262 insertions(+), 157 deletions(-)

diff --git a/kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-10.patch 
b/kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-11.patch
similarity index 99%
rename from kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-10.patch
rename to kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-11.patch
index 5ff3658..092b67d 100644
--- a/kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-10.patch
+++ b/kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-11.patch
@@ -1092,7 +1092,7 @@ index bb28af7..780ca50 100644
  static inline void sp804_clockevents_init(void __iomem *base, unsigned int 
irq, const char *name)
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 0000000..7599b0d
+index 0000000..c7704e8
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,274 @@
@@ -1140,7 +1140,7 @@ index 0000000..7599b0d
 +#include <linux/jump_label.h>
 +#include <linux/ipipe_trace.h>
 +
-+#define IPIPE_CORE_RELEASE    10
++#define IPIPE_CORE_RELEASE    11
 +
 +struct ipipe_domain;
 +
@@ -3712,10 +3712,10 @@ index 0000000..5b77cfb
 +EXPORT_SYMBOL_GPL(cpu_architecture);
 diff --git a/arch/arm/kernel/ipipe_tsc.c b/arch/arm/kernel/ipipe_tsc.c
 new file mode 100644
-index 0000000..fa2d382
+index 0000000..f04e048
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe_tsc.c
-@@ -0,0 +1,179 @@
+@@ -0,0 +1,181 @@
 +#include <linux/kernel.h>
 +#include <linux/module.h>
 +#include <linux/clocksource.h>
@@ -3858,6 +3858,8 @@ index 0000000..fa2d382
 +              __clocksource_updatefreq_hz(&clksrc, tsc_info.freq);
 +
 +      __ipipe_kuser_tsc_freq = tsc_info.freq;
++
++      __ipipe_tracer_hrclock_initialized();
 +}
 +
 +void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
@@ -11051,7 +11053,7 @@ index 8ea3b33..1079825 100644
  }
  
 diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
-index 19ceaa6..d56f20a 100644
+index 19ceaa6..16c312a 100644
 --- a/drivers/irqchip/irq-gic.c
 +++ b/drivers/irqchip/irq-gic.c
 @@ -41,6 +41,7 @@
@@ -11071,12 +11073,10 @@ index 19ceaa6..d56f20a 100644
  
  /*
   * The GIC mapping of CPU interfaces does not necessarily match
-@@ -153,37 +154,74 @@ static inline unsigned int gic_irq(struct irq_data *d)
-  */
+@@ -154,36 +155,73 @@ static inline unsigned int gic_irq(struct irq_data *d)
  static void gic_mask_irq(struct irq_data *d)
  {
--      u32 mask = 1 << (gic_irq(d) % 32);
-+      u32 mask = 1 << (d->irq % 32);
+       u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
  
 -      raw_spin_lock(&irq_controller_lock);
@@ -11091,8 +11091,7 @@ index 19ceaa6..d56f20a 100644
  
  static void gic_unmask_irq(struct irq_data *d)
  {
--      u32 mask = 1 << (gic_irq(d) % 32);
-+      u32 mask = 1 << (d->irq % 32);
+       u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
  
 -      raw_spin_lock(&irq_controller_lock);
@@ -11118,14 +11117,14 @@ index 19ceaa6..d56f20a 100644
 +      raw_spin_unlock_irqrestore_cond(&irq_controller_lock, flags);
 +      writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
 +}
-+
+ 
 +#ifdef CONFIG_IPIPE
 +
 +static void gic_hold_irq(struct irq_data *d)
 +{
-+      u32 mask = 1 << (d->irq % 32);
++      u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
- 
++
 +      raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
 +      writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + 
(gic_irq(d) / 32) * 4);
 +      if (gic_arch_extn.irq_mask)
@@ -11139,7 +11138,7 @@ index 19ceaa6..d56f20a 100644
 +
 +static void gic_release_irq(struct irq_data *d)
 +{
-+      u32 mask = 1 << (d->irq % 32);
++      u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
 +
 +      raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
@@ -11984,10 +11983,10 @@ index e6bb36a..898a91a 100644
  
 diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
 new file mode 100644
-index 0000000..525f3cf
+index 0000000..4ef7e3d
 --- /dev/null
 +++ b/include/linux/ipipe.h
-@@ -0,0 +1,443 @@
+@@ -0,0 +1,449 @@
 +/* -*- linux-c -*-
 + * include/linux/ipipe.h
 + *
@@ -12394,6 +12393,12 @@ index 0000000..525f3cf
 +#define __ipipe_uaccess_might_fault() might_fault()
 +#endif
 +
++#ifdef CONFIG_IPIPE_TRACE
++void __ipipe_tracer_hrclock_initialized(void);
++#else /* !CONFIG_IPIPE_TRACE */
++#define __ipipe_tracer_hrclock_initialized()  do { } while(0)
++#endif /* !CONFIG_IPIPE_TRACE */
++
 +#include <linux/ipipe_compat.h>
 +
 +#else /* !CONFIG_IPIPE */
@@ -17774,10 +17779,10 @@ index 0000000..0c9b908
 +#endif /* CONFIG_IPIPE_HAVE_HOSTRT */
 diff --git a/kernel/ipipe/tracer.c b/kernel/ipipe/tracer.c
 new file mode 100644
-index 0000000..5cce0bc
+index 0000000..8388671
 --- /dev/null
 +++ b/kernel/ipipe/tracer.c
-@@ -0,0 +1,1447 @@
+@@ -0,0 +1,1468 @@
 +/* -*- linux-c -*-
 + * kernel/ipipe/tracer.c
 + *
@@ -18525,6 +18530,9 @@ index 0000000..5cce0bc
 +      unsigned long long abs_tsc;
 +      long us;
 +
++      if (!__ipipe_hrclock_ok())
++              return 0;
++
 +      /* ipipe_tsc2us works on unsigned => handle sign separately */
 +      abs_tsc = (tsc >= 0) ? tsc : -tsc;
 +      us = ipipe_tsc2us(abs_tsc);
@@ -18727,6 +18735,11 @@ index 0000000..5cce0bc
 +
 +              __ipipe_global_path_unlock(flags);
 +
++              if (!__ipipe_hrclock_ok()) {
++                      seq_printf(m, "No hrclock available, dumping traces 
disabled\n");
++                      return NULL;
++              }
++
 +              /* does this path actually contain data? */
 +              if (print_path->end == print_path->begin)
 +                      return NULL;
@@ -18897,6 +18910,11 @@ index 0000000..5cce0bc
 +              if (!print_path)
 +                      return NULL;
 +
++              if (!__ipipe_hrclock_ok()) {
++                      seq_printf(m, "No hrclock available, dumping traces 
disabled\n");
++                      return NULL;
++              }
++
 +              /* back- and post-tracing length, post-trace length was frozen
 +                 in __ipipe_trace, back-trace may have to be reduced due to
 +                 buffer overrun */
@@ -19146,18 +19164,38 @@ index 0000000..5cce0bc
 +
 +extern struct proc_dir_entry *ipipe_proc_root;
 +
-+void __init __ipipe_init_tracer(void)
++void __init __ipipe_tracer_hrclock_initialized(void)
 +{
-+      struct proc_dir_entry *trace_dir;
 +      unsigned long long start, end, min = ULLONG_MAX;
 +      int i;
++
++#ifdef CONFIG_IPIPE_TRACE_VMALLOC
++      if (!per_cpu(trace_path, 0))
++              return;
++#endif
++      /* Calculate minimum overhead of __ipipe_trace() */
++      hard_local_irq_disable();
++      for (i = 0; i < 100; i++) {
++              ipipe_read_tsc(start);
++              __ipipe_trace(IPIPE_TRACE_FUNC, __BUILTIN_RETURN_ADDRESS0,
++                            __BUILTIN_RETURN_ADDRESS1, 0);
++              ipipe_read_tsc(end);
++
++              end -= start;
++              if (end < min)
++                      min = end;
++      }
++      hard_local_irq_enable();
++      trace_overhead = ipipe_tsc2ns(min);
++}
++
++void __init __ipipe_init_tracer(void)
++{
++      struct proc_dir_entry *trace_dir;
 +#ifdef CONFIG_IPIPE_TRACE_VMALLOC
 +      int cpu, path;
 +#endif /* CONFIG_IPIPE_TRACE_VMALLOC */
 +
-+      if (!__ipipe_hrclock_ok())
-+              return;
-+
 +#ifdef CONFIG_IPIPE_TRACE_VMALLOC
 +      for_each_possible_cpu(cpu) {
 +              struct ipipe_trace_path *tp_buf;
@@ -19179,20 +19217,8 @@ index 0000000..5cce0bc
 +      }
 +#endif /* CONFIG_IPIPE_TRACE_VMALLOC */
 +
-+      /* Calculate minimum overhead of __ipipe_trace() */
-+      hard_local_irq_disable();
-+      for (i = 0; i < 100; i++) {
-+              ipipe_read_tsc(start);
-+              __ipipe_trace(IPIPE_TRACE_FUNC, __BUILTIN_RETURN_ADDRESS0,
-+                            __BUILTIN_RETURN_ADDRESS1, 0);
-+              ipipe_read_tsc(end);
-+
-+              end -= start;
-+              if (end < min)
-+                      min = end;
-+      }
-+      hard_local_irq_enable();
-+      trace_overhead = ipipe_tsc2ns(min);
++      if (__ipipe_hrclock_ok() && !trace_overhead)
++              __ipipe_tracer_hrclock_initialized();
 +
 +#ifdef CONFIG_IPIPE_TRACE_ENABLE
 +      ipipe_trace_enable = 1;
@@ -19226,7 +19252,7 @@ index 0000000..5cce0bc
 +#endif /* !CONFIG_IPIPE_TRACE_MCOUNT */
 +}
 diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
-index cbd97ce..0faa00b 100644
+index cbd97ce..16ab280e 100644
 --- a/kernel/irq/chip.c
 +++ b/kernel/irq/chip.c
 @@ -15,6 +15,7 @@
@@ -19275,7 +19301,7 @@ index cbd97ce..0faa00b 100644
                desc->irq_data.chip->irq_shutdown(&desc->irq_data);
 -      else if (desc->irq_data.chip->irq_disable)
 +#ifdef CONFIG_IPIPE
-+              desc->istate |= ~IPIPE_IRQS_NEEDS_STARTUP;
++              desc->istate |= IPIPE_IRQS_NEEDS_STARTUP;
 +#endif
 +      } else if (desc->irq_data.chip->irq_disable)
                desc->irq_data.chip->irq_disable(&desc->irq_data);
diff --git a/kernel/cobalt/arch/arm/patches/ipipe-core-3.14.44-arm-12.patch 
b/kernel/cobalt/arch/arm/patches/ipipe-core-3.14.44-arm-15.patch
similarity index 99%
rename from kernel/cobalt/arch/arm/patches/ipipe-core-3.14.44-arm-12.patch
rename to kernel/cobalt/arch/arm/patches/ipipe-core-3.14.44-arm-15.patch
index c44d632..2ec0438 100644
--- a/kernel/cobalt/arch/arm/patches/ipipe-core-3.14.44-arm-12.patch
+++ b/kernel/cobalt/arch/arm/patches/ipipe-core-3.14.44-arm-15.patch
@@ -144,16 +144,17 @@ index 36e53ef..3651693 100644
  {
        const unsigned char *p = s;
 diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
-index fb28b2e..150beb5 100644
+index fb28b2e..bf84723 100644
 --- a/arch/arm/boot/dts/imx6qdl.dtsi
 +++ b/arch/arm/boot/dts/imx6qdl.dtsi
-@@ -106,6 +106,12 @@
+@@ -106,6 +106,13 @@
                        clocks = <&clks 15>;
                };
  
 +              timer@00a00200 {
 +                      compatible = "arm,cortex-a9-global-timer";
 +                      reg = <0x00a00200 0x20>;
++                      interrupts = <1 11 0xf01>;
 +                      clocks = <&clks 15>;
 +              };
 +
@@ -622,10 +623,10 @@ index 0000000..4b25210
 +      power = <50>;
 +};
 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
-index 69409f7..2cb8144 100644
+index 69409f7..e51b5e8 100644
 --- a/arch/arm/boot/dts/omap4.dtsi
 +++ b/arch/arm/boot/dts/omap4.dtsi
-@@ -62,10 +62,17 @@
+@@ -62,10 +62,18 @@
  
        local-timer@48240600 {
                compatible = "arm,cortex-a9-twd-timer";
@@ -638,6 +639,7 @@ index 69409f7..2cb8144 100644
 +              compatible = "arm,cortex-a9-global-timer";
 +              reg = <0x48240200 0x20>;
 +              clocks = <&mpu_periphclk>;
++              interrupts = <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | 
IRQ_TYPE_LEVEL_HIGH)>;
 +      };
 +
        /*
@@ -1590,7 +1592,7 @@ index bb28af7..780ca50 100644
  static inline void sp804_clockevents_init(void __iomem *base, unsigned int 
irq, const char *name)
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 0000000..50e20e3
+index 0000000..4459611
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,272 @@
@@ -1638,7 +1640,7 @@ index 0000000..50e20e3
 +#include <linux/jump_label.h>
 +#include <linux/ipipe_trace.h>
 +
-+#define IPIPE_CORE_RELEASE    12
++#define IPIPE_CORE_RELEASE    15
 +
 +struct ipipe_domain;
 +
@@ -3663,10 +3665,10 @@ index 88c6bab..cf2772a 100644
   * have in theory up to 7 arguments to a function - r0 to r6.
 diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
 new file mode 100644
-index 0000000..8a6c9bc
+index 0000000..2829e9a
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe.c
-@@ -0,0 +1,575 @@
+@@ -0,0 +1,561 @@
 +/* -*- linux-c -*-
 + * linux/arch/arm/kernel/ipipe.c
 + *
@@ -3877,6 +3879,7 @@ index 0000000..8a6c9bc
 +
 +#ifdef CONFIG_SMP_ON_UP
 +struct static_key __ipipe_smp_key = STATIC_KEY_INIT_TRUE;
++EXPORT_SYMBOL_GPL(__ipipe_smp_key);
 +
 +unsigned notrace __ipipe_processor_id(void)
 +{
@@ -3903,21 +3906,6 @@ index 0000000..8a6c9bc
 +EXPORT_SYMBOL_GPL(smp_on_up);
 +#endif /* SMP_ON_UP */
 +
-+/*
-+ * ipipe_raise_irq() -- Push the interrupt at front of the pipeline
-+ * just like if it has been actually received from a hw source. Also
-+ * works for virtual interrupts.
-+ */
-+void ipipe_raise_irq(unsigned irq)
-+{
-+      unsigned long flags;
-+
-+      flags = hard_local_irq_save();
-+      __ipipe_dispatch_irq(irq, IPIPE_IRQF_NOACK);
-+      hard_local_irq_restore(flags);
-+}
-+EXPORT_SYMBOL_GPL(ipipe_raise_irq);
-+
 +int ipipe_get_sysinfo(struct ipipe_sysinfo *info)
 +{
 +      info->sys_nr_cpus = num_online_cpus();
@@ -4244,10 +4232,10 @@ index 0000000..8a6c9bc
 +EXPORT_SYMBOL_GPL(cpu_architecture);
 diff --git a/arch/arm/kernel/ipipe_tsc.c b/arch/arm/kernel/ipipe_tsc.c
 new file mode 100644
-index 0000000..d42ceee
+index 0000000..2e48631
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe_tsc.c
-@@ -0,0 +1,201 @@
+@@ -0,0 +1,203 @@
 +#include <linux/kernel.h>
 +#include <linux/module.h>
 +#include <linux/sched.h>
@@ -4415,6 +4403,8 @@ index 0000000..d42ceee
 +      ipipe_tsc_update_timer.function = __ipipe_tsc_update_fn;
 +      mod_timer(&ipipe_tsc_update_timer,
 +              jiffies + ipipe_tsc_update_timer.data);
++
++      __ipipe_tracer_hrclock_initialized();
 +}
 +
 +void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
@@ -8105,7 +8095,7 @@ index 0eecd83..2367d9d 100644
  }
  
 diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
-index 9f6ec16..a5cecc6 100644
+index 9f6ec167..a5cecc6 100644
 --- a/arch/arm/mach-pxa/lpd270.c
 +++ b/arch/arm/mach-pxa/lpd270.c
 @@ -24,6 +24,7 @@
@@ -11895,7 +11885,7 @@ index a90be34..a5ac4bc 100644
  }
  
 diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
-index 12698ee..7a68905 100644
+index 12698ee..c4ff114 100644
 --- a/drivers/irqchip/irq-gic.c
 +++ b/drivers/irqchip/irq-gic.c
 @@ -41,6 +41,7 @@
@@ -11915,12 +11905,10 @@ index 12698ee..7a68905 100644
  
  /*
   * The GIC mapping of CPU interfaces does not necessarily match
-@@ -154,37 +155,74 @@ static inline unsigned int gic_irq(struct irq_data *d)
-  */
+@@ -155,36 +156,73 @@ static inline unsigned int gic_irq(struct irq_data *d)
  static void gic_mask_irq(struct irq_data *d)
  {
--      u32 mask = 1 << (gic_irq(d) % 32);
-+      u32 mask = 1 << (d->irq % 32);
+       u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
  
 -      raw_spin_lock(&irq_controller_lock);
@@ -11935,8 +11923,7 @@ index 12698ee..7a68905 100644
  
  static void gic_unmask_irq(struct irq_data *d)
  {
--      u32 mask = 1 << (gic_irq(d) % 32);
-+      u32 mask = 1 << (d->irq % 32);
+       u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
  
 -      raw_spin_lock(&irq_controller_lock);
@@ -11967,7 +11954,7 @@ index 12698ee..7a68905 100644
 +
 +static void gic_hold_irq(struct irq_data *d)
 +{
-+      u32 mask = 1 << (d->irq % 32);
++      u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
 +
 +      raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
@@ -11979,11 +11966,11 @@ index 12698ee..7a68905 100644
 +      }
        writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
 +      raw_spin_unlock_irqrestore_cond(&irq_controller_lock, flags);
-+}
-+
+ }
+ 
 +static void gic_release_irq(struct irq_data *d)
 +{
-+      u32 mask = 1 << (d->irq % 32);
++      u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
 +
 +      raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
@@ -11991,8 +11978,8 @@ index 12698ee..7a68905 100644
 +              gic_arch_extn.irq_unmask(d);
 +      writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + 
(gic_irq(d) / 32) * 4);
 +      raw_spin_unlock_irqrestore_cond(&irq_controller_lock, flags);
- }
- 
++}
++
 +#endif
 +
  static int gic_set_type(struct irq_data *d, unsigned int type)
@@ -12434,6 +12421,25 @@ index f04e25f..5fa6be6 100644
        select CPU_IDLE_GOV_LADDER if (!NO_HZ && !NO_HZ_IDLE)
        select CPU_IDLE_GOV_MENU if (NO_HZ || NO_HZ_IDLE)
        help
+diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
+index 228632c9..3da4d6d 100644
+--- a/drivers/iommu/irq_remapping.c
++++ b/drivers/iommu/irq_remapping.c
+@@ -361,12 +361,12 @@ void panic_if_irq_remap(const char *msg)
+ 
+ static void ir_ack_apic_edge(struct irq_data *data)
+ {
+-      ack_APIC_irq();
++      __ack_APIC_irq();
+ }
+ 
+ static void ir_ack_apic_level(struct irq_data *data)
+ {
+-      ack_APIC_irq();
++      __ack_APIC_irq();
+       eoi_ioapic_irq(data->irq, data->chip_data);
+ }
+ 
 diff --git a/drivers/tty/serial/8250/8250_core.c 
b/drivers/tty/serial/8250/8250_core.c
 index 612dfc7..ffd8160 100644
 --- a/drivers/tty/serial/8250/8250_core.c
@@ -12841,10 +12847,10 @@ index e6bb36a..898a91a 100644
  
 diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
 new file mode 100644
-index 0000000..912f689
+index 0000000..fc31c97
 --- /dev/null
 +++ b/include/linux/ipipe.h
-@@ -0,0 +1,455 @@
+@@ -0,0 +1,461 @@
 +/* -*- linux-c -*-
 + * include/linux/ipipe.h
 + *
@@ -13261,6 +13267,12 @@ index 0000000..912f689
 +#define __ipipe_uaccess_might_fault() might_fault()
 +#endif
 +
++#ifdef CONFIG_IPIPE_TRACE
++void __ipipe_tracer_hrclock_initialized(void);
++#else /* !CONFIG_IPIPE_TRACE */
++#define __ipipe_tracer_hrclock_initialized()  do { } while(0)
++#endif /* !CONFIG_IPIPE_TRACE */
++
 +#include <linux/ipipe_compat.h>
 +
 +#else /* !CONFIG_IPIPE */
@@ -16302,10 +16314,10 @@ index 0000000..797a849
 +}
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 0000000..c5b022b
+index 0000000..026f6d9
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1929 @@
+@@ -0,0 +1,1956 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -17707,6 +17719,33 @@ index 0000000..c5b022b
 +      __ipipe_sync_pipeline(ipipe_head_domain);
 +}
 +
++void ipipe_raise_irq(unsigned int irq)
++{
++      struct ipipe_domain *ipd = ipipe_head_domain;
++      unsigned long flags, control;
++
++      flags = hard_local_irq_save();
++
++      /*
++       * Fast path: raising a virtual IRQ handled by the head
++       * domain.
++       */
++      if (likely(ipipe_virtual_irq_p(irq) && ipd != ipipe_root_domain)) {
++              control = ipd->irqs[irq].control;
++              if (likely(control & IPIPE_HANDLE_MASK)) {
++                      dispatch_irq_head(irq);
++                      goto out;
++              }
++      }
++
++      /* Emulate regular device IRQ receipt. */
++      __ipipe_dispatch_irq(irq, IPIPE_IRQF_NOACK);
++out:
++      hard_local_irq_restore(flags);
++
++}
++EXPORT_SYMBOL_GPL(ipipe_raise_irq);
++
 +#ifdef CONFIG_PREEMPT
 +
 +void preempt_schedule_irq(void);
@@ -18237,10 +18276,10 @@ index 0000000..c5b022b
 +#endif
 diff --git a/kernel/ipipe/timer.c b/kernel/ipipe/timer.c
 new file mode 100644
-index 0000000..0c9b908
+index 0000000..f32a7ff
 --- /dev/null
 +++ b/kernel/ipipe/timer.c
-@@ -0,0 +1,492 @@
+@@ -0,0 +1,493 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/timer.c
 + *
@@ -18608,6 +18647,7 @@ index 0000000..0c9b908
 +              timer->real_set_next_event = evtdev->set_next_event;
 +              evtdev->mult = 1;
 +              evtdev->shift = 0;
++              evtdev->max_delta_ns = UINT_MAX;
 +              evtdev->set_mode = emumode;
 +              evtdev->set_next_event = emutick;
 +              evtdev->ipipe_stolen = 1;
@@ -18735,10 +18775,10 @@ index 0000000..0c9b908
 +#endif /* CONFIG_IPIPE_HAVE_HOSTRT */
 diff --git a/kernel/ipipe/tracer.c b/kernel/ipipe/tracer.c
 new file mode 100644
-index 0000000..5cce0bc
+index 0000000..8388671
 --- /dev/null
 +++ b/kernel/ipipe/tracer.c
-@@ -0,0 +1,1447 @@
+@@ -0,0 +1,1468 @@
 +/* -*- linux-c -*-
 + * kernel/ipipe/tracer.c
 + *
@@ -19486,6 +19526,9 @@ index 0000000..5cce0bc
 +      unsigned long long abs_tsc;
 +      long us;
 +
++      if (!__ipipe_hrclock_ok())
++              return 0;
++
 +      /* ipipe_tsc2us works on unsigned => handle sign separately */
 +      abs_tsc = (tsc >= 0) ? tsc : -tsc;
 +      us = ipipe_tsc2us(abs_tsc);
@@ -19688,6 +19731,11 @@ index 0000000..5cce0bc
 +
 +              __ipipe_global_path_unlock(flags);
 +
++              if (!__ipipe_hrclock_ok()) {
++                      seq_printf(m, "No hrclock available, dumping traces 
disabled\n");
++                      return NULL;
++              }
++
 +              /* does this path actually contain data? */
 +              if (print_path->end == print_path->begin)
 +                      return NULL;
@@ -19858,6 +19906,11 @@ index 0000000..5cce0bc
 +              if (!print_path)
 +                      return NULL;
 +
++              if (!__ipipe_hrclock_ok()) {
++                      seq_printf(m, "No hrclock available, dumping traces 
disabled\n");
++                      return NULL;
++              }
++
 +              /* back- and post-tracing length, post-trace length was frozen
 +                 in __ipipe_trace, back-trace may have to be reduced due to
 +                 buffer overrun */
@@ -20107,18 +20160,38 @@ index 0000000..5cce0bc
 +
 +extern struct proc_dir_entry *ipipe_proc_root;
 +
-+void __init __ipipe_init_tracer(void)
++void __init __ipipe_tracer_hrclock_initialized(void)
 +{
-+      struct proc_dir_entry *trace_dir;
 +      unsigned long long start, end, min = ULLONG_MAX;
 +      int i;
++
++#ifdef CONFIG_IPIPE_TRACE_VMALLOC
++      if (!per_cpu(trace_path, 0))
++              return;
++#endif
++      /* Calculate minimum overhead of __ipipe_trace() */
++      hard_local_irq_disable();
++      for (i = 0; i < 100; i++) {
++              ipipe_read_tsc(start);
++              __ipipe_trace(IPIPE_TRACE_FUNC, __BUILTIN_RETURN_ADDRESS0,
++                            __BUILTIN_RETURN_ADDRESS1, 0);
++              ipipe_read_tsc(end);
++
++              end -= start;
++              if (end < min)
++                      min = end;
++      }
++      hard_local_irq_enable();
++      trace_overhead = ipipe_tsc2ns(min);
++}
++
++void __init __ipipe_init_tracer(void)
++{
++      struct proc_dir_entry *trace_dir;
 +#ifdef CONFIG_IPIPE_TRACE_VMALLOC
 +      int cpu, path;
 +#endif /* CONFIG_IPIPE_TRACE_VMALLOC */
 +
-+      if (!__ipipe_hrclock_ok())
-+              return;
-+
 +#ifdef CONFIG_IPIPE_TRACE_VMALLOC
 +      for_each_possible_cpu(cpu) {
 +              struct ipipe_trace_path *tp_buf;
@@ -20140,20 +20213,8 @@ index 0000000..5cce0bc
 +      }
 +#endif /* CONFIG_IPIPE_TRACE_VMALLOC */
 +
-+      /* Calculate minimum overhead of __ipipe_trace() */
-+      hard_local_irq_disable();
-+      for (i = 0; i < 100; i++) {
-+              ipipe_read_tsc(start);
-+              __ipipe_trace(IPIPE_TRACE_FUNC, __BUILTIN_RETURN_ADDRESS0,
-+                            __BUILTIN_RETURN_ADDRESS1, 0);
-+              ipipe_read_tsc(end);
-+
-+              end -= start;
-+              if (end < min)
-+                      min = end;
-+      }
-+      hard_local_irq_enable();
-+      trace_overhead = ipipe_tsc2ns(min);
++      if (__ipipe_hrclock_ok() && !trace_overhead)
++              __ipipe_tracer_hrclock_initialized();
 +
 +#ifdef CONFIG_IPIPE_TRACE_ENABLE
 +      ipipe_trace_enable = 1;
@@ -20187,7 +20248,7 @@ index 0000000..5cce0bc
 +#endif /* !CONFIG_IPIPE_TRACE_MCOUNT */
 +}
 diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
-index dc04c16..2296ca9 100644
+index dc04c16..dff8902 100644
 --- a/kernel/irq/chip.c
 +++ b/kernel/irq/chip.c
 @@ -15,6 +15,7 @@
@@ -20236,7 +20297,7 @@ index dc04c16..2296ca9 100644
                desc->irq_data.chip->irq_shutdown(&desc->irq_data);
 -      else if (desc->irq_data.chip->irq_disable)
 +#ifdef CONFIG_IPIPE
-+              desc->istate |= ~IPIPE_IRQS_NEEDS_STARTUP;
++              desc->istate |= IPIPE_IRQS_NEEDS_STARTUP;
 +#endif
 +      } else if (desc->irq_data.chip->irq_disable)
                desc->irq_data.chip->irq_disable(&desc->irq_data);
diff --git a/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch 
b/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-8.patch
similarity index 99%
rename from kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch
rename to kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-8.patch
index 073b2a7..fd27b39 100644
--- a/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch
+++ b/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-8.patch
@@ -1653,7 +1653,7 @@ index bb28af7..780ca50 100644
  static inline void sp804_clockevents_init(void __iomem *base, unsigned int 
irq, const char *name)
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 0000000..76c7b6b
+index 0000000..128fc6a
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,272 @@
@@ -1701,7 +1701,7 @@ index 0000000..76c7b6b
 +#include <linux/jump_label.h>
 +#include <linux/ipipe_trace.h>
 +
-+#define IPIPE_CORE_RELEASE    6
++#define IPIPE_CORE_RELEASE    8
 +
 +struct ipipe_domain;
 +
@@ -3734,10 +3734,10 @@ index cfb354f..d11d476 100644
  
 diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
 new file mode 100644
-index 0000000..9577fbb
+index 0000000..8024a79
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe.c
-@@ -0,0 +1,560 @@
+@@ -0,0 +1,561 @@
 +/* -*- linux-c -*-
 + * linux/arch/arm/kernel/ipipe.c
 + *
@@ -3948,6 +3948,7 @@ index 0000000..9577fbb
 +
 +#ifdef CONFIG_SMP_ON_UP
 +struct static_key __ipipe_smp_key = STATIC_KEY_INIT_TRUE;
++EXPORT_SYMBOL_GPL(__ipipe_smp_key);
 +
 +unsigned notrace __ipipe_processor_id(void)
 +{
@@ -13209,7 +13210,7 @@ index a11aae8..ec094e1 100644
                gc->chip_types[0].chip.irq_set_type = aic5_set_type;
                gc->chip_types[0].chip.irq_suspend = aic5_suspend;
 diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
-index 38493ff..84eba98 100644
+index 38493ff..fbc428b 100644
 --- a/drivers/irqchip/irq-gic.c
 +++ b/drivers/irqchip/irq-gic.c
 @@ -39,6 +39,7 @@
@@ -13229,12 +13230,10 @@ index 38493ff..84eba98 100644
  
  /*
   * The GIC mapping of CPU interfaces does not necessarily match
-@@ -153,41 +154,79 @@ static inline unsigned int gic_irq(struct irq_data *d)
-  */
+@@ -154,40 +155,78 @@ static inline unsigned int gic_irq(struct irq_data *d)
  static void gic_mask_irq(struct irq_data *d)
  {
--      u32 mask = 1 << (gic_irq(d) % 32);
-+      u32 mask = 1 << (d->irq % 32);
+       u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
  
 -      raw_spin_lock(&irq_controller_lock);
@@ -13249,8 +13248,7 @@ index 38493ff..84eba98 100644
  
  static void gic_unmask_irq(struct irq_data *d)
  {
--      u32 mask = 1 << (gic_irq(d) % 32);
-+      u32 mask = 1 << (d->irq % 32);
+       u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
  
 -      raw_spin_lock(&irq_controller_lock);
@@ -13281,7 +13279,7 @@ index 38493ff..84eba98 100644
 +
 +static void gic_hold_irq(struct irq_data *d)
 +{
-+      u32 mask = 1 << (d->irq % 32);
++      u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
 +
 +      raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
@@ -13293,11 +13291,11 @@ index 38493ff..84eba98 100644
 +      }
        writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
 +      raw_spin_unlock_irqrestore_cond(&irq_controller_lock, flags);
-+}
-+
+ }
+ 
 +static void gic_release_irq(struct irq_data *d)
 +{
-+      u32 mask = 1 << (d->irq % 32);
++      u32 mask = 1 << (gic_irq(d) % 32);
 +      unsigned long flags;
 +
 +      raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
@@ -13305,8 +13303,8 @@ index 38493ff..84eba98 100644
 +              gic_arch_extn.irq_unmask(d);
 +      writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + 
(gic_irq(d) / 32) * 4);
 +      raw_spin_unlock_irqrestore_cond(&irq_controller_lock, flags);
- }
- 
++}
++
 +#endif
 +
  static int gic_set_type(struct irq_data *d, unsigned int type)
@@ -13841,8 +13839,27 @@ index c5029c1..2d68014 100644
        select CPU_IDLE_GOV_LADDER if (!NO_HZ && !NO_HZ_IDLE)
        select CPU_IDLE_GOV_MENU if (NO_HZ || NO_HZ_IDLE)
        help
+diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
+index 74a1767..7cf4766 100644
+--- a/drivers/iommu/irq_remapping.c
++++ b/drivers/iommu/irq_remapping.c
+@@ -366,12 +366,12 @@ void panic_if_irq_remap(const char *msg)
+ 
+ static void ir_ack_apic_edge(struct irq_data *data)
+ {
+-      ack_APIC_irq();
++      __ack_APIC_irq();
+ }
+ 
+ static void ir_ack_apic_level(struct irq_data *data)
+ {
+-      ack_APIC_irq();
++      __ack_APIC_irq();
+       eoi_ioapic_irq(data->irq, data->chip_data);
+ }
+ 
 diff --git a/drivers/tty/serial/8250/8250_core.c 
b/drivers/tty/serial/8250/8250_core.c
-index e5c31ea..8dce875 100644
+index e5c31ea..8dce8751 100644
 --- a/drivers/tty/serial/8250/8250_core.c
 +++ b/drivers/tty/serial/8250/8250_core.c
 @@ -3480,6 +3480,84 @@ static int serial8250_resume(struct platform_device 
*dev)
@@ -17764,10 +17781,10 @@ index 0000000..797a849
 +}
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 0000000..0320453
+index 0000000..d7c8934
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1917 @@
+@@ -0,0 +1,1916 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -19506,11 +19523,10 @@ index 0000000..0320453
 +       * currently stalled, in which case preemption would be
 +       * disabled, and no migration could occur.
 +       */
-+      if (this_domain == ipipe_root_domain) {
-+              p = raw_cpu_ptr(&ipipe_percpu.root);
-+              if (test_bit(IPIPE_STALL_FLAG, &p->status) || preempt_count())
-+                      goto out;
-+      }
++
++      p = raw_cpu_ptr(&ipipe_percpu.root);
++      if (!preemptible())
++              goto out;
 +      /*
 +       * Our caller may end up accessing the wrong per-cpu variable
 +       * instance due to CPU migration; tell it to complain about
@@ -19687,10 +19703,10 @@ index 0000000..0320453
 +#endif
 diff --git a/kernel/ipipe/timer.c b/kernel/ipipe/timer.c
 new file mode 100644
-index 0000000..354bf29
+index 0000000..143f9e6
 --- /dev/null
 +++ b/kernel/ipipe/timer.c
-@@ -0,0 +1,496 @@
+@@ -0,0 +1,497 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/timer.c
 + *
@@ -20058,6 +20074,7 @@ index 0000000..354bf29
 +              timer->real_set_next_event = evtdev->set_next_event;
 +              evtdev->mult = 1;
 +              evtdev->shift = 0;
++              evtdev->max_delta_ns = UINT_MAX;
 +              evtdev->set_mode = emumode;
 +              evtdev->set_next_event = emutick;
 +              evtdev->ipipe_stolen = 1;
diff --git a/kernel/cobalt/arch/arm/patches/ipipe-core-4.1.18-arm-1.patch 
b/kernel/cobalt/arch/arm/patches/ipipe-core-4.1.18-arm-2.patch
similarity index 99%
rename from kernel/cobalt/arch/arm/patches/ipipe-core-4.1.18-arm-1.patch
rename to kernel/cobalt/arch/arm/patches/ipipe-core-4.1.18-arm-2.patch
index 2385770..7c5aaff 100644
--- a/kernel/cobalt/arch/arm/patches/ipipe-core-4.1.18-arm-1.patch
+++ b/kernel/cobalt/arch/arm/patches/ipipe-core-4.1.18-arm-2.patch
@@ -1635,7 +1635,7 @@ index bb28af7..780ca50 100644
  static inline void sp804_clockevents_init(void __iomem *base, unsigned int 
irq, const char *name)
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 0000000..5cf2950
+index 0000000..77969f4
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,297 @@
@@ -1685,7 +1685,7 @@ index 0000000..5cf2950
 +#include <linux/jump_label.h>
 +#include <linux/ipipe_trace.h>
 +
-+#define IPIPE_CORE_RELEASE    1
++#define IPIPE_CORE_RELEASE    2
 +
 +struct ipipe_domain;
 +struct timekeeper;
@@ -3746,10 +3746,10 @@ index a71501f..2570808 100644
  
 diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
 new file mode 100644
-index 0000000..48cb035
+index 0000000..ffe02fe
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe.c
-@@ -0,0 +1,524 @@
+@@ -0,0 +1,525 @@
 +/* -*- linux-c -*-
 + * linux/arch/arm/kernel/ipipe.c
 + *
@@ -3960,6 +3960,7 @@ index 0000000..48cb035
 +
 +#ifdef CONFIG_SMP_ON_UP
 +struct static_key __ipipe_smp_key = STATIC_KEY_INIT_TRUE;
++EXPORT_SYMBOL_GPL(__ipipe_smp_key);
 +
 +unsigned notrace __ipipe_processor_id(void)
 +{
@@ -10737,7 +10738,7 @@ index f6e4d56..e2904aa 100644
  
  /*
 diff --git a/drivers/clocksource/arm_arch_timer.c 
b/drivers/clocksource/arm_arch_timer.c
-index 0aa135d..ad27139 100644
+index 0aa135d..b13608c 100644
 --- a/drivers/clocksource/arm_arch_timer.c
 +++ b/drivers/clocksource/arm_arch_timer.c
 @@ -17,6 +17,8 @@
@@ -10842,25 +10843,25 @@ index 0aa135d..ad27139 100644
  }
  
  static __always_inline void timer_set_mode(const int access, int mode,
-@@ -298,6 +342,18 @@ static void __arch_timer_setup(unsigned type,
- 
-       clk->set_mode(CLOCK_EVT_MODE_SHUTDOWN, clk);
- 
+@@ -280,6 +324,18 @@ static void __arch_timer_setup(unsigned type,
+                       clk->set_mode = arch_timer_set_mode_phys;
+                       clk->set_next_event = arch_timer_set_next_event_phys;
+               }
++
 +#ifdef CONFIG_IPIPE
-+      clk->ipipe_timer = raw_cpu_ptr(&arch_itimer);
-+      if (arch_timer_use_virtual) {
-+              clk->ipipe_timer->irq = arch_timer_ppi[VIRT_PPI];
-+              clk->ipipe_timer->ack = arch_itimer_ack_virt;
-+      } else {
-+              clk->ipipe_timer->irq = arch_timer_ppi[PHYS_SECURE_PPI];
-+              clk->ipipe_timer->ack = arch_itimer_ack_phys;
-+      }
-+      clk->ipipe_timer->freq = arch_timer_rate;
++              clk->ipipe_timer = raw_cpu_ptr(&arch_itimer);
++              if (arch_timer_use_virtual) {
++                      clk->ipipe_timer->irq = arch_timer_ppi[VIRT_PPI];
++                      clk->ipipe_timer->ack = arch_itimer_ack_virt;
++              } else {
++                      clk->ipipe_timer->irq = arch_timer_ppi[PHYS_SECURE_PPI];
++                      clk->ipipe_timer->ack = arch_itimer_ack_phys;
++              }
++              clk->ipipe_timer->freq = arch_timer_rate;
 +#endif
-+
-       clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff);
- }
- 
+       } else {
+               clk->features |= CLOCK_EVT_FEAT_DYNIRQ;
+               clk->name = "arch_mem_timer";
 @@ -342,6 +398,13 @@ static void arch_counter_set_user_access(void)
  
        /* Enable user access to the virtual counter */


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

Reply via email to