0090-bcm2709-Simplify-and-strip-down-IRQ-handler.patch 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. From 1ef33cbb3347c38f563de1c7df7d103f8b7d23ca Mon Sep 17 00:00:00 2001
  2. From: popcornmix <popcornmix@gmail.com>
  3. Date: Fri, 20 Jun 2014 17:19:27 +0100
  4. Subject: [PATCH 090/114] bcm2709: Simplify and strip down IRQ handler
  5. ---
  6. arch/arm/include/asm/entry-macro-multi.S | 2 +
  7. arch/arm/mach-bcm2709/include/mach/entry-macro.S | 169 +++++++++++------------
  8. 2 files changed, 85 insertions(+), 86 deletions(-)
  9. --- a/arch/arm/include/asm/entry-macro-multi.S
  10. +++ b/arch/arm/include/asm/entry-macro-multi.S
  11. @@ -1,5 +1,6 @@
  12. #include <asm/assembler.h>
  13. +#ifndef CONFIG_ARCH_BCM2709
  14. /*
  15. * Interrupt handling. Preserves r7, r8, r9
  16. */
  17. @@ -28,6 +29,7 @@
  18. #endif
  19. 9997:
  20. .endm
  21. +#endif
  22. .macro arch_irq_handler, symbol_name
  23. .align 5
  24. --- a/arch/arm/mach-bcm2709/include/mach/entry-macro.S
  25. +++ b/arch/arm/mach-bcm2709/include/mach/entry-macro.S
  26. @@ -22,102 +22,99 @@
  27. #include <mach/hardware.h>
  28. #include <mach/irqs.h>
  29. - .macro disable_fiq
  30. - .endm
  31. + .macro arch_ret_to_user, tmp1, tmp2
  32. + .endm
  33. - .macro get_irqnr_preamble, base, tmp
  34. - ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE)
  35. - .endm
  36. -
  37. - .macro arch_ret_to_user, tmp1, tmp2
  38. - .endm
  39. -
  40. - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  41. - /* get core number */
  42. - mrc p15, 0, \tmp, c0, c0, 5
  43. - ubfx \tmp, \tmp, #0, #2
  44. -
  45. - /* get core's local interrupt controller */
  46. - ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source
  47. - add \irqstat, \irqstat, \tmp, lsl #2
  48. - ldr \tmp, [\irqstat]
  49. - /* ignore gpu interrupt */
  50. - bic \tmp, #0x100
  51. - /* ignore mailbox interrupts */
  52. - bics \tmp, #0xf0
  53. - beq 1005f
  54. -
  55. - @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1))
  56. - @ N.B. CLZ is an ARM5 instruction.
  57. - mov \irqnr, #(ARM_IRQ_LOCAL_BASE + 31)
  58. - sub \irqstat, \tmp, #1
  59. - eor \irqstat, \irqstat, \tmp
  60. - clz \tmp, \irqstat
  61. - sub \irqnr, \tmp
  62. - b 1020f
  63. -1005:
  64. - /* get core number */
  65. - mrc p15, 0, \tmp, c0, c0, 5
  66. - ubfx \tmp, \tmp, #0, #2
  67. -
  68. - cmp \tmp, #1
  69. - beq 1020f
  70. - cmp \tmp, #2
  71. - beq 1020f
  72. - cmp \tmp, #3
  73. - beq 1020f
  74. -
  75. - /* get masked status */
  76. - ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)]
  77. - mov \irqnr, #(ARM_IRQ0_BASE + 31)
  78. - and \tmp, \irqstat, #0x300 @ save bits 8 and 9
  79. - /* clear bits 8 and 9, and test */
  80. - bics \irqstat, \irqstat, #0x300
  81. - bne 1010f
  82. -
  83. - tst \tmp, #0x100
  84. - ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)]
  85. - movne \irqnr, #(ARM_IRQ1_BASE + 31)
  86. - @ Mask out the interrupts also present in PEND0 - see SW-5809
  87. - bicne \irqstat, #((1<<7) | (1<<9) | (1<<10))
  88. - bicne \irqstat, #((1<<18) | (1<<19))
  89. - bne 1010f
  90. -
  91. - tst \tmp, #0x200
  92. - ldrne \irqstat, [\base, #(ARM_IRQ_PEND2 - ARMCTRL_IC_BASE)]
  93. - movne \irqnr, #(ARM_IRQ2_BASE + 31)
  94. - @ Mask out the interrupts also present in PEND0 - see SW-5809
  95. - bicne \irqstat, #((1<<21) | (1<<22) | (1<<23) | (1<<24) | (1<<25))
  96. - bicne \irqstat, #((1<<30))
  97. - beq 1020f
  98. + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  99. + /* get core number */
  100. + mrc p15, 0, \base, c0, c0, 5
  101. + ubfx \base, \base, #0, #2
  102. +
  103. + /* get core's local interrupt controller */
  104. + ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source
  105. + add \irqstat, \irqstat, \base, lsl #2
  106. + ldr \tmp, [\irqstat]
  107. +
  108. + /* test for mailbox0 (IPI) interrupt */
  109. + tst \tmp, #0x10
  110. + beq 1030f
  111. +
  112. + /* get core's mailbox interrupt control */
  113. + ldr \irqstat, = __io_address(ARM_LOCAL_MAILBOX0_CLR0) @ mbox_clr
  114. + add \irqstat, \irqstat, \base, lsl #4
  115. + ldr \tmp, [\irqstat]
  116. + clz \tmp, \tmp
  117. + rsb \irqnr, \tmp, #31
  118. + mov \tmp, #1
  119. + lsl \tmp, \irqnr
  120. + str \tmp, [\irqstat] @ clear interrupt source
  121. + dsb
  122. + mov r1, sp
  123. + adr lr, BSYM(1b)
  124. + b do_IPI
  125. +
  126. +1030:
  127. + /* check gpu interrupt */
  128. + tst \tmp, #0x100
  129. + beq 1040f
  130. +
  131. + ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE)
  132. + /* get masked status */
  133. + ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)]
  134. + mov \irqnr, #(ARM_IRQ0_BASE + 31)
  135. + and \tmp, \irqstat, #0x300 @ save bits 8 and 9
  136. + /* clear bits 8 and 9, and test */
  137. + bics \irqstat, \irqstat, #0x300
  138. + bne 1010f
  139. +
  140. + tst \tmp, #0x100
  141. + ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)]
  142. + movne \irqnr, #(ARM_IRQ1_BASE + 31)
  143. + @ Mask out the interrupts also present in PEND0 - see SW-5809
  144. + bicne \irqstat, #((1<<7) | (1<<9) | (1<<10))
  145. + bicne \irqstat, #((1<<18) | (1<<19))
  146. + bne 1010f
  147. +
  148. + tst \tmp, #0x200
  149. + ldrne \irqstat, [\base, #(ARM_IRQ_PEND2 - ARMCTRL_IC_BASE)]
  150. + movne \irqnr, #(ARM_IRQ2_BASE + 31)
  151. + @ Mask out the interrupts also present in PEND0 - see SW-5809
  152. + bicne \irqstat, #((1<<21) | (1<<22) | (1<<23) | (1<<24) | (1<<25))
  153. + bicne \irqstat, #((1<<30))
  154. + beq 1020f
  155. 1010:
  156. - @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1))
  157. - @ N.B. CLZ is an ARM5 instruction.
  158. - sub \tmp, \irqstat, #1
  159. - eor \irqstat, \irqstat, \tmp
  160. - clz \tmp, \irqstat
  161. - sub \irqnr, \tmp
  162. + @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1))
  163. + sub \tmp, \irqstat, #1
  164. + eor \irqstat, \irqstat, \tmp
  165. + clz \tmp, \irqstat
  166. + sub \irqnr, \tmp
  167. + b 1050f
  168. +1040:
  169. + cmp \tmp, #0
  170. + beq 1020f
  171. +
  172. + /* handle local (e.g. timer) interrupts */
  173. + @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1))
  174. + mov \irqnr, #(ARM_IRQ_LOCAL_BASE + 31)
  175. + sub \irqstat, \tmp, #1
  176. + eor \irqstat, \irqstat, \tmp
  177. + clz \tmp, \irqstat
  178. + sub \irqnr, \tmp
  179. +1050:
  180. + mov r1, sp
  181. + @
  182. + @ routine called with r0 = irq number, r1 = struct pt_regs *
  183. + @
  184. + adr lr, BSYM(1b)
  185. + b asm_do_IRQ
  186. 1020: @ EQ will be set if no irqs pending
  187. + .endm
  188. - .endm
  189. -
  190. - .macro test_for_ipi, irqnr, irqstat, base, tmp
  191. - /* get core number */
  192. - mrc p15, 0, \tmp, c0, c0, 5
  193. - ubfx \tmp, \tmp, #0, #2
  194. - /* get core's mailbox interrupt control */
  195. - ldr \irqstat, = __io_address(ARM_LOCAL_MAILBOX0_CLR0) @ mbox_clr
  196. - add \irqstat, \irqstat, \tmp, lsl #4
  197. - ldr \tmp, [\irqstat]
  198. - cmp \tmp, #0
  199. - beq 1030f
  200. - clz \tmp, \tmp
  201. - rsb \irqnr, \tmp, #31
  202. - mov \tmp, #1
  203. - lsl \tmp, \irqnr
  204. - str \tmp, [\irqstat] @ clear interrupt source
  205. - dsb
  206. -1030: @ EQ will be set if no irqs pending
  207. - .endm
  208. +/*
  209. + * Interrupt handling. Preserves r7, r8, r9
  210. + */
  211. + .macro arch_irq_handler_default
  212. +1: get_irqnr_and_base r0, r2, r6, lr
  213. + .endm