aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-06-01Fix kVM_GET_ONE_REG interfacestable-1.0Benjamin Herrenschmidt
Qemu-1.0 included some code to use a new get/set one register interface to KVM which unfortunately hadn't settled, and in the end the code that went into the kernel provides a different interface. This updates qemu to use the new interface. Since the 3.3 kernel doesn't provide this interface, in either the new or the old form, this removes the check that caused qemu to bail out if the ioctl returns an error. In fact we don't even print a message, since it got printed once per vcpu, which gets a bit tedious with more than a few vcpus. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-06-01Allow i8259 to build without i8254Benjamin Herrenschmidt
This allows the i8259 emulation to be compiled without the i8254 emulation. Currently the i8259 emulation code references some variables defined in i8254.c for the "time-drift fix". This moves the definitions from i8254.c to i8259.c so that i8259.c becomes independent of i8254.c. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-06-01Fix conditional build of various x86 specific bitsBenjamin Herrenschmidt
This adds/modifies ifdefs etc. and moves code to make sure that x86-specific code doesn't get compiled on non-x86 platforms. These changes all relate to code that is in the qemu-kvm tree and not in the qemu tree. The change from KVM_CAP_IRQCHIP to KVM_IRQCHIP_PIC_MASTER is because the KVM_CAP_IRQCHIP symbol is defined on all platforms (though the capability only exists on x86), whereas KVM_IRQCHIP_PIC_MASTER is only defined on x86. (If a better symbol exists it could be used instead.) Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-04-16Merge remote branch 'stable-1.0.1-qemu/master' into stable-1.0qemu-kvm-1.0.1Marcelo Tosatti
* stable-1.0.1-qemu/master: (36 commits) Version 1.0.1 e1000: bounds packet size against buffer size s390: fix cpu hotplug / cpu activity on interrupts s390x: add TR function for EXECUTE pseries: Don't try to munmap() a malloc()ed TCE table pseries: Populate "/chosen/linux,stdout-path" in the FDT pseries: Add a routine to find a stable "default" vty and use it pseries: Emit device tree nodes in reg order kvm-ppc: halt secondary cpus when guest reset pseries: Fix array overrun bug in PCI code console: Fix segfault on screendump without VGA adapter rbd: always set out parameter in qemu_rbd_snap_list Documentation: Add qemu-img -t parameter in man page qemu-img rebase: Fix for undersized backing files coroutine: switch per-thread free pool to a global pool qiov: prevent double free or use-after-free PPC: Fix linker scripts on ppc hosts target-sh4: ignore ocbp and ocbwb instructions usb-ohci: td.cbp incorrectly updated near page end usb-host: properly release port on unplug & exit ... Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-02-02Version 1.0.1v1.0.1Justin M. Forbes
Signed-off-by: Justin M. Forbes <jforbes@redhat.com>
2012-02-01Merge branch 's390-1.0' of git://repo.or.cz/qemu/agrafJustin M. Forbes
2012-02-01Merge branch 'ppc-1.0' of git://repo.or.cz/qemu/agrafJustin M. Forbes
2012-01-23e1000: bounds packet size against buffer sizeAnthony Liguori
Otherwise we can write beyond the buffer and corrupt memory. This is tracked as CVE-2012-0029. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-12s390: fix cpu hotplug / cpu activity on interruptsChristian Borntraeger
The add_del/running_cpu code and env->halted are tracking stopped cpus. Sleeping cpus (idle and enabled for interrupts) are waiting inside the kernel. No interrupt besides the restart can move a cpu from stopped to operational. This is already handled over there. So lets just remove the bogus wakup from the common interrupt delivery, otherwise any interrupt will wake up a cpu, even if this cpu is stopped (Thus leading to strange hangs on sigp restart) This fixes echo 0 > /sys/devices/system/cpu/cpu0/online echo 1 > /sys/devices/system/cpu/cpu0/online in the guest Signed-off-by: Christian Borntraeger<borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de> (cherry picked from commit 93116ac0cf9734e7b28886aedf03848b37d6785e)
2012-01-12s390x: add TR function for EXECUTEAlexander Graf
Newer gcc versions (or glibc?) also generate code that tries to EXECUTE the TR opcode. Implement it so that we don't break valid guests. Reported-by: Andreas Faerber <afaerber@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-12pseries: Don't try to munmap() a malloc()ed TCE tableDavid Gibson
For the pseries machine, TCE (IOMMU) tables can either be directly malloc()ed in qemu or, when running on a KVM which supports it, mmap()ed from a KVM ioctl. The latter option is used when available, because it allows the (frequent bottlenext) H_PUT_TCE hypercall to be KVM accelerated. However, even when KVM is persent, TCE acceleration is not always possible. Only KVM HV supports this ioctl(), not KVM PR, or the kernel could run out of contiguous memory to allocate the new table. In this case we need to fall back on the malloc()ed table. When a device is removed, and we need to remove the TCE table, we need to either munmap() or free() the table as appropriate for how it was allocated. The code is supposed to do that, but we buggily fail to initialize the tcet->fd variable in the malloc() case, which is used as a flag to determine which is the right choice. This patch fixes the bug, and cleans up error messages relating to this path while we're at it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-12pseries: Populate "/chosen/linux,stdout-path" in the FDTDavid Gibson
There is a device tree property "/chosen/linux,stdout-path" which indicates which device should be used as stdout - ie. "the console". Currently we don't specify anything, which means both firmware and Linux choose something arbitrarily. Use the routine we added in the last patch to pick a default vty and specify it as stdout. Currently SLOF doesn't use the property, but we are hoping to update it to do so. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de> (cherry picked from commit 68f3a94c64bbaaf8c7f2daa70de1b5d87a432f86)
2012-01-12pseries: Add a routine to find a stable "default" vty and use itDavid Gibson
In vty_lookup() we have a special case for supporting early debug in the kernel. This accepts reg == 0 as a special case to mean "any vty". We implement this by searching the vtys on the bus and returning the first we find. This means that the vty we chose depends on the order the vtys are specified on the QEMU command line - because that determines the order of the vtys on the bus. We'd rather the command line order was irrelevant, so instead return the vty with the lowest reg value. This is still a guess as to what the user really means, but it is at least stable WRT command line ordering. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de> [agraf] fix braces (cherry picked from commit 98331f8ad6a3e2cfbb402d72e6be47eac7706251)
2012-01-12pseries: Emit device tree nodes in reg orderDavid Gibson
Although in theory the device tree has no inherent ordering, in practice the order of nodes in the device tree does effect the order that devices are detected by software. Currently the ordering is determined by the order the devices appear on the QEMU command line. Although that does give the user control over the ordering, it is fragile, especially when the user does not generate the command line manually - eg. when using libvirt etc. So order the device tree based on the reg value, ie. the address of on the VIO bus of the devices. This gives us a sane and stable ordering. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de> [agraf] add braces (cherry picked from commit 05c194384f836240ea4c2da5fa3be43a54bff021)
2012-01-12kvm-ppc: halt secondary cpus when guest resetLiu Yu-B13201
When guest reset, we need to halt secondary cpus until guest kick them. This already works for tcg. The patch add the support for kvm. Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de> [agraf: remove in-kernel irqchip code] (cherry picked from commit 157feeadbaec09fe4dca539a24f6f6d327d6eeb6)
2012-01-12pseries: Fix array overrun bug in PCI codeDavid Gibson
spapr_populate_pci_devices() containd a loop with PCI_NUM_REGIONS (7) iterations. However this overruns the 'bars' global array, which only has 6 elements. In fact we only want to run this loop for things listed in the bars array, so this patch corrects the loop bounds to reflect that. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de> (cherry picked from commit 135712de61dfa22368e98914d65b8b0860ec8505)
2012-01-12console: Fix segfault on screendump without VGA adapterAlexander Graf
When trying to create a screen dump without having any VGA adapter inside the guest, QEMU segfaults. This is because it's trying to switch back to the "previous" screen it was on before dumping the VGA screen. Unfortunately, in my case there simply is no previous screen so it accesses a NULL pointer. Fix it by checking if previous_active_console is actually available. This is 1.0 material. Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-10Merge branch 'master' of ssh://git.qemu.org/pub/git/qemu-stable-1.0Justin M. Forbes
2012-01-10rbd: always set out parameter in qemu_rbd_snap_listJosh Durgin
The caller expects psn_tab to be NULL when there are no snapshots or an error occurs. This results in calling g_free on an invalid address. Reported-by: Oliver Francke <Oliver@filoo.de> Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-01-10Documentation: Add qemu-img -t parameter in man pageKevin Wolf
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-01-10qemu-img rebase: Fix for undersized backing filesKevin Wolf
Backing files may be smaller than the corresponding COW file. When reading directly from the backing file, qemu-img rebase must consider this and assume zero sectors after the end of backing files. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-01-10coroutine: switch per-thread free pool to a global poolAvi Kivity
ucontext-based coroutines use a free pool to reduce allocations and deallocations of coroutine objects. The pool is per-thread, presumably to improve locality. However, as coroutines are usually allocated in a vcpu thread and freed in the I/O thread, the pool accounting gets screwed up and we end allocating and freeing a coroutine for every I/O request. This is expensive since large objects are allocated via the kernel, and are not cached by the C runtime. Fix by switching to a global pool. This is safe since we're protected by the global mutex. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-01-10qiov: prevent double free or use-after-freePaolo Bonzini
qemu_iovec_destroy does not clear the QEMUIOVector fully, and the data could thus be used after free or freed again. While I do not know any example in the tree, I observed this using virtio-scsi (and SCSI scatter/gather) when canceling DMA requests. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-01-10PPC: Fix linker scripts on ppc hostsAlexander Graf
When compiling qemu statically with multilib on PPC, we hit the same issue that commit 845f2c2812d9ed24b36c02a3d06ee83aeafe8b49 is fixing. Do the same here. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit 665a04ae1cbfa8004a38cf0fe99ba799c978a1fe)
2012-01-10target-sh4: ignore ocbp and ocbwb instructionsAurelien Jarno
ocbp and ocbwb controls the writeback of a cache line to memory. They are supposed to do nothing in case of a cache miss. Given QEMU only partially emulate caches, it is safe to ignore these instructions. This fixes a kernel oops when trying to access an rtl8139 NIC with recent versions. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit 0cdb95549fedc73e13c147ab9dcabcc303426a07)
2012-01-10usb-ohci: td.cbp incorrectly updated near page endAndriy Gapon
The current code that updates the cbp value after a transfer looks like this: td.cbp += ret; if ((td.cbp & 0xfff) + ret > 0xfff) { <handle page overflow> because the 'ret' value is effectively added twice the check may fire too early when the overflow hasn't happened yet. Below is one of the possible changes that correct the behavior: Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-01-10usb-host: properly release port on unplug & exitGerd Hoffmann
Factor out port release into a separate function. Call release function in exit notifier too. Add explicit call the USBDEVFS_RELEASE_PORT ioctl, just closing the hub file handle seems not to be enougth. Make sure we release the port before resetting the device, otherwise host drivers will not re-attach. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-01-10usb-storage: cancel I/O on resetGerd Hoffmann
When resetting the usb-storage device we'll have to carefully cancel and clear any requests which might be in flight, otherwise we'll confuse the state machine. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-01-10Fix parse of usb device description with multiple configurationsCao,Bing Bu
Changed From V1: Use DPRINTF instead of fprintf,because it is not an error. When testing ipod on QEMU by He Jie Xu<xuhj@linux.vnet.ibm.com>,qemu made a assertion. We found that the ipod with 2 configurations,and the usb-linux did not parse the descriptor correctly. The descr_len returned is the total length of the all configurations,not one configuration. The older version will through the other configurations instead of skip,continue parsing the descriptor of interfaces/endpoints in other configurations,then went wrong. This patch will put the configuration descriptor parse in loop outside and dispel the other configurations not requested. Signed-off-by: Cao,Bing Bu <mars@linux.vnet.ibm.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-01-10pc: fix event_idx compatibility for virtio devicesAnthony Liguori
event_idx was introduced in 0.15 and must be disabled for all virtio-pci devices (including virtio-balloon-pci). Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-10pc: add pc-0.15Anthony Liguori
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-10cris: Handle conditional stores on CRISv10Stefan Sandstrom
Signed-off-by: Stefan Sandstrom <Stefan.Sandstrom@axis.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-01-10configure: Enable build by default PIE / read-only relocation sections on ↵Brad
OpenBSD amd64/i386. Enable build by default PIE / read-only relocation sections for the QEMU binaries on OpenBSD amd64/i386. Signed-off-by: Brad Smith <brad@comstyle.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-10target-i386: fix cmpxchg instruction emulationAndreas Gustafsson
When the i386 cmpxchg instruction is executed with a memory operand and the comparison result is "unequal", do the memory write before changing the accumulator instead of the other way around, because otherwise the new accumulator value will incorrectly be used in the comparison when the instruction is restarted after a page fault. This bug was originally reported on 2010-04-25 as https://bugs.launchpad.net/qemu/+bug/569760 Signed-off-by: Andreas Gustafsson <gson@gson.org>
2012-01-10hw/9pfs: Use the correct signed type for different variablesAneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-10hw/9pfs: replace iovec manipulation with QEMUIOVectorStefan Hajnoczi
The v9fs_read() and v9fs_write() functions rely on iovec[] manipulation code should be replaced with QEMUIOVector to avoid duplicating code. In the future it may be possible to make the code even more concise by using QEMUIOVector consistently across virtio and 9pfs. The "v" format specifier for pdu_marshal() and pdu_unmarshal() is dropped since it does not actually pack/unpack anything. The specifier was also not implemented to update the offset variable and could only be used at the end of a format string, another sign that this shouldn't really be a format specifier. Instead, see the new v9fs_init_qiov_from_pdu() function. This change avoids a possible iovec[] buffer overflow when indirect vrings are used since the number of vectors is now limited by the underlying VirtQueueElement and cannot be out-of-bounds. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-10hw/9pfs: Use the correct file descriptor in Fsdriver CallbackAneesh Kumar K.V
Fsdriver callback that operate on file descriptor need to differentiate between directory fd and file fd. Based on the original patch from Sassan Panahinejad <sassan@sassan.me.uk> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-10hw/9pfs: Add qdev.reset callback for virtio-9p-pci deviceAneesh Kumar K.V
Add the device reset callback Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-10hw/9pfs: Reset server state during TVERSIONDeepak C Shetty
As per the 9p rfc, during TVERSION its necessary to clean all the active fids, so that we start the session from a clean state. Its also needed in scenarios where the guest is booting off 9p, and boot fails, and client restarts, without any knowledge of the past, it will issue a TVERSION again so this ensures that we always start from a clean state. Signed-off-by: Deepak C Shetty <deepakcs@linux.vnet.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-10hw/9pfs: use migration blockers to prevent live migration when virtfs export ↵Aneesh Kumar K.V
path is mounted Now when you try to migrate with VirtFS export path mounted, you get a proper QMP error: (qemu) migrate tcp:localhost:4444 Migration is disabled when VirtFS export path '/tmp/' is mounted in the guest using mount_tag 'v_tmp' (qemu) Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-10hw/9pfs: Improve portability to older systemsAneesh Kumar K.V
handle fs driver require a set of newly added syscalls. Don't Compile handle FS driver if those syscalls are not available. Instead of adding #ifdef for all those syscalls we check for open by handle syscall. If that is available then rest of the syscalls used by the driver should be available. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-10exec.c: Fix subpage memory access to RAM MemoryRegionAndreas Färber
Commit 95c318f5e1f88d7e5bcc6deac17330fd4806a2d3 (Fix segfault in mmio subpage handling code.) prevented a segfault by making all subpage registrations over an existing memory page perform an unassigned access. Symptoms were writes not taking effect and reads returning zero. Very small page sizes are not currently supported either, so subpage memory areas cannot fully be avoided. Therefore change the previous fix to use a new IO_MEM_SUBPAGE_RAM instead of IO_MEM_UNASSIGNED. Suggested by Avi. Reviewed-by: Avi Kivity <avi@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Avi Kivity <avi@redhat.com> Cc: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-08malta: Fix regression (i8259 interrupts did not work)Stefan Weil
Commit 5632ae46d5bda798e971dae48ebb318ac2c3686a passes the address of i8259 to qemu_irq_proxy. i8259 is an auto variable with undefined value outside of mips_malta_init. This made the interrupt proxy unusable: either QEMU crashes, or the interrupt handler was not called. Ethernet for example no longer worked with MIPS Malta. v2: While v1 used a static variable for i8259, this patch introduces a qdev for the malta machine. i8259 is now part of the device status. This is a minimal qdev implementation to keep the patch small. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit e9b40fd34ceb23461083d505a444a389c094455b)
2011-12-19qemu-kvm: Fix save/restore of in-kernel i8259Jan Kiszka
As the qemu-kvm version of the i8259 contains KVM bits, it still has to be compiled per target. This unbreaks migration of the i8259. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-04Merge commit 'v1.0' into nextqemu-kvm-1.0Avi Kivity
* commit 'v1.0': (47 commits) Update version for 1.0 release Makefile: use full path for qapi-generated directory qapi: fix guardname generation Update version for 1.0-rc4 ccid: Fix buffer overrun in handling of VSC_ATR message Revert "fix out of tree build" configure: avoid screening of --{en, dis}able-usb-redir options cutils: Make strtosz & friends leave follow set to callers qemu-img: Tighten parsing of size arguments x86/cpuid: Tighten parsing of tsc_freq=FREQ vl: Tighten parsing of -m argument vl: Tighten parsing of -numa's parameter mem cutils: Drop broken support for zero strtosz default_suffix configure: tighten pie toolchain support test for tls variables usb-redir: Don't try to write to the chardev after a close event usb-redir: Device disconnect + re-connect robustness fixes usb-redir: Call qemu_chr_fe_open/close spice-qemu-char: Generate chardev open/close events qemu-char: rename qemu_chr_event to qemu_chr_be_event and make it public 9pfs: improve portability to older systems ... Signed-off-by: Avi Kivity <avi@redhat.com>
2011-12-01Update version for 1.0 releasev1.0Anthony Liguori
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-30Makefile: use full path for qapi-generated directoryMichael Roth
Generally $(BUILD_DIR) == $(CURDIR), but that isn't necessarilly the case, so use $(BUILD_DIR)/qapi-generated for generated files to avoid potentionally sticking generating files in odd places outside the build's include paths. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-30qapi: fix guardname generationMichael Roth
Fix a bug in handling dotted paths, and exclude directory prefixes from generated guardnames to avoid odd/pseudo-random guardnames in generated headers. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-28Update version for 1.0-rc4v1.0-rc4Anthony Liguori
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-28ccid: Fix buffer overrun in handling of VSC_ATR messageMarkus Armbruster
ATR size exceeding the limit is diagnosed, but then we merrily use it anyway, overrunning card->atr[]. The message is read from a character device. Obvious security implications unless the other end of the character device is trusted. Spotted by Coverity. CVE-2011-4111. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>