summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-04-08ehci_free_packet: Discard finished packets when the queue is haltedqemu-kvm-1.2-f18Hans de Goede1-7/+11
With pipelining it is possible to encounter a finished packet when cleaning the queue due to a halt. This happens when a non stall error happens while talking to a real device. In this case the queue on the usb-host side will continue processing packets, and we can have completed packets waiting in the queue after an error condition packet causing a halt. There are 2 reasons to discard the completed packets at this point, rather then writing them back to the guest: 1) The guest expect to be able to cancel and/or change packets after the packet with the error without doing an unlink, so writing them back may confuse the guest. 2) Since the queue does not advance when halted, the writing back of these packets will trigger an assert because p->qtdaddr != q->qtdaddr, causing qemu to abort. Note that discarding these packets means that the guest driver and the device will get out of sync! This is unfortunate, but should not be a problem since with a non stall error (iow an io-error) the 2 are out of sync already anyways. Still this patch adds a warning printf to signal this happening. Note that sofar this has only been seen with a DVB-T receiver, which gives of a MPEG-2 stream, which allows for recovering from lost packets, see: https://bugzilla.redhat.com/show_bug.cgi?id=890320 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03ehci: Fixup q->qtdaddr after cancelling an already completed packetHans de Goede1-0/+4
This avoids the q->qtdaddr == p->qtdaddr asserts we have triggering, when a queue contains multiple completed packages when we cancel the queue. I triggered this with windows7 + async interrupt endpoint handling (*) + not detecting circles in ehci_fill_queue() properly, which makes the qtd validation in ehci_fill_queue fail, causing cancellation of the queue on every mouse event ... *) Which is not going upstream as it will cause loss of interrupt events on migration. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from ff80ce599e0465cc6109a38bd3a8ca1890e88891)
2013-04-03ehci: Don't access packet after freeing itHans de Goede1-4/+5
ehci_state_writeback() will free the packet, so we should not access the packet after calling ehci_state_writeback(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from 30d68cf6e156b97fc462e18f38ce83f44702cd7f)
2013-04-03qxl: Add rom_size compat property, fix migration from 1.2Cole Robinson2-5/+12
Commit 038c1879a00153b14bce113315b693e8c2944fa9 changed the qxl rom size to 8192, which fixes incoming migration from qemu 1.0. However from qemu 1.2 and 1.3 had rom size 16384, so incoming migration from those versions is now broken. Add a rom_size compat property. 1.2+ get 16384, everything else is 8192. This isn't actually fool proof, since rom_size can be dependent on the version of spice qemu is built against: https://lists.gnu.org/archive/html/qemu-devel/2013-02/msg03154.html However these sizes match what native Fedora packages get, so it's good enough for now.
2013-04-03qxl: change rom size to 8192Alon Levy1-6/+7
This is a simpler solution to 869981, where migration breaks since qxl's rom bar size has changed. Instead of ignoring fields in QXLRom, which is what has actually changed, we remove some of the modes, a mechanism already accounted for by the guest. The modes left allow for portrait and landscape only modes, corresponding to orientations 0 and 1. Orientations 2 and 3 are dropped. Added assert so that rom size will fit the future QXLRom increases via spice-protocol changes. This patch has been tested with 6.1.0.10015. With the newer 6.1.0.10016 there are problems with both "(flipped)" modes prior to the patch, and the patch loses the ability to set "Portrait" modes. But this is a separate bug to be fixed in the driver, and besides the patch doesn't affect the new arbitrary mode setting functionality. Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit 038c1879a00153b14bce113315b693e8c2944fa9)
2013-04-03pci-assign: Enable MSIX on device to match guestAlex Williamson1-2/+15
When a guest enables MSIX on a device we evaluate the MSIX vector table, typically find no unmasked vectors and don't switch the device to MSIX mode. This generally works fine and the device will be switched once the guest enables and therefore unmasks a vector. Unfortunately some drivers enable MSIX, then use interfaces to send commands between VF & PF or PF & firmware that act based on the host state of the device. These therefore may break when MSIX is managed lazily. This change re-enables the previous test used to enable MSIX (see qemu-kvm a6b402c9), which basically guesses whether a vector will be used based on the data field of the vector table. Cc: qemu-stable@nongnu.org Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit feb9a2ab4b0260d8d680a7ffd25063dafc7ec628) Conflicts: hw/kvm/pci-assign.c
2013-04-03qxl: better vga init in enter_vga_modeGerd Hoffmann1-1/+1
Ask the vga core to update the display. Will trigger dpy_gfx_resize if needed. More complete than just calling dpy_gfx_resize. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit c099e7aa0295678859d58e9e60b7619f6ae3bac8) Conflicts: hw/qxl.c
2013-04-03vmware_vga: fix out of bounds and invalid rects updatingMichael Tokarev1-0/+18
This is a follow up for several attempts to fix this issue. Previous incarnations: 1. http://thread.gmane.org/gmane.linux.ubuntu.bugs.general/3156089 https://bugs.launchpad.net/bugs/918791 "qemu-kvm dies when using vmvga driver and unity in the guest" bug. Fix by Serge Hallyn: https://launchpadlibrarian.net/94916786/qemu-vmware.debdiff This fix is incomplete, since it does not check width and height for being negative. Serge weren't sure if that's the right place to fix it, maybe the fix should be up the stack somewhere. 2. http://thread.gmane.org/gmane.comp.emulators.qemu/166064 by Marek Vasut: "vmware_vga: Redraw only visible area" This one adds the (incomplete) check to vmsvga_update_rect_delayed(), the routine just queues the rect updating but does no interesting stuff. It is also incomplete in the same way as patch by Serge, but also does not touch width&height at all after adjusting x&y, which is wrong. As far as I can see, when processing guest requests, the device places them into a queue (vmsvga_update_rect_delayed()) and processes this queue in different place/time, namely, in vmsvga_update_rect(). Sometimes, vmsvga_update_rect() is called directly, without placing the request to the gueue. This is the place this patch changes, which is the last (deepest) in the stack. I'm not sure if this is the right place still, since it is possible we have some queue optimization (or may have in the future) which will be upset by negative/wrong values here, so maybe we should check for validity of input right when receiving request from the guest (and maybe even use unsigned types there). But I don't know the protocol and implementation enough to have a definitive answer. But since vmsvga_update_rect() has other sanity checks already, I'm adding the missing ones there as well. Cc'ing BALATON Zoltan and Andrzej Zaborowski who shows in `git blame' output and may know something in this area. If this patch is accepted, it should be applied to all active stable branches (at least since 1.1, maybe even before), with minor context change (ds_get_*(s->vga.ds) => s->*). I'm not Cc'ing -stable yet, will do it explicitly once the patch is accepted. BTW, these checks use fprintf(stderr) -- it should be converted to something more appropriate, since stderr will most likely disappear somewhere. Cc: Marek Vasut <marex@denx.de> CC: Serge Hallyn <serge.hallyn@ubuntu.com> Cc: BALATON Zoltan <balaton@eik.bme.hu> Cc: Andrzej Zaborowski <balrogg@gmail.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com> (cherry picked from commit 8cb6bfb54e91b1a31a6ae704def595c2099efde1) Conflicts: hw/vmware_vga.c
2013-04-03iscsi: look for pkg-config file tooPaolo Bonzini1-1/+7
Due to library conflicts, Fedora will have to put libiscsi in /usr/lib/iscsi. Simplify configuration by using a pkg-config file. The Fedora package will distribute one, and the patch to add it has been sent to upstream libiscsi as well. Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-03scsi: fix segfault with 0-byte diskPaolo Bonzini1-2/+2
When a 0-sized disk is found, READ CAPACITY will return a LUN NOT READY error. However, because it returns -1 instead of zero, the HBA will call scsi_req_continue. This will typically cause a segmentation fault or an assertion failure. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-03Revert "serial: fix retry logic"Michael Tokarev1-3/+1
This reverts commit 67c5322d7000fd105a926eec44bc1765b7d70bdd: I'm not sure if the retry logic has ever worked when not using FIFO mode. I found this while writing a test case although code inspection confirms it is definitely broken. The TSR retry logic will never actually happen because it is guarded by an 'if (s->tsr_rety > 0)' but this is the only place that can ever make the variable greater than zero. That effectively makes the retry logic an 'if (0) I believe this is a typo and the intention was >= 0. Once this is fixed thoug I see double transmits with my test case. This is because in the non FIFO case, serial_xmit may get invoked while LSR.THRE is still high because the character was processed but the retransmit timer was still active. We can handle this by simply checking for LSR.THRE and returning early. It's possible that the FIFO paths also need some attention. Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Even if the previous logic was never worked, new logic breaks stuff - namely, qemu -enable-kvm -nographic -kernel /boot/vmlinuz-$(uname -r) -append console=ttyS0 -serial pty the above command will cause the virtual machine to stuck at startup using 100% CPU till one connects to the pty and sends any char to it. Note this is rather typical invocation for various headless virtual machines by libvirt. So revert this change for now, till a better solution will be found. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-03e1000: Discard oversized packets based on SBP|LPEMichael Contreras1-2/+5
Discard packets longer than 16384 when !SBP to match the hardware behavior. Signed-off-by: Michael Contreras <michael@inetric.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
2013-04-03seccomp: adding new syscalls (bugzilla 855162)Eduardo Otubo1-17/+139
According to the bug 855162[0] - there's the need of adding new syscalls to the whitelist when using Qemu with Libvirt. [0] - https://bugzilla.redhat.com/show_bug.cgi?id=855162 Reported-by: Paul Moore <pmoore@redhat.com> Tested-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Eduardo Otubo <otubo@linux.vnet.ibm.com> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-03libcacard: fix missing symbol in libcacard.soAlon Levy1-1/+1
Before patch: $ make libcacard.la $ nm ./libcacard/.libs/libcacard.so.0.0.0 | grep " U " | \ egrep -v "(g_)|(GLIBC)|(SECMOD)|(PK11)|(CERT)|(NSS)|(PORT)|(PR)" U error_set Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-03configure: move vscclient binary under libcacardAlon Levy4-9/+14
build rule is in top level Makefile like other tools. build rule also exists in libcacard for installation purposes. This was fixed in a better way in 1.3.0-rc2
2013-04-03libcacard: fix missing symbols in libcacard.soAlon Levy1-1/+1
2013-04-03dtrace backend: add function to reserved wordsAlon Levy1-1/+1
Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2013-04-03arm_boot: Change initrd load address to "halfway through RAM"Peter Maydell2-15/+27
To avoid continually having to bump the initrd load address to account for larger kernel images, put the initrd halfway through RAM. This allows large kernels on new boards with lots of RAM to work OK, without breaking existing usecases for boards with only 32MB of RAM. Note that this change fixes in passing a bug where we were passing an overly large max_size to load_image_targphys() for the initrd, which meant that we wouldn't correctly refuse to load an enormous initrd that didn't actually fit into RAM. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-04-03configure: Add --disable-kvm-optionsCole Robinson1-1/+10
In Fedora, our qemu package is based on qemu-kvm, and we go to convoluted lengths to provide a qemu-kvm binary with KVM on by default, but all qemu-system-* with KVM off by default (using ./configure --disable-kvm) For qemu-system*, what we really want is upstream qemu symantics of TCG by default, but the opt in option for KVM. CONFIG_KVM_OPTIONS fits the bill, so let's expose it through ./configure. This will also simplify our packaging for non-x86 KVM. Signed-off-by: Cole Robinson <crobinso@redhat.com>
2013-04-03mips: Fix link error with 'piix4_pm_init'Cole Robinson1-0/+1
LINK mips-softmmu/qemu-system-mips LINK m68k-softmmu/qemu-system-m68k hw/mips/../mips_malta.o: In function `mips_malta_init': /home/crobinso/qemu-kvm/hw/mips/../mips_malta.c:961: undefined reference to `piix4_pm_init' Signed-off-by: Cole Robinson <crobinso@redhat.com>
2013-04-03usb-redir: Don't make migration fail in none seamless caseHans de Goede1-4/+9
Instead simple disconnect the device like host redirection does on migration. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03usb-redir: Change usbredir_open_chardev into usbredir_create_parserHans de Goede1-6/+5
As we need to create the parser at more places. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03usb-redir: Adjust pkg-config check for usbredirparser .pc file rename (v2)Hans de Goede1-3/+3
The usbredir 0.5 release introduced the new API for 64 bit packet ids, but it kept the libusbredirparser.pc name as is, meaning that older versions of qemu will still have their pkg-config check for usbredirparser fulfilled, and build with the usb-redir device. Due to the API change there will be some compiler warnings, but the build will succeed, however the usb-redir device will be broken on 32 bit machines. To solve this a new usbredir-0.5.2 release is coming, which renames the libusbredirparser.pc file to libusbredirparser-0.5.pc, so that it will no longer fulfill the pkg-config check of the qemu-1.2 and older releases, stopping the (silent) breakage. This patch adjusts qemu master's configure to properly detect the new usbredir release. Changes in v2: -Not only use the new .pc name in the check but also when getting cflags and libs! Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03ehci: Fix interrupt packet MULT handlingHans de Goede1-20/+19
There are several issues with our handling of the MULT epcap field of interrupt qhs, which this patch fixes. 1) When we don't execute a transaction because of the transaction counter being 0, p->async stays EHCI_ASYNC_NONE, and the next time we process the same qtd we hit an assert in ehci_state_fetchqtd because of this. Even though I believe that this is caused by 3 below, this patch still removes the assert, as that can still happen without 3, when multiple packets are queued for the same interrupt ep. 2) We only *check* the transaction counter from ehci_state_execute, any packets queued up by fill_queue bypass this check. This is fixed by not calling fill_queue for interrupt packets. 3) Some versions of Windows set the MULT field of the qh to 0, which is a clear violation of the EHCI spec, but still they do it. This means that we will never execute a qtd for these, making interrupt ep-s on USB-2 devices not work, and after recent changes, triggering 1). So far we've stored the transaction counter in our copy of the mult field, but with this beginnig at 0 already when dealing with these version of windows this won't work. So this patch adds a transact_ctr field to our qh struct, and sets this to the MULT field value on fetchqh. When the MULT field value is 0, we set it to 4. Assuming that windows gets way with setting it to 0, by the actual hardware going horizontal on a 1 -> 0 transition, which will give it 4 transactions (MULT goes from 0 - 3). Note that we cannot stop on detecting the 1 -> 0 transition, as our decrement of the transaction counter, and checking for it are done in 2 different places. Reported-by: Shawn Starr <shawn.starr@rogers.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03usb-redir: Revert usb-redir part of commit 93bfef4cHans de Goede1-1/+0
Commit 93bfef4c6e4b23caea9d51e1099d06433d8835a4 makes qemu-devices which report the qemu version string to the guest in some way use a qemu_get_version function which reports a machine-specific version string. However usb-redir does not expose the qemu version to the guest, only to the usbredir-host as part of the initial handshake. This can then be logged on the usbredir-host side for debugging purposes and is otherwise completely unused! For debugging purposes it is important to have the real qemu version in there, rather then the machine-specific version. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03usb-redir: Add chardev open / close debug loggingHans de Goede1-0/+6
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03usb-redir: Add support for migrationHans de Goede1-3/+346
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03usb-redir: Store max_packet_size in endp_dataHans de Goede1-1/+3
So that we've a place to migrate it to / from to allow restoring it after migration. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03usb-redir: Add an already_in_flight packet-id queueHans de Goede1-0/+43
After a live migration, the usb-hcd will re-queue all packets by walking over the schedule in the guest memory again, but requests which were encountered on the migration source before will already be in flight, so these should *not* be re-send to the usbredir-host. This patch adds an already in flight packet ud queue, which will be filled by the source before migration and then moved over to the migration dest, any async handled packets are then checked against this queue to avoid sending the same packet to the usbredir-host twice. Signed-off-by: Hans de Goede <hdegoede@redhat,com>
2013-04-03usb-redir: Change cancelled packet code into a generic packet-id queueHans de Goede1-31/+71
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-03xhci: kill xhci_mem_{read,write} dispatcher functionsGerd Hoffmann1-65/+75
... and register subregions instead, so we offload the dispatching to the the memory subsystem which is designed to handle it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: support multiple interruptersGerd Hoffmann1-5/+1
Everything is in place, flip the big switch now and enable support for multiple interrupters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: pick target interrupterGerd Hoffmann1-6/+16
Pick the correct interrupter when queuing an event. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: prepare xhci_runtime_{read,write} for multiple interruptersGerd Hoffmann1-43/+57
Prepare xhci runtime register access function for multiple interrupters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: add XHCIInterrupterGerd Hoffmann2-148/+161
Move all state belonging to the (single) interrupter into a separate struct. First step in adding support for multiple interrupters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: move register update into xhci_intr_raiseGerd Hoffmann1-9/+5
Now that we have a separate function to raise an IRQ we can move some comon code into the function. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: add msix supportGerd Hoffmann2-1/+49
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: rework interrupt handlingGerd Hoffmann1-14/+33
Split xhci_irq_update into a function which handles intx updates (including lowering the irq line once the guests acks the interrupt) and one which is used for raising an irq only. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: fix & cleanup msi.Gerd Hoffmann1-18/+9
Drop custom write_config function which isn't needed any more. Make the msi property a bit property so it accepts 'on' & 'off'. Enable MSI by default. TODO: add compat property to disable on old machine types. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03usb-storage: usb3 supportGerd Hoffmann1-3/+43
Add usb3 descriptors to usb-storage, so it shows up as superspeed device when connected to xhci. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03usb3: bos decriptorGerd Hoffmann4-0/+141
Add support for creating BOS descriptor and device cappability descriptors. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03usb3: superspeed endpoint companionGerd Hoffmann3-20/+62
Add support for building superspeed endpoint companion descriptors, create them for superspeed usb devices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03usb3: superspeed descriptorsGerd Hoffmann2-1/+10
Add superspeed descriptor entry to USBDesc, advertise superspeed support when present. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: update port handlingGerd Hoffmann1-40/+97
This patch changes the way xhci ports are linked to USBPorts. The fixed 1:1 relationship between xhci ports and USBPorts is gone. Now each USBPort represents a physical plug which has usually two xhci ports assigned: one usb2 and ond usb3 port. usb devices show up at one or the other, depending on whenever they support superspeed or not. This patch also makes the number of usb2 and usb3 ports runtime configurable by adding 'p2' and 'p3' properties. It is allowed to have different numbers of usb2 and usb3 ports. Specifying p2=4,p3=2 will give you an xhci adapter which supports all speeds on physical ports 1+2 and usb2 only on ports 3+4.
2013-04-03xhci: update register layoutGerd Hoffmann1-8/+13
Change the register layout to be a bit more sparse and also not depend on the number of ports. Useful when for making the number of ports runtime-configurable.
2013-04-03xhci: add trace_usb_xhci_ep_set_dequeueGerd Hoffmann2-1/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: trace cc codes in cleartextGerd Hoffmann2-2/+48
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: iso xfer supportGerd Hoffmann1-16/+101
Add support for iso transfers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: implement mfindexGerd Hoffmann1-7/+46
Implement mfindex register and mfindex wrap event. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: move device lookup into xhci_setup_packetGerd Hoffmann1-36/+38
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>