pseries: Add a routine to find a stable "default" vty and use it

In vty_lookup() we have a special case for supporting early debug in
the kernel. This accepts reg == 0 as a special case to mean "any vty".

We implement this by searching the vtys on the bus and returning the
first we find. This means that the vty we chose depends on the order
the vtys are specified on the QEMU command line - because that determines
the order of the vtys on the bus.

We'd rather the command line order was irrelevant, so instead return
the vty with the lowest reg value. This is still a guess as to what the
user really means, but it is at least stable WRT command line ordering.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>

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