aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-08-21kvm: i8254: Cache kernel clock offset in KVMPITStateJan Kiszka
To prepare the final fix for clock calibration issues with the in-kernel PIT, we want to cache the offset between vmclock and the clock used by the in-kernel PIT. So far, we only need to update it when the VM state changes between running and stopped because we only read the in-kernel PIT state while the VM is running. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> (cherry picked from commit 205df4d1a87cbb14a50655fb2c0a987467fb29d6) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21ahci: Fix ahci cdrom read corruptions for reads > 128kJason Baron
While testing q35, which has its cdrom attached to the ahci controller, I found that the Fedora 17 install would panic on boot. The panic occurs while squashfs is trying to read from the cdrom. The errors are: [ 8.622711] SQUASHFS error: xz_dec_run error, data probably corrupt [ 8.625180] SQUASHFS error: squashfs_read_data failed to read block 0x20be48a I was also able to produce corrupt data reads using an installed piix based qemu machine, using 'dd'. I found that the corruptions were only occuring when then read size was greater than 128k. For example, the following command results in corrupted reads: dd if=/dev/sr0 of=/tmp/blah bs=256k iflag=direct The > 128k size reads exercise a different code path than 128k and below. In ide_atapi_cmd_read_dma_cb() s->io_buffer_size is capped at 128k. Thus, ide_atapi_cmd_read_dma_cb() is called a second time when the read is > 128k. However, ahci_dma_rw_buf() restart the read from offset 0, instead of at 128k. Thus, resulting in a corrupted read. To fix this, I've introduced 'io_buffer_offset' field in IDEState to keep track of the offset. I've also modified ahci_populate_sglist() to take a new 3rd offset argument, so that the sglist is property initialized. I've tested this patch using 'dd' testing, and Fedora 17 now correctly boots and installs on q35 with the cdrom ahci controller. Signed-off-by: Jason Baron <jbaron@redhat.com> Tested-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 61f52e06f0a21bab782f98ef3ea789aa6d0aa046) Conflicts: hw/ide/ahci.c Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21ahci: Fix sglist memleak in ahci_dma_rw_buf()Jason Baron
I noticed that in hw/ide/ahci:ahci_dma_rw_buf() we do not free the sglist. Thus, I've added a call to qemu_sglist_destroy() to fix this memory leak. In addition, I've adeed a call in qemu_sglist_destroy() to 0 all of the sglist fields, in case there is some other codepath that tries to free the sglist. Signed-off-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit ea8d82a1ed72634f089ed1bccccd9c84cc1ab855) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21apic: Defer interrupt updates to VCPU threadJan Kiszka
KVM performs TPR raising asynchronously to QEMU, specifically outside QEMU's global lock. When an interrupt is injected into the APIC and TPR is checked to decide if this can be delivered, a stale TPR value may be used, causing spurious interrupts in the end. Fix this by deferring apic_update_irq to the context of the target VCPU. We introduce a new interrupt flag for this, CPU_INTERRUPT_POLL. When it is set, the VCPU calls apic_poll_irq before checking for further pending interrupts. To avoid special-casing KVM, we also implement this logic for TCG mode. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com> (cherry picked from commit 5d62c43a17edaa7f6a88821c9086e6c8e0e5327d) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21apic: Reevaluate pending interrupts on LVT_LINT0 changesJan Kiszka
When the guest modifies the LVT_LINT0 register, we need to check if some pending PIC interrupt can now be delivered. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com> (cherry picked from commit a94820ddc36f8c452b37f9dcb323f55ffdbc75f9) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21apic: Resolve potential endless loop around apic_update_irqJan Kiszka
Commit d96e173769 refactored the reinjection of pending PIC interrupts. However, it missed the potential loop of apic_update_irq -> apic_deliver_pic_intr -> apic_local_deliver -> apic_set_irq -> apic_update_irq that /could/ occur if LINT0 is injected as APIC_DM_FIXED and that vector is currently blocked via TPR. Resolve this by reinjecting only where it matters: inside apic_get_interrupt. This function may clear a vector while a PIC-originated reason still exists. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com> (cherry picked from commit 3db3659bf60094657e1465cc809acb09551816ee) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21slirp: Improve error reporting of inaccessible smb directoriesJan Kiszka
Instead of guessing, print the error code returned by access. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> (cherry picked from commit 22a61f365df83d5d7884cceb1c462295977cb2db) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21slirp: Ensure smbd and shared directory exist when enable smbDunrong Huang
Users may pass the following parameters to qemu: $ qemu-kvm -net nic -net user,smb= ... $ qemu-kvm -net nic -net user,smb ... $ qemu-kvm -net nic -net user,smb=bad_directory ... In these cases, qemu started successfully while samba server failed to start. Users will confuse since samba server failed silently without any indication of what it did wrong. To avoid it, we check whether the shared directory exist and if users have permission to access this directory when QEMU's "built-in" SMB server is enabled. Signed-off-by: Dunrong Huang <riegamaths@gmail.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> (cherry picked from commit 927d811b282ffdf5386bd63f435c1507634ba49a) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21slirp: Enforce host-side user of smb shareJan Kiszka
Windows 7 (and possibly other versions) cannot connect to the samba share if the exported host directory is not world-readable. This can be resolved by forcing the username used for access checks to the one under which QEMU and smbd are running. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> (cherry picked from commit 1cb1c5d10bb9e180bd3f7be2c10b212ed86a97b4) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21check-qjson: add test for large JSON objectsMichael Roth
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 7109edfeb69c1d3c2164175837784dfcd210fed0) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21json-parser: don't replicate tokens at each level of recursionMichael Roth
Currently, when parsing a stream of tokens we make a copy of the token list at the beginning of each level of recursion so that we do not modify the original list in cases where we need to fall back to an earlier state. In the worst case, we will only read 1 or 2 tokens off the list before recursing again, which means an upper bound of roughly N^2 token allocations. For a "reasonably" sized QMP request (in this a QMP representation of cirrus_vga's device state, generated via QIDL, being passed in via qom-set), this caused my 16GB's of memory to be exhausted before any noticeable progress was made by the parser. This patch works around the issue by using single copy of the token list in the form of an indexable array so that we can save/restore state by manipulating indices. A subsequent commit adds a "large_dict" test case which exhibits the same behavior as above. With this patch applied the test case successfully completes in under a second. Tested with valgrind, make check, and QMP. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 65c0f1e9558c7c762cdb333406243fff1d687117) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21qlist: add qlist_size()Michael Roth
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit a86a4c2f7b7f0b72816ea1c219d8140699b6665b) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21usb-ehci: Fix an assert whenever isoc transfers are usedHans de Goede
hcd-ehci.c is missing an usb_packet_init() call for the ipacket UsbPacket it uses for isoc transfers, triggering an assert (taking the entire vm down) in usb_packet_setup as soon as any isoc transfers are done by a high speed USB device. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit 7341ea075c09258b98a1d0efc60efd402cbfc9b4) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21usb-redir: Correctly handle the usb_redir_babble usbredir statusHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit adae502c0ae4572ef08f71cb5b5ed5a8e90299fe) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21usb: restore USBDevice->attached on vmloadGerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit 495d544798151206bafca65ec588c0388637eb40) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21uhci: fix uhci_async_cancel_allGerd Hoffmann
We update the QTAILQ in the loop, thus we must use the SAFE version to make sure we don't touch the queue struct after freeing it. https://bugzilla.novell.com/show_bug.cgi?id=766310 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit 77fa9aee38758a078870e25f0dcf642066b4d5cc) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21ehci: don't flush cache on doorbell rings.Gerd Hoffmann
Commit 4be23939ab0d7019c7e59a37485b416fbbf0f073 makes ehci instantly zap any unlinked queue heads when the guest rings the doorbell. While hacking up uas support this turned out to be a problem. The linux kernel can unlink and instantly relink the very same queue head, thereby killing any async packets in flight. That alone isn't an issue yet, the packet will canceled and resubmitted and everything is fine. We'll run into trouble though in case the async packet is completed already, so we can't cancel it any more. The transaction is simply lost then. usb_ehci_qh_ptrs q (nil) - QH @ 39c4f000: next 39c4f122 qtds 00000000,00000001,39c50000 usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0 usb_ehci_qh_ptrs q 0x7f95feba90a0 - QH @ 39c4f000: next 39c4f122 qtds 00000000,00000001,39c50000 usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0 usb_ehci_qh_ptrs q 0x7f95fe515210 - QH @ 39c4f120: next 39c4f0c2 qtds 29dbce40,29dbc4e0,00000009 usb_ehci_qh_fields QH @ 39c4f120 - rl 4, mplen 512, eps 2, ep 1, dev 2 usb_ehci_packet_action q 0x7f95fe515210 p 0x7f95fdec32a0: alloc usb_packet_state_change bus 0, port 2, ep 1, packet 0x7f95fdec32e0, state undef -> setup usb_ehci_packet_action q 0x7f95fe515210 p 0x7f95fdec32a0: process usb_uas_command dev 2, tag 0x2, lun 0, lun64 00000000-00000000 scsi_req_parsed target 0 lun 0 tag 2 command 42 dir 2 length 16384 scsi_req_parsed_lba target 0 lun 0 tag 2 command 42 lba 5933312 scsi_req_alloc target 0 lun 0 tag 2 scsi_req_continue target 0 lun 0 tag 2 scsi_req_data target 0 lun 0 tag 2 len 16384 usb_uas_scsi_data dev 2, tag 0x2, bytes 16384 usb_uas_write_ready dev 2, tag 0x2 usb_packet_state_change bus 0, port 2, ep 1, packet 0x7f95fdec32e0, state setup -> complete usb_ehci_packet_action q 0x7f95fe515210 p 0x7f95fdec32a0: free usb_ehci_qh_ptrs q 0x7f95fdec3210 - QH @ 39c4f0c0: next 39c4f002 qtds 29dbce40,00000001,00000009 usb_ehci_qh_fields QH @ 39c4f0c0 - rl 4, mplen 512, eps 2, ep 2, dev 2 usb_ehci_queue_action q 0x7f95fe5152a0: free usb_packet_state_change bus 0, port 2, ep 2, packet 0x7f95feba9170, state async -> complete ^^^ async packets completes. usb_ehci_packet_action q 0x7f95fdec3210 p 0x7f95feba9130: wakeup usb_ehci_qh_ptrs q (nil) - QH @ 39c4f000: next 39c4f122 qtds 00000000,00000001,39c50000 usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0 usb_ehci_qh_ptrs q 0x7f95feba90a0 - QH @ 39c4f000: next 39c4f122 qtds 00000000,00000001,39c50000 usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0 usb_ehci_qh_ptrs q 0x7f95fe515210 - QH @ 39c4f120: next 39c4f002 qtds 29dbc4e0,29dbc8a0,00000009 usb_ehci_qh_fields QH @ 39c4f120 - rl 4, mplen 512, eps 2, ep 1, dev 2 usb_ehci_queue_action q 0x7f95fdec3210: free usb_ehci_packet_action q 0x7f95fdec3210 p 0x7f95feba9130: free ^^^ endpoint #2 queue head removed from schedule, doorbell makes ehci zap the queue, the (completed) usb packet is freed too and gets lost. usb_ehci_qh_ptrs q (nil) - QH @ 39c4f000: next 39c4f0c2 qtds 00000000,00000001,39c50000 usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0 usb_ehci_qh_ptrs q 0x7f95feba90a0 - QH @ 39c4f000: next 39c4f0c2 qtds 00000000,00000001,39c50000 usb_ehci_qh_fields QH @ 39c4f000 - rl 0, mplen 0, eps 0, ep 0, dev 0 usb_ehci_queue_action q 0x7f9600dff570: alloc usb_ehci_qh_ptrs q 0x7f9600dff570 - QH @ 39c4f0c0: next 39c4f122 qtds 29dbce40,00000001,00000009 usb_ehci_qh_fields QH @ 39c4f0c0 - rl 4, mplen 512, eps 2, ep 2, dev 2 usb_ehci_packet_action q 0x7f9600dff570 p 0x7f95feba9130: alloc usb_packet_state_change bus 0, port 2, ep 2, packet 0x7f95feba9170, state undef -> setup usb_ehci_packet_action q 0x7f9600dff570 p 0x7f95feba9130: process usb_packet_state_change bus 0, port 2, ep 2, packet 0x7f95feba9170, state setup -> async usb_ehci_packet_action q 0x7f9600dff570 p 0x7f95feba9130: async ^^^ linux kernel relinked the queue head, ehci creates a new usb packet, but we should have delivered the completed one instead. usb_ehci_qh_ptrs q 0x7f95fe515210 - QH @ 39c4f120: next 39c4f002 qtds 29dbc4e0,29dbc8a0,00000009 usb_ehci_qh_fields QH @ 39c4f120 - rl 4, mplen 512, eps 2, ep 1, dev 2 So instead of instantly zapping the queue we'll set a flag that the queue needs revalidation in case we'll see it again in the schedule. ehci then checks that the queue head fields addressing / describing the endpoint and the qtd pointer match the cached content before reusing it. Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit 9bc3a3a216e2689bfcdd36c3e079333bbdbf3ba0) Conflicts: hw/usb/hcd-ehci.c Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21ehci: fix resetGerd Hoffmann
Check for the reset bit first when processing USBCMD register writes. Also break out of the switch, there is no need to check the other bits. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit 7046530c36fa3a3f87692bdb54556f5d891a9c03) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21virtio-blk: fix use-after-free while handling scsi commandsAvi Kivity
The scsi passthrough handler falls through after completing a request into the failure path, resulting in a use after free. Reproducible by running a guest with aio=native on a block device. Reported-by: Stefan Priebe <s.priebe@profihost.ag> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 730a9c53b4e52681fcfe31cf38854cbf91e132c7) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21qdev: fix use-after-free in the error path of qdev_init_nofailAnthony Liguori
From Markus: Before: $ qemu-system-x86_64 -display none -drive if=ide qemu-system-x86_64: Device needs media, but drive is empty qemu-system-x86_64: Initialization of device ide-hd failed [Exit 1 ] After: $ qemu-system-x86_64 -display none -drive if=ide qemu-system-x86_64: Device needs media, but drive is empty Segmentation fault (core dumped) [Exit 139 (SIGSEGV)] This error always existed as qdev_init() frees the object. But QOM goes a bit further and purposefully sets the class pointer to NULL to help find use-after-free. It worked :-) Cc: Andreas Faerber <afaerber@suse.de> Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 7de3abe505e34398cef5bddf6c4d0bd9ee47007f) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21kvmvapic: Disable if there is insufficient memoryJan Kiszka
We need at least 1M of RAM to map the option ROM. Otherwise, we will corrupt host memory or even crash: $ qemu-system-x86_64 -nodefaults --enable-kvm -vnc :0 -m 640k Segmentation fault (core dumped) Reported-and-tested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> (cherry picked from commit a9605e0317c7a6d5e68f3a3b6708c8ef1096f4bc) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21s390: Fix error handling and condition code of service callChristian Borntraeger
Invalid sccb addresses will cause specification or addressing exception. Lets add those checks. Furthermore, the good case (cc=0) was incorrect for KVM, we did not set the CC at all. We now use return codes < 0 as program checks and return codes > 0 as condition code values. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de> (cherry picked from commit 9abf567d95a4e840df868ca993219175fbef8c22) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21ppc: Fix bug in handling of PAPR hypercall exitsDavid Gibson
Currently for powerpc, kvm_arch_handle_exit() always returns 1, meaning that its caller - kvm_cpu_exec() - will always exit immediately afterwards to the loop in qemu_kvm_cpu_thread_fn(). There's no need to do this. Once we've handled the hypercall there's no reason we can't go straight around and KVM_RUN again, which is what ret = 0 will signal. The only exception might be for hypercalls which affect the state of cpu_can_run(), however the only one that might do this is H_CEDE and for kvm that is always handled in the kernel, not qemu. Furtherm setting ret = 0 means that when exit_requested is set from a hypercall, we will enter KVM_RUN once more with a signal which lets the the kernel do its internal logic to complete the hypercall with out actually executing any more guest code. This is important if our hypercall also triggered a reset, which previously would re-initialize everything without completing the hypercall. This caused the kernel to get confused because it thought the guest was still in the middle of a hypercall when it has actually been reset. This patch therefore changes to ret = 0, which is both a bugfix and a small optimization. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de> (cherry picked from commit 78e8fde26c032931ca2ae13bfc7c59e38afd17ee) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21configure: Don't override user's --cpu on MacOS and SolarisPeter Maydell
Both MacOS and Solaris have special case handling for the CPU type, because the check_define probes will return i386 even if the hardware is 64 bit and x86_64 would be preferable. Move these checks earlier in the configure probing so that we can do them only if the user didn't specify a CPU with --cpu. This fixes a bug where the user's command line argument was being ignored. Reviewed-by: Andreas F=E4rber <afaerber@suse.de> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit bbea4050802a2e7e0296a21823c0925782c02b93) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-08-21qtest: fix infinite loop when QEMU aborts abruptlyAnthony Liguori
From Markus: Makes "make check" hang: QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 gtester -k --verbose -m=quick tests/crash-test tests/rtc-test TEST: tests/crash-test... (pid=972) qemu-system-x86_64: Device needs media, but drive is empty [Nothing happens, wait a while, then hit ^C] make: *** [check-qtest-x86_64] Interrupt This was due to the fact that we weren't checked for errors when reading from the QMP socket. This patch adds appropriate error checking. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 039380a8e18f618cdacf72486449c04dc1b70eef) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-07-16Merge tag 'v1.1.1' into stable-1.1qemu-kvm-1.1.1Avi Kivity
* tag 'v1.1.1': (34 commits) update VERSION for v1.1.1 s390x: fix s390 virtio aliases rtl8139: validate rx ring before receiving packets ahci: SATA FIS is 20 bytes, not 0x20 qemu-img: document qed format on qemu-img man page virtio: Fix compiler warning for non Linux hosts sheepdog: fix return value of do_load_save_vm_state qemu/xendisk: set maximum number of grants to be used build: install qmp-commands.txt fdc: fix implied seek while there is no media in drive qcow2: fix autoclear image header update Prevent disk data loss when closing qemu qcow2: fix endianness conversion pci_bridge_dev: fix error path in pci_bridge_dev_initfn() qdev: release parent properties on dc->init failure intel-hda: Fix reset of MSI function ahci: Fix reset of MSI function rtl8139: honor RxOverflow flag in can_receive method configure: Fix build for some versions of glibc (9pfs) monitor: Fix memory leak with readline completion ... Signed-off-by: Avi Kivity <avi@redhat.com>
2012-07-12update VERSION for v1.1.1Michael Roth
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-07-10Merge remote-tracking branch 'agraf/s390-for-upstream-1.1' into HEADMichael Roth
2012-07-10s390x: fix s390 virtio aliasesAlexander Graf
Some of the virtio devices have the same frontend name, but actually implement different devices behind the scenes through aliases. The indicator which device type to use is the architecture. On s390, we want s390 virtio devices. On everything else, we want PCI devices. Reflect this in the alias selection code. This way we fix commands like -device virtio-blk on s390x which with this patch applied select the correct virtio-blk-s390 device rather than virtio-blk-pci. Reported-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-07-03qemu-kvm: virtio: Do not register mask notifiers without in-kernel irqchip ↵Jan Kiszka
support We crash if we registers mask notifiers without backing in-kernel irqchip. This corresponds to the check in QEMU upstream after 1.1 now. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-07-03qemu-kvm: Add missing default machine optionsJan Kiszka
qemu-kvm-specific machine defaults were missing for pc-0.15 and pc-1.0. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-06-29fdc: fix implied seek while there is no media in driveqemu-kvm-1.1.0Pavel Hrdina
The Windows uses 'READ' command at the start of an instalation without checking the 'dir' register. We have to abort the transfer with an abnormal termination if there is no media in the drive. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-06-29kvm: i8254: Fix conversion of in-kernel to userspace stateJan Kiszka
Due to a offset between the clock used to generate the in-kernel count_load_time (CLOCK_MONOTONIC) and the clock used for processing this in userspace (vm_clock), reading back the output of PIT channel 2 via port 0x61 was broken. One use cases that suffered from it was the CPU frequency calibration of SeaBIOS, which also affected IDE/AHCI timeouts. This fixes it by calibrating the offset between both clocks on kvm_pit_get and adjusting the kernel value before saving it in the userspace state. As the calibration only works while the vm_clock is running, we cache the in-kernel state across stopped phases. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2012-06-29rtl8139: validate rx ring before receiving packetsJason Wang
Commit ff71f2e8cacefae99179993204172bc65e4303df prevent the possible crash during initialization of linux driver by checking the operating mode.This seems too strict as: - the real card could still work in mode other than normal - some buggy driver who does not set correct opmode after eeprom access So, considering rx ring address were reset to zero (which could be safely trated as an address not intened to DMA to), in order to both letting old guest work and preventing the unexpected DMA to guest, we can forbid packet receiving when rx ring address is zero. Tested-by: Avi Kivity <avi@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit fcce6fd25f3e233f9da9ef01230a668ab35bd343) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25ahci: SATA FIS is 20 bytes, not 0x20Daniel Verkamp
As in the SATA and AHCI specifications, a FIS is 5 Dwords of 4 bytes each, which comes to 20 bytes (decimal), not 0x20. Signed-off-by: Daniel Verkamp <daniel@drv.nu> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 4bb9c939a57103898f5a51aa6a7336eb3320d923) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25qemu-img: document qed format on qemu-img man pageStefan Hajnoczi
The qemu-img.1 man page is missing the qed format from its list of supported formats. Document the image creation options for qed. Suggested-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit f085800e245836fed27fddb3b624a29326637657) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25virtio: Fix compiler warning for non Linux hostsStefan Weil
The local variables ret, i are only used if __linux__ is defined. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 47ce9ef7f89032c4079bf5132a12d1bfd4d5bca5) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25sheepdog: fix return value of do_load_save_vm_stateMORITA Kazutaka
bdrv_save_vmstate and bdrv_load_vmstate should return the vmstate size on success, and -errno on error. Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 6f3c714eb7730630241fd0b33b799352d7feb876) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25qemu/xendisk: set maximum number of grants to be usedJan Beulich
Legacy (non-pvops) gntdev drivers may require this to be done when the number of grants intended to be used simultaneously exceeds a certain driver specific default limit. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> (cherry picked from commit 64c27e5b1fdb6d94bdc0bda3b1869d7383a35c65) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25build: install qmp-commands.txtBruce Rogers
File is targeted for install, but is never installed. Signed-off-by: Bruce Rogers <brogers@suse.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> (cherry picked from commit 0cd23fcc0afe0a847e2e68797b64b297b20121f9) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25fdc: fix implied seek while there is no media in drivePavel Hrdina
The Windows uses 'READ' command at the start of an instalation without checking the 'dir' register. We have to abort the transfer with an abnormal termination if there is no media in the drive. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit c52acf60b6c12ff5eb58eb6ac568c159ae0c8737) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25qcow2: fix autoclear image header updateStefan Hajnoczi
The autoclear feature bits can be used for qcow2 file format features that are safe to "drop" by old programs that do not understand the feature. Upon opening the image file unknown autoclear feature bits are cleared and the image file header is rewritten, but this was happening too early in the code when critical header fields were not yet loaded. Process autoclear feature bits after all necessary header information has been loaded. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit af7b708db2d03eb47f7ba44a050439ad9ee65e7a) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25Prevent disk data loss when closing qemuPavel Dovgaluk
Prevent disk data loss when closing qemu console window under Windows 7. v3. Comment for Sleep() parameter was updated. Signed-off-by: Pavel Dovgalyuk<pavel.dovgaluk@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit b75a02829dde98723dfe16fa098338cb267b28b9) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25qcow2: fix endianness conversionZhi Yong Wu
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 87267753a36798e25262ee48264bea2ab70921aa) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25pci_bridge_dev: fix error path in pci_bridge_dev_initfn()Jason Baron
Currently, we do not properly cleanup, if pci_bridge_dev_initfn fails to initialize properly. Make sure to call pci_bridge_exitfn() in the error path. Signed-off-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit 80aa796bf38b7ef21daa42673b4711510c450d8a) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25qdev: release parent properties on dc->init failureJason Baron
While looking into hot-plugging bridges, I can create a qemu segfault via: $ device_add pci-bridge Bridge chassis not specified. Each bridge is required to be assigned a unique chassis id > 0. ** ERROR:qom/object.c:389:object_delete: assertion failed: (obj->ref == 0) I'm proposing to fix this by adding a call to 'object_unparent()', before the call to qdev_free(). I see there is already a precedent for this usage pattern as seen in qdev_simple_unplug_cb(): /* can be used as ->unplug() callback for the simple cases */ int qdev_simple_unplug_cb(DeviceState *dev) { /* just zap it */ object_unparent(OBJECT(dev)); qdev_free(dev); return 0; } Signed-off-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit 266ca11a0433643a3cc3146a9837d9f2b0bfbe3b) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25intel-hda: Fix reset of MSI functionJan Kiszka
Call msi_reset on device reset as still required by the core. CC: Gerd Hoffmann <kraxel@redhat.com> CC: qemu-stable@nongnu.org Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit 8e729e3b521d9fcd87fc2e40b6322e684f58bb2e) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25ahci: Fix reset of MSI functionJan Kiszka
Call msi_reset on device reset as still required by the core. CC: Alexander Graf <agraf@suse.de> CC: qemu-stable@nongnu.org Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit 868a1a52267daddf933ee18480ae036da029b561) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25rtl8139: honor RxOverflow flag in can_receive methodFernando Luis Vazquez Cao
Some drivers (Linux' 8139too among them) rely on the NIC injecting an interrupt in the event of a receive buffer overflow and, accordingly, set the RxOverflow bit in the interrupt mask. Unfortunately rtl8139's can_receive method ignores the RxOverflow flag, which may lead to a situation where rtl8139 stops receiving packets (can_receive returns 0) when the receive buffer becomes full. If the driver eventually read from the receive buffer or reset the card the emulator could recover from this situation. However some implementations only do this upon receiving an interrupt with either RxOK or RxOverflow set in the ISR; interrupt that will never come because QEMU's flow control mechanisms would prevent rtl8139 from receiving any packet. Letting packets go through when the overflow interrupt is enabled makes the QEMU emulator compliant to the spec and solves the problem. This patch should fix a relatively common (in our experience) network stall observed when running enterprise distros with rtl8139 as the NIC; in some cases the 8139too device driver gets loaded and when under heavy load the network eventually stops working. Reported-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp> Tested-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp> Acked-by: Igor Kovalenko <igor.v.kovalenko@gmail.com> Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit fee9d348ffc5c9f80068086799a948996f633f7e) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-25configure: Fix build for some versions of glibc (9pfs)Stefan Weil
Some versions declare open_by_handle_at, but don't define AT_EMPTY_PATH. Extend the check in configure to test both preconditions. Signed-off-by: Stefan Weil <sw@weilnetz.de> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com> (cherry picked from commit acc55ba8b1519bda27be19fad50b65d2b0c7d26d) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>