📄 adeos-ipipe-2.6.14-ppc64-1.1-00.patch
字号:
+MODULE_LICENSE("GPL");++static int __ipipe_ptd_key_count;++static unsigned long __ipipe_ptd_key_map;++/* ipipe_register_domain() -- Link a new domain to the pipeline. */++int ipipe_register_domain(struct ipipe_domain *ipd,+ struct ipipe_domain_attr *attr)+{+ struct list_head *pos;+ unsigned long flags;++ if (ipipe_current_domain != ipipe_root_domain) {+ printk(KERN_WARNING+ "I-pipe: Only the root domain may register a new domain.\n");+ return -EPERM;+ }++ flags = ipipe_critical_enter(NULL);++ list_for_each(pos, &__ipipe_pipeline) {+ struct ipipe_domain *_ipd =+ list_entry(pos, struct ipipe_domain, p_link);+ if (_ipd->domid == attr->domid)+ break;+ }++ ipipe_critical_exit(flags);++ if (pos != &__ipipe_pipeline)+ /* A domain with the given id already exists -- fail. */+ return -EBUSY;++ ipd->name = attr->name;+ ipd->priority = attr->priority;+ ipd->domid = attr->domid;+ ipd->pdd = attr->pdd;+ ipd->flags = 0;++#ifdef CONFIG_IPIPE_STATS+ {+ int cpu, irq;+ for_each_online_cpu(cpu) {+ ipd->stats[cpu].last_stall_date = 0LL;+ for (irq = 0; irq < IPIPE_NR_IRQS; irq++)+ ipd->stats[cpu].irq_stats[irq].last_receipt_date = 0LL;+ }+ }+#endif /* CONFIG_IPIPE_STATS */++ __ipipe_init_stage(ipd);++ INIT_LIST_HEAD(&ipd->p_link);++#ifdef CONFIG_PROC_FS+ __ipipe_add_domain_proc(ipd);+#endif /* CONFIG_PROC_FS */++ flags = ipipe_critical_enter(NULL);++ list_for_each(pos, &__ipipe_pipeline) {+ struct ipipe_domain *_ipd =+ list_entry(pos, struct ipipe_domain, p_link);+ if (ipd->priority > _ipd->priority)+ break;+ }++ list_add_tail(&ipd->p_link, pos);++ ipipe_critical_exit(flags);++ printk(KERN_WARNING "I-pipe: Domain %s registered.\n", ipd->name);++ /*+ * Finally, allow the new domain to perform its initialization+ * chores.+ */++ if (attr->entry != NULL) {+ ipipe_declare_cpuid;++ ipipe_lock_cpu(flags);++ ipipe_percpu_domain[cpuid] = ipd;+ attr->entry();+ ipipe_percpu_domain[cpuid] = ipipe_root_domain;++ ipipe_load_cpuid(); /* Processor might have changed. */++ if (ipipe_root_domain->cpudata[cpuid].irq_pending_hi != 0 &&+ !test_bit(IPIPE_STALL_FLAG,+ &ipipe_root_domain->cpudata[cpuid].status))+ __ipipe_sync_stage(IPIPE_IRQMASK_ANY);++ ipipe_unlock_cpu(flags);+ }++ return 0;+}++/* ipipe_unregister_domain() -- Remove a domain from the pipeline. */++int ipipe_unregister_domain(struct ipipe_domain *ipd)+{+ unsigned long flags;++ if (ipipe_current_domain != ipipe_root_domain) {+ printk(KERN_WARNING+ "I-pipe: Only the root domain may unregister a domain.\n");+ return -EPERM;+ }++ if (ipd == ipipe_root_domain) {+ printk(KERN_WARNING+ "I-pipe: Cannot unregister the root domain.\n");+ return -EPERM;+ }+#ifdef CONFIG_SMP+ {+ int nr_cpus = num_online_cpus(), _cpuid;+ unsigned irq;++ /*+ * In the SMP case, wait for the logged events to drain on+ * other processors before eventually removing the domain+ * from the pipeline.+ */++ ipipe_unstall_pipeline_from(ipd);++ flags = ipipe_critical_enter(NULL);++ for (irq = 0; irq < IPIPE_NR_IRQS; irq++) {+ clear_bit(IPIPE_HANDLE_FLAG, &ipd->irqs[irq].control);+ clear_bit(IPIPE_STICKY_FLAG, &ipd->irqs[irq].control);+ set_bit(IPIPE_PASS_FLAG, &ipd->irqs[irq].control);+ }++ ipipe_critical_exit(flags);++ for (_cpuid = 0; _cpuid < nr_cpus; _cpuid++)+ for (irq = 0; irq < IPIPE_NR_IRQS; irq++)+ while (ipd->cpudata[_cpuid].irq_counters[irq].pending_hits > 0)+ cpu_relax();+ }+#endif /* CONFIG_SMP */++#ifdef CONFIG_PROC_FS+ __ipipe_remove_domain_proc(ipd);+#endif /* CONFIG_PROC_FS */++ /*+ * Simply remove the domain from the pipeline and we are almost done.+ */++ flags = ipipe_critical_enter(NULL);+ list_del_init(&ipd->p_link);+ ipipe_critical_exit(flags);++ __ipipe_cleanup_domain(ipd);++ printk(KERN_WARNING "I-pipe: Domain %s unregistered.\n", ipd->name);++ return 0;+}++/*+ * ipipe_propagate_irq() -- Force a given IRQ propagation on behalf of+ * a running interrupt handler to the next domain down the pipeline.+ * ipipe_schedule_irq() -- Does almost the same as above, but attempts+ * to pend the interrupt for the current domain first.+ */+int fastcall __ipipe_schedule_irq(unsigned irq, struct list_head *head)+{+ struct list_head *ln;+ unsigned long flags;+ ipipe_declare_cpuid;++ if (irq >= IPIPE_NR_IRQS ||+ (ipipe_virtual_irq_p(irq)+ && !test_bit(irq - IPIPE_VIRQ_BASE, &__ipipe_virtual_irq_map)))+ return -EINVAL;++ ipipe_lock_cpu(flags);++ ln = head;++ while (ln != &__ipipe_pipeline) {+ struct ipipe_domain *ipd =+ list_entry(ln, struct ipipe_domain, p_link);++ if (test_bit(IPIPE_HANDLE_FLAG, &ipd->irqs[irq].control)) {+ ipd->cpudata[cpuid].irq_counters[irq].total_hits++;+ ipd->cpudata[cpuid].irq_counters[irq].pending_hits++;+ __ipipe_set_irq_bit(ipd, cpuid, irq);+ ipipe_mark_irq_receipt(ipd, irq, cpuid);+ ipipe_unlock_cpu(flags);+ return 1;+ }++ ln = ipd->p_link.next;+ }++ ipipe_unlock_cpu(flags);++ return 0;+}++/* ipipe_free_virq() -- Release a virtual/soft interrupt. */++int ipipe_free_virq(unsigned virq)+{+ if (!ipipe_virtual_irq_p(virq))+ return -EINVAL;++ clear_bit(virq - IPIPE_VIRQ_BASE, &__ipipe_virtual_irq_map);++ return 0;+}++void ipipe_init_attr(struct ipipe_domain_attr *attr)+{+ attr->name = "anon";+ attr->domid = 1;+ attr->entry = NULL;+ attr->priority = IPIPE_ROOT_PRIO;+ attr->pdd = NULL;+}++/*+ * ipipe_catch_event() -- Interpose or remove an event handler for a+ * given domain.+ */+int ipipe_catch_event(struct ipipe_domain *ipd,+ unsigned event,+ int (*handler)(unsigned event, struct ipipe_domain *ipd, void *data))+{+ int self = 0;++ if (event & IPIPE_EVENT_SELF) {+ event &= ~IPIPE_EVENT_SELF;+ self = 1;+ }++ if (event >= IPIPE_NR_EVENTS)+ return -EINVAL;++ if (!xchg(&ipd->evhand[event],handler)) {+ if (handler) {+ if (self)+ ipd->evself |= (1LL << event);+ else+ __ipipe_event_monitors[event]++;+ }+ }+ else if (!handler) {+ if (ipd->evself & (1LL << event))+ ipd->evself &= ~(1LL << event);+ else+ __ipipe_event_monitors[event]--;+ } else if ((ipd->evself & (1LL << event)) && !self) {+ __ipipe_event_monitors[event]++;+ ipd->evself &= ~(1LL << event);+ } else if (!(ipd->evself & (1LL << event)) && self) {+ __ipipe_event_monitors[event]--;+ ipd->evself |= (1LL << event);+ }++ return 0;+}++cpumask_t ipipe_set_irq_affinity (unsigned irq, cpumask_t cpumask)+{+#ifdef CONFIG_SMP+ if (irq >= IPIPE_NR_XIRQS)+ /* Allow changing affinity of external IRQs only. */+ return CPU_MASK_NONE;++ if (num_online_cpus() > 1)+ return __ipipe_set_irq_affinity(irq,cpumask);+#endif /* CONFIG_SMP */++ return CPU_MASK_NONE;+}++int fastcall ipipe_send_ipi (unsigned ipi, cpumask_t cpumask)++{+#ifdef CONFIG_SMP+ return __ipipe_send_ipi(ipi,cpumask);+#else /* !CONFIG_SMP */+ return -EINVAL;+#endif /* CONFIG_SMP */+}++int ipipe_alloc_ptdkey (void)+{+ unsigned long flags;+ int key = -1;++ spin_lock_irqsave_hw(&__ipipe_pipelock,flags);++ if (__ipipe_ptd_key_count < IPIPE_ROOT_NPTDKEYS) {+ key = ffz(__ipipe_ptd_key_map);+ set_bit(key,&__ipipe_ptd_key_map);+ __ipipe_ptd_key_count++;+ }++ spin_unlock_irqrestore_hw(&__ipipe_pipelock,flags);++ return key;+}++int ipipe_free_ptdkey (int key)+{+ unsigned long flags;++ if (key < 0 || key >= IPIPE_ROOT_NPTDKEYS)+ return -EINVAL;++ spin_lock_irqsave_hw(&__ipipe_pipelock,flags);++ if (test_and_clear_bit(key,&__ipipe_ptd_key_map))+ __ipipe_ptd_key_count--;++ spin_unlock_irqrestore_hw(&__ipipe_pipelock,flags);++ return 0;+}++int fastcall ipipe_set_ptd (int key, void *value)++{+ if (key < 0 || key >= IPIPE_ROOT_NPTDKEYS)+ return -EINVAL;++ current->ptd[key] = value;++ return 0;+}++void fastcall *ipipe_get_ptd (int key)++{+ if (key < 0 || key >= IPIPE_ROOT_NPTDKEYS)+ return NULL;++ return current->ptd[key];+}++EXPORT_SYMBOL(ipipe_register_domain);+EXPORT_SYMBOL(ipipe_unregister_domain);+EXPORT_SYMBOL(ipipe_free_virq);+EXPORT_SYMBOL(ipipe_init_attr);+EXPORT_SYMBOL(ipipe_catch_event);+EXPORT_SYMBOL(ipipe_alloc_ptdkey);+EXPORT_SYMBOL(ipipe_free_ptdkey);+EXPORT_SYMBOL(ipipe_set_ptd);+EXPORT_SYMBOL(ipipe_get_ptd);+EXPORT_SYMBOL(ipipe_set_irq_affinity);+EXPORT_SYMBOL(ipipe_send_ipi);+EXPORT_SYMBOL(__ipipe_schedule_irq);--- 2.6.14/kernel/irq/handle.c 2005-10-28 02:02:08.000000000 +0200+++ 2.6.14-ipipe/kernel/irq/handle.c 2005-10-31 10:15:18.000000000 +0100@@ -81,6 +81,17 @@ { int ret, retval = 0, status = 0; +#ifdef CONFIG_IPIPE+ /*+ * If processing a timer tick, pass the original regs as+ * collected during preemption and not our phony - always+ * kernel-originated - frame, so that we don't wreck the+ * profiling code.+ */+ if (__ipipe_tick_irq == irq)+ regs = __ipipe_tick_regs + smp_processor_id();+#endif /* CONFIG_IPIPE */+ if (!(action->flags & SA_INTERRUPT)) local_irq_enable(); @@ -117,14 +128,18 @@ /* * No locking required for CPU-local interrupts: */+#ifndef CONFIG_IPIPE desc->handler->ack(irq);+#endif /* CONFIG_IPIPE */ action_ret = handle_IRQ_event(irq, regs, desc->action); desc->handler->end(irq); return 1; } spin_lock(&desc->lock);+#ifndef CONFIG_IPIPE desc->handler->ack(irq);+#endif /* CONFIG_IPIPE */ /* * REPLAY is when Linux resends an IRQ that was dropped earlier * WAITING is used by probe to mark irqs that are being tested--- 2.6.14/kernel/printk.c 2005-10-28 02:02:08.000000000 +0200+++ 2.6.14-ipipe/kernel/printk.c 2006-01-03 11:45:23.000000000 +0100@@ -507,6 +507,78 @@ * is inspected when the actual printing occurs. */ +#ifdef CONFIG_IPIPE++static ipipe_spinlock_t __ipipe_printk_lock = IPIPE_SPIN_LOCK_UNLOCKED;++static int __ipipe_printk_fill;++static char __ipipe_printk_buf[__LOG_BUF_LEN];++void __ipipe_flush_printk (unsigned virq, void *cookie)+{+ char *p = __ipipe_printk_buf;+ int len, lmax, out = 0;+ unsigned long flags;++ goto start;++ do {+ spin_unlock_irqrestore_hw(&__ipipe_printk_lock,flags);+ start:+ lmax = __ipipe_printk_fill;+ while (out < lmax) {+ len = strlen(p) + 1;+ printk("%s",p);+ p += len;+ out += len;+ }+ spin_lock_irqsave_hw(&__ipipe_printk_lock,flags);+ }+ while (__ipipe_printk_fill != lmax);++ __ipipe_printk_fill = 0;++ spin_unlock_irqrestore_hw(&__ipipe_printk_lock,flags);+}++asmlinkage int printk(const char *fmt, ...)+{+ int r, fbytes, oldcount;+ unsigned long flags;+ va_list args;++ va_start(args, fmt);++ if (ipipe_current_domain == ipipe_root_domain ||+ test_bit(IPIPE_SPRINTK_FLAG,&ipipe_current_domain->flags) ||+ oops_in_progress) {+ r = vprintk(fmt, args);+ goto out;+ }++ spin_lock_irqsave_hw(&__ipipe_printk_lock,flags);++ oldcount = __ipipe_printk_fill;+ fbytes = __LOG_BUF_LEN - oldcount;++ if (fbytes > 1) {+ r = vscnprintf(__ipipe_printk_buf + __ipipe_printk_fill,+ fbytes, fmt, args) + 1; /* account for the null byte */+ __ipipe_printk_fill += r;+ } else+ r = 0;++ spin_unlock_irqrestore_hw(&__ipipe_printk_lock,flags);++ if (oldcount == 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -