summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-04-07main-loop: disable fd_set-based glib integration under w32Paolo Bonzini1-30/+33
Using select with glib pollfds is wrong under w32. Restrict the code to the POSIX case. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07main loop: use msec-based timeout in glib_select_fillPaolo Bonzini1-12/+10
The timeval-based timeout is not needed until we actually invoke select, so compute it only then. Also group the two calls that modify the timeout, glib_select_fill and os_host_main_loop_wait. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07target-sparc: QOM'ify CPUAndreas Färber3-9/+135
Embed CPUSPARCState as first member of SPARCCPU. Drop cpu_sparc_close() in favor of object_delete() and a finalizer. Let cpu_state_reset() call cpu_reset(). Make TYPE_SPARC_CPU non-abstract for now. Distinguish between "sparc-cpu" and "sparc64-cpu". Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07target-sparc: Rename cpu_init.cAndreas Färber2-1/+1
Align QOM'ified targets, with a view to simplify Makefile.target. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-06Userspace ARM BE8 supportPaul Brook7-20/+86
Add support for ARM BE8 userspace binaries. i.e. big-endian data and little-endian code. In principle LE8 mode is also possible, but AFAIK has never actually been implemented/used. System emulation doesn't have any useable big-endian board models, but should in principle work once you fix that. Dynamic endianness switching requires messing with data accesses, preferably with TCG cooperation, and is orthogonal to BE8 support. Signed-off-by: Paul Brook <paul@codesourcery.com> [PMM: various changes, mostly as per my suggestions in code review: * rebase * use EF_ defines rather than hardcoded constants * make bswap_code a bool for future VMSTATE macro compatibility * update comment in cpu.h about TB flags bit field usage * factor out load-code-and-swap into arm_ld*_code functions and get_user_code* macros * fix stray trailing space at end of line * added braces in disas.c to satisfy checkpatch ] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06elf.h: Update EF_ARM_ constants to newer ABI versionsPeter Maydell1-0/+21
Update the EF_ARM_* constants (for the ELF header e_flags field) to include the newer flags specified for later versions of the ABI. (This set of constants is from include/elf/arm.h from binutils-2.17 and so licensed under GPL-v2-or-later.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.Benoit Canet1-4/+27
The cpu capabilities passed by the elf loader in AT_HWCAP where a constant. Make AT_HWCAP reflect the emulated cpu features in order to give correct clues to eglibc. Riku Voipio: fixed to apply to current head Fix : [Bug 887516] [NEW] VFP support reported for the PXA270 Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user/arm/syscall_nr.h: Add syscall number for ppollPeter Maydell1-1/+1
The list of ARM syscall numbers was missing the entry for ppoll, which meant we were accidentally not providing it. (This wasn't causing any practical issues beyond warnings about unimplemented syscalls, because glibc will fall back to another code path if the syscall isn't present.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAMEPeter Maydell1-0/+24
Add support for the prctl options PR_GET_NAME and PR_SET_NAME, which take or return a name in a 16 byte buffer pointed to by arg2. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user/syscall.c: Fix indentation in prctl handlingPeter Maydell1-14/+15
Clean up the odd indentation of this switch statement before we double its size by adding new cases to it. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: reserve 4GB of vmem for 32-on-64Alexander Graf1-0/+11
When running 32-on-64 bit guests, we should always reserve as much virtual memory as we possibly can for the guest process, so it can never overlap with QEMU address space. Fortunately we already have the infrastructure for that. All that's missing is some sane default value to also make use of it! Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: resolve reserved_va vma downwardsPeter Maydell3-11/+26
After consulting with Paul Brook, we concluded that it's best to search the VMA space downwards, so that we don't even get the chance to conflict with the brk range. This patch resolves a bunch of allocation conflicts when using -R. Signed-off-by: Alexander Graf <agraf@suse.de> [minor changes to get it to apply -- PMM] Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: take RESERVED_VA into account for g2h_valid()Alexander Graf1-1/+2
When running with -R (RESERVED_VA > 0) all guest virtual addresses are within the [0..RESERVED_VA] range. Reflect this with g2h_valid() too so we can safely check for boundaries of our guest address space. This is required to have the /proc/self/maps code not show maps that aren't accessible from the guest process's point of view. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: fix fallocateAlexander Graf1-0/+5
Fallocate gets off_t parameters passed in, so we should also read them out accordingly. Signed-off-by: Alexander Graf <agraf@suse.de> --- v1 -> v2: - unbreak 64-bit guests Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: Add ioctl for BLKBSZGETAlexander Graf1-0/+1
This patch adds the ioctl wrapper definition for BLKBSZGET. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: add BLKSSZGET ioctl wrapperAlexander Graf1-0/+1
This patch adds an ioctl definition for BLKSSZGET. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: fix BLK ioctl argumentsAlexander Graf1-3/+5
Some BLK ioctls passed sizeof(x) into a macro that already did sizeof() on the passed in argument, rendering the size information inside the ioctl be the size of the host default integer type. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: add struct old_dev_t compatAlexander Graf3-2/+58
The compat LOOP_SET_STATUS ioctl uses struct old_dev_t in its passed struct. That variable type is vastly different between different architectures. Implement wrapping around it so we can use it. This fixes running arm kpartx on an x86_64 host for me. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: implement device mapper ioctlsAlexander Graf4-0/+312
This patch implements all ioctls currently implemented by device mapper, enabling us to run dmsetup and kpartx inside of linux-user. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: target_argv is placed on ts->bprm->argv and can't be freed()Fabio Erculiani1-5/+0
TaskState contains linux_bprm struct which encapsulates argv among other things. argv might be used around the code and is expected to contain valid data. Before this patch, ts->bprm->argv was NULL due to it being freed right after loader_exec(). Signed-off-by: Fabio Erculiani <lxnay@sabayon.org> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06linux-user: improve fake /proc/self/stat making `ps` not segfault.Fabio Erculiani1-4/+15
With the current fake /proc/self/stat implementation `ps` is segfaulting because it expects to read PID and argv[0] as first and second field respectively, with the latter being enclosed between backets. Reproducing is as easy as running: `ps` inside qemu-user chroot with /proc mounted. Signed-off-by: Fabio Erculiani <lxnay@sabayon.org> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-05qed: remove incoming live migration blockerBenoît Canet2-11/+0
Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qed: honor BDRV_O_INCOMING for incoming live migrationBenoît Canet1-2/+3
From original commit with Patchwork-id: 31108 by Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> "The QED image format includes a file header bit to mark images dirty. QED normally checks dirty images on open and fixes inconsistent metadata. This is undesirable during live migration since the dirty bit may be set if the source host is modifying the image file. The check should be postponed until migration completes. Skip operations that modify the image file if the BDRV_O_INCOMING flag is set." Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05migration: clear BDRV_O_INCOMING flags on end of incoming live migrationBenoît Canet1-0/+1
Signed-off-by: Benoît Canet <benoit.canet@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qed: add bdrv_invalidate_cache to be called after incoming live migrationBenoît Canet1-0/+10
The QED image is reopened to flush metadata and check consistency. Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05blockdev: open images with BDRV_O_INCOMING on incoming live migrationBenoît Canet1-0/+4
Open images with BDRV_O_INCOMING in order to inform block drivers that an incoming live migration is coming. Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05block: add a function to clear incoming live migration flagsBenoît Canet2-0/+11
This function will clear all BDRV_O_INCOMING flags. Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05block: Add new BDRV_O_INCOMING flag to notice incoming live migrationBenoît Canet1-0/+1
From original patch with Patchwork-id: 31110 by Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> "Add a flag to indicate that incoming migration is pending and care needs to be taken for data consistency. Block drivers should not modify the image file before incoming migration is complete since the migration source host is still using the image file." The rationale for not using bdrv->read_only is the following. "Unfortunately this is not possible because too many other places in QEMU test bdrv_is_read_only() and use it for their own evil purposes. For example, ide_init_drive() will error out because read-only harddisks are not supported. We're mixing guest and host side read-only concepts so this simpler alternative does not work." Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05block stream: close unused files and update ->backing_hdMarcelo Tosatti1-0/+34
Close the now unused images that were part of the previous backing file chain and adjust ->backing_hd, backing_filename and backing_format properly. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=801449 Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qemu-iotests: Fix call syntax for qemu-ioStefan Weil3-6/+6
qemu-io requires options first, then fixed parameters. GNU getopt also allows options at the end, but POSIX getopt doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX behaviour with GNU getopt, too. Cc: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qemu-iotests: Fix call syntax for qemu-imgStefan Weil1-2/+7
qemu-img requires first options, then file name, then size. GNU getopt also allows options at the end, but POSIX getopt doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX behaviour with GNU getopt, too. Cc: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qemu-iotests: Test unknown qcow2 header extensionsKevin Wolf3-0/+149
The immportant thing here is that header extensions don't get silently dropped when the header is rewritten, e.g. during a rebase. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qemu-iotests: qcow2.pyKevin Wolf1-0/+207
This adds a tool that is meant to inspect and edit qcow2 files in a low-level way, that wouldn't be possible with qemu-img/io, for example by adding yet unknown extensions or flags. This way we can test whether qemu deals properly with future backwards compatible extensions. For now, let's start with the image header and header extensions. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05sheepdog: fix send req helpersLiu Yuan1-0/+2
We should return if reading of the header fails. Cc: Kevin Wolf <kwolf@redhat.com> Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Liu Yuan <tailai.ly@taobao.com> Acked-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05sheepdog: implement SD_OP_FLUSH_VDI operationLiu Yuan1-14/+128
Flush operation is supposed to flush the write-back cache of sheepdog cluster. By issuing flush operation, we can assure the Guest of data reaching the sheepdog cluster storage. Cc: Kevin Wolf <kwolf@redhat.com> Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Liu Yuan <tailai.ly@taobao.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05block: bdrv_append() fixesJeff Cody1-2/+11
A few fixups for bdrv_append(): The new bs (bs_new) passed into bdrv_append() should be anonymous. Rather than call bdrv_make_anon() to enforce this, use an assert to catch when a caller is passing in a bs_new that is not anonymous. Also, the new top layer should have its backing_format reflect the original top's format. And last, after the swap of bs contents, the device_name will have been copied down. This needs to be cleared to reflect the anonymity of the bs that was pushed down. Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qed: track dirty flag statusDong Xu Wang1-0/+1
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qemu-img: add dirty flag statusDong Xu Wang2-0/+4
Some block drivers can verify their image files are clean or not. So we can show it while using "qemu-img info". Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qed: image fragmentation statisticsDong Xu Wang1-0/+9
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05qemu-img: add image fragmentation statisticsDong Xu Wang2-1/+15
Discussion can be found at: http://patchwork.ozlabs.org/patch/128730/ This patch add image fragmentation statistics while using qemu-img check. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05block: document job APIPaolo Bonzini1-3/+112
I am not sure that these are really proper GtkDoc, but they follow the existing documentation in block_int.h. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05block: set job->speed in block_set_speedPaolo Bonzini2-2/+7
There is no need to do this in every implementation of set_speed (even though there is only one right now). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05block: fix streaming/closing racePaolo Bonzini3-2/+22
Streaming can issue I/O while qcow2_close is running. This causes the L2 caches to become very confused or, alternatively, could cause a segfault when the streaming coroutine is reentered after closing its block device. The fix is to cancel streaming jobs when closing their underlying device. The cancellation must be synchronous, on the other hand qemu_aio_wait will not restart a coroutine that is sleeping in co_sleep. So add a flag saying whether streaming has in-flight I/O. If the busy flag is false, the coroutine is quiescent and, when cancelled, will not issue any new I/O. This protects streaming against closing, but not against deleting. We have a reference count protecting us against concurrent deletion, but I still added an assertion to ensure nothing bad happens. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05block: cancel jobs when a device is ready to go awayPaolo Bonzini1-0/+3
We do not want jobs to keep a device busy for a possibly very long time, and management could become confused because they thought a device was not even there anymore. So, cancel long-running jobs as soon as their device is going to disappear. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05block: disable I/O throttling on sync apiZhi Yong Wu1-0/+20
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> 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>
2012-04-05Use DMADirection type for dma_bdrv_ioDavid Gibson4-16/+22
Currently dma_bdrv_io() takes a 'to_dev' boolean parameter to determine the direction of DMA it is emulating. We already have a DMADirection enum designed specifically to encode DMA directions. This patch uses it for dma_bdrv_io() as well. This involves removing the DMADirection definition from the #ifdef it was inside, but since that only existed to protect the definition of dma_addr_t from places where config.h is not included, there wasn't any reason for it to be there in the first place. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05vdi: change goto to loopPaolo Bonzini1-73/+68
Finally reindent all code and change goto statements to a loop. Acked-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05vdi: do not create useless iovecsPaolo Bonzini1-46/+33
Reads and writes to the underlying file can also occur with the simple non-vectored I/O interfaces. Acked-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05vdi: leave bounce buffering to block layerPaolo Bonzini1-55/+12
vdi.c really works as if it implemented bdrv_read and bdrv_write. However, because only vector I/O is supported by the asynchronous callbacks, it went through extra pain to bounce-buffer the I/O. This can be handled by the block layer now that the format is coroutine-based. Acked-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05vdi: move aiocb fields to localsPaolo Bonzini1-98/+65
Most of the AIOCB really holds local variables that need to persist across callback invocation. It can go away now. Acked-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>