irq.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * arch/s390/kernel/irq.c
  3. *
  4. * Copyright IBM Corp. 2004,2007
  5. * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
  6. * Thomas Spatzier (tspat@de.ibm.com)
  7. *
  8. * This file contains interrupt related functions.
  9. */
  10. #include <linux/module.h>
  11. #include <linux/kernel.h>
  12. #include <linux/kernel_stat.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/seq_file.h>
  15. #include <linux/cpu.h>
  16. #include <linux/proc_fs.h>
  17. #include <linux/profile.h>
  18. /*
  19. * show_interrupts is needed by /proc/interrupts.
  20. */
  21. int show_interrupts(struct seq_file *p, void *v)
  22. {
  23. static const char *intrclass_names[] = { "EXT", "I/O", };
  24. int i = *(loff_t *) v, j;
  25. if (i == 0) {
  26. seq_puts(p, " ");
  27. for_each_online_cpu(j)
  28. seq_printf(p, "CPU%d ",j);
  29. seq_putc(p, '\n');
  30. }
  31. if (i < NR_IRQS) {
  32. seq_printf(p, "%s: ", intrclass_names[i]);
  33. #ifndef CONFIG_SMP
  34. seq_printf(p, "%10u ", kstat_irqs(i));
  35. #else
  36. for_each_online_cpu(j)
  37. seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
  38. #endif
  39. seq_putc(p, '\n');
  40. }
  41. return 0;
  42. }
  43. /*
  44. * For compatibilty only. S/390 specific setup of interrupts et al. is done
  45. * much later in init_channel_subsystem().
  46. */
  47. void __init
  48. init_IRQ(void)
  49. {
  50. /* nothing... */
  51. }
  52. /*
  53. * Switch to the asynchronous interrupt stack for softirq execution.
  54. */
  55. extern void __do_softirq(void);
  56. asmlinkage void do_softirq(void)
  57. {
  58. unsigned long flags, old, new;
  59. if (in_interrupt())
  60. return;
  61. local_irq_save(flags);
  62. if (local_softirq_pending()) {
  63. /* Get current stack pointer. */
  64. asm volatile("la %0,0(15)" : "=a" (old));
  65. /* Check against async. stack address range. */
  66. new = S390_lowcore.async_stack;
  67. if (((new - old) >> (PAGE_SHIFT + THREAD_ORDER)) != 0) {
  68. /* Need to switch to the async. stack. */
  69. new -= STACK_FRAME_OVERHEAD;
  70. ((struct stack_frame *) new)->back_chain = old;
  71. asm volatile(" la 15,0(%0)\n"
  72. " basr 14,%2\n"
  73. " la 15,0(%1)\n"
  74. : : "a" (new), "a" (old),
  75. "a" (__do_softirq)
  76. : "0", "1", "2", "3", "4", "5", "14",
  77. "cc", "memory" );
  78. } else
  79. /* We are already on the async stack. */
  80. __do_softirq();
  81. }
  82. local_irq_restore(flags);
  83. }
  84. EXPORT_SYMBOL(do_softirq);
  85. void init_irq_proc(void)
  86. {
  87. struct proc_dir_entry *root_irq_dir;
  88. root_irq_dir = proc_mkdir("irq", NULL);
  89. create_prof_cpu_mask(root_irq_dir);
  90. }