Commit 5a66f6d5 authored by Philippe Gerum's avatar Philippe Gerum

cobalt/powerpc: upgrade I-pipe support

parent 807152f5
......@@ -341,7 +341,7 @@ index 10be1dd..cfad863 100644
* or should we not care like we do now ? --BenH.
diff --git a/arch/powerpc/include/asm/ipipe.h b/arch/powerpc/include/asm/ipipe.h
new file mode 100644
index 0000000..40aca5b
index 0000000..1533d8b
--- /dev/null
+++ b/arch/powerpc/include/asm/ipipe.h
@@ -0,0 +1,157 @@
......@@ -386,7 +386,7 @@ index 0000000..40aca5b
+#include <linux/cache.h>
+#include <linux/threads.h>
+
+#define IPIPE_CORE_RELEASE 8
+#define IPIPE_CORE_RELEASE 9
+
+struct ipipe_domain;
+
......@@ -2463,10 +2463,10 @@ index 3fdef0f..72c186e 100644
li r0,0
diff --git a/arch/powerpc/kernel/ipipe.c b/arch/powerpc/kernel/ipipe.c
new file mode 100644
index 0000000..18f4599
index 0000000..d47e1b4
--- /dev/null
+++ b/arch/powerpc/kernel/ipipe.c
@@ -0,0 +1,396 @@
@@ -0,0 +1,391 @@
+/* -*- linux-c -*-
+ * linux/arch/powerpc/kernel/ipipe.c
+ *
......@@ -2832,11 +2832,6 @@ index 0000000..18f4599
+ return __ipipe_exit_irq(regs);
+}
+
+void __ipipe_pin_range_globally(unsigned long start, unsigned long end)
+{
+ /* We don't support this. */
+}
+
+#ifndef CONFIG_SMP
+EXPORT_SYMBOL_GPL(last_task_used_math);
+#endif
......@@ -3830,7 +3825,7 @@ index 7a8a748..8f13a2f 100644
{
long *start, *end;
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 51ab9e7..2234331 100644
index 010fabf..553a4b4 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -197,9 +197,9 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
......@@ -5661,7 +5656,7 @@ index 612dfc7..ffd8160 100644
.probe = serial8250_probe,
.remove = serial8250_remove,
diff --git a/fs/exec.c b/fs/exec.c
index ea4449d..aa73a12 100644
index 05f1942..836253a 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -822,6 +822,7 @@ static int exec_mmap(struct mm_struct *mm)
......@@ -6439,10 +6434,10 @@ index 0000000..912f689
+#endif /* !__LINUX_IPIPE_H */
diff --git a/include/linux/ipipe_base.h b/include/linux/ipipe_base.h
new file mode 100644
index 0000000..ea01dd6
index 0000000..a37358c
--- /dev/null
+++ b/include/linux/ipipe_base.h
@@ -0,0 +1,356 @@
@@ -0,0 +1,358 @@
+/* -*- linux-c -*-
+ * include/linux/ipipe_base.h
+ *
......@@ -6624,9 +6619,6 @@ index 0000000..ea01dd6
+
+void __ipipe_flush_printk(unsigned int irq, void *cookie);
+
+void __ipipe_pin_range_globally(unsigned long start,
+ unsigned long end);
+
+#define __ipipe_get_cpu(flags) ({ (flags) = hard_preempt_disable(); ipipe_processor_id(); })
+#define __ipipe_put_cpu(flags) hard_preempt_enable(flags)
+
......@@ -6759,10 +6751,6 @@ index 0000000..ea01dd6
+
+static inline void __ipipe_init_taskinfo(struct task_struct *p) { }
+
+static inline void __ipipe_pin_range_globally(unsigned long start,
+ unsigned long end)
+{ }
+
+#define hard_preempt_disable() ({ preempt_disable(); 0; })
+#define hard_preempt_enable(flags) ({ preempt_enable(); (void)(flags); })
+
......@@ -6789,6 +6777,15 @@ index 0000000..ea01dd6
+
+#endif /* !CONFIG_IPIPE */
+
+#ifdef CONFIG_IPIPE_WANT_PTE_PINNING
+void __ipipe_pin_mapping_globally(unsigned long start,
+ unsigned long end);
+#else
+static inline void __ipipe_pin_mapping_globally(unsigned long start,
+ unsigned long end)
+{ }
+#endif
+
+static inline void ipipe_preempt_root_only(void)
+{
+#if defined(CONFIG_IPIPE_DEBUG_CONTEXT) && \
......@@ -8306,7 +8303,7 @@ index 5b9b84b..6c8bb4d 100644
static inline void __raw_read_lock(rwlock_t *lock)
{
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 218b058..d579687 100644
index 91fe6a3..d579687 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -24,6 +24,7 @@ struct sched_param {
......@@ -8372,15 +8369,6 @@ index 218b058..d579687 100644
/*
* cache last used pipe for splice
@@ -1695,7 +1719,7 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk)
}
-static int pid_alive(const struct task_struct *p);
+static inline int pid_alive(const struct task_struct *p);
static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
{
pid_t pid = 0;
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 3f2867f..336c90a 100644
--- a/include/linux/spinlock.h
......@@ -8986,10 +8974,10 @@ index e2c6853..68c5ef5a 100644
trace_task_newtask(p, clone_flags);
diff --git a/kernel/ipipe/Kconfig b/kernel/ipipe/Kconfig
new file mode 100644
index 0000000..da17b04
index 0000000..218f51da
--- /dev/null
+++ b/kernel/ipipe/Kconfig
@@ -0,0 +1,62 @@
@@ -0,0 +1,65 @@
+config IPIPE
+ bool "Interrupt pipeline"
+ default y
......@@ -9010,6 +8998,9 @@ index 0000000..da17b04
+config IPIPE_WANT_CLOCKSOURCE
+ bool
+
+config IPIPE_WANT_PTE_PINNING
+ bool
+
+config IPIPE_CORE_APIREV
+ int
+ depends on IPIPE
......@@ -14860,20 +14851,20 @@ index e3be87e..e6a7b54 100644
/* ftrace_dyn_arch_init places the return code in addr */
if (addr)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 774a080..8b2f9dd 100644
index da41de9..82df76d8 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2651,7 +2651,8 @@ static DEFINE_PER_CPU(unsigned int, current_context);
static __always_inline int trace_recursive_lock(void)
{
- unsigned int val = this_cpu_read(current_context);
- unsigned int val = __this_cpu_read(current_context);
+ unsigned long flags;
+ unsigned int val;
int bit;
if (in_interrupt()) {
@@ -2664,22 +2665,35 @@ static __always_inline int trace_recursive_lock(void)
@@ -2664,21 +2665,34 @@ static __always_inline int trace_recursive_lock(void)
} else
bit = 3;
......@@ -14887,35 +14878,31 @@ index 774a080..8b2f9dd 100644
+ }
val |= (1 << bit);
- this_cpu_write(current_context, val);
+ __this_cpu_write(current_context, val);
+
+ hard_local_irq_restore(flags);
__this_cpu_write(current_context, val);
+ hard_local_irq_restore(flags);
+
return 0;
}
static __always_inline void trace_recursive_unlock(void)
{
- unsigned int val = this_cpu_read(current_context);
- unsigned int val = __this_cpu_read(current_context);
+ unsigned long flags;
+ unsigned int val;
+
+ flags = hard_local_irq_save();
+ val = __this_cpu_read(current_context);
val--;
- val &= this_cpu_read(current_context);
- this_cpu_write(current_context, val);
+ val &= __this_cpu_read(current_context);
+ __this_cpu_write(current_context, val);
val &= val & (val - 1);
__this_cpu_write(current_context, val);
+
+ hard_local_irq_restore(flags);
}
#else
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 813b021..6911c85 100644
index a2d62b3..38b8ba8 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2053,8 +2053,9 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
......@@ -15240,7 +15227,7 @@ index f8e0e53..02175aa3 100644
wake_up_klogd();
}
diff --git a/lib/ioremap.c b/lib/ioremap.c
index 0c9216c..1575d3e 100644
index 0c9216c..00a9a30 100644
--- a/lib/ioremap.c
+++ b/lib/ioremap.c
@@ -10,6 +10,7 @@
......@@ -15259,7 +15246,7 @@ index 0c9216c..1575d3e 100644
+ /* APEI may invoke this for temporarily remapping pages in interrupt
+ * context - nothing we can and need to propagate globally. */
+ if (!in_interrupt()) {
+ __ipipe_pin_range_globally(start, end);
+ __ipipe_pin_mapping_globally(start, end);
+ flush_cache_vmap(start, end);
+ }
......@@ -15297,7 +15284,7 @@ index 0862816..aacbf2df 100644
help
Transparent Hugepages allows the kernel to use huge pages and
diff --git a/mm/memory.c b/mm/memory.c
index 102af09..7d9fc91 100644
index 749e1c6..090df7e 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -788,6 +788,34 @@ out:
......@@ -15425,7 +15412,7 @@ index 102af09..7d9fc91 100644
if (entry.val)
break;
progress += 8;
@@ -2563,34 +2637,6 @@ static inline int pte_unmap_same(struct mm_struct *mm, pmd_t *pmd,
@@ -2564,34 +2638,6 @@ static inline int pte_unmap_same(struct mm_struct *mm, pmd_t *pmd,
return same;
}
......@@ -15460,7 +15447,7 @@ index 102af09..7d9fc91 100644
/*
* This routine handles present pages, when users try to write
* to a shared page. It is done by copying the page to a new address
@@ -4269,6 +4315,41 @@ void copy_user_huge_page(struct page *dst, struct page *src,
@@ -4270,6 +4316,41 @@ void copy_user_huge_page(struct page *dst, struct page *src,
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
......@@ -15626,14 +15613,14 @@ index 769a67a..b67a1ab 100644
return pages;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index aa3891e..5c756384 100644
index aa3891e..9b8e1ef 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -191,6 +191,8 @@ static int vmap_page_range_noflush(unsigned long start, unsigned long end,
return err;
} while (pgd++, addr = next, addr != end);
+ __ipipe_pin_range_globally(start, end);
+ __ipipe_pin_mapping_globally(start, end);
+
return nr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment