📄 adeos-ipipe-2.6.14-ppc64-1.1-00.patch
字号:
cpu_idle(); } @@ -487,6 +488,11 @@ init_timers(); softirq_init(); time_init();+ /*+ * We need to wait for the interrupt and time subsystems to be+ * initialized before enabling the pipeline.+ */+ ipipe_init(); /* * HACK ALERT! This is early. We're enabling the console before@@ -611,6 +617,7 @@ #ifdef CONFIG_SYSCTL sysctl_init(); #endif+ ipipe_init_proc(); /* Networking initialization needs a process context */ sock_init();--- 2.6.14/kernel/Makefile 2005-10-28 02:02:08.000000000 +0200+++ 2.6.14-ipipe/kernel/Makefile 2006-01-30 12:46:21.000000000 +0100@@ -32,6 +32,7 @@ obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_SECCOMP) += seccomp.o+obj-$(CONFIG_IPIPE) += ipipe/ ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y) # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is--- 2.6.14/kernel/exit.c 2005-10-28 02:02:08.000000000 +0200+++ 2.6.14-ipipe/kernel/exit.c 2005-10-31 10:15:18.000000000 +0100@@ -846,6 +846,7 @@ exit_itimers(tsk->signal); acct_process(code); }+ ipipe_exit_notify(tsk); exit_mm(tsk); exit_sem(tsk);--- 2.6.14/kernel/fork.c 2005-10-28 02:02:08.000000000 +0200+++ 2.6.14-ipipe/kernel/fork.c 2005-10-31 10:15:18.000000000 +0100@@ -1153,6 +1153,14 @@ total_forks++; write_unlock_irq(&tasklist_lock); retval = 0;+#ifdef CONFIG_IPIPE+ {+ int k;++ for (k = 0; k < IPIPE_ROOT_NPTDKEYS; k++)+ p->ptd[k] = NULL;+ }+#endif /* CONFIG_IPIPE */ fork_out: if (retval)--- 2.6.14/kernel/ipipe/Kconfig 1970-01-01 01:00:00.000000000 +0100+++ 2.6.14-ipipe/kernel/ipipe/Kconfig 2006-01-09 03:41:09.000000000 +0100@@ -0,0 +1,15 @@+config IPIPE+ bool "Interrupt pipeline"+ default y+ ---help---+ Activate this option if you want the interrupt pipeline to be+ compiled in.++config IPIPE_STATS+ bool "Collect statistics"+ depends on IPIPE+ default n+ ---help---+ Activate this option if you want runtime statistics to be collected+ while the I-pipe is operating. This option adds a small overhead, but+ is useful to detect unexpected latency spots.--- 2.6.14/kernel/ipipe/Makefile 1970-01-01 01:00:00.000000000 +0100+++ 2.6.14-ipipe/kernel/ipipe/Makefile 2005-12-29 14:04:04.000000000 +0100@@ -0,0 +1,3 @@++obj-$(CONFIG_IPIPE) += core.o generic.o+obj-$(CONFIG_IPIPE_TRACE) += tracer.o--- 2.6.14/kernel/ipipe/core.c 1970-01-01 01:00:00.000000000 +0100+++ 2.6.14-ipipe/kernel/ipipe/core.c 2006-01-06 09:28:39.000000000 +0100@@ -0,0 +1,827 @@+/* -*- linux-c -*-+ * linux/kernel/ipipe/core.c+ *+ * Copyright (C) 2002-2005 Philippe Gerum.+ *+ * This program is free software; you can redistribute it and/or modify+ * it under the terms of the GNU General Public License as published by+ * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,+ * USA; either version 2 of the License, or (at your option) any later+ * version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.+ *+ * Architecture-independent I-PIPE core support.+ */++#include <linux/sched.h>+#include <linux/module.h>+#include <linux/kallsyms.h>+#include <linux/interrupt.h>+#ifdef CONFIG_PROC_FS+#include <linux/proc_fs.h>+#endif /* CONFIG_PROC_FS */++static struct ipipe_domain ipipe_root =+ { .cpudata = {[0 ... IPIPE_NR_CPUS-1] =+ { .status = (1<<IPIPE_STALL_FLAG) } } };++struct ipipe_domain *ipipe_root_domain = &ipipe_root;++struct ipipe_domain *ipipe_percpu_domain[IPIPE_NR_CPUS] =+ {[0 ... IPIPE_NR_CPUS - 1] = &ipipe_root };++ipipe_spinlock_t __ipipe_pipelock = IPIPE_SPIN_LOCK_UNLOCKED;++struct list_head __ipipe_pipeline;++unsigned long __ipipe_virtual_irq_map = 0;++#ifdef CONFIG_PRINTK+unsigned __ipipe_printk_virq;+#endif /* CONFIG_PRINTK */++int __ipipe_event_monitors[IPIPE_NR_EVENTS];++/*+ * ipipe_init() -- Initialization routine of the IPIPE layer. Called+ * by the host kernel early during the boot procedure.+ */+void ipipe_init(void)+{+ struct ipipe_domain *ipd = &ipipe_root;++ __ipipe_check_platform(); /* Do platform dependent checks first. */++ /*+ * A lightweight registration code for the root domain. We are+ * running on the boot CPU, hw interrupts are off, and+ * secondary CPUs are still lost in space.+ */++ INIT_LIST_HEAD(&__ipipe_pipeline);++ ipd->name = "Linux";+ ipd->domid = IPIPE_ROOT_ID;+ ipd->priority = IPIPE_ROOT_PRIO;++ __ipipe_init_stage(ipd);++ INIT_LIST_HEAD(&ipd->p_link);+ list_add_tail(&ipd->p_link, &__ipipe_pipeline);++ __ipipe_init_platform();++#ifdef CONFIG_PRINTK+ __ipipe_printk_virq = ipipe_alloc_virq(); /* Cannot fail here. */+ ipd->irqs[__ipipe_printk_virq].handler = &__ipipe_flush_printk;+ ipd->irqs[__ipipe_printk_virq].cookie = NULL;+ ipd->irqs[__ipipe_printk_virq].acknowledge = NULL;+ ipd->irqs[__ipipe_printk_virq].control = IPIPE_HANDLE_MASK;+#endif /* CONFIG_PRINTK */++ __ipipe_enable_pipeline();++ printk(KERN_INFO "I-pipe %s: pipeline enabled.\n",+ IPIPE_VERSION_STRING);+}++void __ipipe_init_stage(struct ipipe_domain *ipd)+{+ int cpuid, n;++ for (cpuid = 0; cpuid < IPIPE_NR_CPUS; cpuid++) {+ ipd->cpudata[cpuid].irq_pending_hi = 0;++ for (n = 0; n < IPIPE_IRQ_IWORDS; n++)+ ipd->cpudata[cpuid].irq_pending_lo[n] = 0;++ for (n = 0; n < IPIPE_NR_IRQS; n++) {+ ipd->cpudata[cpuid].irq_counters[n].total_hits = 0;+ ipd->cpudata[cpuid].irq_counters[n].pending_hits = 0;+ }+ }++ for (n = 0; n < IPIPE_NR_IRQS; n++) {+ ipd->irqs[n].acknowledge = NULL;+ ipd->irqs[n].handler = NULL;+ ipd->irqs[n].control = IPIPE_PASS_MASK; /* Pass but don't handle */+ }++ for (n = 0; n < IPIPE_NR_EVENTS; n++)+ ipd->evhand[n] = NULL;++ ipd->evself = 0;++#ifdef CONFIG_SMP+ ipd->irqs[IPIPE_CRITICAL_IPI].acknowledge = &__ipipe_ack_system_irq;+ ipd->irqs[IPIPE_CRITICAL_IPI].handler = &__ipipe_do_critical_sync;+ ipd->irqs[IPIPE_CRITICAL_IPI].cookie = NULL;+ /* Immediately handle in the current domain but *never* pass */+ ipd->irqs[IPIPE_CRITICAL_IPI].control =+ IPIPE_HANDLE_MASK|IPIPE_STICKY_MASK|IPIPE_SYSTEM_MASK;+#endif /* CONFIG_SMP */+}++void __ipipe_stall_root(void)+{+ ipipe_declare_cpuid;+ unsigned long flags;++ ipipe_get_cpu(flags); /* Care for migration. */++ set_bit(IPIPE_STALL_FLAG, &ipipe_root_domain->cpudata[cpuid].status);++#ifdef CONFIG_SMP+ if (!__ipipe_pipeline_head_p(ipipe_root_domain))+ ipipe_put_cpu(flags);+#else /* CONFIG_SMP */+ if (__ipipe_pipeline_head_p(ipipe_root_domain))+ local_irq_disable_hw();+#endif /* CONFIG_SMP */+ ipipe_mark_domain_stall(ipipe_root_domain,cpuid);+}++void __ipipe_cleanup_domain(struct ipipe_domain *ipd)+{+ ipipe_unstall_pipeline_from(ipd);++#ifdef CONFIG_SMP+ {+ int cpu;++ for_each_online_cpu(cpu) {+ while (ipd->cpudata[cpu].irq_pending_hi != 0)+ cpu_relax();+ }+ }+#endif /* CONFIG_SMP */+}++void __ipipe_unstall_root(void)+{+ ipipe_declare_cpuid;++ local_irq_disable_hw();++ ipipe_load_cpuid();++ __clear_bit(IPIPE_STALL_FLAG, &ipipe_root_domain->cpudata[cpuid].status);++ ipipe_mark_domain_unstall(ipipe_root_domain, cpuid);++ if (ipipe_root_domain->cpudata[cpuid].irq_pending_hi != 0)+ __ipipe_sync_stage(IPIPE_IRQMASK_ANY);++ local_irq_enable_hw();+}++unsigned long __ipipe_test_root(void)+{+ unsigned long flags, s;+ ipipe_declare_cpuid;++ ipipe_get_cpu(flags); /* Care for migration. */+ s = test_bit(IPIPE_STALL_FLAG, &ipipe_root_domain->cpudata[cpuid].status);+ ipipe_put_cpu(flags);++ return s;+}++unsigned long __ipipe_test_and_stall_root(void)+{+ unsigned long flags, s;+ ipipe_declare_cpuid;++ ipipe_get_cpu(flags); /* Care for migration. */+ s = test_and_set_bit(IPIPE_STALL_FLAG,+ &ipipe_root_domain->cpudata[cpuid].status);+ ipipe_mark_domain_stall(ipipe_root_domain,cpuid);+ ipipe_put_cpu(flags);++ return s;+}++void fastcall __ipipe_restore_root(unsigned long flags)+{+ if (flags)+ __ipipe_stall_root();+ else+ __ipipe_unstall_root();+}++/*+ * ipipe_unstall_pipeline_from() -- Unstall the pipeline and+ * synchronize pending interrupts for a given domain. See+ * __ipipe_walk_pipeline() for more information.+ */+void fastcall ipipe_unstall_pipeline_from(struct ipipe_domain *ipd)+{+ struct ipipe_domain *this_domain;+ struct list_head *pos;+ unsigned long flags;+ ipipe_declare_cpuid;++ ipipe_lock_cpu(flags);++ __clear_bit(IPIPE_STALL_FLAG, &ipd->cpudata[cpuid].status);++ ipipe_mark_domain_unstall(ipd, cpuid);++ this_domain = ipipe_percpu_domain[cpuid];++ if (ipd == this_domain) {+ if (ipd->cpudata[cpuid].irq_pending_hi != 0)+ __ipipe_sync_stage(IPIPE_IRQMASK_ANY);++ goto release_cpu_and_exit;+ }++ list_for_each(pos, &__ipipe_pipeline) {++ struct ipipe_domain *next_domain =+ list_entry(pos, struct ipipe_domain, p_link);++ if (test_bit(IPIPE_STALL_FLAG,+ &next_domain->cpudata[cpuid].status))+ break; /* Stalled stage -- do not go further. */++ if (next_domain->cpudata[cpuid].irq_pending_hi != 0) {++ if (next_domain == this_domain)+ __ipipe_sync_stage(IPIPE_IRQMASK_ANY);+ else {+ __ipipe_switch_to(this_domain, next_domain,+ cpuid);++ ipipe_load_cpuid(); /* Processor might have changed. */++ if (this_domain->cpudata[cpuid].+ irq_pending_hi != 0+ && !test_bit(IPIPE_STALL_FLAG,+ &this_domain->cpudata[cpuid].+ status))+ __ipipe_sync_stage(IPIPE_IRQMASK_ANY);+ }++ break;+ } else if (next_domain == this_domain)+ break;+ }++release_cpu_and_exit:++ if (__ipipe_pipeline_head_p(ipd))+ local_irq_enable_hw();+ else+ ipipe_unlock_cpu(flags);+}++/*+ * ipipe_suspend_domain() -- Suspend the current domain, switching to+ * the next one which has pending work down the pipeline.+ */+void ipipe_suspend_domain(void)+{+ struct ipipe_domain *this_domain, *next_domain;+ struct list_head *ln;+ unsigned long flags;+ ipipe_declare_cpuid;++ ipipe_lock_cpu(flags);++ this_domain = next_domain = ipipe_percpu_domain[cpuid];++ __clear_bit(IPIPE_STALL_FLAG, &this_domain->cpudata[cpuid].status);++ ipipe_mark_domain_unstall(this_domain, cpuid);++ if (this_domain->cpudata[cpuid].irq_pending_hi != 0)+ goto sync_stage;++ for (;;) {+ ln = next_domain->p_link.next;++ if (ln == &__ipipe_pipeline)+ break;++ next_domain = list_entry(ln, struct ipipe_domain, p_link);++ if (test_bit(IPIPE_STALL_FLAG,+ &next_domain->cpudata[cpuid].status))+ break;++ if (next_domain->cpudata[cpuid].irq_pending_hi == 0)+ continue;++ ipipe_percpu_domain[cpuid] = next_domain;++sync_stage:++ __ipipe_sync_stage(IPIPE_IRQMASK_ANY);++ ipipe_load_cpuid(); /* Processor might have changed. */++ if (ipipe_percpu_domain[cpuid] != next_domain)+ /*+ * Something has changed the current domain under our+ * feet, recycling the register set; take note.+ */+ this_domain = ipipe_percpu_domain[cpuid];+ }++ ipipe_percpu_domain[cpuid] = this_domain;++ ipipe_unlock_cpu(flags);+}++/* ipipe_alloc_virq() -- Allocate a pipelined virtual/soft interrupt.+ * Virtual interrupts are handled in exactly the same way than their+ * hw-generated counterparts wrt pipelining.+ */+unsigned ipipe_alloc_virq(void)+{+ unsigned long flags, irq = 0;+ int ipos;++ spin_lock_irqsave_hw(&__ipipe_pipelock, flags);++ if (__ipipe_virtual_irq_map != ~0) {+ ipos = ffz(__ipipe_virtual_irq_map);+ set_bit(ipos, &__ipipe_virtual_irq_map);+ irq = ipos + IPIPE_VIRQ_BASE;+ }++ spin_unlock_irqrestore_hw(&__ipipe_pipelock, flags);++ return irq;+}++/* ipipe_virtualize_irq() -- Attach a handler (and optionally a hw+ acknowledge routine) to an interrupt for a given domain. */++int ipipe_virtualize_irq(struct ipipe_domain *ipd,+ unsigned irq,+ ipipe_irq_handler_t handler,+ void *cookie,+ ipipe_irq_ackfn_t acknowledge,+ unsigned modemask)+{+ unsigned long flags;+ int err;++ if (irq >= IPIPE_NR_IRQS)+ return -EINVAL;++ if (ipd->irqs[irq].control & IPIPE_SYSTEM_MASK)+ return -EPERM;++ spin_lock_irqsave_hw(&__ipipe_pipelock, flags);++ if (handler != NULL) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -