irq.c (36d99df2fb474222ab47fbe8ae7385661033223b) irq.c (85218827cc4ca900867807f19345418164ffc108)
1/*
2 * Derived from arch/i386/kernel/irq.c
3 * Copyright (C) 1992 Linus Torvalds
4 * Adapted from arch/i386 by Gary Thomas
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * Updated and modified by Cort Dougan <cort@fsmlabs.com>
7 * Copyright (C) 1996-2001 Cort Dougan
8 * Adapted for Power Macintosh by Paul Mackerras

--- 293 unchanged lines hidden (view full) ---

302 if (irq != NO_IRQ && irq != NO_IRQ_IGNORE) {
303#ifdef CONFIG_IRQSTACKS
304 /* Switch to the irq stack to handle this */
305 curtp = current_thread_info();
306 irqtp = hardirq_ctx[smp_processor_id()];
307 if (curtp != irqtp) {
308 struct irq_desc *desc = irq_desc + irq;
309 void *handler = desc->handle_irq;
1/*
2 * Derived from arch/i386/kernel/irq.c
3 * Copyright (C) 1992 Linus Torvalds
4 * Adapted from arch/i386 by Gary Thomas
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * Updated and modified by Cort Dougan <cort@fsmlabs.com>
7 * Copyright (C) 1996-2001 Cort Dougan
8 * Adapted for Power Macintosh by Paul Mackerras

--- 293 unchanged lines hidden (view full) ---

302 if (irq != NO_IRQ && irq != NO_IRQ_IGNORE) {
303#ifdef CONFIG_IRQSTACKS
304 /* Switch to the irq stack to handle this */
305 curtp = current_thread_info();
306 irqtp = hardirq_ctx[smp_processor_id()];
307 if (curtp != irqtp) {
308 struct irq_desc *desc = irq_desc + irq;
309 void *handler = desc->handle_irq;
310 unsigned long saved_sp_limit = current->thread.ksp_limit;
310 if (handler == NULL)
311 handler = &__do_IRQ;
312 irqtp->task = curtp->task;
313 irqtp->flags = 0;
314
315 /* Copy the softirq bits in preempt_count so that the
316 * softirq checks work in the hardirq context.
317 */
318 irqtp->preempt_count =
319 (irqtp->preempt_count & ~SOFTIRQ_MASK) |
320 (curtp->preempt_count & SOFTIRQ_MASK);
321
311 if (handler == NULL)
312 handler = &__do_IRQ;
313 irqtp->task = curtp->task;
314 irqtp->flags = 0;
315
316 /* Copy the softirq bits in preempt_count so that the
317 * softirq checks work in the hardirq context.
318 */
319 irqtp->preempt_count =
320 (irqtp->preempt_count & ~SOFTIRQ_MASK) |
321 (curtp->preempt_count & SOFTIRQ_MASK);
322
323 current->thread.ksp_limit = (unsigned long)irqtp +
324 _ALIGN_UP(sizeof(struct thread_info), 16);
322 call_handle_irq(irq, desc, irqtp, handler);
325 call_handle_irq(irq, desc, irqtp, handler);
326 current->thread.ksp_limit = saved_sp_limit;
323 irqtp->task = NULL;
324
325
326 /* Set any flag that may have been set on the
327 * alternate stack
328 */
329 if (irqtp->flags)
330 set_bits(irqtp->flags, &curtp->flags);

--- 16 unchanged lines hidden (view full) ---

347 }
348#endif
349}
350
351void __init init_IRQ(void)
352{
353 if (ppc_md.init_IRQ)
354 ppc_md.init_IRQ();
327 irqtp->task = NULL;
328
329
330 /* Set any flag that may have been set on the
331 * alternate stack
332 */
333 if (irqtp->flags)
334 set_bits(irqtp->flags, &curtp->flags);

--- 16 unchanged lines hidden (view full) ---

351 }
352#endif
353}
354
355void __init init_IRQ(void)
356{
357 if (ppc_md.init_IRQ)
358 ppc_md.init_IRQ();
355#ifdef CONFIG_PPC64
356 irq_ctx_init();
359 irq_ctx_init();
357#endif
358}
359
360
361#ifdef CONFIG_IRQSTACKS
362struct thread_info *softirq_ctx[NR_CPUS] __read_mostly;
363struct thread_info *hardirq_ctx[NR_CPUS] __read_mostly;
364
365void irq_ctx_init(void)

--- 12 unchanged lines hidden (view full) ---

378 tp->cpu = i;
379 tp->preempt_count = HARDIRQ_OFFSET;
380 }
381}
382
383static inline void do_softirq_onstack(void)
384{
385 struct thread_info *curtp, *irqtp;
360}
361
362
363#ifdef CONFIG_IRQSTACKS
364struct thread_info *softirq_ctx[NR_CPUS] __read_mostly;
365struct thread_info *hardirq_ctx[NR_CPUS] __read_mostly;
366
367void irq_ctx_init(void)

--- 12 unchanged lines hidden (view full) ---

380 tp->cpu = i;
381 tp->preempt_count = HARDIRQ_OFFSET;
382 }
383}
384
385static inline void do_softirq_onstack(void)
386{
387 struct thread_info *curtp, *irqtp;
388 unsigned long saved_sp_limit = current->thread.ksp_limit;
386
387 curtp = current_thread_info();
388 irqtp = softirq_ctx[smp_processor_id()];
389 irqtp->task = curtp->task;
389
390 curtp = current_thread_info();
391 irqtp = softirq_ctx[smp_processor_id()];
392 irqtp->task = curtp->task;
393 current->thread.ksp_limit = (unsigned long)irqtp +
394 _ALIGN_UP(sizeof(struct thread_info), 16);
390 call_do_softirq(irqtp);
395 call_do_softirq(irqtp);
396 current->thread.ksp_limit = saved_sp_limit;
391 irqtp->task = NULL;
392}
393
394#else
395#define do_softirq_onstack() __do_softirq()
396#endif /* CONFIG_IRQSTACKS */
397
398void do_softirq(void)

--- 690 unchanged lines hidden ---
397 irqtp->task = NULL;
398}
399
400#else
401#define do_softirq_onstack() __do_softirq()
402#endif /* CONFIG_IRQSTACKS */
403
404void do_softirq(void)

--- 690 unchanged lines hidden ---