irq.c 2.1 KB

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