summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2017-09-04qapi: Change data type of the FOO_lookup generated for enum FOOMarc-André Lureau4-6/+11
Currently, a FOO_lookup is an array of strings terminated by a NULL sentinel. A future patch will generate enums with "holes". NULL-termination will cease to work then. To prepare for that, store the length in the FOO_lookup by wrapping it in a struct and adding a member for the length. The sentinel will be dropped next. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170822132255.23945-13-marcandre.lureau@redhat.com> [Basically redone] Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-16-git-send-email-armbru@redhat.com> [Rebased]
2017-09-04qapi: Generate FOO_str() macro for QAPI enum FOOMarkus Armbruster1-0/+1
The next commit will put it to use. May look pointless now, but we're going to change the FOO_lookup's type, and then it'll help. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-13-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2017-09-04tpm: Clean up model registration & lookupMarkus Armbruster1-1/+1
We have a strict separation between enum TpmModel and tpm_models[]: * TpmModel may have any number of members. It just happens to have one. * tpm_register_model() uses the first empty slot in tpm_models[]. If you register more than tpm_models[] has space, tpn_register_model() fails. Its caller silently ignores the failure. Register the same TpmModel more than once has no effect other than wasting tpm_models[] slots: tpm_model_is_registered() is happy with the first one it finds. Since we only ever register one model, and tpm_models[] has space for just that one, this contraption even works. Turn tpm_models[] into a straight map from enum TpmType to bool. Much simpler. Cc: Stefan Berger <stefanb@us.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-5-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> [Commit message typo fixed]
2017-09-04tpm: Clean up driver registration & lookupMarc-André Lureau1-1/+1
We have a strict separation between enum TpmType and be_drivers[]: * TpmType may have any number of members. It just happens to have one. * tpm_register_driver() uses the first empty slot in be_drivers[]. If you register more than tpm_models[] has space, tpm_register_driver() fails. Its caller silently ignores the failure. If you register more than one with a given TpmType, tpm_display_backend_drivers() will shows all of them, but tpm_driver_find_by_type() and tpm_get_backend_driver() will find only the one one that registered first. Since we only ever register one driver, and be_drivers[] has space for just that one, this contraption even works. Turn be_drivers[] into a straight map from enum TpmType to driver. Much simpler, and has a decent chance to actually work should we ever acquire additional drivers. While there, use qapi_enum_parse() in tpm_get_backend_driver(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170822132255.23945-8-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Rebased, superfluous initializer dropped, commit message rewritten] Cc: Stefan Berger <stefanb@us.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-4-git-send-email-armbru@redhat.com>
2017-09-04qapi: Drop superfluous qapi_enum_parse() parameter maxMarkus Armbruster1-1/+1
The lookup tables have a sentinel, no need to make callers pass their size. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-3-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Rebased, commit message corrected]
2017-09-04qlit: add QLIT_QNULL and QLIT_BOOLMarc-André Lureau1-0/+5
As they are going to be used in the following patches. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170825105913.4060-9-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-09-04qlit: make qlit_equal_qobject() take const argumentsMarc-André Lureau1-1/+1
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170825105913.4060-8-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-09-04qlit: make qlit_equal_qobject return a boolMarc-André Lureau1-1/+1
Make it more obvious about the expected return values. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170825105913.4060-7-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-09-04qlit: rename compare_litqobj_to_qobj() to qlit_equal_qobject()Marc-André Lureau1-1/+1
compare_litqobj_to_qobj() lacks a qlit_ prefix. Moreover, "compare" suggests -1, 0, +1 for less than, equal and greater than. The function actually returns non-zero for equal, zero for unequal. Rename to qlit_equal_qobject(). Its return type will be cleaned up in the next patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170825105913.4060-6-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-09-04qlit: Change compound literals to initializersMarc-André Lureau1-4/+4
The QLIT_QFOO() macros expand into compound literals. Sadly, gcc doesn't recognizes these as constant expressions (clang does), which makes the macros useless for initializing objects with static storage duration. There is a gcc bug about it: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71713 Change the macros to expand into initializers. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170825105913.4060-5-marcandre.lureau@redhat.com> [Commit message improved] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-09-04qlit: use QLit prefix consistentlyMarc-André Lureau1-12/+12
Rename from LiteralQ to QLit. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170825105913.4060-4-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-09-04qlit: move qlit from check-qjson to qobject/Marc-André Lureau1-0/+49
Fix code style issues while at it, to please checkpatch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170825105913.4060-3-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-09-04qdict: Add qdict_put_null() helper, and put it to useMarc-André Lureau1-1/+3
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170825105913.4060-2-marcandre.lureau@redhat.com> [Update to qobject.cocci squashed in, commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-09-04qobject: Explain how QNum works, and whyMarkus Armbruster1-0/+21
Suggested-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503384739-17207-1-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> [Comment typos fixed]
2017-08-31Merge remote-tracking branch 'remotes/elmarco/tags/tidy-pull-request' into ↵Peter Maydell1-1/+1
staging # gpg: Signature made Thu 31 Aug 2017 11:29:33 BST # gpg: using RSA key 0xDAE8E10975969CE5 # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * remotes/elmarco/tags/tidy-pull-request: (29 commits) eepro100: replace g_malloc()+memcpy() with g_memdup() test-iov: replace g_malloc()+memcpy() with g_memdup() i386: replace g_malloc()+memcpy() with g_memdup() i386: introduce ELF_NOTE_SIZE macro decnumber: use DIV_ROUND_UP kvm: use DIV_ROUND_UP i386/dump: use DIV_ROUND_UP ppc: use DIV_ROUND_UP msix: use DIV_ROUND_UP usb-hub: use DIV_ROUND_UP q35: use DIV_ROUND_UP piix: use DIV_ROUND_UP virtio-serial: use DIV_ROUND_UP console: use DIV_ROUND_UP monitor: use DIV_ROUND_UP virtio-gpu: use DIV_ROUND_UP vga: use DIV_ROUND_UP ui: use DIV_ROUND_UP vnc: use DIV_ROUND_UP vvfat: use DIV_ROUND_UP ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-31Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into ↵Peter Maydell1-4/+4
staging # gpg: Signature made Thu 31 Aug 2017 09:21:49 BST # gpg: using RSA key 0x9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/block-pull-request: qcow2: allocate cluster_cache/cluster_data on demand qemu-doc: Add UUID support in initiator name tests: migration/guestperf Python 2.6 argparse compatibility docker.py: Python 2.6 argparse compatibility scripts: add argparse module for Python 2.6 compatibility misc: Remove unused Error variables oslib-posix: Print errors before aborting on qemu_alloc_stack() throttle: Test the valid range of config values throttle: Make burst_length 64bit and add range checks throttle: Make LeakyBucket.avg and LeakyBucket.max integer types throttle: Remove throttle_fix_bucket() / throttle_unfix_bucket() throttle: Make throttle_is_valid() a bit less verbose throttle: Update the throttle_fix_bucket() documentation throttle: Fix wrong variable name in the header documentation nvme: Fix get/set number of queues feature, again Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-31Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-08-30' into ↵Peter Maydell1-2/+2
staging nbd patches for 2017-08-30 - Kashyap Chamarthy: qemu-iotests: Extend non-shared storage migration test (194) - Stefan Hajnaczi: 0/3 nbd-client: enter read_reply_co during init to avoid crash - Vladimir Sementsov-Ogievskiy: portions of 0/17 nbd client refactoring and fixing # gpg: Signature made Wed 30 Aug 2017 19:03:46 BST # gpg: using RSA key 0xA7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" # gpg: aka "[jpeg image of size 6874]" # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-nbd-2017-08-30: block/nbd-client: refactor request send/receive block/nbd-client: rename nbd_recv_coroutines_enter_all block/nbd-client: get rid of ssize_t nbd/client: fix nbd_send_request to return int nbd/client: refactor nbd_receive_reply nbd/client: refactor nbd_read_eof nbd/client: fix nbd_opt_go qemu-iotests: test NBD over UNIX domain sockets in 083 qemu-iotests: improve nbd-fault-injector.py startup protocol nbd-client: avoid read_reply_co entry if send failed qemu-iotests: Extend non-shared storage migration test (194) Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-31console: use DIV_ROUND_UPMarc-André Lureau1-1/+1
I used the clang-tidy qemu-round check to generate the fix: https://github.com/elmarco/clang-tools-extra Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
2017-08-30nbd/client: fix nbd_send_request to return intVladimir Sementsov-Ogievskiy1-1/+1
Fix nbd_send_request to return int, as it returns a return value of nbd_write (which is int), and the only user of nbd_send_request's return value (nbd_co_send_request) consider it as int too. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20170804151440.320927-5-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
2017-08-30nbd/client: refactor nbd_receive_replyVladimir Sementsov-Ogievskiy1-1/+1
Refactor nbd_receive_reply to return 1 on success, 0 on eof, when no data was read and <0 for other cases, because returned size of read data is not actually used. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20170804151440.320927-4-vsementsov@virtuozzo.com> [eblake: tweak function comments] Signed-off-by: Eric Blake <eblake@redhat.com>
2017-08-30s390x/kvm: move KVM declarations and stubs to separate filesDavid Hildenbrand1-0/+1
Let's do it just like the other architectures. Introduce kvm-stub.c for stubs and kvm_s390x.h for the declarations. Change license to GPL2+ and keep copyright notice. As we are dropping the sysemu/kvm.h include from cpu.h, fix up includes. Suggested-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20170818114353.13455-18-david@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-08-30s390x/sclp: properly guard pci-specific functionsCornelia Huck1-4/+12
If we do not provide zpci, pci reconfiguration via sclp is not available either. I/O adapter configuration, however, should always be present. Rename the values that refer to I/O adapter configuration (instead of only pci) to make things clearer. Move length checking of the sccb for I/O adapter configuration into the common sclp code (out of the pci code). This also fixes an issue that the pci code would refer to a field in the sccb before checking whether it was actually long enough. Check for the adapter type in the sccb and return unrecognized adapter type if the guest tries to issue I/O adapter configure/deconfigure for a type other than pci or for pci if the zpci facility is not provided. Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-08-30s390x/pci: add stubsCornelia Huck1-0/+1
Some non-pci code calls into zpci code. Provide some stubs for builds without pci. Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Halil Pasic <pasic@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-08-30kvm: remove hard dependency on pciCornelia Huck1-0/+2
The msi routing code in kvm calls some pci functions: provide some stubs to enable builds without pci. Also, to make this more obvious, guard them via a pci_available boolean (which also can be reused in other places). Fixes: e1d4fb2de ("kvm-irqchip: x86: add msi route notify fn") Fixes: 767a554a0 ("kvm-all: Pass requester ID to MSI routing functions") Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-08-30s390x: introduce 2.11 compat machineCornelia Huck1-0/+3
Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-08-30s390x/css: generate solicited crw for rchp completion signalingDong Jia Shi1-1/+2
A successful completion of rchp should signal a solicited channel path initialized CRW (channel report word), while the current implementation always generates an un-solicited one. Let's fix this. Reported-by: Halil Pasic <pasic@linux.vnet.ibm.com> Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com> Message-Id: <20170803003527.86979-3-bjsdjshi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-08-30s390x/css: use macro for event-information pending error recover codeDong Jia Shi1-2/+10
Let's use a macro for the ERC (error recover code) when generating a Channel Subsystem Event-information pending CRW (channel report word). While we are at it, let's also add all other ERCs. Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com> Message-Id: <20170803003527.86979-2-bjsdjshi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-08-29throttle: Make burst_length 64bit and add range checksAlberto Garcia1-1/+1
LeakyBucket.burst_length is defined as an unsigned integer but the code never checks for overflows and it only makes sure that the value is not 0. In practice this means that the user can set something like throttling.iops-total-max-length=4294967300 despite being larger than UINT_MAX and the final value after casting to unsigned int will be 4. This patch changes the data type to uint64_t. This does not increase the storage size of LeakyBucket, and allows us to assign the value directly from qemu_opt_get_number() or BlockIOThrottle and then do the checks directly in throttle_is_valid(). The value of burst_length does not have a specific upper limit, but since the bucket size is defined by max * burst_length we have to prevent overflows. Instead of going for UINT64_MAX or something similar this patch reuses THROTTLE_VALUE_MAX, which allows I/O bursts of 1 GiB/s for 10 days in a row. Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: 1b2e3049803f71cafb2e1fa1be4fb47147a0d398.1503580370.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-08-29throttle: Make LeakyBucket.avg and LeakyBucket.max integer typesAlberto Garcia1-2/+2
Both the throttling limits set with the throttling.iops-* and throttling.bps-* options and their QMP equivalents defined in the BlockIOThrottle struct are integer values. Those limits are also reported in the BlockDeviceInfo struct and they are integers there as well. Therefore there's no reason to store them internally as double and do the conversion everytime we're setting or querying them, so this patch uses uint64_t for those types. Let's also use an unsigned type because we don't allow negative values anyway. LeakyBucket.level and LeakyBucket.burst_level do however remain double because their value changes depending on the fraction of time elapsed since the previous I/O operation. Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: f29b840422767b5be2c41c2dfdbbbf6c5f8fedf8.1503580370.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-08-29throttle: Fix wrong variable name in the header documentationAlberto Garcia1-1/+1
The level of the burst bucket is stored in bkt.burst_level, not bkt.burst_length. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Manos Pitsidianakis <el13635@mail.ntua.gr> Message-id: 49aab2711d02f285567f3b3b13a113847af33812.1503580370.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-08-23block-backend: Allow more "can inactivate" casesFam Zheng1-0/+1
These two conditions corresponds to mirror job's source and target, which need to be allowed as they are part of the non-shared storage migration workflow: failing to inactivate either will result in a failure during migration completion. Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <20170823134242.12080-3-famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> [eblake: improve comment grammar] Signed-off-by: Eric Blake <eblake@redhat.com>
2017-08-22hw/ppc/spapr: Fix segfault when instantiating a 'pc-dimm' without 'memdev'Thomas Huth1-1/+1
QEMU currently crashes when trying to use a 'pc-dimm' on the pseries machine without specifying its 'memdev' property. This happens because pc_dimm_get_memory_region() does not check whether the 'memdev' property has properly been set by the user. Looking closer at this function, it's also obvious that it is using &error_abort to call another function - and this is bad in a function that is used in the hot-plugging calling chain since this can also cause QEMU to exit unexpectedly. So let's fix these issues in a proper way now: Add a "Error **errp" parameter to pc_dimm_get_memory_region() which we use in case the 'memdev' property has not been set by the user, and which we can use instead of the &error_abort, and change the callers of get_memory_region() to make use of this "errp" parameter for proper error checking. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-11osdep: Add runtime OFD lock detectionFam Zheng1-0/+1
Build time check of OFD lock is not sufficient and can cause image open errors when the runtime environment doesn't support it. Add a helper function to probe it at runtime, additionally. Also provide a qemu_has_ofd_lock() for callers to check the status. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-09Revert "cpu: add APIs to allocate/free CPU environment"Michael S. Tsirkin1-31/+0
This reverts commit e2a7f28693aea7e194ec1435697ec4feb24f8a6f. This was not supposed to go upstream yet. Reverting. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-08-08Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell3-11/+15
* --help/--version improvements (Eric) * GCC 7 workaround (Greg) * Small SCSI fix (Hannes) * SSE 4.1 fix (Joseph) * RCU deadlock fix (myself) # gpg: Signature made Tue 08 Aug 2017 16:28:56 BST # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # 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/tags/for-upstream: maint: Include bug-reporting info in --help output qga: Give more --version information qemu-io: Give more --version information qemu-img: Sort sub-command names in --help target/i386: set rip_offset for some SSE4.1 instructions scsi: clarify sense codes for LUN0 emulation kvm: workaround build break on gcc-7.1.1 / fedora26 Revert "rcu: do not create thread in pthread_atfork callback" rcu: completely disable pthread_atfork callbacks as soon as possible Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-08maint: Include bug-reporting info in --help outputEric Blake1-0/+5
These days, many programs are including a bug-reporting address, or better yet, a link to the project web site, at the tail of their --help output. However, we were not very consistent at doing so: only qemu-nbd and qemu-qa mentioned anything, with the latter pointing to an individual person instead of the project. Add a new #define that sets up a uniform string, mentioning both bug reporting instructions and overall project details, and which a downstream vendor could tweak if they want bugs to go to a downstream database. Then use it in all of our binaries which have --help output. The canned text intentionally references http:// instead of https:// because our https website currently causes certificate errors in some browsers. That can be tweaked later once we have resolved the web site issued. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170803163353.19558-5-eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08block: Allow reopen rw without BDRV_O_ALLOW_RDWRKevin Wolf1-1/+2
BDRV_O_ALLOW_RDWR is a flag that tells whether qemu can internally reopen a node read-write temporarily because the user requested read-write for the top-level image, but qemu decided that read-only is enough for this node (a backing file). bdrv_reopen() is different, it is also used for cases where the user changed their mind and wants to update the options. There is no reason to forbid making a node read-write in that case. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2017-08-08block: drop bdrv_set_key from BlockDriverPaolo Bonzini1-1/+0
This is not used anymore since c01c214b69 ("block: remove all encryption handling APIs", 2017-07-11). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-08Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into stagingPeter Maydell1-0/+31
virtio: fix for rc2 It turns out there's a way to setup SHPC on Q35: just put a PCI to PCI bridge behind a DMI to PCI one. Our _OSC is thus incorrect. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Mon 07 Aug 2017 22:39:20 BST # gpg: using RSA key 0x281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: cpu: add APIs to allocate/free CPU environment hw/i386: allow SHPC for Q35 machine Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-08kvm: workaround build break on gcc-7.1.1 / fedora26Greg Kurz1-10/+4
Building QEMU on fedora26 with the latest gcc package fails: CC ppc64-softmmu/target/ppc/kvm.o In file included from include/sysemu/hw_accel.h:16:0, from target/ppc/kvm.c:31: target/ppc/kvm.c: In function ‘kvmppc_booke_watchdog_enable’: include/sysemu/kvm.h:449:35: error: ‘args_tmp[i]’ may be used uninitialized in this function [-Werror=maybe-uninitialized] cap.args[i] = args_tmp[i]; \ ^ target/ppc/kvm.c: In function ‘kvmppc_set_papr’: include/sysemu/kvm.h:449:35: error: ‘args_tmp[i]’ may be used uninitialized in this function [-Werror=maybe-uninitialized] cc1: all warnings being treated as errors $ rpm -q gcc gcc-7.1.1-3.fc26.ppc64le The compiler should obviously optimize this code away when no extra agument is passed to kvm_vm_enable_cap() and kvm_vcpu_enable_cap(), but it doesn't. This bug should be fixed one day in gcc, but we can also change our code pattern so that we don't hit the issue anymore. We workaround this, by using memcpy() instead of open-coding the copy. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <150210580404.1343.7325713896658799315.stgit@bahia.lan> Acked-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08Revert "rcu: do not create thread in pthread_atfork callback"Paolo Bonzini1-1/+0
This reverts commit a59629fcc6f603e19b516dc08f75334e5c480bd0. This is not needed anymore because the IOThread mutex is not "magic" anymore (need not kick the CPU thread)and also because fork callbacks are only enabled at the very beginning of QEMU's execution. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08rcu: completely disable pthread_atfork callbacks as soon as possiblePaolo Bonzini1-0/+6
Because of -daemonize, system mode QEMU sometimes needs to fork() and keep RCU enabled in the child. However, there is a possible deadlock with synchronize_rcu: - the CPU thread is inside a RCU critical section and wants to take the BQL in order to do MMIO - the monitor thread, which is owning the BQL, calls rcu_init_lock which tries to take the rcu_sync_lock - the call_rcu thread has taken rcu_sync_lock in synchronize_rcu, but synchronize_rcu needs the CPU thread to end the critical section before returning. This cannot happen for user-mode emulation, because it does not have a BQL. To fix it, assume that system mode QEMU only forks in preparation for exec (except when daemonizing) and disable pthread_atfork as soon as the double fork has happened. Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Tested-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08cpu: add APIs to allocate/free CPU environmentMichael S. Tsirkin1-0/+31
These will be implemented and then used by follow-up patches. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-08-02mips: Add KVM T&E segment support for TCGJames Hogan1-2/+3
MIPS KVM trap & emulate guest kernels have a different segment layout compared with traditional MIPS kernels, to allow both the user and kernel code to run from the user address segment without repeatedly trapping to KVM. QEMU currently supports this layout only for KVM, but its sometimes useful to be able to run these kernels in QEMU on a PC, so enable it for TCG too. This also paves the way for MIPS KVM VZ support (which uses the normal virtual memory layout) by abstracting whether user mode kernel segments are in use. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Yongbok Kim <yongbok.kim@imgtec.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: kvm@vger.kernel.org Reviewed-by: Richard Henderson <rth@twiddle.net> [Yongbok Kim: minor change] Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
2017-08-02Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into stagingPeter Maydell1-2/+1
pc, acpi, virtio: fixes, test speedup for rc1 Some fixes all over the place. Notably vhost-user gained a new message to set endian-ness. Borderline for 2.10 but seems to be the only way to fix legacy guests. Also pc tests are run on kvm now. Not a fix at all but doesn't touch qemu itself, so I merged it since I had to run these a lot and I just got tired of waiting for these to finish. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 01 Aug 2017 22:36:47 BST # gpg: using RSA key 0x281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" # 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: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: pc: acpi: force FADT rev1 for 440fx based machine types pc: make 'pc.rom' readonly when machine has PCI enabled vhost-user: fix watcher need be removed when vhost-user hotplug tests/bios-tables-test: Compiler warning fix accel: cleanup error output intel_iommu: use access_flags for iotlb intel_iommu: fix iova for pt vhost-user: fix legacy cross-endian configurations vhost: fix a memory leak tests: switch pxe and vm gen id tests to use kvm Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-02intel_iommu: use access_flags for iotlbPeter Xu1-2/+1
It was cached by read/write separately. Let's merge them. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-08-01char: don't exit on hmp 'chardev-add help'Anton Nefedov1-1/+3
qemu_chr_new_from_opts() is used from both vl.c and hmp, and it is quite confusing to see qemu suddenly exit after receiving a help option in hmp. Do exit(0) from vl.c instead. Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Message-Id: <1500977081-120929-1-git-send-email-anton.nefedov@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-01char-fd: remove useless chr pointerMarc-André Lureau1-1/+1
Apparently unused since it was introduced in commit a29753f8aa79a34a324afebe340182a51a5aef11. Now, it can be trivially accessed by CHARDEV() of self. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170720100046.4424-1-marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-01cpu_physical_memory_sync_dirty_bitmap: Fix alignment checkDr. David Alan Gilbert1-3/+4
This code has an optimised, word aligned version, and a boring unaligned version. Recently 084140bd498909 fixed a missing offset addition from the core of both versions. However, the offset isn't necessarily aligned and thus the choice between the two versions needs fixing up to also include the offset. Symptom: A few stuck unsent pages during migration; not normally noticed unless under very low bandwidth in which case the migration may get stuck never ending and never performing a 2nd sync; noticed by a hanging postcopy-test on a very heavily loaded system. Fixes: 084140bd498909 Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reported-by: Alex Benneé <alex.benee@linaro.org> Tested-by: Alex Benneé <alex.benee@linaro.org> -- v2 Move 'page' inside the if (Comment from Paolo) Message-Id: <20170724165125.29887-1-dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-07-31docs: fix broken paths to docs/devel/atomics.txtPhilippe Mathieu-Daudé1-2/+2
With the move of some docs/ to docs/devel/ on ac06724a71, a couple of references were not updated. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>