irq.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 = "C70", .desc = "[I/O] 3270" },
  37. {.name = "TAP", .desc = "[I/O] Tape" },
  38. {.name = "VMR", .desc = "[I/O] Unit Record Devices" },
  39. {.name = "LCS", .desc = "[I/O] LCS" },
  40. {.name = "CLW", .desc = "[I/O] CLAW" },
  41. {.name = "CTC", .desc = "[I/O] CTC" },
  42. {.name = "APB", .desc = "[I/O] AP Bus" },
  43. {.name = "NMI", .desc = "[NMI] Machine Check" },
  44. };
  45. /*
  46. * show_interrupts is needed by /proc/interrupts.
  47. */
  48. int show_interrupts(struct seq_file *p, void *v)
  49. {
  50. int i = *(loff_t *) v, j;
  51. get_online_cpus();
  52. if (i == 0) {
  53. seq_puts(p, " ");
  54. for_each_online_cpu(j)
  55. seq_printf(p, "CPU%d ",j);
  56. seq_putc(p, '\n');
  57. }
  58. if (i < NR_IRQS) {
  59. seq_printf(p, "%s: ", intrclass_names[i].name);
  60. #ifndef CONFIG_SMP
  61. seq_printf(p, "%10u ", kstat_irqs(i));
  62. #else
  63. for_each_online_cpu(j)
  64. seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
  65. #endif
  66. if (intrclass_names[i].desc)
  67. seq_printf(p, " %s", intrclass_names[i].desc);
  68. seq_putc(p, '\n');
  69. }
  70. put_online_cpus();
  71. return 0;
  72. }
  73. /*
  74. * For compatibilty only. S/390 specific setup of interrupts et al. is done
  75. * much later in init_channel_subsystem().
  76. */
  77. void __init
  78. init_IRQ(void)
  79. {
  80. /* nothing... */
  81. }
  82. /*
  83. * Switch to the asynchronous interrupt stack for softirq execution.
  84. */
  85. asmlinkage void do_softirq(void)
  86. {
  87. unsigned long flags, old, new;
  88. if (in_interrupt())
  89. return;
  90. local_irq_save(flags);
  91. if (local_softirq_pending()) {
  92. /* Get current stack pointer. */
  93. asm volatile("la %0,0(15)" : "=a" (old));
  94. /* Check against async. stack address range. */
  95. new = S390_lowcore.async_stack;
  96. if (((new - old) >> (PAGE_SHIFT + THREAD_ORDER)) != 0) {
  97. /* Need to switch to the async. stack. */
  98. new -= STACK_FRAME_OVERHEAD;
  99. ((struct stack_frame *) new)->back_chain = old;
  100. asm volatile(" la 15,0(%0)\n"
  101. " basr 14,%2\n"
  102. " la 15,0(%1)\n"
  103. : : "a" (new), "a" (old),
  104. "a" (__do_softirq)
  105. : "0", "1", "2", "3", "4", "5", "14",
  106. "cc", "memory" );
  107. } else
  108. /* We are already on the async stack. */
  109. __do_softirq();
  110. }
  111. local_irq_restore(flags);
  112. }
  113. #ifdef CONFIG_PROC_FS
  114. void init_irq_proc(void)
  115. {
  116. struct proc_dir_entry *root_irq_dir;
  117. root_irq_dir = proc_mkdir("irq", NULL);
  118. create_prof_cpu_mask(root_irq_dir);
  119. }
  120. #endif