summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-11-30coroutine-sigaltstack.c: Use stack_t, not struct sigaltstackPeter Maydell1-2/+2
Use the POSIX-specified stack_t type as the argument to sigaltstack() rather than the legacy struct sigaltstack. This allows us to compile on MacOSX with --with-coroutine=sigaltstack. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-11-30stream: fix ratelimit_set_speedDietmar Maurer1-1/+1
The formula to compute slice_quota was wrong since commit 6ef228fc. Signed-off-by: Dietmar Maurer <dietmar@proxmox.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-11-30atapi: make change media detection for guests easierPavel Hrdina2-11/+10
If you have a guest with a media in the optical drive and you change it, the windows guest cannot properly recognize this media change. Windows needs to detect sense "NOT_READY with ASC_MEDIUM_NOT_PRESENT" before we send sense "UNIT_ATTENTION with ASC_MEDIUM_MAY_HAVE_CHANGED". Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-11-30Documentation: Update image format informationKevin Wolf2-57/+194
Document new and yet undocumented options and image formats. The qemu-img man page contains information only for raw and qcow2 now and references the HTML documentation for a more detailed description of other formats. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-11-30Documentation: Update block cache mode informationKevin Wolf1-20/+20
Somehow we forgot to update this when cache=writeback became the default. While changing the information on the default, also make the description of all caches modes a bit more accurate. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-11-28event notifier: Fix setup for win32Jan Kiszka1-1/+1
The event notifier state is only reset by test_and_clear. But we created the windows event object with auto-reset, which subtly swallowed events. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-28Merge remote-tracking branch 'bonzini/nbd-next' into stagingAnthony Liguori2-2/+2
* bonzini/nbd-next: nbd-server-add: Fix the default for 'writable' nbd: fix use of two uninitialized bytes when connecting to a named export Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-28Merge remote-tracking branch 'bonzini/scsi-next' into stagingAnthony Liguori2-188/+84
* bonzini/scsi-next: virtio-scsi: Fix subtle (guest) endian bug virtio-scsi: Fix some endian bugs with virtio-scsi iscsi: do not assume device is zero initialized iscsi: fix deadlock during login iscsi: fix segfault in url parsing Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-28Merge remote-tracking branch 'agraf/s390-for-upstream-1.3' into stagingAnthony Liguori2-2/+2
* agraf/s390-for-upstream-1.3: sclp: Fix uninitialized var in handle_write_event_buf(). s390: Fix ram_size updating in machine init Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-28Merge remote-tracking branch 'agraf/ppc-for-upstream-1.3' into stagingAnthony Liguori5-5/+10
* agraf/ppc-for-upstream-1.3: fbdev: fix pixman compile on old pixman vl.c: Fix broken -usb option pseries: Fix bug in PCI MSI allocation kvm: fix incorrect length in a loop over kvm dirty pages map PPC: Fix missing TRACE exception hw/ide/macio: Fix segfault caused by NULL DMAContext* Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-28Merge remote-tracking branch 'afaerber/qom-cpu-1.3' into stagingAnthony Liguori1-1/+1
* afaerber/qom-cpu-1.3: target-i386: Enable SSSE3 TCG support target-i386/cpu: Add missing flags to Haswell CPU model Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-28build: compile translate.o with -fno-gcse option on GCC 4.6.x and 4.7.[012]Paolo Bonzini2-0/+19
These versions of GCC require insane (>2GB) amounts of memory to compile translate.o. As a countermeasure, disable the culprit optimization pass. This should fix the buildbot failure for default_x86_64_fedora16. Anyway this is a good thing to do because people will try to compile 1.3 with less than 2GB of memory and complain. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-28virtio-scsi: Fix subtle (guest) endian bugDavid Gibson1-2/+2
The virtio-scsi config space is, by specification, in guest endian (which is ill-defined, but there you go). In virtio_scsi_get_config() we set up all the fields in there, using stl_raw(). Which is a problem for the max_channel and max_target fields, which are 16-bit, not 32-bit. For little-endian targets we get away with it by accident, since the first two bytes will still be correct, and the extra two bytes written (with zeroes) will be overwritten correctly by the next store. But for big-endian guests, this means the max_target field ends up as zero, which means the guest will only recognize a single disk on the virtio-scsi bus. This patch fixes the problem. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Paul 'Rusty' Russell <rusty@rustcorp.com.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-28virtio-scsi: Fix some endian bugs with virtio-scsiDavid Gibson1-3/+5
The virtio-scsi specification does not specify the correct endianness for fields in the request structure. It's therefore best to assume that it is "guest native" endian since that's the (stupid and poorly defined) norm in virtio. However, the qemu device for virtio-scsi has no byteswaps at all, and so will break if the guest has different endianness from the host. This patch fixes it by adding tswap() calls for the sense_len and resid fields in the request structure. In theory status_qualifier needs swaps as well, but that field is never actually touched. The tag field is a uint64_t, but since its value is completely arbitrary, it might as well be uint8_t[8] and so it does not need swapping. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Paul 'Rusty' Russell <rusty@rustcorp.com.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-28iscsi: do not assume device is zero initializedPeter Lieven1-0/+6
Without any complex checks we can't assume that an iscsi target is initialized to zero. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-28iscsi: fix deadlock during loginPeter Lieven1-181/+70
If the connection is interrupted before the first login is successfully completed qemu-kvm is waiting forever in qemu_aio_wait(). This is fixed by performing an sync login to the target. If the connection breaks after the first successful login errors are handled internally by libiscsi. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-28iscsi: fix segfault in url parsingPeter Lieven1-2/+1
If an invalid URL is specified iscsi_get_error(iscsi) is called with iscsi == NULL. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-28nbd-server-add: Fix the default for 'writable'Michal Privoznik1-1/+1
The documentation to this monitor command tells, that 'writable' argument is optional and defaults to false. However, the code sets true as the default. But since some applications may already been using this, it's safer to fix the code and not documentation which would break those applications. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-28nbd: fix use of two uninitialized bytes when connecting to a named exportPaolo Bonzini1-1/+1
Reported-by: Michal Privoznik <mprivoznik@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-27rtc: Only call rtc_set_cmos when Register B SET flag is disabled.Alex Horn2-1/+45
This bug occurs when the SET flag of Register B is enabled. When an RTC data register (i.e. any of the ten time/calender CMOS bytes) is set, the data is (as expected) correctly stored in the cmos_data array. However, since the SET flag is enabled, the function rtc_set_time is not invoked. As a result, the field base_rtc in RTCState remains uninitialized. This causes a problem on subsequent writes which can end up overwriting data. To see this, consider writing data to Register A after having written data to any of the RTC data registers; the following figure illustrates the call stack for the Register A write operation: +- cmos_io_port_write +-- check_update_timer +---- get_next_alarm +------ rtc_update_time In rtc_update_time, get_guest_rtc calculates the wrong time and overwrites the previously written RTC data register values. Signed-off-by: Alex Horn <alex.horn@cs.ox.ac.uk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-27virtio-rng: do not use g_assert_cmpintPaolo Bonzini1-2/+1
g_assert_cmpint is not available on glib 2.12, which is the minimum version required to build QEMU (we only require 2.16 to run tests, since that is the first version including GTester). Do not use it in hardware models, use a normal assertion instead. This fixes the buildbot failure for default_x86_64_rhel5. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-27tests: make threadpool cancellation test looserPaolo Bonzini1-2/+5
The cancellation test is failing on the buildbots. While the failure merits a little more investigation to understand what is going on, the logs show that the failure is not impacting the coverage provided by the test. Hence, loosen a bit the assertions in a way that should let the test proceed and hopefully pass. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26Update version for 1.3.0-rc1v1.3.0-rc1Anthony Liguori1-1/+1
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26virtio-rng: fix typos, commentsAmit Shah2-7/+6
Fix typos, whitespace and update comments to match current implementation. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26virtio-rng: disable timer on device removalAmit Shah1-0/+2
Disable the rate-limit timer on device remove (e.g. hot-unplug). Signed-off-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26virtio-rng: remove extra request for entropyAmit Shah1-7/+0
If we got fewer bytes from the backend than requested, don't poke the backend for more bytes; the guest will ask for more (or if the guest has already asked for more, the backend knows about it via handle_input()). Signed-off-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26virtio-rng: use virtqueue_get_avail_bytes, fix migrationAmit Shah1-64/+12
Popping an elem from the vq just to find out its length causes problems with save/load later on. Use the new virtqueue_get_avail_bytes() function instead, saves us the complexity in the migration code, as well as makes the migration endian-safe. Signed-off-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26i8259: Fix PIC_COMMON() macroAndreas Färber1-1/+1
It used a wrong struct type name since its introduction in 8f04ee0882aec9fe91fb70f767edf5dacff59835 (isa: pic: convert to QEMU Object Model), apparently it is unused so far. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26qapi: handle visitor->type_size() in QapiDeallocVisitorStefan Hajnoczi1-0/+6
visit_type_size() requires either visitor->type_size() or visitor_uint64() to be implemented, otherwise a NULL function pointer is invoked. It is possible to trigger this crash as follows: $ qemu-system-x86_64 -netdev tap,sndbuf=0,id=netdev0 \ -device virtio-blk-pci,netdev=netdev0 The 'sndbuf' option has type "size". Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26target-i386: cpu: add missing flags to Haswell CPU modelEduardo Habkost1-2/+3
When adding the Haswell CPU model, I intended to make it a superset of the features present on the SandyBridge model, but I have removed the SEP and RDTSCP features from the feature list by mistake. This patch adds the missing SEP and RDTSCP features (that are present on SandyBridge) to Haswell. Reported-by: Martin Kletzander <mkletzan@redhat.com> Acked-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26vl.c: Fix broken -usb optionPeter Maydell1-8/+4
Commit 094b287f0b accidentally broke the "-usb" command line option, so it would have no effect if the user had not specified any machine options at that point. (the return value from 'qemu_opts_find(qemu_find_opts("machine"), 0);' is NULL if there are no user specified options, so it is only to be used for looking up an option, not when trying to set one.) Similarly, would '-usbdevice' no longer cause USB to default to enabled. Fix this regression by using the same style of code for forcing the usb=on machine option that we use for other aliases such as '-enable-kvm'. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26qom: make object_finalize staticPaolo Bonzini2-10/+1
It is not used anymore, and there is no need to make it public. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26qdev: simplify (de)allocation of busesPaolo Bonzini4-16/+3
All conditional deallocation can now be done with object_delete. Remove the @qom_allocated and @glib_allocated fields; replace the latter with a direct assignment of the @free function pointer. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26qom: make object_delete usable for statically-allocated objectsPaolo Bonzini2-1/+13
Store in the object the freeing function that will be used at deletion time. This makes it possible to use object_delete on statically-allocated (embedded) objects. Dually, it makes it possible to use object_unparent and object_unref without leaking memory, when the lifetime of object might extend until after the call to object_delete. Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26qdev: move bus removal to object_unparentPaolo Bonzini3-3/+27
Add an ObjectClass method that is done at object_unparent time. It should remove any backlinks to the object in the composition tree, so that object_delete will be able to drop the last reference and free the object. Use it for qdev buses. Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26qom: fix refcount of non-heap-allocated objectsPaolo Bonzini1-1/+1
The reference count for embedded objects is always one too low, because object_initialize_with_type returns with zero references to the object. This causes premature finalization of the object (or an assertion failure) after calling object_ref to add an extra reference and object_unref to remove it. The fix is to move the initial object_ref call from object_new_with_type to object_initialize_with_type. Acked-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26sclp: Fix uninitialized var in handle_write_event_buf().Cornelia Huck1-1/+2
Some gcc versions rightly complain about a possibly unitialized rc, so let's move setting it before the QTAILQ_FOREACH(). Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-26s390: Fix ram_size updating in machine initHeinz Graalfs1-1/+0
The global variable 'ram_size' is hidden by the local variable declaration in s390_init(). Since we want to update the global ram size in certain cases we must not use a local ram_size variable. - This fixes booting with unusual ram sizes like -m 67001 - This changes behaviour back to the situation before commit 5f072e1f3075bd869e0ace9f2545a85992ac0084 (create struct for machine initialization arguments) Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-26fbdev: fix pixman compile on old pixmanAlexander Graf1-0/+2
My QEMU compile failed with the following error: qemu-pixman.c: In function ‘qemu_pixman_get_type’: qemu-pixman.c:24: error: ‘PIXMAN_TYPE_BGRA’ undeclared (first use in this function) qemu-pixman.c:24: error: (Each undeclared identifier is reported only once qemu-pixman.c:24: error: for each function it appears in.) Guard the PIXMAN_TYPE_BGRA branch like in the case right above the failing case, so that compilation is fixed. Functionality on such old pixman is a different question ;-). Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-26vl.c: Fix broken -usb optionPeter Maydell1-8/+4
Commit 094b287f0b accidentally broke the "-usb" command line option, so it would have no effect if the user had not specified any machine options at that point. (the return value from 'qemu_opts_find(qemu_find_opts("machine"), 0);' is NULL if there are no user specified options, so it is only to be used for looking up an option, not when trying to set one.) Similarly, would '-usbdevice' no longer cause USB to default to enabled. Fix this regression by using the same style of code for forcing the usb=on machine option that we use for other aliases such as '-enable-kvm'. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-26pseries: Fix bug in PCI MSI allocationAlexey Kardashevskiy1-1/+1
In one of the recent reworks to the XICS code, a bug was introduced where we use the wrong sense and allocate level interrupts instead of message interrupts for PCI MSIs. This patch fixes it. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-26kvm: fix incorrect length in a loop over kvm dirty pages mapAlexey Kardashevskiy1-1/+1
QEMU allocates a map enough for 4k pages. However the system page size can be 64K (for example on POWER) and the host kernel uses only a small part of it as one big stores a dirty flag for 16 pages 4K each, the hpratio variable stores this ratio and the kvm_get_dirty_pages_log_range function handles it correctly. However kvm_get_dirty_pages_log_range still goes beyond the data provided by the host kernel which is not correct. It does not cause errors at the moment as the whole bitmap is zeroed before doing KVM ioctl. The patch reduces number of iterations over the map. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-26PPC: Fix missing TRACE exceptionJulio Guerra1-1/+2
This patch fixes bug 1031698 : https://bugs.launchpad.net/qemu/+bug/1031698 If we look at the (truncated) translation of the conditional branch instruction in the test submitted in the bug post, the call to the exception helper is missing in the "bne-false" chunk of translated code : IN: bne- 0x1800278 OUT: 0xb544236d: jne 0xb5442396 0xb5442373: mov %ebp,(%esp) 0xb5442376: mov $0x44,%ebx 0xb544237b: mov %ebx,0x4(%esp) 0xb544237f: mov $0x1800278,%ebx 0xb5442384: mov %ebx,0x25c(%ebp) 0xb544238a: call 0x827475a ^^^^^^^^^^^^^^^^^^ 0xb5442396: mov %ebp,(%esp) 0xb5442399: mov $0x44,%ebx 0xb544239e: mov %ebx,0x4(%esp) 0xb54423a2: mov $0x1800270,%ebx 0xb54423a7: mov %ebx,0x25c(%ebp) Indeed, gen_exception(ctx, excp) called by gen_goto_tb (called by gen_bcond) changes ctx->exception's value to excp's : gen_bcond() { gen_goto_tb(ctx, 0, ctx->nip + li - 4); /* ctx->exception value is POWERPC_EXCP_BRANCH */ gen_goto_tb(ctx, 1, ctx->nip); /* ctx->exception now value is POWERPC_EXCP_TRACE */ } Making the following gen_goto_tb()'s test false during the second call : if ((ctx->singlestep_enabled & (CPU_BRANCH_STEP | CPU_SINGLE_STEP)) && ctx->exception == POWERPC_EXCP_BRANCH /* false...*/) { target_ulong tmp = ctx->nip; ctx->nip = dest; /* ... and this is the missing call */ gen_exception(ctx, POWERPC_EXCP_TRACE); ctx->nip = tmp; } So the patch simply adds the missing matching case, fixing our problem. Signed-off-by: Julio Guerra <guerr@julio.in> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-26hw/ide/macio: Fix segfault caused by NULL DMAContext*Peter Maydell1-2/+4
Pass qemu_sglist_init the global dma_context_memory rather than a NULL pointer; this fixes a segfault in dma_memory_map() when the guest starts using DMA. Reported-by: Amadeusz Sławiński <amade@asmblr.net> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-26target-i386: Enable SSSE3 TCG supportAurelien Jarno1-1/+1
SSSE3 support has been added to TCG more than 4 years ago in commit 4242b1bd8acc19aaaacffdaad4ac23213d72a72b. It has been disabled by mistake in commit 551a2dec8fa55006a68393b9d6fb63577d2b3f1c. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-11-26target-i386/cpu: Add missing flags to Haswell CPU modelEduardo Habkost1-2/+3
When adding the Haswell CPU model, I intended to make it a superset of the features present on the SandyBridge model, but I have removed the SEP and RDTSCP features from the feature list by mistake. This patch adds the missing SEP and RDTSCP features (that are present on SandyBridge) to Haswell. Reported-by: Martin Kletzander <mkletzan@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-11-26hmp: do not crash on invalid SCSI hotplugPaolo Bonzini1-1/+7
Commit 0d93692 (qdev: Convert busses to QEMU Object Model, 2012-05-02) removed a check on the type of the bus where a SCSI disk is hotplugged. However, hot-plugging to the wrong kind of device now causes a crash due to either a NULL pointer dereference (avoided by the previous patch) or a failed QOM cast. Instead, in this case we need to use object_dynamic_cast and check for the result, similar to what was done before that commit. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26qom: dynamic_cast of NULL is always NULLPaolo Bonzini1-2/+2
Trying to cast a NULL value will cause a crash. Returning NULL is also sensible, and it is also what the type-unsafe DO_UPCAST macro does. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26tests: add thread pool unit testsPaolo Bonzini2-0/+215
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26tests: add AioContext unit testsPaolo Bonzini2-0/+669
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>