summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2010-10-22ide: Handle flush failureKevin Wolf2-2/+11
Instead of always assuming success for bdrv_aio_flush, actually do something with the error. This respects the werror option and accordingly ignores the error, reports it to the guest or stops the VM and retries after cont. Ignoring the error is trivial, obviously. For stopping the VM and retrying later old code can be reused, but we need to introduce a new status for "retry a flush". For reporting to the guest, fortunately the same action is required as for a failed read/write (status = DRDY | ERR, error = ABRT), so this code can be reused as well. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22ide: Factor ide_flush_cache outKevin Wolf1-4/+10
The next patch reuses this code, so put it in its own function. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22qemu-img: Fix qemu-img convert -obacking_fileKevin Wolf1-0/+7
The old -B option caused a backing file to be used for the converted image and to avoid copying clusters from the old backing file. When replaced with -obacking_file, qemu-img convert does assign the backing file to the new image, but it doesn't realize that it should avoid copying clusters from the backing file. This patch checks the -o options for a backing_file and applies the same logic as for -B in this case. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22block: Use GCC_FMT_ATTR and fix a format errorStefan Weil1-2/+3
Adding the gcc format attribute detects a format bug which is fixed here. v2: Don't use type cast. BDRV_SECTOR_SIZE is unsigned long long, so %lld should be the correct format specifier. Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22qemu-io: New command mapKevin Wolf1-0/+39
The new map command in qemu-io lists all allocated/unallocated areas in an image file. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22Copy snapshots out of QCOW2 diskedison9-5/+75
In order to backup snapshots, created from QCOW2 iamge, we want to copy snapshots out of QCOW2 disk to a seperate storage. The following patch adds a new option in "qemu-img": qemu-img convert -f qcow2 -O qcow2 -s snapshot_name src_img bck_img. Right now, it only supports to copy the full snapshot, delta snapshot is on the way. Changes from V1: all the comments from Kevin are addressed: Add read-only checking Fix coding style Change the name from bdrv_snapshot_load to bdrv_snapshot_load_tmp Signed-off-by: Disheng Su <edison@cloud.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22ide: set WCACHE supported in IDENTIFY dataChristoph Hellwig1-2/+2
ATA does not only have the WCACHE enabled bit in identify word 85, but also a WCACHE supported bit in word 82. While the Linux kernel is fine with the latter at least hdparm also needs the former before correctly displaying the cache settings. There's also a non-zero chance other operating systems are more picky in their volatile write cache detection. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22qcow2: Remove old image creation functionKevin Wolf1-224/+0
They have been #ifdef'd out by the previous patch. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22qcow2: Simplify image creationKevin Wolf1-1/+132
Instead of doing lots of magic for setting up initial refcount blocks and stuff create a minimal (inconsistent) image, open it and initialize the rest with regular qcow2 functions. This is a complete rewrite of the image creation function. The old implementating is #ifdef'd out and will be removed by the next patch (removing it here would have made the diff unreadable because diff tries to find similarities when it's really a rewrite) Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22qcow2: Support exact L1 table growthStefan Hajnoczi4-12/+19
The L1 table grow operation includes a size calculation that bumps up the new L1 table size in order to anticipate the size needs of vmstate data. This helps reduce the number of times that the L1 table has to be grown when vmstate data is appended. This size overhead is not necessary during image creation, bdrv_truncate(), or snapshot goto operations. In fact, existing qemu-iotests that exercise table growth are no longer able to trigger it because image creation preallocates an L1 table that is too large after changes to qcow_create2(). This patch keeps the size calculation but also adds exact growth for callers that do not want to inflate the L1 table size unnecessarily. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22monitor: Ignore "." and ".." when completing file name.Kusanagi Kouichi1-0/+5
Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-10-22Fix test suite build with tracing enabledJan Kiszka1-6/+6
qemu_malloc instrumentations require linking against the trace objects. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-10-22Silence compiler warning in json test caseJan Kiszka1-1/+3
This avoids error: zero-length gnu_printf format string Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-10-22Trivial fix for QMP/qmp-events.txtHidetoshi Seto1-1/+1
Fix example of STOP event that was just copy-and-pasted. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-10-21curses: Fix control-{@[\]^_} and ESCSamuel Thibault2-3/+7
control-{@[\]^_} shouldn't get the 'a' - 'A' offset for correct translation. ESC is better simulated as escape key. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Andrew Zaborowski <balrogg@gmail.com>
2010-10-21kvm: save/restore x86-64 MSRs on x86-64 kernelsMarcelo Tosatti1-10/+20
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21kvm: writeback SMP TSCs on migration onlyMarcelo Tosatti1-1/+9
commit 6389c45441269baa2873e6feafebd17105ddeaf6 Author: Jan Kiszka <jan.kiszka@siemens.com> Date: Mon Mar 1 18:17:26 2010 +0100 qemu-kvm: Cleanup/fix TSC and PV clock writeback Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21kvm: factor out kvm_has_msr_starMarcelo Tosatti1-11/+30
And add kvm_has_msr_hsave_pa(), to avoid warnings on older kernels without support. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21kvm: add save/restore of MSR_VM_HSAVE_PAMarcelo Tosatti1-0/+5
commit 2bba4446746add456ceeb0e8359a43032a2ea333 Author: Alexander Graf <agraf@suse.de> Date: Thu Dec 18 15:38:32 2008 +0100 Enable nested SVM support in userspace Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21Fix build on !KVM_CAP_MCEHidetoshi Seto1-2/+3
This patch removes following warnings: target-i386/kvm.c: In function 'kvm_put_msrs': target-i386/kvm.c:782: error: unused variable 'i' target-i386/kvm.c: In function 'kvm_get_msrs': target-i386/kvm.c:1083: error: label at end of compound statement Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21x86, mce: broadcast mce depending on the cpu versionHidetoshi Seto1-5/+24
There is no reason why SRAO event received by the main thread is the only one that being broadcasted. According to the x86 ASDM vol.3A 15.10.4.1, MCE signal is broadcast on processor version 06H_EH or later. This change is required to handle SRAR in smp guests. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21x86, mce: ignore SRAO only when MCG_SER_P is availableHidetoshi Seto1-6/+10
And restruct this block to call kvm_mce_in_exception() only when it is required. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-20Fix pci hotplug to generate level triggered interrupt.Gleb Natapov1-11/+17
SCI is level triggered. pci hotplug should behave appropriately. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-10-20Use defines instead of numbers for pci hotplug sts bitGleb Natapov1-2/+4
Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-10-20Fix memory leak in register save load due to xsave supportMarcelo Tosatti1-3/+8
From: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-20Add savevm/loadvm support for MCEMarcelo Tosatti1-1/+38
Port qemu-kvm's commit 1bab5d11545d8de5facf46c28630085a2f9651ae Author: Huang Ying <ying.huang@intel.com> Date: Wed Mar 3 16:52:46 2010 +0800 Add savevm/loadvm support for MCE MCE registers are saved/load into/from CPUState in kvm_arch_save/load_regs. To simulate the MCG_STATUS clearing upon reset, MSR_MCG_STATUS is set to 0 for KVM_PUT_RESET_STATE. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20MCE: Relay UCR MCE to guestMarcelo Tosatti7-14/+278
Port qemu-kvm's commit 4b62fff1101a7ad77553147717a8bd3bf79df7ef Author: Huang Ying <ying.huang@intel.com> Date: Mon Sep 21 10:43:25 2009 +0800 MCE: Relay UCR MCE to guest UCR (uncorrected recovery) MCE is supported in recent Intel CPUs, where some hardware error such as some memory error can be reported without PCC (processor context corrupted). To recover from such MCE, the corresponding memory will be unmapped, and all processes accessing the memory will be killed via SIGBUS. For KVM, if QEMU/KVM is killed, all guest processes will be killed too. So we relay SIGBUS from host OS to guest system via a UCR MCE injection. Then guest OS can isolate corresponding memory and kill necessary guest processes only. SIGBUS sent to main thread (not VCPU threads) will be broadcast to all VCPU threads as UCR MCE. aliguori: fix build Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-10-20Add RAM -> physical addr mapping in MCE simulationHuang Ying2-0/+24
In QEMU-KVM, physical address != RAM address. While MCE simulation needs physical address instead of RAM address. So kvm_physical_memory_addr_from_ram() is implemented to do the conversion, and it is invoked before being filled in the IA32_MCi_ADDR MSR. Reported-by: Dean Nelson <dnelson@redhat.com> Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20Export qemu_ram_addr_from_hostMarcelo Tosatti3-11/+20
To be used by next patches. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20kvm: x86: add mce supportMarcelo Tosatti3-0/+111
Port qemu-kvm's MCE support commit c68b2374c9048812f488e00ffb95db66c0bc07a7 Author: Huang Ying <ying.huang@intel.com> Date: Mon Jul 20 10:00:53 2009 +0800 Add MCE simulation support to qemu/kvm KVM ioctls are used to initialize MCE simulation and inject MCE. The real MCE simulation is implemented in Linux kernel. The Kernel part has been merged. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20iothread: use signalfdMarcelo Tosatti1-5/+69
Block SIGALRM, SIGIO and consume them via signalfd. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20signalfd compatibilityMarcelo Tosatti4-0/+179
Port qemu-kvm's signalfd compat code. commit 5a7fdd0abd7cd24dac205317a4195446ab8748b5 Author: Anthony Liguori <aliguori@us.ibm.com> Date: Wed May 7 11:55:47 2008 -0500 Use signalfd() in io-thread This patch reworks the IO thread to use signalfd() instead of sigtimedwait() This will eliminate the need to use SIGIO everywhere. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20Add svm cpuid featuresJoerg Roedel3-17/+75
This patch adds the svm cpuid feature flags to the qemu intialization path. It also adds the svm features available on phenom to its cpu-definition and extends the host cpu type to support all svm features KVM can provide. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20Set cpuid definition to 0 before initializing itJoerg Roedel1-0/+2
This patch cleans the (stack-allocated) cpuid definition to 0 before actually initializing it. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20configure: Support disabling warnings in $gcc_flagsMarkus Armbruster1-1/+1
-Wall enables a bunch of warnings at once. configure puts it after $gcc_flags. This makes it impossible to disable warnings enabled by -Wall there. Fix by putting configured flags last. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-20tcg: Fix compiler error (comparison of unsigned expression)Stefan Weil1-1/+1
When qemu is configured with --enable-debug-tcg, gcc throws this warning (or error with -Werror): tcg/tcg.c:1030: error: comparison of unsigned expression >= 0 is always true Fix it by removing the >= 0 part. The type cast to 'unsigned' catches negative values of op (which should never happen). This is a modification of Hollis Blanchard's patch. Cc: Hollis Blanchard <hollis@penguinppc.org> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-20wacom tablet: activate event handlers.Gerd Hoffmann1-3/+10
Add qemu_activate_mouse_event_handler() calls to the usb wavom tablet so it actually receives events. Also make sure we only remove the handler if we registered it before. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-10-20vmmouse: adapt to mouse handler changes.Gerd Hoffmann1-10/+21
This patch updates the vmmouse handler registration and activation. Old behavior: vmmouse_read_id, vmmouse_request_relative and vmmouse_request_absolute unregister the handler and re-register it. New behavior: vmmouse_request_relative and vmmouse_request_absolute will unregister the handler in case the mode did change. Then register and active the handler with current mode if needed. Note that the old code never ever *activates* the handler, so the vmmouse doesn't receive events. This trips up Fedora 14 for example: Boot a default install without usb tablet, watch the X-Server activating the vmmouse then, enjoy a non-functional mouse. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-10-20[virtio-9p] Add support to v9fs_string_alloc_printf() for handling %lu.Venkateswararao Jujjuri (JV)1-0/+17
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20[virtio-9p] Use preadv/pwritev instead of readv/writevSanchit Garg3-94/+67
readv & writev, read & write respectively from the current offset of the file & hence their use has to be preceeded by a call to lseek. preadv/writev can be used instead, as they take the offset as an argument. This saves one system call( lseek ). In case preadv is not supported, it is implemented by an lseek followed by a readv. Depending upon the configuration of QEMU, the appropriate read & write methods are selected. This patch also fixes the zero byte read/write bug & obviates the need to apply a fix for that bug separately. Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Sanchit Garg <sancgarg@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20[virtio-9p] Qemu 9p commandline options validity checksHarsh Prateek Bora2-19/+33
Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20virtio-9p: Support mapped posix aclAneesh Kumar K.V5-6/+192
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20virtio-9p: Use layered xattr approachAneesh Kumar K.V7-92/+345
We would need this to make sure we handle the mapped security model correctly for different xattr names. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20[virtio-9p] Ignore O_DIRECT hint from client.Venkateswararao Jujjuri (JV)1-0/+5
The O_DIRECT flag imposes alignment restrictions on the length and address of userspace buffers and the file offset of I/Os. While VirtFS/9P has plans to implement O_DIRECT behavior on the server, for now we will stick to a behavior like NFS by bypassing the page cache only on the client. Server may still cache the I/O. Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20qemu-virtio-9p: Implement TREADLINK operation for 9p2000.LM. Mohan Kumar3-0/+60
Synopsis size[4] TReadlink tag[2] fid[4] size[4] RReadlink tag[2] target[s] Description Readlink is used to return the contents of the symoblic link referred by fid. Contents of symboic link is returned as a response. target[s] - Contents of the symbolic link referred by fid. Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20[virtio-9p] Introduce server side TFSYNC/RFSYNC for dotlVenkateswararao Jujjuri (JV)3-0/+36
SYNOPSIS size[4] Tfsync tag[2] fid[4] size[4] Rfsync tag[2] DESCRIPTION The Tfsync transaction transfers ("flushes") all modified in-core data of file identified by fid to the disk device (or other permanent storage device) where that file resides. Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20qemu-virtio9p: Implement TGETLOCKM. Mohan Kumar3-0/+79
Synopsis size[4] TGetlock tag[2] fid[4] getlock[n] size[4] RGetlock tag[2] getlock[n] Description TGetlock is used to test for the existence of byte range posix locks on a file identified by given fid. The reply contains getlock structure. If the lock could be placed it returns F_UNLCK in type field of getlock structure. Otherwise it returns the details of the conflicting locks in the getlock structure getlock structure: type[1] - Type of lock: F_RDLCK, F_WRLCK start[8] - Starting offset for lock length[8] - Number of bytes to lock If length is 0, lock all bytes starting at the location 'start' through to the end of file proc_id[4] - process id that wants to take lock/owns the task in case of reply client[4] - Client id of the system that owns the process Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20[virto-9p] Implement TLOCKM. Mohan Kumar3-0/+94
Synopsis size[4] TLock tag[2] fid[4] flock[n] size[4] RLock tag[2] status[1] Description Tlock is used to acquire/release byte range posix locks on a file identified by given fid. The reply contains status of the lock request flock structure: type[1] - Type of lock: F_RDLCK, F_WRLCK, F_UNLCK flags[4] - Flags could be either of P9_LOCK_FLAGS_BLOCK(1) - Blocked lock request, if there is a conflicting lock exists, wait for that lock to be released. P9_LOCK_FLAGS_RECLAIM(2) - Reclaim lock request, used when client is trying to reclaim a lock after a server restrart (due to crash) start[8] - Starting offset for lock length[8] - Number of bytes to lock If length is 0, lock all bytes starting at the location 'start' through to the end of file pid[4] - PID of the process that wants to take lock client_id[4] - Unique client id status[1] - Status of the lock request, can be P9_LOCK_SUCCESS(0), P9_LOCK_BLOCKED(1), P9_LOCK_ERROR(2) or P9_LOCK_GRACE(3) P9_LOCK_SUCCESS - Request was successful P9_LOCK_BLOCKED - A conflicting lock is held by another process P9_LOCK_ERROR - Error while processing the lock request P9_LOCK_GRACE - Server is in grace period, it can't accept new lock requests in this period (except locks with P9_LOCK_FLAGS_RECLAIM flag set) Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20[virtio-9p] open should not return EBADFSripathi Kodi1-1/+3
When 9P server fails to create a file due to permission problems it should return EPERM. However the current 9P2000.L code returns EBADF. EBADF is NOT a valid return value from open() call. The problem is because we do not preserve the errno variable properly. If the file open had failed, the call to close() on the fd in v9fs_post_lcreate() fails and sets errno to EBADF. We should preserve the errno that we got from open() and we should call close() only if we had a valid fd. Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-10-20trace: improve info trace outputBlue Swirl1-2/+4
Use PRI*64 to print full 64 bit data even on ILP32 hosts. Print also sixth tracepoint parameter. Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>