irq.c 2.3 KB

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