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