pc: Fix and clean up PIC-to-APIC IRQ path

The master PIC is connected to the LINTIN0 of the APICs. As the APIC
currently does not track the state of that line, we have to ask the PIC
to reinject its IRQ after the CPU picked up an event from the APIC.

This introduces pic_get_output to read the master PIC IRQ line state
without changing it. The APIC uses this function to decide if a PIC IRQ
should be reinjected on apic_update_irq. This reflects better how the
real hardware works.

The patch fixes some failures of the kvm unit tests apic and eventinj by
allowing to enable the proper CPU IRQ deassertion when the guest masks
some pending IRQs at PIC level.

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