irq.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Copyright IBM Corp. 2004,2010
  3. * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
  4. * Thomas Spatzier (tspat@de.ibm.com)
  5. *
  6. * This file contains interrupt related functions.
  7. */
  8. #include <linux/module.h>
  9. #include <linux/kernel.h>
  10. #include <linux/kernel_stat.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/seq_file.h>
  13. #include <linux/cpu.h>
  14. #include <linux/proc_fs.h>
  15. #include <linux/profile.h>
  16. struct irq_class {
  17. char *name;
  18. char *desc;
  19. };
  20. static const struct irq_class intrclass_names[] = {
  21. {.name = "EXT" },
  22. {.name = "I/O" },
  23. {.name = "CLK", .desc = "[EXT] Clock Comparator" },
  24. {.name = "IPI", .desc = "[EXT] Signal Processor" },
  25. {.name = "TMR", .desc = "[EXT] CPU Timer" },
  26. {.name = "TAL", .desc = "[EXT] Timing Alert" },
  27. {.name = "PFL", .desc = "[EXT] Pseudo Page Fault" },
  28. {.name = "DSD", .desc = "[EXT] DASD Diag" },
  29. {.name = "VRT", .desc = "[EXT] Virtio" },
  30. {.name = "SCP", .desc = "[EXT] Service Call" },
  31. {.name = "IUC", .desc = "[EXT] IUCV" },
  32. {.name = "QAI", .desc = "[I/O] QDIO Adapter Interrupt" },
  33. {.name = "QDI", .desc = "[I/O] QDIO Interrupt" },
  34. {.name = "DAS", .desc = "[I/O] DASD" },
  35. {.name = "C15", .desc = "[I/O] 3215" },
  36. {.name = "NMI", .desc = "[NMI] Machine Check" },
  37. };
  38. /*
  39. * show_interrupts is needed by /proc/interrupts.
  40. */
  41. int show_interrupts(struct seq_file *p, void *v)
  42. {
  43. int i = *(loff_t *) v, j;
  44. get_online_cpus();
  45. if (i == 0) {
  46. seq_puts(p, " ");
  47. for_each_online_cpu(j)
  48. seq_printf(p, "CPU%d ",j);
  49. seq_putc(p, '\n');
  50. }
  51. if (i < NR_IRQS) {
  52. seq_printf(p, "%s: ", intrclass_names[i].name);
  53. #ifndef CONFIG_SMP
  54. seq_printf(p, "%10u ", kstat_irqs(i));
  55. #else
  56. for_each_online_cpu(j)
  57. seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
  58. #endif
  59. if (intrclass_names[i].desc)
  60. seq_printf(p, " %s", intrclass_names[i].desc);
  61. seq_putc(p, '\n');
  62. }
  63. put_online_cpus();
  64. return 0;
  65. }
  66. /*
  67. * For compatibilty only. S/390 specific setup of interrupts et al. is done
  68. * much later in init_channel_subsystem().
  69. */
  70. void __init
  71. init_IRQ(void)
  72. {
  73. /* nothing... */
  74. }
  75. /*
  76. * Switch to the asynchronous interrupt stack for softirq execution.
  77. */
  78. asmlinkage void do_softirq(void)
  79. {
  80. unsigned long flags, old, new;
  81. if (in_interrupt())
  82. return;
  83. local_irq_save(flags);
  84. if (local_softirq_pending()) {
  85. /* Get current stack pointer. */
  86. asm volatile("la %0,0(15)" : "=a" (old));
  87. /* Check against async. stack address range. */
  88. new = S390_lowcore.async_stack;
  89. if (((new - old) >> (PAGE_SHIFT + THREAD_ORDER)) != 0) {
  90. /* Need to switch to the async. stack. */
  91. new -= STACK_FRAME_OVERHEAD;
  92. ((struct stack_frame *) new)->back_chain = old;
  93. asm volatile(" la 15,0(%0)\n"
  94. " basr 14,%2\n"
  95. " la 15,0(%1)\n"
  96. : : "a" (new), "a" (old),
  97. "a" (__do_softirq)
  98. : "0", "1", "2", "3", "4", "5", "14",
  99. "cc", "memory" );
  100. } else
  101. /* We are already on the async stack. */
  102. __do_softirq();
  103. }
  104. local_irq_restore(flags);
  105. }
  106. #ifdef CONFIG_PROC_FS
  107. void init_irq_proc(void)
  108. {
  109. struct proc_dir_entry *root_irq_dir;
  110. root_irq_dir = proc_mkdir("irq", NULL);
  111. create_prof_cpu_mask(root_irq_dir);
  112. }
  113. #endif