summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* block: Rename bdrv_co_flush to bdrv_co_flush_to_diskKevin Wolf2011-11-1111-45/+59
| | | | | | | | | There are two different types of flush that you can do: Flushing one level up to the OS (i.e. writing data to the host page cache) or flushing it all the way down to the disk. The existing functions flush to the disk, reflect this in the function name. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* hw/pc.c: Fix use-while-uninitialized of fd_type[]Peter Maydell2011-11-111-3/+1
| | | | | | | | | | Fix a use-while-uninitialized of the fd_type[] array (introduced in commit 34d4260e1, noticed by Coverity). This is more theoretical than practical, since it's quite hard to get here with floppy==NULL (the qdev_try_create() of the isa-fdc device has to fail). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Fix vpc initialization of the Dynamic Disk HeaderCharles Arnold2011-11-111-1/+5
| | | | | | | | | | | | | | | The Data Offset field in the Dynamic Disk Header is an 8 byte field. Although the specification (2006-10-11) gives an example of initializing only the first 4 bytes, images generated by Microsoft on Windows initialize all 8 bytes. Failure to initialize all 8 bytes results in errors from utilities like Citrix's vhd-util which checks specifically for the proper Data Offset field initialization. Signed-off-by: Charles Arnold <carnold@suse.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-nbd: open the block device after starting the client threadPaolo Bonzini2011-11-111-17/+17
| | | | | | | | | | | | This is cleaner, because we do not need to close the block device when there is an error opening /dev/nbdX. It was done this way only to print errors before daemonizing. At the same time, use atexit to ensure that the block device is closed whenever we exit. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-nbd: fix socket creation racePaolo Bonzini2011-11-111-15/+15
| | | | | | | | | | | | | | Now that the client and server are in the same process, there is no need to race on the creation of the socket. We can open the listening socket before starting the client thread. This avoids that "qemu-nbd -v -c" prints this once before connecting successfully to the socket: connect(unix:/var/lock/qemu-nbd-nbd0): No such file or directory Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-nbd: print error messages from the daemon through a pipePaolo Bonzini2011-11-111-9/+59
| | | | | | | | | | | In order to get nice error messages, keep the qemu-nbd process running until before issuing NBD_DO_IT and connected to the daemon with a pipe. This lets the qemu-nbd process relay error messages from the daemon and exit with a nonzero status if appropriate. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-nbd: move client to a threadPaolo Bonzini2011-11-111-80/+93
| | | | | | | | | | | | | | | | This avoids that qemu-nbd uses both forking and threads, which do not behave well together. qemu-nbd is already Unix only, and there is no qemu_thread_join, so for now use pthreads. Since the parent and child no longer have separate file descriptors, we can open the NBD device before daemonizing, instead of checking with access(2) and restricting the open to the client only. Reported-by: Pierre Riteau <pierre.riteau@irisa.fr> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-nbd: rename socket variablePaolo Bonzini2011-11-111-13/+12
| | | | | | | | It will be moved to a global variable by the next patch, and it would conflict with the socket function. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-nbd: trap SIGTERMPaolo Bonzini2011-11-111-5/+29
| | | | | | | | | | | The client process right now uses SIGTERM to interrupt the server side. This does not affect the exit status of "qemu-nbd -v -c" because the server is a child process. This will change when both sides will be in the same process, and anyway cleaning up things nicely upon SIGTERM is good practice. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* nbd: treat EPIPE from NBD_DO_IT as successPaolo Bonzini2011-11-111-0/+7
| | | | | | | | This can be seen with "qemu-nbd -v -c", which returns 1 instead of 0 when you disconnect with "qemu-nbd -d". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: implement eject requestsPaolo Bonzini2011-11-111-3/+21
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* atapi: implement eject requestsPaolo Bonzini2011-11-112-3/+21
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: add eject request callbackPaolo Bonzini2011-11-113-4/+23
| | | | | | | | | | | | | | | | | | Recent versions of udev always keep the tray locked so that the kernel can observe "eject request" events (aka tray button presses) even on discs that aren't mounted. Add support for these events in the ATAPI and SCSI cd drive device models. To let management cope with the behavior of udev, an event should also be added for "tray opened/closed". This way, after issuing an "eject" command, management can poll until the guests actually reacts to the command. They can then issue the "change" command after the tray has been opened, or try with "eject -f" after a (configurable?) timeout. However, with this patch and the corresponding support in the device models, at least it is possible to do a manual two-step eject+change sequence. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* vvfat: Fix read-write modeKevin Wolf2011-11-111-21/+23
| | | | | | | | vvfat used to directly call into the qcow2 block driver instead of using the block.c wrappers. With the coroutine conversion, this stopped working. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* hw/lan9118.c: Add missing 'break' to fix buffer overrunPeter Maydell2011-11-101-0/+1
| | | | | | | | | Add a missing 'break' statement to fix a buffer overrun when executing the EEPROM write-all command. Spotted by Coverity (see bug 887883). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* x86/cpuid: Fix crash on -cpu ""Markus Armbruster2011-11-101-2/+2
| | | | | | | Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* x86/cpuid: Plug memory leak in cpudef_setfield()Markus Armbruster2011-11-101-0/+1
| | | | | | | | To reproduce the leak, put two name options into the same [cpudef] section of target-x86_64.conf. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* x86/cpuid: Convert remaining strdup() to g_strdup()Markus Armbruster2011-11-101-4/+4
| | | | | | | Fixes missing error checking. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* ui/vnc: Convert sasl.mechlist to g_malloc() & friendsMarkus Armbruster2011-11-101-14/+5
| | | | | | | | Fixes protocol_client_auth_sasl_mechname() not to crash when malloc() fails. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* qdev: Fix crash on -device '?=x'Markus Armbruster2011-11-101-1/+1
| | | | | | | Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* configure: Show --cpu option on the help list陳韋任2011-11-101-0/+1
| | | | | Signed-off-by: Chen Wen-Ren (陳韋任) <chenwj@iis.sinica.edu.tw> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* qemu-tech.texi: Update default code cache size陳韋任2011-11-101-1/+1
| | | | | | | Update the document since the default code cache size is 32 MB now. Signed-off-by: chenwj <chenwj@cs.nctu.edu.tw> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* hpet: fix infinite loop in qemu_run_timers with -icount enabledMax Filippov2011-11-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hpet_timer timer callback rearms itself based on difference between current HPET tick counter and comparator value. Difference calculated by the hpet_calculate_diff function is limited to non-negative values. cur_tick is calculated via hpet_get_ticks that uses qemu_get_clock_ns(vm_clock). With -icount enabled vm_clock doesn't advance during qemu_run_timers loop thus once difference is zero, qemu_run_timers loops forever handling hpet_timer. Limit hpet_calculate_diff results to positive only values to avoid that infinite loop. This fixes the following qemu-system-x86_64 hang when it reaches timer_irq_works() in the linux bootup: [ 0.000000] Fast TSC calibration using PIT [ 0.000000] Detected 1000.054 MHz processor. [ 0.000031] Calibrating delay loop (skipped), value calculated using timer frequency.. 2000.10 BogoMIPS (lpj=10000540) [ 0.000404] pid_max: default: 32768 minimum: 301 [ 0.001138] Mount-cache hash table entries: 256 [ 0.003883] Initializing cgroup subsys ns [ 0.004035] Initializing cgroup subsys cpuacct [ 0.004280] Initializing cgroup subsys freezer [ 0.004790] Performance Events: AMD PMU driver. [ 0.004985] ... version: 0 [ 0.005134] ... bit width: 48 [ 0.005285] ... generic registers: 4 [ 0.005437] ... value mask: 0000ffffffffffff [ 0.005625] ... max period: 00007fffffffffff [ 0.005807] ... fixed-purpose events: 0 [ 0.005957] ... event mask: 000000000000000f [ 0.006275] SMP alternatives: switching to UP code Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* hw/omap_gpmc.c: Add missing 'break's to fix 8 bit NAND writesPeter Maydell2011-11-091-0/+2
| | | | | | | | | Add missing 'break' statements which would have meant that writing to an 8 bit NAND device was broken. Spotted by Coverity (see bug 887883). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* hw/omap_dss.c: Fix !-vs-~ bug in handling DISPC_CONTROLPeter Maydell2011-11-091-4/+5
| | | | | | | | | Fix a bug revealed by a coverity scan (see bug 887883) which meant that we would never print the warning about unpredictable behaviour if a nonexistent overlay is enabled. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* i386: derive '-cpu host' from KVM_GET_SUPPORTED_CPUIDAvi Kivity2011-11-091-23/+4
| | | | | | | | | | | | The fact that a host cpu supports a feature doesn't mean that QEMU and KVM will also support it, yet -cpuid host brings host features wholesale. We need to whitelist each feature separately to make sure we support it. This patch adds KVM whitelisting (by simply using KVM_GET_SUPPORTED_CPUID instead of the CPUID instruction). Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* configure: fix detection for xattr.h on modern distributionsAvi Kivity2011-11-097-7/+45
| | | | | | | | | | | Modern distributions place xattr.h in /usr/include/sys, and fold libattr.so into libc. They also don't have an ENOATTR. Make configure detect this, and add a qemu-xattr.h file that directs the #include to the right place. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Clean up assertion in get_boot_devices_list()Markus Armbruster2011-11-091-1/+1
| | | | | | | | g_strdup() can't fail, remove assertion. Assert its argument can't be null, because that's not obvious (add_boot_device_path() ensures it). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Replace WriteFileEx with WriteFile in qemu_create_pidfileFabien Chouteau2011-11-091-3/+4
| | | | | | | | | | | | The function that writes pidfile for win32 uses WriteFileEx which is an asynchronous IO function. The arguments given to WriteFileEx are allocated on the stack and one of them is "in out". When the IO operation is actually executed the calling function has already returned, so the arguments are no longer allocated or allocated to another frame. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* win32: remove broken timersPaolo Bonzini2011-11-091-3/+1
| | | | | | | | The non-dynticks timer variations are broken, so they can be removed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtex: Remove memset of clk_setupEdgar E. Iglesias2011-11-081-1/+0
| | | | | | clk_setup is now a function. Fixes a segfault. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* Update version for v1.0-rc1Anthony Liguori2011-11-071-1/+1
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* console: Fix rendering of VGA underlineMarkus Armbruster2011-11-071-3/+3
| | | | | | | | | | | | | | | | | vga_putcharxy()'s underline code sets font_data to 0xffff instead of 0xff. vga_putcharxy() then reads dmask16[0xffff >> 4] and dmask4[0xffff >> 6]. In practice, these out-of-bounds subscripts "only" put a few crap bits into the display surface. For 32 bit pixels, there's no array access. font_data's extra bits go straight into the display surface. Broken when commit 6d6f7c28 implemented underline. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu_timedate_diff() shouldn't modify its argument.Gleb Natapov2011-11-071-2/+5
| | | | | | | | | | The caller of qemu_timedate_diff() does not expect that tm it passes to the function will be modified, but mktime() is destructive and modifies its argument. Pass a copy of tm to it and set tm_isdst so that mktime() will not rely on it since its value may be outdated. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* reenable vm_clock when resuming all vcpusWen Congyang2011-11-071-0/+1
| | | | | | | | | | | We disable vm_clock when pausing all vcpus, but we forget to reenable it when resuming all vcpus. It will cause that the guest can not be rebooted. Tested-by: Zhi Yong Wu <zwu.kernel@gmai.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qxl: fix vga port initialization.Gerd Hoffmann2011-11-071-5/+17
| | | | | | | | | | | | | | | | Commit 0a039dc70096b768d3810afa50ba1d214768aaf4 broke vga modes for qxl-vga by loosing vga_ioport_read windup. qxl needs to hook into vga port writes only and used to realize that by letting vga_init() do the work for both reads and writes, then overwrite the write function. That little detail was missed while doing the conversion ... This patch fixes it. It also switch qxl vga ioport registration to portio lists while being at it. Cc: Hans de Goede <hdegoede@redhat.com> Acked-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ac97: don't override the pci subsystem idGerd Hoffmann2011-11-072-5/+27
| | | | | | | | | | | | | This patch removes the code lines which set the subsystem id for the emulated ac97 card to 8086:0000. Due to the device id being zero the subsystem id isn't vaild anyway. With the patch applied the sound card gets the default qemu subsystem id (1af4:1100) instead. [ v2: old & broken id is maintained for -M pc-$oldqemuversion ] Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pc: add 1.0 machine typeGerd Hoffmann2011-11-071-3/+11
| | | | | | | | This patch adds a pc-1.0 machine type. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* disable automatic loading of sgabios when -nographicPaolo Bonzini2011-11-071-9/+0
| | | | | | | | | sgabios hasn't gotten a lot of coverage since it was not shipped. For 1.0, let's disable the automatic loading of the option ROM in -nographic mode. We can put it back for 1.1. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* add sgabios blob and submodulePaolo Bonzini2011-11-075-1/+10
| | | | | | | | The rom was not added together with the sgabios device and is not installed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori2011-11-074-88/+138
|\
| * vvfat: reorganize computation of disk geometryPaolo Bonzini2011-11-041-16/+24
| | | | | | | | | | | | | | | | | | | | | | First determine FAT12/16/32, then compute geometry from that for both FDD and HDD. For 1.44MB floppies, and 2.88MB floppies using FAT16, change to 1 sector/cluster. The default remains 2.88MB with FAT12 and 2 sectors/cluster. Both DOS and mkdosfs by default format a 2.88MB floppy as FAT12. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * vvfat: do not hardcode sector counts in error messagePaolo Bonzini2011-11-041-5/+2
| | | | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * vvfat: unify and correct computation of sector countPaolo Bonzini2011-11-041-3/+3
| | | | | | | | | | | | | | | | | | | | The sector count is stored in the partition and hence must not include the sectors before its start. At the same time, remove the useless special casing for 1.44 MB floppies. This fixes fsck on VVFAT hard disks, which otherwise tries to seek past the end of the disk. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * vvfat: need to use first_sectors_number to distinguish fdd/hddPaolo Bonzini2011-11-041-2/+2
| | | | | | | | | | | | | | | | This is consistent with what "real" floppies have, so file(1) now actually recognizes the VVFAT image as a 1.44 MB floppy. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * vvfat: do not fail if the disk has spare sectorsPaolo Bonzini2011-11-041-2/+2
| | | | | | | | | | | | | | | | | | If the number of "faked sectors" + the number of sectors that are part of a cluster does not sum up to the total number of sectors, qemu-img convert fails. Read these spare sectors as all zeros. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * vvfat: fix out of bounds array_get usagePaolo Bonzini2011-11-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | When reading the address of the first free entry, you cannot use array_get without first marking all entries as occupied. This is visible if you change the sectors per cluster on a floppy from 2 to 1. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block/cloop: Use g_free instead of freeDong Xu Wang2011-11-041-3/+3
| | | | | | | | | | | | | | | | | | | | Fix mismatching allocation and deallocation: g_free should be used to pair with g_malloc. Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed_by: Ray Wang <raywang@linux.vnet.ibm.com> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block/cloop: Fix coding styleDong Xu Wang2011-11-041-52/+63
| | | | | | | | | | | | | | | | | | Fix coding style in block/cloop.c. Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed_by: Ray Wang <raywang@linux.vnet.ibm.com> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * dma: Avoid reentrancy in DMA transfer handlersKevin Wolf2011-11-041-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the conversion of the block layer to coroutines, bdrv_read/write have changed to run a nested event loop that calls qemu_bh_poll. Consequently a scheduled BH can be called while a DMA transfer handler runs and this means that DMA_run becomes reentrant. Devices haven't been designed to cope with that, so instead of running a nested transfer handler just wait for the next invocation of the BH from the main loop. This fixes some problems with the floppy device. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
OpenPOWER on IntegriCloud