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