pseries: Don't test for MSR_PR for hypercalls under KVM

PAPR hypercalls should only be invoked from the guest kernel, not guest
user programs, that is, with MSR[PR]=0.  Currently we check this in
spapr_hypercall, returning H_PRIVILEGE if MSR[PR]=1.

However, under KVM the state of MSR[PR] is already checked by the host
kernel before passing the hypercall to qemu, making this check redundant.
Worse, however, we don't generally synchronize KVM and qemu state on the
hypercall path, meaning that qemu could incorrectly reject a hypercall
because it has a stale MSR value.

This patch fixes the problem by moving the privilege test exclusively to
the TCG hypercall path.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
CC: qemu-stable@nongnu.org
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit efcb9383b974114e5f682e531346006f8f2466c0)

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