aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-11-02qapi: More robust conditions for when labels are neededEric Blake2-2/+5
We were using regular expressions to see if ret included any earlier text that emitted a 'goto out;' line, to decide whether we needed to output an 'out:' label. But this is fragile, if the ret text can possibly combine more than one generated function body, where the first function used a goto but the second does not. Change the code to just check for the known conditions which cause an error check to be needed. Besides, it's slightly more efficient to use plain checks than regular expression searching. No change to generated code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-4-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02qapi: More idiomatic string operationsEric Blake1-3/+3
Rather than slicing the end of a string, we can use python's endswith(). And rather than creating a set of characters, we can search for a character within a string. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-3-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02tests/qapi-schema: Test for reserved names, empty structEric Blake24-4/+59
Add some testsuite coverage to ensure future patches are on the right track: Our current C representation of qapi arrays is done by appending 'List' to the element name; but we are not preventing the creation of an object type with the same name. Add reserved-type-list.json to test this. Then rename enum-union-clash.json to reserved-type-kind.json to cover the reservation that we DO detect, and shorten it to match the fact that the name is reserved even if there is no clash. We are failing to detect a collision between a dictionary member and the implicit 'has_*' flag for another optional member. The easiest fix would be for a future patch to reserve the entire "has[-_]" namespace for member names (the collision is also possible for branch names within flat unions, but only as long as branch names can collide with (non-variant) members; however, since future patches are about to remove that, it is not worth testing here). Add reserved-member-has.json to test this. A similar collision exists between a dictionary member where c_name() munges what might otherwise be a reserved name to start with 'q_', and another member explicitly starts with "q[-_]". Again, the easiest solution for a future patch will be reserving the entire namespace, but here for commands as well as members. Add reserved-member-q.json and reserved-command-q.json to test this; separate tests since arguably our munging of command 'unix' to 'qmp_q_unix()' could be done without a q_, which is different than the munging of a member 'unix' to 'foo.q_unix'. Finally, our testsuite does not have any compilation coverage of struct inheritance with empty qapi structs. Update qapi-schema-test.json to test this. Note that there is currently no technical reason to forbid type name patterns from member names, or member name patterns from types, since the two are not in the same namespace in C and won't collide; but it's not worth adding positive tests of these corner cases at this time, especially while there is other churn pending in patches that rearrange which collisions actually happen. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-2-git-send-email-eblake@redhat.com> [Commit message tweaked slightly] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02qapi-schema: mark InetSocketAddress as mandatory againDaniel P. Berrange1-4/+2
Revert the qapi-schema.json change done in: commit 0983f5e6af76d5df8c6346cbdfff9d8305fb6da0 Author: Daniel P. Berrange <berrange@redhat.com> Date: Tue Sep 1 14:46:50 2015 +0100 sockets: allow port to be NULL when listening on IP address Switching "port" from mandatory to optional causes the QAPI code generator to add a 'has_port' field to the InetSocketAddress struct. No code that created InetSocketAddress objects was updated to set 'has_port = true', which caused the non-NULL port strings to be silently dropped when copying InetSocketAddress objects. Reported-by: Knut Omang <knuto@ifi.uio.no> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1445509543-30679-1-git-send-email-berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-10-30Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into ↵Peter Maydell21-116/+293
staging # gpg: Signature made Thu 29 Oct 2015 18:09:16 GMT using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/block-pull-request: block: Consider all child nodes in bdrv_requests_pending() target-arm: xlnx-zynqmp: Add sdhci support. sdhci: Split sdhci.h for public and internal device usage sd.h: Move sd.h to include/hw/sd/ virtio: sync the dataplane vring state to the virtqueue before virtio_save gdb command: qemu handlers virtio-blk: switch off scsi-passthrough by default ppc/spapr: add 2.4 compat props s390x: include HW_COMPAT_* props qemu-gdb: add $qemu_coroutine_sp and $qemu_coroutine_pc qemu-gdb: extract parts of "qemu coroutine" implementation qemu-gdb: allow using glibc_pointer_guard() on core dumps Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-30Merge remote-tracking branch 'remotes/lalrae/tags/mips-20151030' into stagingPeter Maydell8-59/+112
MIPS patches 2015-10-30 Changes: * R6 CPU can be woken up by non-enabled interrupts * PC fix in KVM * Coprocessor 0 XContext calculation fix * various MIPS R6 updates # gpg: Signature made Fri 30 Oct 2015 14:51:56 GMT using RSA key ID 0B29DA6B # gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>" * remotes/lalrae/tags/mips-20151030: target-mips: fix updating XContext on mmu exception target-mips: add SIGRIE instruction target-mips: Set Config5.XNP for R6 cores target-mips: add PC, XNP reg numbers to RDHWR hw/mips_malta: Fix KVM PC initialisation target-mips: Add enum for BREAK32 target-mips: update writing to CP0.Status.KX/SX/UX in MIPS Release R6 target-mips: implement the CPU wake-up on non-enabled interrupts in R6 target-mips: move the test for enabled interrupts to a separate function Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-30target-mips: fix updating XContext on mmu exceptionYongbok Kim1-3/+4
Correct updating XContext.Region field on mmu exceptions. If Config3.CTXTC = 0 then the R field of XContext has to be updated with the value of bits 63..62 of the virtual address upon a TLB exception. Also fixed the below line which overs 80 characters. Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com> Reviewed-by: James Hogan <james.hogan@imgtec.com> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-10-30target-mips: add SIGRIE instructionYongbok Kim1-1/+11
Add SIGRIE (Signal Reserved Instruction Exception) for both MIPS and microMIPS. The instruction allows to use the 16-bit code field for software use. This instruction is introduced by and required as of Release 6. Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-10-30target-mips: Set Config5.XNP for R6 coresYongbok Kim1-2/+2
Set Config5.XNP for R6 cores to indicate the extended LL/SC family of instructions NOT present. Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-10-30target-mips: add PC, XNP reg numbers to RDHWRYongbok Kim4-32/+63
Add Performance Counter (4) and XNP (5) register numbers to RDHWR. Add check_hwrena() to simplify access control checkings. Add RDHWR support to microMIPS R6. Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-10-30hw/mips_malta: Fix KVM PC initialisationJames Hogan1-1/+1
Commit 71c199c81d29 ("mips_malta: provide ememsize env variable to kernels") changed the meaning of loaderparams.ram_size to be the whole of RAM rather than just the low part below where the boot code is placed for KVM, but it didn't update the PC initialisation for KVM to use ram_low_size. Fix that now. Fixes: 71c199c81d29 ("mips_malta: provide ememsize env variable to kernels") Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Paul Burton <paul.burton@imgtec.com> Cc: Leon Alrae <leon.alrae@imgtec.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-10-30Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2015-10-30' ↵Peter Maydell20-153/+189
into staging QMP and QObject patches # gpg: Signature made Fri 30 Oct 2015 08:06:26 GMT using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-monitor-2015-10-30: docs: Document QMP event rate limiting monitor: Throttle event VSERPORT_CHANGE separately by "id" monitor: Turn monitor_qapi_event_state[] into a hash table glib: add compatibility interface for g_hash_table_add() monitor: Split MonitorQAPIEventConf off MonitorQAPIEventState monitor: Switch from timer_new() to timer_new_ns() monitor: Simplify event throttling monitor: Reduce casting of QAPI event QDict qstring: Make conversion from QObject * accept null qlist: Make conversion from QObject * accept null qfloat qint: Make conversion from QObject * accept null qdict: Make conversion from QObject * accept null qbool: Make conversion from QObject * accept null qobject: Drop QObject_HEAD Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-30docs: Document QMP event rate limitingMarkus Armbruster2-0/+17
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444921716-9511-8-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2015-10-30monitor: Throttle event VSERPORT_CHANGE separately by "id"Markus Armbruster1-4/+23
VSERPORT_CHANGE is emitted when the guest opens or closes a virtio-serial port. The event's member "id" identifies the port. When several events arrive quickly, throttling drops all but the last of them. Because of that, a QMP client must assume that *any* port may have changed state when it receives a VSERPORT_CHANGE event and throttling may have happened. Make the event more useful by throttling it for each port separately. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1444921716-9511-7-git-send-email-armbru@redhat.com>
2015-10-30monitor: Turn monitor_qapi_event_state[] into a hash tableMarkus Armbruster1-16/+37
In preparation of finer grained throttling. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1444921716-9511-6-git-send-email-armbru@redhat.com>
2015-10-30glib: add compatibility interface for g_hash_table_add()Markus Armbruster1-0/+8
The next commit will use it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2015-10-29block: Consider all child nodes in bdrv_requests_pending()Kevin Wolf1-5/+8
The function manually recursed into bs->file and bs->backing to check whether there were any requests pending, but it ignored other children. There's no need to special case file and backing here, so just replace these two explicit recursions by a loop recursing for all child nodes. Reported-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Message-id: 1446029211-27148-1-git-send-email-kwolf@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29target-arm: xlnx-zynqmp: Add sdhci support.Sai Pavan Boddu2-0/+31
Add two SYSBUS_SDHCI devices for xlnx-zynqmp Signed-off-by: Sai Pavan Boddu <saipava@xilinx.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29sdhci: Split sdhci.h for public and internal device usageSai Pavan Boddu3-71/+99
Split sdhci.h into pubilc version (i.e include/hw/sd/sdhci.h) and internal version (i.e hw/sd/sdhci-interna.h) based on register declarations and object declaration. Signed-off-by: Sai Pavan Boddu <saipava@xilinx.com> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29sd.h: Move sd.h to include/hw/sd/Sai Pavan Boddu8-7/+7
Create a sd directory under include/hw/ and move sd.h to include/hw/sd/ Signed-off-by: Sai Pavan Boddu <saipava@xilinx.com> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29virtio: sync the dataplane vring state to the virtqueue before virtio_savePavel Butsykin2-0/+10
When creating snapshot with the dataplane enabled, the snapshot file gets not the actual state of virtqueue, because the current state is stored in VirtIOBlockDataPlane. Therefore, before saving snapshot need to sync the dataplane vring state to the virtqueue. The dataplane will resume its work at the next notify virtqueue. When snapshot loads with loadvm we get a message: VQ 0 size 0x80 Guest index 0x15f5 inconsistent with Host index 0x0: delta 0x15f5 error while loading state for instance 0x0 of device '0000:00:08.0/virtio-blk' Error -1 while loading VM state to reproduce the error I used the following hmp commands: savevm snap1 loadvm snap1 qemu parameters: --enable-kvm -smp 4 -m 1024 -drive file=/var/lib/libvirt/images/centos6.4.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,id=virtio-disk0 -set device.virtio-disk0.x-data-plane=on Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Message-id: 1445859777-2982-1-git-send-email-den@openvz.org CC: Stefan Hajnoczi <stefanha@redhat.com> CC: "Michael S. Tsirkin" <mst@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> CC: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29gdb command: qemu handlersDr. David Alan Gilbert2-1/+60
A new gdb commands are added: qemu handlers That dumps an AioContext list (by default qemu_aio_context) possibly including a backtrace for cases it knows about (with the verbose option). Intended to help find why something is hanging waiting for IO. Use 'qemu handlers --verbose iohandler_ctx' to find out why your incoming migration is stuck. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-id: 1445951385-11924-1-git-send-email-dgilbert@redhat.com V2: Merge into one command with optional handlers arg, and only do backtrace in verbose mode (gdb) qemu handlers ---- {pfd = {fd = 6, events = 25, revents = 0}, io_read = 0x55869656ffd0 <event_notifier_dummy_cb>, io_write = 0x0, deleted = 0, opaque = 0x558698c4ce08, node = {le_next = 0x0, le_prev = 0x558698c4cdc0}} (gdb) qemu handlers iohandler_ctx ---- {pfd = {fd = 9, events = 25, revents = 0}, io_read = 0x558696581380 <fd_coroutine_enter>, io_write = 0x0, deleted = 0, opaque = 0x558698dc99d0, node = {le_next = 0x558698c4cca0, le_prev = 0x558698c4c1d0}} ---- {pfd = {fd = 4, events = 25, revents = 0}, io_read = 0x55869657b330 <sigfd_handler>, io_write = 0x0, deleted = 0, opaque = 0x4, node = {le_next = 0x558698c4c260, le_prev = 0x558699f72508}} ---- {pfd = {fd = 5, events = 25, revents = 0}, io_read = 0x55869656ffd0 <event_notifier_dummy_cb>, io_write = 0x0, deleted = 0, opaque = 0x558698c4c218, node = {le_next = 0x0, le_prev = 0x558698c4ccc8}} ---- (gdb) qemu handlers --verbose iohandler_ctx ---- {pfd = {fd = 9, events = 25, revents = 0}, io_read = 0x558696581380 <fd_coroutine_enter>, io_write = 0x0, deleted = 0, opaque = 0x558698dc99d0, node = {le_next = 0x558698c4cca0, le_prev = 0x558698c4c1d0}} #0 0x0000558696581820 in qemu_coroutine_switch (from_=from_@entry=0x558698cb3cf0, to_=to_@entry=0x7f421c37eac8, action=action@entry=COROUTINE_YIELD) at /home/dgilbert/git/qemu/coroutine-ucontext.c:177 #1 0x0000558696580c00 in qemu_coroutine_yield () at /home/dgilbert/git/qemu/qemu-coroutine.c:145 #2 0x00005586965814f5 in yield_until_fd_readable (fd=9) at /home/dgilbert/git/qemu/qemu-coroutine-io.c:90 #3 0x0000558696523937 in socket_get_buffer (opaque=0x55869a3dc620, buf=0x558698c505a0 "", pos=<optimized out>, size=32768) at /home/dgilbert/git/qemu/migration/qemu-file-unix.c:101 #4 0x0000558696521fac in qemu_fill_buffer (f=0x558698c50570) at /home/dgilbert/git/qemu/migration/qemu-file.c:227 #5 0x0000558696522989 in qemu_peek_byte (f=0x558698c50570, offset=0) at /home/dgilbert/git/qemu/migration/qemu-file.c:507 #6 0x0000558696522bf4 in qemu_get_be32 (f=0x558698c50570) at /home/dgilbert/git/qemu/migration/qemu-file.c:520 #7 0x0000558696522bf4 in qemu_get_be32 (f=f@entry=0x558698c50570) at /home/dgilbert/git/qemu/migration/qemu-file.c:604 #8 0x0000558696347e5c in qemu_loadvm_state (f=f@entry=0x558698c50570) at /home/dgilbert/git/qemu/migration/savevm.c:1821 #9 0x000055869651de8c in process_incoming_migration_co (opaque=0x558698c50570) at /home/dgilbert/git/qemu/migration/migration.c:336 #10 0x000055869658188a in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at /home/dgilbert/git/qemu/coroutine-ucontext.c:80 #11 0x00007f420f05df10 in __start_context () at /lib64/libc.so.6 #12 0x00007ffc40815f50 in () #13 0x0000000000000000 in () ---- Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29virtio-blk: switch off scsi-passthrough by defaultCornelia Huck2-2/+6
Devices that are compliant with virtio-1 do not support scsi passthrough any more (and it has not been a recommended setup anyway for quite some time). To avoid having to switch it off explicitly in newer qemus that turn on virtio-1 by default, let's switch the default to scsi=false for 2.5. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Message-id: 1444991154-79217-4-git-send-email-cornelia.huck@de.ibm.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29ppc/spapr: add 2.4 compat propsCornelia Huck1-0/+9
HW_COMPAT_2_4 will become non-empty: prepare for it. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Message-id: 1444991154-79217-3-git-send-email-cornelia.huck@de.ibm.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29s390x: include HW_COMPAT_* propsCornelia Huck1-0/+2
We want to inherit generic hw compat as well. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 1444991154-79217-2-git-send-email-cornelia.huck@de.ibm.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29qemu-gdb: add $qemu_coroutine_sp and $qemu_coroutine_pcPaolo Bonzini2-0/+19
These can be useful to manually get a stack trace of a coroutine inside a core dump. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1444636974-19950-4-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29qemu-gdb: extract parts of "qemu coroutine" implementationPaolo Bonzini1-29/+27
Provide useful Python functions to reach and decipher a jmpbuf. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1444636974-19950-3-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29qemu-gdb: allow using glibc_pointer_guard() on core dumpsPaolo Bonzini1-2/+16
get_fs_base() cannot be run on a core dump, because it uses the arch_prctl system call. The fs base is the value that is returned by pthread_self(), and it would be nice to just glean it from the "info threads" output: * 1 Thread 0x7f16a3fff700 (LWP 33642) pthread_cond_wait@@GLIBC_2.3.2 () ^^^^^^^^^^^^^^ but unfortunately the gdb API does not provide that. Instead, we can look for the "arg" argument of the start_thread function if glibc debug information are available. If not, fall back to the old mechanism. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1444636974-19950-2-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-29target-mips: Add enum for BREAK32Yongbok Kim1-1/+2
Add enum for BREAK32 Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-10-29target-mips: update writing to CP0.Status.KX/SX/UX in MIPS Release R6Leon Alrae1-1/+6
Implement the relationship between CP0.Status.KX, SX and UX. It should not be possible to set UX bit if SX is 0, the same applies for setting SX if KX is 0. Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-10-29target-mips: implement the CPU wake-up on non-enabled interrupts in R6Leon Alrae1-3/+4
In Release 6, the behaviour of WAIT has been modified to make it a requirement that a processor that has disabled operation as a result of executing a WAIT will resume operation on arrival of an interrupt even if interrupts are not enabled. Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-10-29target-mips: move the test for enabled interrupts to a separate functionLeon Alrae3-16/+20
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2015-10-29monitor: Split MonitorQAPIEventConf off MonitorQAPIEventStateMarkus Armbruster1-41/+37
In preparation of turning monitor_qapi_event_state[] into a hash table for finer grained throttling. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1444921716-9511-5-git-send-email-armbru@redhat.com>
2015-10-29monitor: Switch from timer_new() to timer_new_ns()Markus Armbruster1-4/+3
We don't actually care for the scale, so we can just as well use the simpler interface. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444921716-9511-4-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2015-10-29monitor: Simplify event throttlingMarkus Armbruster2-35/+32
The event throttling state machine is hard to understand. I'm not sure it's entirely correct. Rewrite it in a more straightforward manner: State 1: No event sent recently (less than evconf->rate ns ago) Invariant: evstate->timer is not pending, evstate->qdict is null On event: send event, arm timer, goto state 2 State 2: Event sent recently, no additional event being delayed Invariant: evstate->timer is pending, evstate->qdict is null On event: store it in evstate->qdict, goto state 3 On timer: goto state 1 State 3: Event sent recently, additional event being delayed Invariant: evstate->timer is pending, evstate->qdict is non-null On event: store it in evstate->qdict, goto state 3 On timer: send evstate->qdict, clear evstate->qdict, arm timer, goto state 2 Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444921716-9511-3-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2015-10-29monitor: Reduce casting of QAPI event QDictMarkus Armbruster1-19/+19
Make the variables holding the event QDict instead of QObject. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1444921716-9511-2-git-send-email-armbru@redhat.com>
2015-10-29qstring: Make conversion from QObject * accept nullMarkus Armbruster3-13/+8
qobject_to_qstring() crashes on null, which is a trap for the unwary. Return null instead, and simplify a few callers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444918537-18107-7-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-10-29qlist: Make conversion from QObject * accept nullMarkus Armbruster1-2/+1
qobject_to_qlist() crashes on null, which is a trap for the unwary. Return null instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444918537-18107-6-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-10-29qfloat qint: Make conversion from QObject * accept nullMarkus Armbruster4-22/+21
qobject_to_qfloat() and qobject_to_qint() crash on null, which is a trap for the unwary. Return null instead, and simplify a few callers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444918537-18107-5-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-10-29qdict: Make conversion from QObject * accept nullMarkus Armbruster2-11/+6
qobject_to_qdict() crashes on null, which is a trap for the unwary. Return null instead, and simplify a few callers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444918537-18107-4-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-10-29qbool: Make conversion from QObject * accept nullMarkus Armbruster3-13/+8
qobject_to_qbool() crashes on null, which is a trap for the unwary. Return null instead, and simplify a few callers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444918537-18107-3-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-10-29qobject: Drop QObject_HEADMarkus Armbruster7-10/+6
QObject_HEAD is a macro expanding into the common part of structs that are sub-types of QObject. It's always been just QObject base, and unlikely to change. Drop the macro, because the code is clearer with out it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1444918537-18107-2-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-10-29Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into stagingPeter Maydell22-95/+1276
virtio, pc, memory: fixes+features for 2.5 New features: This enables hotplug for multifunction devices. Patches are very small, so I think it's OK to merge at this stage. There's also some new infrastructure for vhost-user testing not enabled yet so it's harmless to merge. I've reverted the "gap between DIMMs" workaround, as it seems too risky, and applied my own patch in virtio, but not in dataplane code. This means that dataplane is broken for some complex DIMM configurations for now. Waiting for Stefan to review the dataplane fix. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Thu 29 Oct 2015 09:36:16 GMT using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" * remotes/mst/tags/for_upstream: enable multi-function hot-add remove function during multi-function hot-add tests/vhost-user-bridge: add vhost-user bridge application Revert "memhp: extend address auto assignment to support gaps" Revert "pc: memhp: force gaps between DIMM's GPA" virtio: drop virtqueue_map_sg virtio-scsi: convert to virtqueue_map virtio-serial: convert to virtio_map virtio-blk: convert to virtqueue_map virtio: switch to virtio_map virtio: introduce virtio_map mmap-alloc: fix error handling pc: memhp: do not emit inserting event for coldplugged DIMMs vhost-user-test: fix up rhel6 build vhost-user: cleanup msg size math vhost-user: cleanup struct size math Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-29enable multi-function hot-addCao jin4-10/+64
Enable PCIe device multi-function hot-add, just ensure function 0 is added last, then driver will get the notification to scan the slot. Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-29remove function during multi-function hot-addCao jin1-5/+18
In case user want to cancel the hot-add operation, should roll back, device_del the added function that still don`t work. Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-29tests/vhost-user-bridge: add vhost-user bridge applicationVictor Kaplansky2-0/+1111
The test existing in QEMU for vhost-user feature is good for testing the management protocol, but does not allow actual traffic. This patch proposes Vhost-User Bridge application, which can serve the QEMU community as a comprehensive test by running real internet traffic by means of vhost-user interface. Essentially the Vhost-User Bridge is a very basic vhost-user backend for QEMU. It runs as a standalone user-level process. For packet processing Vhost-User Bridge uses an additional QEMU instance with a backend configured by "-net socket" as a shared VLAN. This way another QEMU virtual machine can effectively serve as a shared bus by means of UDP communication. For a more simple setup, the another QEMU instance running the SLiRP backend can be the same QEMU instance running vhost-user client. This Vhost-User Bridge implementation is very preliminary. It is missing many features. I has been studying vhost-user protocol internals, so I've written vhost-user-bridge bit by bit as I progressed through the protocol. Most probably its internal architecture will change significantly. To run Vhost-User Bridge application: 1. Build vhost-user-bridge with a regular procedure. This will create a vhost-user-bridge executable under tests directory: $ configure; make tests/vhost-user-bridge 2. Ensure the machine has hugepages enabled in kernel with command line like: default_hugepagesz=2M hugepagesz=2M hugepages=2048 3. Run Vhost-User Bridge with: $ tests/vhost-user-bridge The above will run vhost-user server listening for connections on UNIX domain socket /tmp/vubr.sock, and will try to connect by UDP to VLAN bridge to localhost:5555, while listening on localhost:4444 Run qemu with a virtio-net backed by vhost-user: $ qemu \ -enable-kvm -m 512 -smp 2 \ -object memory-backend-file,id=mem,size=512M,mem-path=/dev/hugepages,share=on \ -numa node,memdev=mem -mem-prealloc \ -chardev socket,id=char0,path=/tmp/vubr.sock \ -netdev type=vhost-user,id=mynet1,chardev=char0,vhostforce \ -device virtio-net-pci,netdev=mynet1 \ -net none \ -net socket,vlan=0,udp=localhost:4444,localaddr=localhost:5555 \ -net user,vlan=0 \ disk.img vhost-user-bridge was tested very lightly: it's able to bringup a linux on client VM with the virtio-net driver, and execute transmits and receives to the internet. I tested with "wget redhat.com", "dig redhat.com". PS. I've consulted DPDK's code for vhost-user during Vhost-User Bridge implementation. Signed-off-by: Victor Kaplansky <victork@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-29Revert "memhp: extend address auto assignment to support gaps"Michael S. Tsirkin4-16/+11
This reverts commit df0acded19ec4b826aa095cfc19d341bd66fafd3. There's no point to it now that the only user has been reverted. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-29Revert "pc: memhp: force gaps between DIMM's GPA"Michael S. Tsirkin4-7/+2
This reverts commit aa8580cddf011e8cedcf87f7a0fdea7549fc4704. As described in http://article.gmane.org/gmane.comp.emulators.qemu/371432 that commit causes linux guests to crash on memory hot-unplug. The original problem it's trying to solve has now been addressed within virtio. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-29virtio: drop virtqueue_map_sgMichael S. Tsirkin2-9/+0
Deprecated in favor of virtqueue_map. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2015-10-29virtio-scsi: convert to virtqueue_mapMichael S. Tsirkin1-14/+2
Note: virtqueue_map already validates input so virtio-scsi does not have to. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>