aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-04-26tests/tcg/nios2: Re-enable linux-user testsRichard Henderson1-11/+0
Now that threads and signals have been fixed, re-enable tests. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-9-richard.henderson@linaro.org>
2022-04-26linux-user/nios2: Use QEMU_ESIGRETURN from do_rt_sigreturnRichard Henderson1-8/+4
Drop the kernel-specific "pr2" code structure and use the qemu-specific error return value. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-8-richard.henderson@linaro.org>
2022-04-26linux-user/nios2: Remove do_sigreturnRichard Henderson1-7/+0
There is no sigreturn syscall, only rt_sigreturn. This function is unused. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-7-richard.henderson@linaro.org>
2022-04-26linux-user/nios2: Handle special qemu syscall return valuesRichard Henderson1-0/+8
Honor QEMU_ESIGRETURN and QEMU_ERESTARTSYS. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-6-richard.henderson@linaro.org>
2022-04-26linux-user/nios2: Adjust error returnRichard Henderson1-2/+7
Follow the kernel assembly, which considers all negative return values to be errors. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-5-richard.henderson@linaro.org>
2022-04-26linux-user/nios2: Drop syscall 0 "workaround"Richard Henderson1-4/+0
Syscall 0 is __NR_io_setup for this target; there is nothing to work around. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Fixes: a0a839b65b6 ("nios2: Add usermode binaries emulation") Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-4-richard.henderson@linaro.org>
2022-04-26linux-user/nios2: Fix clone child returnRichard Henderson1-0/+1
The child side of clone needs to set the secondary syscall return value, r7, to indicate syscall success. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-3-richard.henderson@linaro.org>
2022-04-26linux-user/nios2: Hoist pc advance to the top of EXCP_TRAPRichard Henderson1-2/+8
Note that this advance *should* be done by the translator, as that's the pc value that's supposed to be generated by hardware. However, that's a much larger change across sysemu as well. In the meantime, produce the correct PC for any signals raised by the trap instruction. Note the special case of TRAP_BRKPT, which itself is special cased within the kernel. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-2-richard.henderson@linaro.org>
2022-04-25Merge tag 'pull-block-2022-04-25' of https://gitlab.com/hreitz/qemu into stagingRichard Henderson28-188/+231
Block patches: - New @force parameter for blockdev-change-medium - Improvements to the iotests to help with debugging - Fix iotest 108 on systems without user_allow_other in fuse.conf # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEEy2LXoO44KeRfAE00ofpA0JgBnN8FAmJmqyISHGhyZWl0ekBy # ZWRoYXQuY29tAAoJEKH6QNCYAZzf7uEP/RKNblyIuFjHkPgaMzWqdGUjHpbRzKBi # NFgO+ISRCSx/KXYBaanJP94qKLfpACJ1JHDUD3hipeO3kmVGmtF93cKypTQS4qhL # bGmX+h38AK1omSR2iWRhu4ue4VAPeu9gLoHNYJ5vZlylWD3eHdppN7K2KFf7Aeo5 # /BnhwHiU2IQ7WkLlo5Pdb96+LqZfmCGYJGWO6eWx123+j+bpjLfpmV9+Kjzb1pDc # FN60OFlp8RozXHKpqh4ZoThtJ+t3sYdlo6yvg1K18Y5JcXTx5d4D24HGo1ZIRxqz # XgJbi+bSr8hnxCjvdUZlr3IpbjAE5DVbCjtDxyjGnim6vjIwhxCSWM7Bvzw2tm60 # TYNl2zxyIe5831v6Xv/YfYJFqtos/orZf87TSqx/uWrfinbxZ1nN/8zi5z9lC8tg # S6IlNpKPK0wv33BmLVHcsnMABLY2YiJPx/Ngl0CvAEGvkQdaHzgcYGbmeEMrZTv7 # hVpBb1t+AKmnXYYZdCh4ulfJLUg3R9mXf0oI3otbcpNMwExB6hqcVI23VYC00Ct5 # m3Tb6bddIkBih25l9B7i6FPWfXG+0zu6Q4kIQiXmfNkqKseQ96aDY1aAU/GWoTZH # MOOPqIhmLRgyYpJ3+am9AseczaMybC4DIfx1VXzjwS/X3YwHvHEbZ7iPR6C0630Z # yslJbuH4ERl7 # =url0 # -----END PGP SIGNATURE----- # gpg: Signature made Mon 25 Apr 2022 07:07:30 AM PDT # gpg: using RSA key CB62D7A0EE3829E45F004D34A1FA40D098019CDF # gpg: issuer "hreitz@redhat.com" # gpg: Good signature from "Hanna Reitz <hreitz@redhat.com>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: CB62 D7A0 EE38 29E4 5F00 4D34 A1FA 40D0 9801 9CDF * tag 'pull-block-2022-04-25' of https://gitlab.com/hreitz/qemu: iotests/108: Fix when missing user_allow_other iotests: make qemu_io_log() check return codes by default iotests: remove qemu_io_silent() and qemu_io_silent_check(). iotests: remove qemu_io_pipe_and_status() iotests/image-fleecing: switch to qemu_io() iotests/migration-permissions: use assertRaises() for qemu_io() negative test iotests: rebase qemu_io() on top of qemu_tool() iotests: create generic qemu_tool() function iotests/040: Fix TestCommitWithFilters test iotests/040: Don't check image pattern on zero-length image iotests: Don't check qemu_io() output for specific error strings iotests/163: Fix broken qemu-io invocation iotests: replace calls to log(qemu_io(...)) with qemu_io_log() block: add 'force' parameter to 'blockdev-change-medium' command Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-04-25Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into stagingRichard Henderson4-27/+63
Pull request Small contrib/vhost-user-blk, contrib/vhost-user-scsi, and tools/virtiofsd improvements. # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmJmYGYACgkQnKSrs4Gr # c8gNIAgAgCEeBMP61cdT8DGBBw26abmrNmCCjXYL3rNcR2GNsn0x9VbedBhSPt9O # z+/nej9UkRKHgQ/+V1LqWD2D/TU327nLQ74z1JJvGtjWhvM18XTTAeh1BQbVywKU # z+o6WSyP22Xx87cUIuOGGMgNDDfIY2j/t5sU8eR+lxXxDuKXx3tulTV65QlNSw9z # 19rb8eJkaau5YWhN5gPEI65O/YVgGUtA+c5z39AoBG85XAAhm+6+mTFfuy8J8gp/ # wqr61+xB7bB3AxIOv1/0PWCl3F/+kPs7ybJRGkHMNtKyJtp34Y86kwsVEBtOMGVO # wm/ht7FMy2GhnaKGjNMtvJm29ZArqA== # =zZcV # -----END PGP SIGNATURE----- # gpg: Signature made Mon 25 Apr 2022 01:48:38 AM PDT # gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full] # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full] * tag 'block-pull-request' of https://gitlab.com/stefanha/qemu: virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option contrib/vhost-user-blk: add missing GOptionEntry NULL terminator Implements Backend Program conventions for vhost-user-scsi Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-04-25iotests/108: Fix when missing user_allow_otherHanna Reitz1-1/+1
FUSE exports' allow-other option defaults to "auto", which means that it will try passing allow_other as a mount option, and fall back to not using it when an error occurs. We make no effort to hide fusermount's error message (because it would be difficult, and because users might want to know about the fallback occurring), and so when allow_other does not work (primarily when /etc/fuse.conf does not contain user_allow_other), this error message will appear and break the reference output. We do not need allow_other here, though, so we can just pass allow-other=off to fix that. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220421142435.569600-1-hreitz@redhat.com> Tested-by: Markus Armbruster <armbru@redhat.com> Tested-by: Eric Blake <eblake@redhat.com>
2022-04-25iotests: make qemu_io_log() check return codes by defaultJohn Snow2-3/+4
Just like qemu_img_log(), upgrade qemu_io_log() to enforce a return code of zero by default. Tests that use qemu_io_log(): 242 245 255 274 303 307 nbd-reconnect-on-open Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-13-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests: remove qemu_io_silent() and qemu_io_silent_check().John Snow10-59/+38
Like qemu-img, qemu-io returning 0 should be the norm and not the exception. Remove all calls to qemu_io_silent that just assert the return code is zero (That's every last call, as it turns out), and replace them with a normal qemu_io() call. qemu_io_silent_check() appeared to have been unused already. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-12-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests: remove qemu_io_pipe_and_status()John Snow1-3/+0
I know we just added it, sorry. This is done in favor of qemu_io() which *also* returns the console output and status, but with more robust error handling on failure. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-11-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests/image-fleecing: switch to qemu_io()John Snow1-9/+19
This test expects failure ... but only sometimes. When? Why? It's for reads of a region not defined by a bitmap. Adjust the test to be more explicit about what it expects to fail and why. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-10-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests/migration-permissions: use assertRaises() for qemu_io() negative testJohn Snow1-14/+14
Modify this test to use assertRaises for its negative testing of qemu_io. If the exception raised does not match the one we tell it to expect, we get *that* exception unhandled. If we get no exception, we get a unittest assertion failure and the provided emsg printed to screen. If we get the CalledProcessError exception but the output is not what we expect, we re-raise the original CalledProcessError. Tidy. (Note: Yes, you can reference "with" objects after that block ends; it just means that ctx.__exit__(...) will have been called on it. It does not *actually* go out of scope. unittests expects you to want to inspect the Exception object, so they leave it defined post-exit.) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-9-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests: rebase qemu_io() on top of qemu_tool()John Snow6-54/+81
Rework qemu_io() to be analogous to qemu_img(); a function that requires a return code of zero by default unless disabled explicitly. Tests that use qemu_io(): 030 040 041 044 055 056 093 124 129 132 136 148 149 151 152 163 165 205 209 219 236 245 248 254 255 257 260 264 280 298 300 302 304 image-fleecing migrate-bitmaps-postcopy-test migrate-bitmaps-test migrate-during-backup migration-permissions Test that use qemu_io_log(): 242 245 255 274 303 307 nbd-reconnect-on-open Copy-pastables for testing/verification: ./check -qcow2 030 040 041 044 055 056 124 129 132 151 152 163 165 209 \ 219 236 242 245 248 254 255 257 260 264 274 \ 280 298 300 302 303 304 307 image-fleecing \ migrate-bitmaps-postcopy-test migrate-bitmaps-test \ migrate-during-backup nbd-reconnect-on-open ./check -raw 093 136 148 migration-permissions ./check -nbd 205 # ./configure configure --disable-gnutls --enable-gcrypt # this ALSO requires passwordless sudo. ./check -luks 149 # Just the tests that were edited in this commit: ./check -qcow2 030 040 242 245 ./check -raw migration-permissions ./check -nbd 205 ./check -luks 149 Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20220418211504.943969-8-jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests: create generic qemu_tool() functionJohn Snow1-11/+21
reimplement qemu_img() in terms of qemu_tool() in preparation for doing the same with qemu_io(). Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-7-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests/040: Fix TestCommitWithFilters testJohn Snow1-2/+4
Without this change, asserting that qemu_io always returns 0 causes this test to fail in a way we happened not to be catching previously: qemu.utils.VerboseProcessError: Command '('/home/jsnow/src/qemu/bin/git/tests/qemu-iotests/../../qemu-io', '--cache', 'writeback', '--aio', 'threads', '-f', 'qcow2', '-c', 'read -P 4 3M 1M', '/home/jsnow/src/qemu/bin/git/tests/qemu-iotests/scratch/3.img')' returned non-zero exit status 1. ┏━ output ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ┃ qemu-io: can't open device ┃ /home/jsnow/src/qemu/bin/git/tests/qemu-iotests/scratch/3.img: ┃ Could not open backing file: Could not open backing file: Throttle ┃ group 'tg' does not exist ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ The commit jobs changes the backing file string stored in the image file header belonging to the node above the commit’s top node to point to the commit target (the base node). QEMU tries to be as accurate as possible, and so in these test cases will include the filter that is part of the block graph in that backing file string (by virtue of making it a json:{} description of the post-commit subgraph). This makes little sense outside of QEMU, though: Specifically, the throttle node in that subgraph will dearly miss its supposedly associated throttle group object. When starting the commit job, we can specify a custom backing file string to write into said image file, so let’s use that feature to write the plain filename of the backing chain’s next actual image file there. Explicitly provide the backing file so that opening the file outside of QEMU (Where we will not have throttle groups) will succeed. Signed-off-by: Hanna Reitz <hreitz@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20220418211504.943969-6-jsnow@redhat.com>
2022-04-25iotests/040: Don't check image pattern on zero-length imageJohn Snow1-2/+12
qemu-io fails on read/write beyond end-of-file on raw images, so skip these invocations when running the zero-length image tests. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-5-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests: Don't check qemu_io() output for specific error stringsJohn Snow2-18/+17
A forthcoming commit updates qemu_io() to raise an exception on non-zero return by default, and changes its return type. In preparation, simplify some calls to qemu_io() that assert that specific error message strings do not appear in qemu-io's output. Asserting that all of these calls return a status code of zero will be a more robust way to guard against failure. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-4-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests/163: Fix broken qemu-io invocationJohn Snow1-4/+1
The 'read' commands to qemu-io were malformed, and this invocation only worked by coincidence because the error messages were identical. Oops. There's no point in checking the patterning of the reference image, so just check the empty image by itself instead. (Note: as of this commit, nothing actually enforces that this command completes successfully, but a forthcoming commit in this series will enforce that qemu_io() must have a zero status code.) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-3-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25iotests: replace calls to log(qemu_io(...)) with qemu_io_log()John Snow3-8/+6
This makes these callsites a little simpler, but the real motivation is a forthcoming commit will change the return type of qemu_io(), so removing users of the return value now is helpful. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-2-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-25block: add 'force' parameter to 'blockdev-change-medium' commandDenis V. Lunev5-6/+19
'blockdev-change-medium' is a convinient wrapper for the following sequence of commands: * blockdev-open-tray * blockdev-remove-medium * blockdev-insert-medium * blockdev-close-tray and should be used f.e. to change ISO image inside the CD-ROM tray. Though the guest could lock the tray and some linux guests like CentOS 8.5 actually does that. In this case the execution if this command results in the error like the following: Device 'scsi0-0-1-0' is locked and force was not specified, wait for tray to open and try again. This situation is could be resolved 'blockdev-open-tray' by passing flag 'force' inside. Thus is seems reasonable to add the same capability for 'blockdev-change-medium' too. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> Acked-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> CC: Hanna Reitz <hreitz@redhat.com> CC: Eric Blake <eblake@redhat.com> CC: Markus Armbruster <armbru@redhat.com> Message-Id: <20220412221846.280723-1-den@openvz.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-04-22Merge tag 'pull-target-arm-20220422-1' of ↵Richard Henderson31-490/+1840
https://git.linaro.org/people/pmaydell/qemu-arm into staging target-arm queue: * Implement GICv4 emulation * Some cleanup patches in target/arm * hw/arm/smmuv3: Pass the actual perm to returned IOMMUTLBEntry in smmuv3_translate() # -----BEGIN PGP SIGNATURE----- # # iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmJisasZHHBldGVyLm1h # eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3vcdEACIcvC8E93tFfeKwDQHSdPx # 7dPCdq+EZc/xEA2U/q282PFtvNBP6zo65RzWKXTkyfE5exLkCmqJqXSIUVfiuTyT # IAx9mL++StpBJMiqAebzEp2n8gwG7JymFeGuHYGet/nRrcwQYacBNxSl+BIVqZAm # mUy2UOlqJDlzMAVOcs/Ikfhj0z3qa52aZ8eF6sQI3mbSggiSIWOhyzNYo7jMB1x7 # UuHlYpvYDltKT7PveA5JSuBP9OmV5RrqqO4s5c22Y+o4k+La/NURDPdegblMfRA9 # MfWAEHqjA1WQaxh/Tb4Bex1u875mFMOXMZk3P910wSeqxMLhTCmjTA2g4p1KhfcA # LQJ5G2IvSA7HN660NLhZAqL601/1tS7Qcl387TfcU7WCDbgmzv2RCvH6UACF2hVl # CH4bC3lKvemT324aOBs/TCnvdu54qR6hkJZ57XSn59QHvrRvrREVdYNfQnl/g751 # GTp8aMcmvTkZ8I7k2t4Tx+CoFO38+rv7PupLN+Eq4k97ovXmAWxekizv8KYu5itY # emg63kItorwCgRwkKP28RKWLS/7dEpoF8sg5jBiBtGBGNG0AWPq4GZdrhaL58cr4 # lr4nSseN2IRsrp3SgM2203RjdghFM8ey1Dq+x2mRp+Q21vVTltI/VSiUSz0c2Vpo # JgbC4Jo+jufMkav31zOCAg== # =jqHX # -----END PGP SIGNATURE----- # gpg: Signature made Fri 22 Apr 2022 06:46:19 AM PDT # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "peter.maydell@linaro.org" # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [full] # gpg: aka "Peter Maydell <pmaydell@gmail.com>" [full] # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [full] * tag 'pull-target-arm-20220422-1' of https://git.linaro.org/people/pmaydell/qemu-arm: (61 commits) hw/arm/smmuv3: Pass the actual perm to returned IOMMUTLBEntry in smmuv3_translate() target/arm: Use tcg_constant_i32 in translate.h target/arm: Use tcg_constant in translate-vfp.c target/arm: Use smin/smax for do_sat_addsub_32 target/arm: Use tcg_constant in translate-neon.c target/arm: Use tcg_constant in translate-m-nocp.c target/arm: Simplify aa32 DISAS_WFI target/arm: Simplify gen_sar target/arm: Simplify GEN_SHIFT in translate.c target/arm: Split out gen_rebuild_hflags target/arm: Split out set_btype_raw target/arm: Remove fpexc32_access target/arm: Change CPUArchState.thumb to bool target/arm: Change DisasContext.thumb to bool target/arm: Extend store_cpu_offset to take field size target/arm: Change CPUArchState.aarch64 to bool target/arm: Change DisasContext.aarch64 to bool target/arm: Update SCTLR bits to ARMv9.2 target/arm: Update SCR_EL3 bits to ARMv8.8 target/arm: Update ISAR fields for ARMv8.8 ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-04-22hw/arm/smmuv3: Pass the actual perm to returned IOMMUTLBEntry in ↵Xiang Chen1-1/+1
smmuv3_translate() It always calls the IOMMU MR translate() callback with flag=IOMMU_NONE in memory_region_iommu_replay(). Currently, smmuv3_translate() return an IOMMUTLBEntry with perm set to IOMMU_NONE even if the translation success, whereas it is expected to return the actual permission set in the table entry. So pass the actual perm to returned IOMMUTLBEntry in the table entry. Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Message-id: 1650094695-121918-1-git-send-email-chenxiang66@hisilicon.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Use tcg_constant_i32 in translate.hRichard Henderson1-10/+3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Use tcg_constant in translate-vfp.cRichard Henderson1-53/+23
Use tcg_constant_{i32,i64} as appropriate throughout. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Use smin/smax for do_sat_addsub_32Richard Henderson1-7/+2
The operation we're performing with the movcond is either min/max depending on cond -- simplify. Use tcg_constant_i64 while we're at it. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Use tcg_constant in translate-neon.cRichard Henderson1-14/+7
Use tcg_constant_{i32,i64} as appropriate throughout. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Use tcg_constant in translate-m-nocp.cRichard Henderson1-7/+5
Use tcg_constant_{i32,i64} as appropriate throughout. This fixes a bug in trans_VSCCLRM() where we were leaking a TCGv. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Simplify aa32 DISAS_WFIRichard Henderson1-8/+4
The length of the previous insn may be computed from the difference of start and end addresses. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Simplify gen_sarRichard Henderson1-5/+3
Use tcg_gen_umin_i32 instead of tcg_gen_movcond_i32. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Simplify GEN_SHIFT in translate.cRichard Henderson1-10/+8
Instead of computing tmp1 = shift & 0xff; dest = (tmp1 > 0x1f ? 0 : value) << (tmp1 & 0x1f) use tmpd = value << (shift & 0x1f); dest = shift & 0xe0 ? 0 : tmpd; which has a flatter dependency tree. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Split out gen_rebuild_hflagsRichard Henderson2-28/+33
For aa32, the function has a parameter to use the new el. For aa64, that never happens. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Split out set_btype_rawRichard Henderson1-13/+12
Common code for reset_btype and set_btype. Use tcg_constant_i32. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Remove fpexc32_accessRichard Henderson3-33/+2
This function is incorrect in that it does not properly consider CPTR_EL2.FPEN. We've already got another mechanism for raising an FPU access trap: ARM_CP_FPU, so use that instead. Remove CP_ACCESS_TRAP_FP_EL{2,3}, which becomes unused. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Change CPUArchState.thumb to boolRichard Henderson4-6/+6
Bool is a more appropriate type for this value. Adjust the assignments to use true/false. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Change DisasContext.thumb to boolRichard Henderson2-2/+2
Bool is a more appropriate type for this value. Move the member down in the struct to keep the bool type members together and remove a hole. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Extend store_cpu_offset to take field sizeRichard Henderson2-9/+25
Currently we assume all fields are 32-bit. Prepare for fields of a single byte, using sizeof_field(). Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> [PMM: use sizeof_field() instead of raw sizeof()] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Change CPUArchState.aarch64 to boolRichard Henderson5-6/+6
Bool is a more appropriate type for this value. Adjust the assignments to use true/false. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Change DisasContext.aarch64 to boolRichard Henderson3-3/+3
Bool is a more appropriate type for this value. Move the member down in the struct to keep the bool type members together and remove a hole. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Update SCTLR bits to ARMv9.2Richard Henderson1-0/+14
Update SCTLR_ELx fields per ARM DDI0487 H.a. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Update SCR_EL3 bits to ARMv8.8Richard Henderson1-0/+12
Update SCR_EL3 fields per ARM DDI0487 H.a. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22target/arm: Update ISAR fields for ARMv8.8Richard Henderson1-0/+24
Update isar fields per ARM DDI0487 H.a. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-04-22hw/arm/virt: Support TCG GICv4Peter Maydell3-20/+67
Add support for the TCG GICv4 to the virt board. For the board, the GICv4 is very similar to the GICv3, with the only difference being the size of the redistributor frame. The changes here are thus: * calculating virt_redist_capacity correctly for GICv4 * changing various places which were "if GICv3" to be "if not GICv2" * the commandline option handling Note that using GICv4 reduces the maximum possible number of CPUs on the virt board from 512 to 317, because we can now only fit half as many redistributors into the redistributor regions we have defined. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220408141550.1271295-42-peter.maydell@linaro.org
2022-04-22hw/arm/virt: Abstract out calculation of redistributor region capacityPeter Maydell2-9/+11
In several places in virt.c we calculate the number of redistributors that fit in a region of our memory map, which is the size of the region divided by the size of a single redistributor frame. For GICv4, the redistributor frame is a different size from that for GICv3. Abstract out the calculation of redistributor region capacity so that we have one place we need to change to handle GICv4 rather than several. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220408141550.1271295-41-peter.maydell@linaro.org
2022-04-22hw/arm/virt: Use VIRT_GIC_VERSION_* enum values in create_gic()Peter Maydell1-8/+23
Everywhere we need to check which GIC version we're using, we look at vms->gic_version and use the VIRT_GIC_VERSION_* enum values, except in create_gic(), which copies vms->gic_version into a local 'int' variable and makes direct comparisons against values 2 and 3. For consistency, change this function to check the GIC version the same way we do elsewhere. This includes not implicitly relying on the enumeration type values happening to match the integer 'revision' values the GIC device object wants. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220408141550.1271295-40-peter.maydell@linaro.org
2022-04-22hw/intc/arm_gicv3: Allow 'revision' property to be set to 4Peter Maydell2-5/+12
Now that we have implemented all the GICv4 requirements, relax the error-checking on the GIC object's 'revision' property to allow a TCG GIC to be a GICv4, whilst still constraining the KVM GIC to GICv3. Our 'revision' property doesn't consider the possibility of wanting to specify the minor version of the GIC -- for instance there is a GICv3.1 which adds support for extended SPI and PPI ranges, among other things, and also GICv4.1. But since the QOM property is internal to QEMU, not user-facing, we can cross that bridge when we come to it. Within the GIC implementation itself code generally checks against the appropriate ID register feature bits, and the only use of s->revision is for setting those ID register bits. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220408141550.1271295-39-peter.maydell@linaro.org
2022-04-22hw/intc/arm_gicv3: Update ID and feature registers for GICv4Peter Maydell6-12/+32
Update the various GIC ID and feature registers for GICv4: * PIDR2 [7:4] is the GIC architecture revision * GICD_TYPER.DVIS is 1 to indicate direct vLPI injection support * GICR_TYPER.VLPIS is 1 to indicate redistributor support for vLPIs * GITS_TYPER.VIRTUAL is 1 to indicate vLPI support * GITS_TYPER.VMOVP is 1 to indicate that our VMOVP implementation handles cross-ITS synchronization for the guest * ICH_VTR_EL2.nV4 is 0 to indicate direct vLPI injection support Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220408141550.1271295-38-peter.maydell@linaro.org