irq.c 3.5 KB

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