ioapic: when switches to level trigger mode, interrupts raised repeatedly.

- the trigger mode is edge at first
- During initializatoin, the interrupt is raised as edge which is masked.
  The corresponding bit of irr is set.
- Then the mode is switched to level and it's unmasked.
- the bit of irr is set, so the interrupt is raised repeatedly by
  ioapic_service().
- OS considers that the irq line is broken and falls back to polling mode.

This patch fixes the issues.
After raising edige, clear the bit of irr.

> Bringing up interface eth0:
> Determining IP information for eth0...irq 18: nobody cared (try booting with the "irqpoll" option)
> Pid: 4126, comm: ip Not tainted 2.6.38-rc7 #1
> Call Trace:
>  <IRQ>  [<ffffffff8105b009>] ? __report_bad_irq+0x38/0x87
>  [<ffffffff8105b177>] ? note_interrupt+0x11f/0x188
>  [<ffffffff8105bacf>] ? handle_fasteoi_irq+0xa7/0xd1
>  [<ffffffff810046ff>] ? handle_irq+0x83/0x8c
>  [<ffffffff81003eb9>] ? do_IRQ+0x48/0xaf
>  [<ffffffff81300513>] ? ret_from_intr+0x0/0xe
>  [<ffffffff81031ab8>] ? __do_softirq+0x4f/0x114
>  [<ffffffff81002d6c>] ? call_softirq+0x1c/0x28
>  [<ffffffff81004647>] ? do_softirq+0x33/0x68
>  [<ffffffff810316fb>] ? irq_exit+0x36/0x38
>  [<ffffffff81015f2c>] ? smp_apic_timer_interrupt+0x88/0x96
>  [<ffffffff81002853>] ? apic_timer_interrupt+0x13/0x20
>  <EOI>  [<ffffffff810177ed>] ? __ioapic_set_affinity+0x68/0x7c
>  [<ffffffff813000f0>] ? _raw_spin_unlock_irqrestore+0x8/0xa
>  [<ffffffff8105a84f>] ? __setup_irq+0x224/0x2cb
>  [<ffffffff8120e3c5>] ? e1000_intr+0x0/0x103
>  [<ffffffff8105a9c7>] ? request_threaded_irq+0xd1/0x114
>  [<ffffffff8120e396>] ? e1000_request_irq+0x34/0x63
>  [<ffffffff8121237d>] ? e1000_open+0x81/0x11f
>  [<ffffffff8129097c>] ? call_netdevice_notifiers+0x45/0x4a
>  [<ffffffff81290d8d>] ? __dev_open+0x97/0xc4
>  [<ffffffff8128e9c5>] ? __dev_change_flags+0xb9/0x13d
>  [<ffffffff81290cc1>] ? dev_change_flags+0x1c/0x51
>  [<ffffffff812d0542>] ? devinet_ioctl+0x26e/0x594
>  [<ffffffff812d174c>] ? inet_ioctl+0x92/0xaa
>  [<ffffffff81281d75>] ? T.1003+0x13/0x32
>  [<ffffffff81282152>] ? sock_ioctl+0x1f2/0x1ff
>  [<ffffffff810ae2d3>] ? do_vfs_ioctl+0x498/0x4e7
>  [<ffffffff81281203>] ? sock_alloc_file+0xb3/0x115
>  [<ffffffff8109f79f>] ? fd_install+0x31/0x5d
>  [<ffffffff810ae364>] ? sys_ioctl+0x42/0x65
>  [<ffffffff81001f3b>] ? system_call_fastpath+0x16/0x1b
> handlers:
> [<ffffffff8120e3c5>] (e1000_intr+0x0/0x103)
> Disabling IRQ #18

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
1 file changed
tree: cd63d3e301b26199d811445d0336f73ea357c2da
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. libcacard/
  12. linux-user/
  13. net/
  14. pc-bios/
  15. QMP/
  16. roms/
  17. scripts/
  18. slirp/
  19. sysconfigs/
  20. target-alpha/
  21. target-arm/
  22. target-cris/
  23. target-i386/
  24. target-lm32/
  25. target-m68k/
  26. target-microblaze/
  27. target-mips/
  28. target-ppc/
  29. target-s390x/
  30. target-sh4/
  31. target-sparc/
  32. tcg/
  33. tests/
  34. ui/
  35. .gitignore
  36. .gitmodules
  37. a.out.h
  38. acl.c
  39. acl.h
  40. aes.c
  41. aes.h
  42. aio.c
  43. alpha-dis.c
  44. alpha.ld
  45. arch_init.c
  46. arch_init.h
  47. arm-dis.c
  48. arm-semi.c
  49. arm.ld
  50. async.c
  51. balloon.c
  52. balloon.h
  53. bitmap.c
  54. bitmap.h
  55. bitops.c
  56. bitops.h
  57. block-migration.c
  58. block-migration.h
  59. block.c
  60. block.h
  61. block_int.h
  62. blockdev.c
  63. blockdev.h
  64. bswap.h
  65. bt-host.c
  66. bt-host.h
  67. bt-vhci.c
  68. buffered_file.c
  69. buffered_file.h
  70. cache-utils.c
  71. cache-utils.h
  72. Changelog
  73. check-qdict.c
  74. check-qfloat.c
  75. check-qint.c
  76. check-qjson.c
  77. check-qlist.c
  78. check-qstring.c
  79. cmd.c
  80. cmd.h
  81. CODING_STYLE
  82. compatfd.c
  83. compatfd.h
  84. config.h
  85. configure
  86. console.c
  87. console.h
  88. COPYING
  89. COPYING.LIB
  90. cpu-all.h
  91. cpu-common.h
  92. cpu-defs.h
  93. cpu-exec.c
  94. cpus.c
  95. cpus.h
  96. cris-dis.c
  97. cursor.c
  98. cursor_hidden.xpm
  99. cursor_left_ptr.xpm
  100. cutils.c
  101. def-helper.h
  102. device_tree.c
  103. device_tree.h
  104. dis-asm.h
  105. disas.c
  106. disas.h
  107. dma-helpers.c
  108. dma.h
  109. dyngen-exec.h
  110. elf.h
  111. envlist.c
  112. envlist.h
  113. exec-all.h
  114. exec.c
  115. gdbstub.c
  116. gdbstub.h
  117. gen-icount.h
  118. HACKING
  119. hmp-commands.hx
  120. host-utils.c
  121. host-utils.h
  122. hpet.h
  123. hppa-dis.c
  124. hppa.ld
  125. i386-dis.c
  126. i386.ld
  127. ia64-dis.c
  128. ia64.ld
  129. input.c
  130. iohandler.c
  131. ioport-user.c
  132. ioport.c
  133. ioport.h
  134. iorange.h
  135. iov.c
  136. iov.h
  137. json-lexer.c
  138. json-lexer.h
  139. json-parser.c
  140. json-parser.h
  141. json-streamer.c
  142. json-streamer.h
  143. kvm-all.c
  144. kvm-stub.c
  145. kvm.h
  146. libfdt_env.h
  147. LICENSE
  148. linux-aio.c
  149. m68k-dis.c
  150. m68k-semi.c
  151. m68k.ld
  152. MAINTAINERS
  153. Makefile
  154. Makefile.dis
  155. Makefile.hw
  156. Makefile.objs
  157. Makefile.target
  158. Makefile.user
  159. microblaze-dis.c
  160. migration-exec.c
  161. migration-fd.c
  162. migration-tcp.c
  163. migration-unix.c
  164. migration.c
  165. migration.h
  166. mips-dis.c
  167. mips.ld
  168. module.c
  169. module.h
  170. monitor.c
  171. monitor.h
  172. nbd.c
  173. nbd.h
  174. net-checksum.c
  175. net.c
  176. net.h
  177. notify.c
  178. notify.h
  179. os-posix.c
  180. os-win32.c
  181. osdep.c
  182. osdep.h
  183. oslib-posix.c
  184. oslib-win32.c
  185. path.c
  186. pci-ids.txt
  187. pflib.c
  188. pflib.h
  189. poison.h
  190. posix-aio-compat.c
  191. ppc-dis.c
  192. ppc.ld
  193. ppc64.ld
  194. qbool.c
  195. qbool.h
  196. qdict-test-data.txt
  197. qdict.c
  198. qdict.h
  199. qemu-aio.h
  200. qemu-barrier.h
  201. qemu-char.c
  202. qemu-char.h
  203. qemu-common.h
  204. qemu-config.c
  205. qemu-config.h
  206. qemu-doc.texi
  207. qemu-error.c
  208. qemu-error.h
  209. qemu-img-cmds.hx
  210. qemu-img.c
  211. qemu-img.texi
  212. qemu-io.c
  213. qemu-lock.h
  214. qemu-log.h
  215. qemu-malloc.c
  216. qemu-nbd.c
  217. qemu-nbd.texi
  218. qemu-objects.h
  219. qemu-option.c
  220. qemu-option.h
  221. qemu-options.h
  222. qemu-options.hx
  223. qemu-os-posix.h
  224. qemu-os-win32.h
  225. qemu-queue.h
  226. qemu-sockets.c
  227. qemu-tech.texi
  228. qemu-thread-posix.c
  229. qemu-thread-posix.h
  230. qemu-thread-win32.c
  231. qemu-thread-win32.h
  232. qemu-thread.h
  233. qemu-timer-common.c
  234. qemu-timer.c
  235. qemu-timer.h
  236. qemu-tool.c
  237. qemu-x509.h
  238. qemu.sasl
  239. qemu_socket.h
  240. qerror.c
  241. qerror.h
  242. qfloat.c
  243. qfloat.h
  244. qint.c
  245. qint.h
  246. qjson.c
  247. qjson.h
  248. qlist.c
  249. qlist.h
  250. qmp-commands.hx
  251. qobject.h
  252. qstring.c
  253. qstring.h
  254. range.h
  255. readline.c
  256. readline.h
  257. README
  258. rules.mak
  259. rwhandler.c
  260. rwhandler.h
  261. s390-dis.c
  262. s390.ld
  263. savevm.c
  264. sh4-dis.c
  265. simpletrace.c
  266. simpletrace.h
  267. softmmu-semi.h
  268. softmmu_defs.h
  269. softmmu_exec.h
  270. softmmu_header.h
  271. softmmu_template.h
  272. sparc-dis.c
  273. sparc.ld
  274. sparc64.ld
  275. spice-qemu-char.c
  276. sysemu.h
  277. targphys.h
  278. tcg-runtime.c
  279. thunk.c
  280. thunk.h
  281. TODO
  282. trace-events
  283. translate-all.c
  284. uboot_image.h
  285. usb-bsd.c
  286. usb-linux.c
  287. usb-stub.c
  288. VERSION
  289. version.rc
  290. vgafont.h
  291. vl.c
  292. x86_64.ld