Module: xenomai-3 Branch: stable-3.0.x Commit: 2111a07350c4651f34c9d4972d7c06f63e1eb077 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2111a07350c4651f34c9d4972d7c06f63e1eb077
Author: Philippe Gerum <r...@xenomai.org> Date: Fri Sep 9 18:58:13 2016 +0200 cobalt/blackfin: upgrade I-pipe support --- ...6.patch => ipipe-core-3.18.20-blackfin-8.patch} | 70 +++-- ...-2.patch => ipipe-core-4.1.18-blackfin-6.patch} | 298 +++++++++++++++----- 2 files changed, 282 insertions(+), 86 deletions(-) diff --git a/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.20-blackfin-6.patch b/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.20-blackfin-8.patch similarity index 99% rename from kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.20-blackfin-6.patch rename to kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.20-blackfin-8.patch index 6ecaf7f..e5d0f88 100644 --- a/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.20-blackfin-6.patch +++ b/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.20-blackfin-8.patch @@ -12,7 +12,7 @@ index af76634..ebff376 100644 comment "Processor and Board Settings" diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h -index fe1160f..cc10543 100644 +index fe1160fb..44ed44e 100644 --- a/arch/blackfin/include/asm/ipipe.h +++ b/arch/blackfin/include/asm/ipipe.h @@ -28,7 +28,7 @@ @@ -32,7 +32,7 @@ index fe1160f..cc10543 100644 -#define IPIPE_MAJOR_NUMBER 1 -#define IPIPE_MINOR_NUMBER 16 -#define IPIPE_PATCH_NUMBER 1 -+#define IPIPE_CORE_RELEASE 6 ++#define IPIPE_CORE_RELEASE 8 #ifdef CONFIG_SMP #error "I-pipe/blackfin: SMP not implemented" @@ -2214,6 +2214,18 @@ index abcafaa..a8440e4 100644 } ____cacheline_aligned; /* +diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h +index 662697b..6a9b6ad 100644 +--- a/include/linux/ftrace.h ++++ b/include/linux/ftrace.h +@@ -108,6 +108,7 @@ enum { + FTRACE_OPS_FL_ADDING = 1 << 9, + FTRACE_OPS_FL_REMOVING = 1 << 10, + FTRACE_OPS_FL_MODIFYING = 1 << 11, ++ FTRACE_OPS_FL_IPIPE_EXCLUSIVE = 1 << 12, + }; + + #ifdef CONFIG_DYNAMIC_FTRACE diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index cba442e..b513a46 100644 --- a/include/linux/hardirq.h @@ -8159,7 +8171,7 @@ index 0000000..143f9e6 +#endif /* CONFIG_IPIPE_HAVE_HOSTRT */ diff --git a/kernel/ipipe/tracer.c b/kernel/ipipe/tracer.c new file mode 100644 -index 0000000..da272c50 +index 0000000..8388671 --- /dev/null +++ b/kernel/ipipe/tracer.c @@ -0,0 +1,1468 @@ @@ -9497,7 +9509,7 @@ index 0000000..da272c50 + +static struct ftrace_ops ipipe_trace_ops = { + .func = ipipe_trace_function, -+ .flags = FTRACE_OPS_FL_RECURSION_SAFE, ++ .flags = FTRACE_OPS_FL_IPIPE_EXCLUSIVE, +}; + +static ssize_t __ipipe_wr_enable(struct file *file, const char __user *buffer, @@ -11058,7 +11070,7 @@ index a5da09c..6650799 100644 help This option will modify all the calls to function tracing diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c -index d1eff3d..2a324bc 100644 +index d1eff3d..f8b9472 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -32,6 +32,7 @@ @@ -11069,7 +11081,33 @@ index d1eff3d..2a324bc 100644 #include <trace/events/sched.h> -@@ -2298,6 +2299,9 @@ void __weak arch_ftrace_update_code(int command) +@@ -251,8 +252,17 @@ static inline void update_function_graph_func(void) { } + + static void update_ftrace_function(void) + { ++ struct ftrace_ops *ops; + ftrace_func_t func; + ++ for (ops = ftrace_ops_list; ++ ops != &ftrace_list_end; ops = ops->next) ++ if (ops->flags & FTRACE_OPS_FL_IPIPE_EXCLUSIVE) { ++ set_function_trace_op = ops; ++ func = ops->func; ++ goto set_pointers; ++ } ++ + /* + * Prepare the ftrace_ops that the arch callback will use. + * If there's only one ftrace_ops registered, the ftrace_ops_list +@@ -280,6 +290,7 @@ static void update_ftrace_function(void) + + update_function_graph_func(); + ++ set_pointers: + /* If there's no change, then do nothing more here */ + if (ftrace_trace_function == func) + return; +@@ -2298,6 +2309,9 @@ void __weak arch_ftrace_update_code(int command) static void ftrace_run_update_code(int command) { @@ -11079,7 +11117,7 @@ index d1eff3d..2a324bc 100644 int ret; ret = ftrace_arch_code_modify_prepare(); -@@ -2311,7 +2315,13 @@ static void ftrace_run_update_code(int command) +@@ -2311,7 +2325,13 @@ static void ftrace_run_update_code(int command) * is safe. The stop_machine() is the safest, but also * produces the most overhead. */ @@ -11093,7 +11131,7 @@ index d1eff3d..2a324bc 100644 ret = ftrace_arch_code_modify_post_process(); FTRACE_WARN_ON(ret); -@@ -4621,10 +4631,10 @@ static int ftrace_process_locs(struct module *mod, +@@ -4621,10 +4641,10 @@ static int ftrace_process_locs(struct module *mod, * reason to cause large interrupt latencies while we do it. */ if (!mod) @@ -11106,7 +11144,7 @@ index d1eff3d..2a324bc 100644 ret = 0; out: mutex_unlock(&ftrace_lock); -@@ -4723,9 +4733,11 @@ void __init ftrace_init(void) +@@ -4723,9 +4743,11 @@ void __init ftrace_init(void) unsigned long count, flags; int ret; @@ -11120,7 +11158,7 @@ index d1eff3d..2a324bc 100644 if (ret) goto failed; -@@ -4891,7 +4903,16 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, +@@ -4891,7 +4913,16 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, } } while_for_each_ftrace_op(op); out: @@ -11486,24 +11524,22 @@ index 0c9216c..00a9a30 100644 return err; } diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c -index 1afec32..5803111 100644 +index 1afec32..f7c1a2a 100644 --- a/lib/smp_processor_id.c +++ b/lib/smp_processor_id.c -@@ -12,10 +12,13 @@ notrace static unsigned int check_preemption_disabled(const char *what1, +@@ -12,6 +12,12 @@ notrace static unsigned int check_preemption_disabled(const char *what1, { int this_cpu = raw_smp_processor_id(); ++ if (hard_irqs_disabled()) ++ goto out; ++ + if (!ipipe_root_p) + goto out; + if (likely(preempt_count())) goto out; -- if (irqs_disabled()) -+ if (irqs_disabled() || hard_irqs_disabled()) - goto out; - - /* diff --git a/mm/memory.c b/mm/memory.c index 90fb265..8a1fd79 100644 --- a/mm/memory.c diff --git a/kernel/cobalt/arch/blackfin/patches/ipipe-core-4.1.18-blackfin-2.patch b/kernel/cobalt/arch/blackfin/patches/ipipe-core-4.1.18-blackfin-6.patch similarity index 97% rename from kernel/cobalt/arch/blackfin/patches/ipipe-core-4.1.18-blackfin-2.patch rename to kernel/cobalt/arch/blackfin/patches/ipipe-core-4.1.18-blackfin-6.patch index 9ad6bc4..a90bf09 100644 --- a/kernel/cobalt/arch/blackfin/patches/ipipe-core-4.1.18-blackfin-2.patch +++ b/kernel/cobalt/arch/blackfin/patches/ipipe-core-4.1.18-blackfin-6.patch @@ -12,7 +12,7 @@ index af76634..ebff376 100644 comment "Processor and Board Settings" diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h -index fe1160f..d988c1f 100644 +index fe1160fb..3150218 100644 --- a/arch/blackfin/include/asm/ipipe.h +++ b/arch/blackfin/include/asm/ipipe.h @@ -28,7 +28,7 @@ @@ -32,7 +32,7 @@ index fe1160f..d988c1f 100644 -#define IPIPE_MAJOR_NUMBER 1 -#define IPIPE_MINOR_NUMBER 16 -#define IPIPE_PATCH_NUMBER 1 -+#define IPIPE_CORE_RELEASE 2 ++#define IPIPE_CORE_RELEASE 6 #ifdef CONFIG_SMP #error "I-pipe/blackfin: SMP not implemented" @@ -2174,6 +2174,19 @@ index 0000000..1f6e9c3 +static inline void __ipipe_init_threadinfo(struct ipipe_threadinfo *p) { } + +#endif /* !_IPIPE_THREAD_INFO_H */ +diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h +index 0e97856..b5d7e60 100644 +--- a/include/linux/basic_mmio_gpio.h ++++ b/include/linux/basic_mmio_gpio.h +@@ -50,7 +50,7 @@ struct bgpio_chip { + * Used to lock bgpio_chip->data. Also, this is needed to keep + * shadowed and real data registers writes together. + */ +- spinlock_t lock; ++ ipipe_spinlock_t lock; + + /* Shadowed data register to clear/set bits safely. */ + unsigned long data; diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 96c280b..0baa8f1 100644 --- a/include/linux/clockchips.h @@ -2226,6 +2239,18 @@ index 901555a..1ba117c 100644 int (*read)(struct console *, char *, unsigned); struct tty_driver *(*device)(struct console *, int *); void (*unblank)(void); +diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h +index 6cd8c0e..0951ab4 100644 +--- a/include/linux/ftrace.h ++++ b/include/linux/ftrace.h +@@ -134,6 +134,7 @@ enum { + FTRACE_OPS_FL_ALLOC_TRAMP = 1 << 12, + FTRACE_OPS_FL_IPMODIFY = 1 << 13, + FTRACE_OPS_FL_PID = 1 << 14, ++ FTRACE_OPS_FL_IPIPE_EXCLUSIVE = 1 << 15, + }; + + #ifdef CONFIG_DYNAMIC_FTRACE diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index f4af034..fa16b8c 100644 --- a/include/linux/hardirq.h @@ -2736,10 +2761,10 @@ index 0000000..0a9b5b6 +#endif /* !__LINUX_IPIPE_H */ diff --git a/include/linux/ipipe_base.h b/include/linux/ipipe_base.h new file mode 100644 -index 0000000..8c06eed +index 0000000..42b368a --- /dev/null +++ b/include/linux/ipipe_base.h -@@ -0,0 +1,360 @@ +@@ -0,0 +1,365 @@ +/* -*- linux-c -*- + * include/linux/ipipe_base.h + * @@ -2850,6 +2875,7 @@ index 0000000..8c06eed +#define IPIPE_KEVT_EXIT 4 +#define IPIPE_KEVT_CLEANUP 5 +#define IPIPE_KEVT_HOSTRT 6 ++#define IPIPE_KEVT_CLOCKFREQ 7 + +struct ipipe_vm_notifier { + void (*handler)(struct ipipe_vm_notifier *nfy); @@ -2978,6 +3004,9 @@ index 0000000..8c06eed +#define __ipipe_report_cleanup(mm) \ + __ipipe_notify_kevent(IPIPE_KEVT_CLEANUP, mm) + ++#define __ipipe_report_clockfreq_update(freq) \ ++ __ipipe_notify_kevent(IPIPE_KEVT_CLOCKFREQ, &(freq)) ++ +void __ipipe_notify_vm_preemption(void); + +void __ipipe_call_mayday(struct pt_regs *regs); @@ -2997,7 +3026,8 @@ index 0000000..8c06eed +#define IPIPE_EVENT_EXIT (IPIPE_FIRST_EVENT + 4) +#define IPIPE_EVENT_CLEANUP (IPIPE_FIRST_EVENT + 5) +#define IPIPE_EVENT_HOSTRT (IPIPE_FIRST_EVENT + 6) -+#define IPIPE_EVENT_SYSCALL (IPIPE_FIRST_EVENT + 7) ++#define IPIPE_EVENT_CLOCKFREQ (IPIPE_FIRST_EVENT + 7) ++#define IPIPE_EVENT_SYSCALL (IPIPE_FIRST_EVENT + 8) +#define IPIPE_LAST_EVENT IPIPE_EVENT_SYSCALL +#define IPIPE_NR_EVENTS (IPIPE_LAST_EVENT + 1) + @@ -3848,10 +3878,10 @@ index 0000000..d00c56b +#endif /* !__LINUX_IPIPE_DOMAIN_H */ diff --git a/include/linux/ipipe_lock.h b/include/linux/ipipe_lock.h new file mode 100644 -index 0000000..f71d2f1 +index 0000000..a108278 --- /dev/null +++ b/include/linux/ipipe_lock.h -@@ -0,0 +1,260 @@ +@@ -0,0 +1,327 @@ +/* -*- linux-c -*- + * include/linux/ipipe_lock.h + * @@ -3880,22 +3910,87 @@ index 0000000..f71d2f1 + arch_spinlock_t arch_lock; +} __ipipe_spinlock_t; + ++#define ipipe_spinlock(lock) ((__ipipe_spinlock_t *)(lock)) +#define ipipe_spinlock_p(lock) \ + __builtin_types_compatible_p(typeof(lock), __ipipe_spinlock_t *) || \ + __builtin_types_compatible_p(typeof(lock), __ipipe_spinlock_t []) + ++#define std_spinlock_raw(lock) ((raw_spinlock_t *)(lock)) +#define std_spinlock_raw_p(lock) \ + __builtin_types_compatible_p(typeof(lock), raw_spinlock_t *) || \ + __builtin_types_compatible_p(typeof(lock), raw_spinlock_t []) + ++#ifdef CONFIG_PREEMPT_RT_FULL ++ ++#define PICK_SPINLOCK_IRQSAVE(lock, flags) \ ++ do { \ ++ if (ipipe_spinlock_p(lock)) \ ++ (flags) = __ipipe_spin_lock_irqsave(ipipe_spinlock(lock)); \ ++ else if (std_spinlock_raw_p(lock)) \ ++ __real_raw_spin_lock_irqsave(std_spinlock_raw(lock), flags); \ ++ else __bad_lock_type(); \ ++ } while (0) ++ ++#define PICK_SPINTRYLOCK_IRQSAVE(lock, flags) \ ++ ({ \ ++ int __ret__; \ ++ if (ipipe_spinlock_p(lock)) \ ++ __ret__ = __ipipe_spin_trylock_irqsave(ipipe_spinlock(lock), &(flags)); \ ++ else if (std_spinlock_raw_p(lock)) \ ++ __ret__ = __real_raw_spin_trylock_irqsave(std_spinlock_raw(lock), flags); \ ++ else __bad_lock_type(); \ ++ __ret__; \ ++ }) ++ ++#define PICK_SPINTRYLOCK_IRQ(lock) \ ++ ({ \ ++ int __ret__; \ ++ if (ipipe_spinlock_p(lock)) \ ++ __ret__ = __ipipe_spin_trylock_irq(ipipe_spinlock(lock)); \ ++ else if (std_spinlock_raw_p(lock)) \ ++ __ret__ = __real_raw_spin_trylock_irq(std_spinlock_raw(lock)); \ ++ else __bad_lock_type(); \ ++ __ret__; \ ++ }) ++ ++#define PICK_SPINUNLOCK_IRQRESTORE(lock, flags) \ ++ do { \ ++ if (ipipe_spinlock_p(lock)) \ ++ __ipipe_spin_unlock_irqrestore(ipipe_spinlock(lock), flags); \ ++ else if (std_spinlock_raw_p(lock)) { \ ++ __ipipe_spin_unlock_debug(flags); \ ++ __real_raw_spin_unlock_irqrestore(std_spinlock_raw(lock), flags); \ ++ } else __bad_lock_type(); \ ++ } while (0) ++ ++#define PICK_SPINOP(op, lock) \ ++ ({ \ ++ if (ipipe_spinlock_p(lock)) \ ++ arch_spin##op(&ipipe_spinlock(lock)->arch_lock); \ ++ else if (std_spinlock_raw_p(lock)) \ ++ __real_raw_spin##op(std_spinlock_raw(lock)); \ ++ else __bad_lock_type(); \ ++ (void)0; \ ++ }) ++ ++#define PICK_SPINOP_RET(op, lock, type) \ ++ ({ \ ++ type __ret__; \ ++ if (ipipe_spinlock_p(lock)) \ ++ __ret__ = arch_spin##op(&ipipe_spinlock(lock)->arch_lock); \ ++ else if (std_spinlock_raw_p(lock)) \ ++ __ret__ = __real_raw_spin##op(std_spinlock_raw(lock)); \ ++ else { __ret__ = -1; __bad_lock_type(); } \ ++ __ret__; \ ++ }) ++ ++#else /* !CONFIG_PREEMPT_RT_FULL */ ++ ++#define std_spinlock(lock) ((spinlock_t *)(lock)) +#define std_spinlock_p(lock) \ + __builtin_types_compatible_p(typeof(lock), spinlock_t *) || \ + __builtin_types_compatible_p(typeof(lock), spinlock_t []) + -+#define ipipe_spinlock(lock) ((__ipipe_spinlock_t *)(lock)) -+#define std_spinlock_raw(lock) ((raw_spinlock_t *)(lock)) -+#define std_spinlock(lock) ((spinlock_t *)(lock)) -+ +#define PICK_SPINLOCK_IRQSAVE(lock, flags) \ + do { \ + if (ipipe_spinlock_p(lock)) \ @@ -3971,6 +4066,8 @@ index 0000000..f71d2f1 + __ret__; \ + }) + ++#endif /* !CONFIG_PREEMPT_RT_FULL */ ++ +#define arch_spin_lock_init(lock) \ + do { \ + IPIPE_DEFINE_SPINLOCK(__lock__); \ @@ -4100,7 +4197,7 @@ index 0000000..f71d2f1 +#define __ipipe_spin_trylock_irq(lock) 1 +#define __ipipe_spin_trylock_irqsave(lock, x) ({ (void)(x); 1; }) +#define __ipipe_spin_unlock_irqrestore(lock, x) do { (void)(x); } while (0) -+#define __ipipe_spin_unlock_irqbegin(lock) do { } while (0) ++#define __ipipe_spin_unlock_irqbegin(lock) spin_unlock(lock) +#define __ipipe_spin_unlock_irqcomplete(x) do { (void)(x); } while (0) +#define __ipipe_spin_unlock_debug(flags) do { } while (0) + @@ -4114,10 +4211,10 @@ index 0000000..f71d2f1 +#endif /* !__LINUX_IPIPE_LOCK_H */ diff --git a/include/linux/ipipe_tickdev.h b/include/linux/ipipe_tickdev.h new file mode 100644 -index 0000000..58a4142 +index 0000000..2f065ad --- /dev/null +++ b/include/linux/ipipe_tickdev.h -@@ -0,0 +1,145 @@ +@@ -0,0 +1,148 @@ +/* -*- linux-c -*- + * include/linux/ipipe_tickdev.h + * @@ -4197,6 +4294,7 @@ index 0000000..58a4142 + struct clock_event_device *cdev); + int (*real_set_next_event)(unsigned long evt, + struct clock_event_device *cdev); ++ unsigned int (*refresh_freq)(void); +}; + +#define __ipipe_hrtimer_irq __ipipe_raw_cpu_read(ipipe_percpu.hrtimer_irq) @@ -4249,6 +4347,8 @@ index 0000000..58a4142 + +unsigned ipipe_timer_ns2ticks(struct ipipe_timer *timer, unsigned ns); + ++void __ipipe_timer_refresh_freq(unsigned int hrclock_freq); ++ +#else /* !CONFIG_IPIPE */ + +#define ipipe_host_timer_register(clkevt) do { } while (0) @@ -5803,7 +5903,7 @@ index 0000000..797a849 +} diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c new file mode 100644 -index 0000000..3b07d65 +index 0000000..339fb95 --- /dev/null +++ b/kernel/ipipe/core.c @@ -0,0 +1,1916 @@ @@ -6631,7 +6731,7 @@ index 0000000..3b07d65 + unsigned long flags, irq = 0; + int ipos; + -+ spin_lock_irqsave(&__ipipe_lock, flags); ++ raw_spin_lock_irqsave(&__ipipe_lock, flags); + + if (__ipipe_virtual_irq_map != ~0) { + ipos = ffz(__ipipe_virtual_irq_map); @@ -6639,7 +6739,7 @@ index 0000000..3b07d65 + irq = ipos + IPIPE_VIRQ_BASE; + } + -+ spin_unlock_irqrestore(&__ipipe_lock, flags); ++ raw_spin_unlock_irqrestore(&__ipipe_lock, flags); + + return irq; +} @@ -6669,7 +6769,7 @@ index 0000000..3b07d65 + (irq >= IPIPE_NR_XIRQS && !ipipe_virtual_irq_p(irq))) + return -EINVAL; + -+ spin_lock_irqsave(&__ipipe_lock, flags); ++ raw_spin_lock_irqsave(&__ipipe_lock, flags); + + if (ipd->irqs[irq].handler) { + ret = -EBUSY; @@ -6687,7 +6787,7 @@ index 0000000..3b07d65 + if (irq < IPIPE_NR_ROOT_IRQS) + __ipipe_enable_irqdesc(ipd, irq); +out: -+ spin_unlock_irqrestore(&__ipipe_lock, flags); ++ raw_spin_unlock_irqrestore(&__ipipe_lock, flags); + + return ret; +} @@ -6702,7 +6802,7 @@ index 0000000..3b07d65 + ipipe_root_only(); +#endif /* CONFIG_IPIPE_LEGACY */ + -+ spin_lock_irqsave(&__ipipe_lock, flags); ++ raw_spin_lock_irqsave(&__ipipe_lock, flags); + + if (ipd->irqs[irq].handler == NULL) + goto out; @@ -6715,7 +6815,7 @@ index 0000000..3b07d65 + if (irq < IPIPE_NR_ROOT_IRQS) + __ipipe_disable_irqdesc(ipd, irq); +out: -+ spin_unlock_irqrestore(&__ipipe_lock, flags); ++ raw_spin_unlock_irqrestore(&__ipipe_lock, flags); +} +EXPORT_SYMBOL_GPL(ipipe_free_irq); + @@ -7358,7 +7458,7 @@ index 0000000..3b07d65 + * another CPU. Enter a spinning wait until he releases the + * global lock. + */ -+ spin_lock(&__ipipe_cpu_barrier); ++ raw_spin_lock(&__ipipe_cpu_barrier); + + /* Got it. Now get out. */ + @@ -7368,7 +7468,7 @@ index 0000000..3b07d65 + + cpumask_set_cpu(cpu, &__ipipe_cpu_pass_map); + -+ spin_unlock(&__ipipe_cpu_barrier); ++ raw_spin_unlock(&__ipipe_cpu_barrier); + + cpumask_clear_cpu(cpu, &__ipipe_cpu_sync_map); +} @@ -7401,7 +7501,7 @@ index 0000000..3b07d65 + } +restart: + online = *cpu_online_mask; -+ spin_lock(&__ipipe_cpu_barrier); ++ raw_spin_lock(&__ipipe_cpu_barrier); + + __ipipe_cpu_sync = syncfn; + @@ -7427,7 +7527,7 @@ index 0000000..3b07d65 + */ + __ipipe_cpu_sync = NULL; + -+ spin_unlock(&__ipipe_cpu_barrier); ++ raw_spin_unlock(&__ipipe_cpu_barrier); + /* + * Ensure all CPUs consumed the IPI to avoid + * running __ipipe_cpu_sync prematurely. This @@ -7457,7 +7557,7 @@ index 0000000..3b07d65 + +#ifdef CONFIG_SMP + if (atomic_dec_and_test(&__ipipe_critical_count)) { -+ spin_unlock(&__ipipe_cpu_barrier); ++ raw_spin_unlock(&__ipipe_cpu_barrier); + while (!cpumask_empty(&__ipipe_cpu_sync_map)) + cpu_relax(); + cpumask_clear_cpu(ipipe_processor_id(), &__ipipe_cpu_lock_map); @@ -7725,10 +7825,10 @@ index 0000000..3b07d65 +#endif diff --git a/kernel/ipipe/timer.c b/kernel/ipipe/timer.c new file mode 100644 -index 0000000..73f748e +index 0000000..a9917f4 --- /dev/null +++ b/kernel/ipipe/timer.c -@@ -0,0 +1,497 @@ +@@ -0,0 +1,520 @@ +/* -*- linux-c -*- + * linux/kernel/ipipe/timer.c + * @@ -7855,7 +7955,7 @@ index 0000000..73f748e + if (timer->cpumask == NULL) + timer->cpumask = cpumask_of(smp_processor_id()); + -+ spin_lock_irqsave(&lock, flags); ++ raw_spin_lock_irqsave(&lock, flags); + + list_for_each_entry(t, &timers, link) { + if (t->rating <= timer->rating) { @@ -7865,7 +7965,7 @@ index 0000000..73f748e + } + list_add_tail(&timer->link, &timers); + done: -+ spin_unlock_irqrestore(&lock, flags); ++ raw_spin_unlock_irqrestore(&lock, flags); +} + +static void ipipe_timer_request_sync(void) @@ -7888,18 +7988,14 @@ index 0000000..73f748e + timer->request(timer, steal); +} + -+/* Set up a timer as per-cpu timer for ipipe */ -+static void install_pcpu_timer(unsigned cpu, unsigned hrclock_freq, -+ struct ipipe_timer *t) { -+ unsigned hrtimer_freq; ++static void config_pcpu_timer(struct ipipe_timer *t, unsigned hrclock_freq) ++{ + unsigned long long tmp; ++ unsigned hrtimer_freq; + -+ if (__ipipe_hrtimer_freq == 0) ++ if (__ipipe_hrtimer_freq != t->freq) + __ipipe_hrtimer_freq = t->freq; + -+ per_cpu(ipipe_percpu.hrtimer_irq, cpu) = t->irq; -+ per_cpu(percpu_timer, cpu) = t; -+ + hrtimer_freq = t->freq; + if (__ipipe_hrclock_freq > UINT_MAX) + hrtimer_freq /= 1000; @@ -7912,6 +8008,15 @@ index 0000000..73f748e + t->c2t_frac = tmp; +} + ++/* Set up a timer as per-cpu timer for ipipe */ ++static void install_pcpu_timer(unsigned cpu, unsigned hrclock_freq, ++ struct ipipe_timer *t) ++{ ++ per_cpu(ipipe_percpu.hrtimer_irq, cpu) = t->irq; ++ per_cpu(percpu_timer, cpu) = t; ++ config_pcpu_timer(t, hrclock_freq); ++} ++ +static void select_root_only_timer(unsigned cpu, unsigned hrclock_khz, + const struct cpumask *mask, + struct ipipe_timer *t) { @@ -7965,7 +8070,7 @@ index 0000000..73f748e + } else + hrclock_freq = __ipipe_hrclock_freq; + -+ spin_lock_irqsave(&lock, flags); ++ raw_spin_lock_irqsave(&lock, flags); + + /* First, choose timers for the CPUs handled by ipipe */ + for_each_cpu(cpu, mask) { @@ -8005,7 +8110,7 @@ index 0000000..73f748e + } + } + -+ spin_unlock_irqrestore(&lock, flags); ++ raw_spin_unlock_irqrestore(&lock, flags); + + flags = ipipe_critical_enter(ipipe_timer_request_sync); + ipipe_timer_request_sync(); @@ -8014,7 +8119,7 @@ index 0000000..73f748e + return 0; + +err_remove_all: -+ spin_unlock_irqrestore(&lock, flags); ++ raw_spin_unlock_irqrestore(&lock, flags); + + for_each_cpu(cpu, mask) { + per_cpu(ipipe_percpu.hrtimer_irq, cpu) = -1; @@ -8226,9 +8331,27 @@ index 0000000..73f748e +} + +#endif /* CONFIG_IPIPE_HAVE_HOSTRT */ ++ ++int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, ++ bool force); ++ ++void __ipipe_timer_refresh_freq(unsigned int hrclock_freq) ++{ ++ struct ipipe_timer *t = __ipipe_raw_cpu_read(percpu_timer); ++ unsigned long flags; ++ ++ if (t && t->refresh_freq) { ++ t->freq = t->refresh_freq(); ++ flags = hard_local_irq_save(); ++ config_pcpu_timer(t, hrclock_freq); ++ hard_local_irq_restore(flags); ++ clockevents_program_event(t->host_timer, ++ t->host_timer->next_event, false); ++ } ++} diff --git a/kernel/ipipe/tracer.c b/kernel/ipipe/tracer.c new file mode 100644 -index 0000000..da272c50 +index 0000000..1ae7bc2 --- /dev/null +++ b/kernel/ipipe/tracer.c @@ -0,0 +1,1468 @@ @@ -8293,7 +8416,7 @@ index 0000000..da272c50 +#define IPIPE_TFLG_CURRDOM_SHIFT 10 /* bits 10..11: current domain */ +#define IPIPE_TFLG_CURRDOM_MASK 0x0C00 +#define IPIPE_TFLG_DOMSTATE_SHIFT 12 /* bits 12..15: domain stalled? */ -+#define IPIPE_TFLG_DOMSTATE_BITS 3 ++#define IPIPE_TFLG_DOMSTATE_BITS 1 + +#define IPIPE_TFLG_DOMAIN_STALLED(point, n) \ + (point->flags & (1 << (n + IPIPE_TFLG_DOMSTATE_SHIFT))) @@ -8436,7 +8559,7 @@ index 0000000..da272c50 + if (length > per_cpu(trace_path, cpu)[per_cpu(max_path, cpu)].length) { + /* we need protection here against other cpus trying + to start a proc dump */ -+ spin_lock(&global_path_lock); ++ raw_spin_lock(&global_path_lock); + + /* active path holds new worst case */ + tp->length = length; @@ -8445,7 +8568,7 @@ index 0000000..da272c50 + /* find next unused trace path */ + active = __ipipe_get_free_trace_path(active, cpu); + -+ spin_unlock(&global_path_lock); ++ raw_spin_unlock(&global_path_lock); + + tp = &per_cpu(trace_path, cpu)[active]; + @@ -8468,7 +8591,7 @@ index 0000000..da272c50 + + /* we need protection here against other cpus trying + * to set their frozen path or to start a proc dump */ -+ spin_lock(&global_path_lock); ++ raw_spin_lock(&global_path_lock); + + per_cpu(frozen_path, cpu) = active; + @@ -8482,7 +8605,7 @@ index 0000000..da272c50 + tp->end = -1; + } + -+ spin_unlock(&global_path_lock); ++ raw_spin_unlock(&global_path_lock); + + tp = &per_cpu(trace_path, cpu)[active]; + @@ -8637,7 +8760,7 @@ index 0000000..da272c50 + int cpu; + struct ipipe_trace_path *tp; + -+ spin_lock_irqsave(&global_path_lock, flags); ++ raw_spin_lock_irqsave(&global_path_lock, flags); + + cpu = ipipe_processor_id(); + restart: @@ -9566,7 +9689,7 @@ index 0000000..da272c50 + +static struct ftrace_ops ipipe_trace_ops = { + .func = ipipe_trace_function, -+ .flags = FTRACE_OPS_FL_RECURSION_SAFE, ++ .flags = FTRACE_OPS_FL_IPIPE_EXCLUSIVE, +}; + +static ssize_t __ipipe_wr_enable(struct file *file, const char __user *buffer, @@ -10453,7 +10576,7 @@ index 2329daa..79cfe9b 100644 if (pm_wakeup_pending()) { error = -EAGAIN; diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c -index 3c1aca0..90b1189 100644 +index 3c1aca0..ae6b3d5 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -62,6 +62,9 @@ int console_printk[4] = { @@ -10569,7 +10692,7 @@ index 3c1aca0..90b1189 100644 + goto start; + + do { -+ spin_unlock_irqrestore(&__ipipe_printk_lock, flags); ++ raw_spin_unlock_irqrestore(&__ipipe_printk_lock, flags); + start: + lmax = __ipipe_printk_fill; + while (out < lmax) { @@ -10578,13 +10701,13 @@ index 3c1aca0..90b1189 100644 + p += len; + out += len; + } -+ spin_lock_irqsave(&__ipipe_printk_lock, flags); ++ raw_spin_lock_irqsave(&__ipipe_printk_lock, flags); + } + while (__ipipe_printk_fill != lmax); + + __ipipe_printk_fill = 0; + -+ spin_unlock_irqrestore(&__ipipe_printk_lock, flags); ++ raw_spin_unlock_irqrestore(&__ipipe_printk_lock, flags); +} + /** @@ -10622,7 +10745,7 @@ index 3c1aca0..90b1189 100644 + goto out; + } + -+ spin_lock_irqsave(&__ipipe_printk_lock, flags); ++ raw_spin_lock_irqsave(&__ipipe_printk_lock, flags); + + oldcount = __ipipe_printk_fill; + fbytes = __LOG_BUF_LEN - oldcount; @@ -10633,7 +10756,7 @@ index 3c1aca0..90b1189 100644 + } else + r = 0; + -+ spin_unlock_irqrestore(&__ipipe_printk_lock, flags); ++ raw_spin_unlock_irqrestore(&__ipipe_printk_lock, flags); + + if (oldcount == 0) + ipipe_raise_irq(__ipipe_printk_virq); @@ -11282,7 +11405,7 @@ index 3b9a48a..edd9470 100644 help This option will modify all the calls to function tracing diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c -index eb11011..5fa6c0a 100644 +index eb11011..d0957bd 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -32,6 +32,7 @@ @@ -11293,7 +11416,33 @@ index eb11011..5fa6c0a 100644 #include <trace/events/sched.h> -@@ -2518,6 +2519,9 @@ void __weak arch_ftrace_update_code(int command) +@@ -262,8 +263,17 @@ static ftrace_func_t ftrace_ops_get_list_func(struct ftrace_ops *ops) + + static void update_ftrace_function(void) + { ++ struct ftrace_ops *ops; + ftrace_func_t func; + ++ for (ops = ftrace_ops_list; ++ ops != &ftrace_list_end; ops = ops->next) ++ if (ops->flags & FTRACE_OPS_FL_IPIPE_EXCLUSIVE) { ++ set_function_trace_op = ops; ++ func = ops->func; ++ goto set_pointers; ++ } ++ + /* + * Prepare the ftrace_ops that the arch callback will use. + * If there's only one ftrace_ops registered, the ftrace_ops_list +@@ -291,6 +301,7 @@ static void update_ftrace_function(void) + + update_function_graph_func(); + ++ set_pointers: + /* If there's no change, then do nothing more here */ + if (ftrace_trace_function == func) + return; +@@ -2518,6 +2529,9 @@ void __weak arch_ftrace_update_code(int command) static void ftrace_run_update_code(int command) { @@ -11303,7 +11452,7 @@ index eb11011..5fa6c0a 100644 int ret; ret = ftrace_arch_code_modify_prepare(); -@@ -2531,7 +2535,13 @@ static void ftrace_run_update_code(int command) +@@ -2531,7 +2545,13 @@ static void ftrace_run_update_code(int command) * is safe. The stop_machine() is the safest, but also * produces the most overhead. */ @@ -11317,7 +11466,7 @@ index eb11011..5fa6c0a 100644 ret = ftrace_arch_code_modify_post_process(); FTRACE_WARN_ON(ret); -@@ -4877,10 +4887,10 @@ static int ftrace_process_locs(struct module *mod, +@@ -4877,10 +4897,10 @@ static int ftrace_process_locs(struct module *mod, * reason to cause large interrupt latencies while we do it. */ if (!mod) @@ -11330,7 +11479,7 @@ index eb11011..5fa6c0a 100644 ret = 0; out: mutex_unlock(&ftrace_lock); -@@ -4979,9 +4989,11 @@ void __init ftrace_init(void) +@@ -4979,9 +4999,11 @@ void __init ftrace_init(void) unsigned long count, flags; int ret; @@ -11344,7 +11493,7 @@ index eb11011..5fa6c0a 100644 if (ret) goto failed; -@@ -5174,7 +5186,16 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, +@@ -5174,7 +5196,16 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, } } while_for_each_ftrace_op(op); out: @@ -11704,24 +11853,22 @@ index 86c8911..373a30b 100644 return err; } diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c -index 1afec32..5803111 100644 +index 1afec32..f7c1a2a 100644 --- a/lib/smp_processor_id.c +++ b/lib/smp_processor_id.c -@@ -12,10 +12,13 @@ notrace static unsigned int check_preemption_disabled(const char *what1, +@@ -12,6 +12,12 @@ notrace static unsigned int check_preemption_disabled(const char *what1, { int this_cpu = raw_smp_processor_id(); ++ if (hard_irqs_disabled()) ++ goto out; ++ + if (!ipipe_root_p) + goto out; + if (likely(preempt_count())) goto out; -- if (irqs_disabled()) -+ if (irqs_disabled() || hard_irqs_disabled()) - goto out; - - /* diff --git a/mm/memory.c b/mm/memory.c index 2a9e098..46ec4cd 100644 --- a/mm/memory.c @@ -11929,7 +12076,7 @@ index 2a9e098..46ec4cd 100644 static struct kmem_cache *page_ptl_cachep; diff --git a/mm/mlock.c b/mm/mlock.c -index 3d3ee6c..ed47c08 100644 +index 3d3ee6ca..ed47c08 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -756,3 +756,28 @@ void user_shm_unlock(size_t size, struct user_struct *user) @@ -12064,3 +12211,16 @@ index 2faaa29..ef00f26 100644 return nr; } +diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c +index 96c2e42..2e6e3cf 100644 +--- a/sound/soc/intel/atom/sst/sst.c ++++ b/sound/soc/intel/atom/sst/sst.c +@@ -369,7 +369,7 @@ static inline void sst_restore_shim64(struct intel_sst_drv *ctx, + */ + spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags); + sst_shim_write64(shim, SST_IMRX, shim_regs->imrx), +- sst_shim_write64(shim, SST_CSR, shim_regs->csr), ++ sst_shim_write64(shim, SST_CSR, shim_regs->csr); + spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags); + } + _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git