aboutsummaryrefslogtreecommitdiff
path: root/monitor
AgeCommit message (Collapse)AuthorFilesLines
2021-03-23qmp: add new qmp display-reloadZihao Chang1-0/+17
This patch provides a new qmp to reload display configuration without restart VM, but only reloading the vnc tls certificates is implemented. Example: {"execute": "display-reload", "arguments":{"type": "vnc", "tls-certs": true}} Signed-off-by: Zihao Chang <changzihao1@huawei.com> Message-Id: <20210316075845.1476-4-changzihao1@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-19qapi: Implement deprecated-output=hide for QMP introspectionMarkus Armbruster1-0/+71
This policy suppresses deprecated bits in output, and thus permits "testing the future". Implement it for QMP command query-qmp-schema: suppress information on deprecated commands, events and object type members, i.e. anything that has the special feature flag "deprecated". Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210318155519.1224118-8-armbru@redhat.com>
2021-03-19monitor: Drop query-qmp-schema 'gen': false hackMarkus Armbruster3-17/+17
QMP commands return their response as a generated QAPI type, which the monitor core converts to JSON via QObject. query-qmp-schema's response is the generated introspection data. This is a QLitObject since commit 7d0f982bfb "qapi: generate a literal qobject for introspection", v2.12). Before, it was a string. Instead of converting QLitObject / string -> QObject -> QAPI type SchemaInfoList -> QObject -> JSON, we take a shortcut: the command is 'gen': false, so it can return the QObject instead of the QAPI type. Slightly simpler and more efficient. The next commit will filter the response for output policy, and this is easier in the SchemaInfoList representation. Drop the shortcut. This replaces the manual command registration by a generated one. The manual registration makes the command available before the machine is built by passing flag QCO_ALLOW_PRECONFIG. To keep it available there, we need need to add 'allow-preconfig': true to its definition in the schema. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210318155519.1224118-7-armbru@redhat.com>
2021-03-19hmp: QAPIfy object_addKevin Wolf1-15/+2
This switches the HMP command object_add from a QemuOpts-based parser to user_creatable_add_from_str() which uses a keyval parser and enforces the QAPI schema. Apart from being a cleanup, this makes non-scalar properties and help accessible. In order for help to be printed to the monitor instead of stdout, the printf() calls in the help functions are changed to qemu_printf(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-03-19qapi/qom: QAPIfy object-addKevin Wolf1-2/+0
This converts object-add from 'gen': false to the ObjectOptions QAPI type. As an immediate benefit, clients can now use QAPI schema introspection for user creatable QOM objects. It is also the first step towards making the QAPI schema the only external interface for the creation of user creatable objects. Once all other places (HMP and command lines of the system emulator and all tools) go through QAPI, too, some object implementations can be simplified because some checks (e.g. that mandatory options are set) are already performed by QAPI, and in another step, QOM boilerplate code could be generated from the schema. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2021-03-18migrate: remove QMP/HMP commands for speed, downtime and cache sizeDaniel P. Berrangé1-34/+0
The generic 'migrate_set_parameters' command handle all types of param. Only the QMP commands were documented in the deprecations page, but the rationale for deprecating applies equally to HMP, and the replacements exist. Furthermore the HMP commands are just shims to the QMP commands, so removing the latter breaks the former unless they get re-implemented. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-18monitor: remove 'query-events' QMP commandDaniel P. Berrangé1-24/+0
The code comment suggests removing QAPIEvent_(str|lookup) symbols too, however, these are both auto-generated as standard for any enum in QAPI. As such it they'll exist whether we use them or not. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-18monitor: raise error when 'pretty' option is used with HMPDaniel P. Berrangé1-2/+2
This is only semantically useful for QMP. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-18ui, monitor: remove deprecated VNC ACL option and HMP commandsDaniel P. Berrangé1-187/+0
The VNC ACL concept has been replaced by the pluggable "authz" framework which does not use monitor commands. Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-15monitor: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARDMahmoud Mandour2-33/+26
Removed various qemu_mutex_lock and their respective qemu_mutex_unlock calls and used lock guard macros (QEMU_LOCK_GUARD and WITH_QEMU_LOCK_GUARD). This simplifies the code by eliminating qemu_mutex_unlock calls. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Message-Id: <20210311031538.5325-6-ma.mandourr@gmail.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-02-15monitor/qmp: Stop processing requests when shutdown is requestedKevin Wolf1-0/+5
Before this patch, monitor_qmp_dispatcher_co() used to check whether shutdown is requested only when it would have to wait for new requests. If there were still some queued requests, it would try to execute all of them before shutting down. This can be surprising when the queued QMP commands take long or hang because Ctrl-C may not actually exit QEMU as soon as possible. Change monitor_qmp_dispatcher_co() so that it additionally checks whether shutdown is request before it gets a new request from the queue. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20210212172028.288825-3-kwolf@redhat.com> Tested-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-02-15monitor: Fix assertion failure on shutdownKevin Wolf1-10/+15
Commit 357bda95 already tried to fix the order in monitor_cleanup() by moving shutdown of the dispatcher coroutine further to the start. However, it didn't go far enough: iothread_stop() makes sure that all pending work (bottom halves) in the AioContext of the monitor iothread is completed. iothread_destroy() depends on this and fails an assertion if there is still a pending BH. While the dispatcher coroutine is running, it will try to resume the monitor after taking a request out of the queue, which involves a BH. The dispatcher is run until it terminates in the AIO_WAIT_WHILE() loop. However, adding new BHs between iothread_stop() and iothread_destroy() is forbidden. Fix this by stopping the dispatcher first before shutting down the other parts of the monitor. This means we can now receive requests that aren't handled any more when QEMU is shutting down, but this is unlikely to be a problem for QMP clients. Fixes: 357bda9590784ff75803d52de43150d4107ed98e Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20210212172028.288825-2-kwolf@redhat.com> Tested-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-02-08migration: introduce a delete_snapshot wrapperDaniel P. Berrangé1-1/+1
Make snapshot deletion consistent with the snapshot save and load commands by using a wrapper around the blockdev layer. The main difference is that we get upfront validation of the passed in device list (if any). Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20210204124834.774401-10-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-02-08migration: wire up support for snapshot device selectionDaniel P. Berrangé1-2/+3
Modify load_snapshot/save_snapshot to accept the device list and vmstate node name parameters previously added to the block layer. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20210204124834.774401-9-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-02-08migration: control whether snapshots are ovewrittenDaniel P. Berrangé1-1/+1
The traditional HMP "savevm" command will overwrite an existing snapshot if it already exists with the requested name. This new flag allows this to be controlled allowing for safer behaviour with a future QMP command. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20210204124834.774401-8-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-02-08block: add ability to specify list of blockdevs during snapshotDaniel P. Berrangé1-1/+1
When running snapshot operations, there are various rules for which blockdevs are included/excluded. While this provides reasonable default behaviour, there are scenarios that are not well handled by the default logic. Some of the conditions do not have a single correct answer. Thus there needs to be a way for the mgmt app to provide an explicit list of blockdevs to perform snapshots across. This can be achieved by passing a list of node names that should be used. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20210204124834.774401-5-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-02-08migration: stop returning errno from load_snapshot()Daniel P. Berrangé1-1/+1
None of the callers care about the errno value since there is a full Error object populated. This gives consistency with save_snapshot() which already just returns a boolean value. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> [PMD: Return false/true instead of -1/0, document function] Acked-by: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210204124834.774401-4-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-02-08block: push error reporting into bdrv_all_*_snapshot functionsDaniel P. Berrangé1-6/+1
The bdrv_all_*_snapshot functions return a BlockDriverState pointer for the invalid backend, which the callers then use to report an error message. In some cases multiple callers are reporting the same error message, but with slightly different text. In the future there will be more error scenarios for some of these methods, which will benefit from fine grained error message reporting. So it is helpful to push error reporting down a level. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> [PMD: Initialize variables] Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210204124834.774401-2-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-02-08migration: Display the migration blockersDr. David Alan Gilbert1-0/+9
Update 'info migrate' to display migration blocking information. If the outbound migration is not blocked, there is no change, however if it is blocked a message is displayed with a list of reasons why, e.g. qemu-system-x86_64 -nographic -smp 4 -m 4G -M pc,usb=on \ -chardev null,id=n -device usb-serial,chardev=n \ -virtfs local,path=/home,mount_tag=fs,security_model=none \ -drive if=virtio,file=myimage.qcow2 (qemu) info migrate globals: store-global-state: on only-migratable: off send-configuration: on send-section-footer: on decompress-error-check: on clear-bitmap-shift: 18 Outgoing migration blocked: Migration is disabled when VirtFS export path '/home' is mounted in the guest using mount_tag 'fs' non-migratable device: 0000:00:01.2/1/usb-serial Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20210202135522.127380-3-dgilbert@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-02-08migration: Fix migrate-set-parameters argument validationMarkus Armbruster1-12/+12
Commit 741d4086c8 "migration: Use proper types in json" (v2.12.0) switched MigrationParameters to narrower integer types, and removed the simplified qmp_migrate_set_parameters()'s argument checking accordingly. Good idea, except qmp_migrate_set_parameters() takes MigrateSetParameters, not MigrationParameters. Its job is updating migrate_get_current()->parameters (which *is* of type MigrationParameters) according to its argument. The integers now get truncated silently. Reproducer: ---> {'execute': 'query-migrate-parameters'} <--- {"return": {[...] "compress-threads": 8, [...]}} ---> {"execute": "migrate-set-parameters", "arguments": {"compress-threads": 257}} <--- {"return": {}} ---> {'execute': 'query-migrate-parameters'} <--- {"return": {[...] "compress-threads": 1, [...]}} Fix by resynchronizing MigrateSetParameters with MigrationParameters. Fixes: 741d4086c856320807a2575389d7c0505578270b Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20210202141734.2488076-2-armbru@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-02-04qmp: Resume OOB-enabled monitor before processing the requestMarkus Armbruster1-6/+27
monitor_qmp_dispatcher_co() needs to resume the monitor if handle_qmp_command() suspended it. Two cases: 1. OOB enabled: suspended if mon->qmp_requests has no more space 2. OOB disabled: suspended always We resume only after we processed the request. Which can take a long time. Resume the monitor right when the queue has space to keep the monitor available for out-of-band commands even in this corner case. Leave the "OOB disabled" case alone. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210201161504.1976989-4-armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> [Trailing whitespace tidied up]
2021-02-04qmp: Add more tracepointsMarkus Armbruster2-0/+11
Add tracepoints for in-band request enqueue and dequeue, processing of queued in-band errors, and responses. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210201161504.1976989-3-armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
2021-02-04qmp: Fix up comments after commit 9ce44e2ce2Markus Armbruster1-2/+2
Commit 9ce44e2ce2 "qmp: Move dispatcher to a coroutine" replaced monitor_qmp_bh_dispatcher() by monitor_qmp_dispatcher_co(), but neglected to update comments. Do that now. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210201161504.1976989-2-armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
2021-02-04monitor/qmp-cmds.c: Don't include ui/vnc.hPeter Maydell1-1/+1
The qmp-cmds.c file currently includes ui/vnc.h, which (being located in the ui/ directory rather than include) is really supposed to be for use only by the ui subsystem. In fact the function prototypes we need (vnc_display_password(), etc) are all declared in include/ui/console.h, so we can switch to including that instead. (ui/vnc.h includes include/ui/console.h, so this change strictly reduces the quantity of headers qmp-cmds.c pulls in.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20210104161200.15068-1-peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2021-01-28qapi: More complex uses of QAPI_LIST_APPENDEric Blake1-15/+10
These cases require a bit more thought to review; in each case, the code was appending to a list, but not with a FOOList **tail variable. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20210113221013.390592-6-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Flawed change to qmp_guest_network_get_interfaces() dropped] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2021-01-28qapi: Use QAPI_LIST_APPEND in trivial casesEric Blake1-5/+5
The easiest spots to use QAPI_LIST_APPEND are where we already have an obvious pointer to the tail of a list. While at it, consistently use the variable name 'tail' for that purpose. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210113221013.390592-5-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2021-01-28qapi: A couple more QAPI_LIST_PREPEND() stragglersEric Blake1-5/+4
Commit 54aa3de72e switched multiple sites to use QAPI_LIST_PREPEND instead of open-coding, but missed a couple of spots. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20210113221013.390592-3-eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2021-01-23qmp: remove deprecated "change" commandPaolo Bonzini1-51/+0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210120144235.345983-3-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23hmp: remove "change vnc TARGET" commandPaolo Bonzini1-2/+5
The HMP command \"change vnc TARGET\" is messy: - it takes an ugly shortcut to determine if the option has an "id", with incorrect results if "id=" is not preceded by an unescaped comma. - it deletes the existing QemuOpts and does not try to rollback if the parsing fails (which is not causing problems, but only due to how VNC options are parsed) - because it uses the same parsing function as "-vnc", it forces the latter to not support "-vnc help". On top of this, it uses a deprecated QMP command, thus getting in the way of removing the QMP command. Since the usecase for the command is not clear, just remove it and send "change vnc password" directly to the QMP "change-vnc-password" command. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20210120144235.345983-2-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-08Remove superfluous timer_del() callsPeter Maydell1-1/+0
This commit is the result of running the timer-del-timer-free.cocci script on the whole source tree. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Corey Minyard <cminyard@mvista.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20201215154107.3255-4-peter.maydell@linaro.org
2021-01-02remove TCG includes from common codePaolo Bonzini1-1/+0
Enable removing tcg/$tcg_arch from the include path when TCG is disabled. Move translate-all.h to include/exec, since stubs exist for the functions defined therein. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-01Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-12-19' into ↵Peter Maydell6-65/+57
staging QAPI patches patches for 2020-12-19 # gpg: Signature made Sat 19 Dec 2020 09:40:05 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2020-12-19: (33 commits) qobject: Make QString immutable block: Use GString instead of QString to build filenames keyval: Use GString to accumulate value strings json: Use GString instead of QString to accumulate strings migration: Replace migration's JSON writer by the general one qobject: Factor JSON writer out of qobject_to_json() qobject: Factor quoted_str() out of to_json() qobject: Drop qstring_get_try_str() qobject: Drop qobject_get_try_str() Revert "qobject: let object_property_get_str() use new API" block: Avoid qobject_get_try_str() qmp: Fix tracing of non-string command IDs qobject: Move internals to qobject-internal.h hw/rdma: Replace QList by GQueue Revert "qstring: add qstring_free()" qobject: Change qobject_to_json()'s value to GString qobject: Use GString instead of QString to accumulate JSON qobject: Make qobject_to_json_pretty() take a pretty argument monitor: Use GString instead of QString for output buffer hmp: Simplify how qmp_human_monitor_command() gets output ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-12-19qmp: Fix tracing of non-string command IDsMarkus Armbruster1-12/+18
Tracepoints monitor_qmp_cmd_in_band and monitor_qmp_cmd_out_of_band (commit cf869d5317 "qmp: support out-of-band (oob) execution") treat non-string "id" like absent "id". Fix that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-10-armbru@redhat.com>
2020-12-19qobject: Change qobject_to_json()'s value to GStringMarkus Armbruster1-7/+7
qobject_to_json() and qobject_to_json_pretty() build a GString, then covert it to QString. Just one of the callers actually needs a QString: qemu_rbd_parse_filename(). A few others need a string they can modify: qmp_send_response(), qga's send_response(), to_json_str(), and qmp_fd_vsend_fds(). The remainder just need a string. Change qobject_to_json() and qobject_to_json_pretty() to return the GString. qemu_rbd_parse_filename() now has to convert to QString. All others save a QString temporary. to_json_str() actually becomes a bit simpler, because GString provides more convenient modification functions. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-6-armbru@redhat.com>
2020-12-19qobject: Make qobject_to_json_pretty() take a pretty argumentMarkus Armbruster1-1/+1
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-4-armbru@redhat.com>
2020-12-19monitor: Use GString instead of QString for output bufferMarkus Armbruster3-14/+10
GString has a richer set of string operations than QString. It should be preferred to QString except where we need a QObject or reference counting. We don't here. Switch to GString, and put its richer interface to use. Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-3-armbru@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2020-12-19hmp: Simplify how qmp_human_monitor_command() gets outputMarkus Armbruster1-5/+1
Commit 48c043d0d1 "hmp: human-monitor-command: stop using the Memory chardev driver" left us "if string is non-empty, duplicate it, else duplicate the empty string". Meh. Duplicate it unconditionally. Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-2-armbru@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2020-12-19qapi: Use QAPI_LIST_PREPEND() where possibleEric Blake3-27/+21
Anywhere we create a list of just one item or by prepending items (typically because order doesn't matter), we can use QAPI_LIST_PREPEND(). But places where we must keep the list in order by appending remain open-coded until later patches. Note that as a side effect, this also performs a cleanup of two minor issues in qga/commands-posix.c: the old code was performing new = g_malloc0(sizeof(*ret)); which 1) is confusing because you have to verify whether 'new' and 'ret' are variables with the same type, and 2) would conflict with C++ compilation (not an actual problem for this file, but makes copy-and-paste harder). Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20201113011340.463563-5-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> [Straightforward conflicts due to commit a8aa94b5f8 "qga: update schema for guest-get-disks 'dependents' field" and commit a10b453a52 "target/mips: Move mips_cpu_add_definition() from helper.c to cpu.c" resolved. Commit message tweaked.] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-12-18monitor:Don't use '#' flag of printf format ('%#') in format stringsYutao Ai1-1/+1
Delete '#' and use '0x' prefix instead Signed-off-by: Yutao Ai <aiyutao@huawei.com> Message-Id: <20201125014514.55562-4-aiyutao@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2020-12-18monitor:braces {} are necessary for all arms of this statementYutao Ai1-5/+9
Fix the errors by add {} Signed-off-by: Yutao Ai <aiyutao@huawei.com> Message-Id: <20201125014514.55562-3-aiyutao@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2020-12-18monitor:open brace '{' following struct go on the same lineYutao Ai1-2/+1
Move the open brace '{' following struct go on the same line Signed-off-by: Yutao Ai <aiyutao@huawei.com> Message-Id: <20201125014514.55562-2-aiyutao@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2020-12-15qmp: generalize watchdog-set-action to -no-reboot/-no-shutdownAlejandro Jimenez1-1/+2
Add a QMP command to allow for the behaviors specified by the -no-reboot and -no-shutdown command line option to be set at runtime. The new command is named set-action and takes optional arguments, named after an event, that provide a corresponding action to take. Example: -> { "execute": "set-action", "arguments": { "reboot": "none", "shutdown": "poweroff", "watchdog": "debug" } } <- { "return": {} } Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Message-Id: <1607705564-26264-4-git-send-email-alejandro.j.jimenez@oracle.com> [Split the series differently, with -action based on the QMP command. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-15machine: introduce MachineInitPhasePaolo Bonzini1-1/+1
Generalize the qdev_hotplug variable to the different phases of machine initialization. We would like to allow different monitor commands depending on the phase. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-15vl: remove separate preconfig main_loopPaolo Bonzini1-9/+0
Move post-preconfig initialization to the x-exit-preconfig. If preconfig is not requested, just exit preconfig mode immediately with the QMP command. As a result, the preconfig loop will run with accel_setup_post and os_setup_post restrictions (xen_restrict, chroot, etc.) already done. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-15remove preconfig statePaolo Bonzini2-6/+6
The preconfig state is only used if -incoming is not specified, which makes the RunState state machine more tricky than it need be. However there is already an equivalent condition which works even with -incoming, namely qdev_hotplug. Use it instead of a separate runstate. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-11Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into ↵Peter Maydell2-9/+12
staging * Fix for NULL segments (Bin Meng) * Support for 32768 CPUs on x86 without IOMMU (David) * PDEP/PEXT fix and testcase (myself) * Remove bios_name and ram_size globals (myself) * qemu_init rationalization (myself) * Update kernel-doc (myself + upstream patches) * Propagate MemTxResult across DMA and PCI functions (Philippe) * Remove master/slave when applicable (Philippe) * WHPX support for in-kernel irqchip (Sunil) # gpg: Signature made Thu 10 Dec 2020 17:21:50 GMT # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini-gitlab/tags/for-upstream: (113 commits) scripts: kernel-doc: remove unnecessary change wrt Linux Revert "docs: temporarily disable the kernel-doc extension" scripts: kernel-doc: use :c:union when needed scripts: kernel-doc: split typedef complex regex scripts: kernel-doc: fix typedef parsing Revert "kernel-doc: Handle function typedefs that return pointers" Revert "kernel-doc: Handle function typedefs without asterisks" scripts: kernel-doc: try to use c:function if possible scripts: kernel-doc: fix line number handling scripts: kernel-doc: allow passing desired Sphinx C domain dialect scripts: kernel-doc: don't mangle with parameter list scripts: kernel-doc: fix typedef identification scripts: kernel-doc: reimplement -nofunction argument scripts: kernel-doc: fix troubles with line counts scripts: kernel-doc: use a less pedantic markup for funcs on Sphinx 3.x scripts: kernel-doc: make it more compatible with Sphinx 3.x Revert "kernel-doc: Use c:struct for Sphinx 3.0 and later" Revert "scripts/kerneldoc: For Sphinx 3 use c:macro for macros with arguments" scripts: kernel-doc: add support for typedef enum kernel-doc: add support for ____cacheline_aligned attribute ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-12-10sev: add sev-inject-launch-secretTobin Feldman-Fitzthum1-4/+13
AMD SEV allows a guest owner to inject a secret blob into the memory of a virtual machine. The secret is encrypted with the SEV Transport Encryption Key and integrity is guaranteed with the Transport Integrity Key. Although QEMU facilitates the injection of the launch secret, it cannot access the secret. Signed-off-by: Tobin Feldman-Fitzthum <tobin@linux.ibm.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Brijesh Singh <brijesh.singh@amd.com> Message-Id: <20201027170303.47550-1-tobin@linux.ibm.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-12-10hmp: introduce cmd_availablePaolo Bonzini1-8/+10
Combine the RUN_STATE_PRECONFIG and cmd_can_preconfig checks into a single function, to avoid repeating the same expression (or its negation after applying DeMorgan's rule) over and over again. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-10make ram_size local to vl.cPaolo Bonzini1-1/+2
Use the machine properties for the leftovers too. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-10ui: Tweak a client_migrate_info error messageMarkus Armbruster1-1/+1
Change Parameter 'protocol' expects spice to Parameter 'protocol' expects 'spice' for consistency with similar error messages elsewhere. Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201113082626.2725812-7-armbru@redhat.com>