sdk/emulator/qemu.git
12 years agotarget-xtensa: Start QOM'ifying CPU init
Andreas Färber [Wed, 11 Apr 2012 16:24:50 +0000 (18:24 +0200)]
target-xtensa: Start QOM'ifying CPU init

Move XtensaConfig-independent code from cpu_xtensa_init() into a
QOM initfn, as a start.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: QOM'ify CPU reset
Andreas Färber [Wed, 11 Apr 2012 16:24:49 +0000 (18:24 +0200)]
target-xtensa: QOM'ify CPU reset

Move code from cpu_state_reset() into QOM xtensa_cpu_reset().
To avoid moving reset_mmu() and dependencies, make it non-static.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: QOM'ify CPU
Andreas Färber [Wed, 11 Apr 2012 16:24:48 +0000 (18:24 +0200)]
target-xtensa: QOM'ify CPU

Embed CPUXtensaState as first member of XtensaCPU.
Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: improve unit tests debugging
Max Filippov [Thu, 15 Mar 2012 21:24:57 +0000 (01:24 +0400)]
target-xtensa: improve unit tests debugging

- add testcase announcement;
- add global symbols for individual tests;
- add host-debug-* makefile target.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: Move helpers.h to helper.h
Lluís Vilanova [Mon, 13 Feb 2012 15:33:58 +0000 (16:33 +0100)]
target-xtensa: Move helpers.h to helper.h

Provides a file naming scheme consistent with other targets.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 13 Apr 2012 13:04:43 +0000 (08:04 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  configure: Insist on a Python 2, not Python 3
  bsd-user: fix compile failure
  ps2: avoid repeated header file includes
  make: Always set LC_ALL=C for makeinfo
  configure: Fix wrong preprocessor statement
  configure: Remove useless uses of ARCH_CFLAGS

12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Fri, 13 Apr 2012 13:04:31 +0000 (08:04 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  kvmclock: guest stop notification
  kvm: update linux headers
  kvm: set gsi_bits and max_gsi correctly
  kvm: Drop unused kvm_pit_in_kernel
  kvm: allow arbitrarily sized mmio ioeventfd
  kvm: Drop redundant kvm_enabled from cpu_thread_is_idle
  kvm: add flightrecorder script

12 years agoMerge remote-tracking branch 'afaerber/qom-cpu-lm32.v3' into staging
Anthony Liguori [Fri, 13 Apr 2012 13:04:13 +0000 (08:04 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu-lm32.v3' into staging

* afaerber/qom-cpu-lm32.v3:
  target-lm32: QOM'ify CPU reset
  target-lm32: QOM'ify CPU init
  target-lm32: QOM'ify CPU

12 years agoconfigure: Insist on a Python 2, not Python 3
Peter Maydell [Thu, 12 Apr 2012 18:09:52 +0000 (19:09 +0100)]
configure: Insist on a Python 2, not Python 3

Our Python scripts require Python 2 and will fail on Python 3, eg:
  File "/home/petmay01/linaro/qemu-from-laptop/qemu/scripts/qapi-commands.py", line 378
      except getopt.GetoptError, err:
                               ^
  SyntaxError: invalid syntax

Add a check to configure that Python is not a Python 3, so we can
fail with a comprehensible error rather than an obscure one.

Reported-by: Boris Matti <swiftos@lavabit.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agobsd-user: fix compile failure
Peter Maydell [Thu, 12 Apr 2012 11:43:41 +0000 (12:43 +0100)]
bsd-user: fix compile failure

bsd-user doesn't actually support reserving a memory area for the
guest address space, but we need to at least define the reserved_va
global so that cpu-all.h's RESERVED_VA macro will work correctly.

This fixes a compilation error introduced in commit 39879bb
which added a use of RESERVED_VA to h2g_valid().

Reported-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agokvmclock: guest stop notification
Eric B Munson [Sat, 7 Apr 2012 00:47:47 +0000 (06:17 +0530)]
kvmclock: guest stop notification

Often when a guest is stopped from the qemu console, it will report spurious
soft lockup warnings on resume.  There are kernel patches being discussed that
will give the host the ability to tell the guest that it is being stopped and
should ignore the soft lockup warning that generates.  This patch uses the qemu
Notifier system to tell the guest it is about to be stopped.

Signed-off-by: Eric B Munson <emunson@mgebm.net>
Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: update linux headers
Marcelo Tosatti [Thu, 12 Apr 2012 03:43:27 +0000 (00:43 -0300)]
kvm: update linux headers

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: set gsi_bits and max_gsi correctly
Jason Baron [Wed, 28 Mar 2012 18:18:05 +0000 (14:18 -0400)]
kvm: set gsi_bits and max_gsi correctly

The current kvm_init_irq_routing() doesn't set up the used_gsi_bitmap
correctly, and as a consequence pins max_gsi to 32 when it really
should be 1024. I ran into this limitation while testing pci
passthrough, where I consistently got an -ENOSPC return from
kvm_get_irq_route_gsi() called from assigned_dev_update_msix_mmio().

Signed-off-by: Jason Baron <jbaron@redhat.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: Drop unused kvm_pit_in_kernel
Jan Kiszka [Wed, 21 Mar 2012 23:00:48 +0000 (00:00 +0100)]
kvm: Drop unused kvm_pit_in_kernel

This is now implied by kvm_irqchip_in_kernel.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: allow arbitrarily sized mmio ioeventfd
Michael S. Tsirkin [Tue, 20 Mar 2012 12:31:38 +0000 (14:31 +0200)]
kvm: allow arbitrarily sized mmio ioeventfd

We use a 2 byte ioeventfd for virtio memory,
add support for this.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: Drop redundant kvm_enabled from cpu_thread_is_idle
Jan Kiszka [Wed, 21 Mar 2012 12:36:22 +0000 (13:36 +0100)]
kvm: Drop redundant kvm_enabled from cpu_thread_is_idle

This is now implied by kvm_irqchip_in_kernel.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: add flightrecorder script
Stefan Hajnoczi [Fri, 9 Mar 2012 14:13:40 +0000 (14:13 +0000)]
kvm: add flightrecorder script

The kvm kernel module includes a number of trace events which can be
useful when debugging system behavior.  Even on production systems these
trace events can be used to observe guest behavior and identify the
source of problems.

The kvm_flightrecorder script is a command-line wrapper for the
/sys/kernel/debug/tracing interface.  Kernel symbols do not need to be
installed.

This script captures a fixed-size buffer of KVM trace events.  Recent
events overwrite the oldest events when the buffer size is exceeded and
it is possible to leave KVM tracing enabled for any period of time with
just a fixed-size buffer.  If the buffer is large enough this script is
a useful tool for collecting detailed information after an issue occurs
with a guest.  Hence the name "flight recorder".

The script can also be used in 'tail' mode to simply view KVM trace
events as they occur.  This is handy for development and to ensure that
the guest is indeed running.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agops2: avoid repeated header file includes
Wanpeng Li [Wed, 11 Apr 2012 01:02:21 +0000 (09:02 +0800)]
ps2: avoid repeated header file includes

Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agomake: Always set LC_ALL=C for makeinfo
Stefan Weil [Tue, 27 Mar 2012 17:15:27 +0000 (19:15 +0200)]
make: Always set LC_ALL=C for makeinfo

Otherwise the generated file qemu-doc.html will contain "Anhang"
instead of "Appendix" with a German locale (de_DE.UTF-8).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoconfigure: Fix wrong preprocessor statement
Stefan Weil [Fri, 6 Apr 2012 19:33:20 +0000 (21:33 +0200)]
configure: Fix wrong preprocessor statement

#abort is not a preprocessor statement. It aborts, but the preprocessor
statement #error is more common to abort a compilation.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoconfigure: Remove useless uses of ARCH_CFLAGS
Peter Maydell [Wed, 4 Apr 2012 16:03:15 +0000 (17:03 +0100)]
configure: Remove useless uses of ARCH_CFLAGS

Remove some useless uses of ARCH_CFLAGS -- this variable was never set
so will always be empty. The uses were accidental: in commit 0c439cbf8
Juan Quintela removed ARCH_CFLAGS in favour of CFLAGS (which in turn
became QEMU_CFLAGS). However in commit be17dc90 a use of it was
reintroduced (apparently accidentally) by Michael S. Tsirkin, and then
I subsequently cut-n-pasted that into a number of other configure
feature tests.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotarget-microblaze: added PetaLogix copyright
Peter A. G. Crosthwaite [Thu, 12 Apr 2012 04:30:30 +0000 (14:30 +1000)]
target-microblaze: added PetaLogix copyright

Microblaze cpu development has been driven and funded by PetaLogix. Added (c)
PetaLogix line accordingly.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agotarget-lm32: QOM'ify CPU reset
Andreas Färber [Tue, 10 Apr 2012 23:37:45 +0000 (01:37 +0200)]
target-lm32: QOM'ify CPU reset

Move code from cpu_state_reset() into QOM lm32_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
12 years agotarget-lm32: QOM'ify CPU init
Andreas Färber [Tue, 10 Apr 2012 23:33:33 +0000 (01:33 +0200)]
target-lm32: QOM'ify CPU init

Move code from cpu_lm32_init() to an initfn; call cpu_reset()
instead of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
12 years agotarget-lm32: QOM'ify CPU
Andreas Färber [Tue, 10 Apr 2012 23:22:08 +0000 (01:22 +0200)]
target-lm32: QOM'ify CPU

Embed CPULM32State as first member of QOM LM32CPU.
Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
12 years agortl8139: do not assume TxStatus[] and TxAddr[] are adjacent
Stefan Hajnoczi [Wed, 11 Apr 2012 11:01:44 +0000 (12:01 +0100)]
rtl8139: do not assume TxStatus[] and TxAddr[] are adjacent

Commit afe0a595356192d5f79703cf6462fcc112df007c ("rtl8139: support byte
read to TxStatus registers") reused rtl8139_TxStatus_read() for reading
TxAddr registers.  It relies on the fact that TxStatus[] and TxAddr[]
are adjacent.

This causes a gcc warning because the compiler can detect that array
access is out-of-bounds:

  hw/rtl8139.c:2501:27: error: array subscript is above array bounds [-Werror=array-bounds]

This patch refactors the function so that we don't rely on out-of-bounds
accesses.

Cc: Jason Wang <jasonwang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-i386: QOM'ify CPU reset
Andreas Färber [Mon, 2 Apr 2012 22:16:24 +0000 (00:16 +0200)]
target-i386: QOM'ify CPU reset

Move code from cpu_state_reset() into QOM x86_cpu_reset(),
fixing style issues for FPU init.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-i386: QOM'ify CPU init
Andreas Färber [Mon, 2 Apr 2012 22:00:17 +0000 (00:00 +0200)]
target-i386: QOM'ify CPU init

Move code from cpu_x86_init() to new QOM x86_cpu_initfn().
Also move mce_init() to cpu.c since it's used nowhere else.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-i386: QOM'ify CPU
Andreas Färber [Mon, 2 Apr 2012 21:20:08 +0000 (23:20 +0200)]
target-i386: QOM'ify CPU

Embed CPUX86State as first member of X86CPU.
Distinguish between "x86_64-cpu" and "i386-cpu".
Drop cpu_x86_close() in favor of calling object_delete() directly.

For now let CPUClass::reset() call cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-i386: Rename cpuid.c
Andreas Färber [Mon, 2 Apr 2012 20:22:12 +0000 (22:22 +0200)]
target-i386: Rename cpuid.c

Name it cpu.c to align with other QOM'ified targets.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoMerge commit 'ff71f2e8cacefae99179993204172bc65e4303df' into staging
Anthony Liguori [Tue, 10 Apr 2012 13:21:58 +0000 (08:21 -0500)]
Merge commit 'ff71f2e8cacefae99179993204172bc65e4303df' into staging

* commit 'ff71f2e8cacefae99179993204172bc65e4303df': (21 commits)
  rtl8139: do the network/host communication only in normal operating mode
  rtl8139: correctly check the opmode
  net: move compute_mcast_idx() to net.h
  rtl8139: support byte read to TxStatus registers
  rtl8139: remove unused marco
  rtl8139: limit transmission buffer size in c+ mode
  pci_regs: Add PCI_EXP_TYPE_PCIE_BRIDGE
  virtio-net: add DATA_VALID flag
  pci_bridge: upper 32 bit are long registers
  pci: fix bridge IO/BASE
  pcie: drop functionality moved to core
  pci: set memory type for memory behind the bridge
  pci: add standard bridge device
  slotid: add slot id capability
  shpc: standard hot plug controller
  pci_bridge: user-friendly default bus name
  pci: make another unused extern function static
  pci: don't export an internal function
  pci_regs: Fix value of PCI_EXP_TYPE_RC_EC.
  pci: Do not check if a bus exist in pci_parse_devaddr.
  ...

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Tue, 10 Apr 2012 13:17:36 +0000 (08:17 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qapi: convert device_del
  qdev: qdev_unplug(): use error_set()

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Tue, 10 Apr 2012 13:16:12 +0000 (08:16 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (46 commits)
  qed: remove incoming live migration blocker
  qed: honor BDRV_O_INCOMING for incoming live migration
  migration: clear BDRV_O_INCOMING flags on end of incoming live migration
  qed: add bdrv_invalidate_cache to be called after incoming live migration
  blockdev: open images with BDRV_O_INCOMING on incoming live migration
  block: add a function to clear incoming live migration flags
  block: Add new BDRV_O_INCOMING flag to notice incoming live migration
  block stream: close unused files and update ->backing_hd
  qemu-iotests: Fix call syntax for qemu-io
  qemu-iotests: Fix call syntax for qemu-img
  qemu-iotests: Test unknown qcow2 header extensions
  qemu-iotests: qcow2.py
  sheepdog: fix send req helpers
  sheepdog: implement SD_OP_FLUSH_VDI operation
  block: bdrv_append() fixes
  qed: track dirty flag status
  qemu-img: add dirty flag status
  qed: image fragmentation statistics
  qemu-img: add image fragmentation statistics
  block: document job API
  ...

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Tue, 10 Apr 2012 13:10:41 +0000 (08:10 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  make: fix clean rule by removing build file in qom/
  configure: Link qga against UST tracing related libraries
  configure: Link QEMU against 'liburcu-bp'
  main-loop: make qemu_event_handle static
  block/curl: Replace usleep by g_usleep
  qtest: Add missing GCC_FMT_ATTR
  w32: Undefine error constants before their redefinition
  configure: fix mingw32 libs_qga typo

12 years agopetalogix_s3adsp1800: deleted bad FIXME comment
Peter A. G. Crosthwaite [Tue, 10 Apr 2012 04:05:52 +0000 (14:05 +1000)]
petalogix_s3adsp1800: deleted bad FIXME comment

This FIXME has already been actioned. Deleted comment.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoqapi: convert device_del
Luiz Capitulino [Thu, 29 Mar 2012 15:38:50 +0000 (12:38 -0300)]
qapi: convert device_del

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqdev: qdev_unplug(): use error_set()
Luiz Capitulino [Wed, 14 Mar 2012 20:37:38 +0000 (17:37 -0300)]
qdev: qdev_unplug(): use error_set()

It currently uses qerror_report(), but next commit will convert
the drive_del command to the QAPI and this requires using
error_set().

One particularity of qerror_report() is that it knows when it's
running on monitor context or command-line context and prints the
error message accordingly. error_set() doesn't do this, so we
have to be careful not to drop error messages.

qdev_unplug() has three kinds of usages:

 1. It's called when hot adding a device fails, to undo anything
    that has been done before hitting the error

 2. It's called by function monitor functions like device_del(),
    to unplug a device

 3. It's used by xen_platform.c in a way that doesn't _seem_ to
    be in monitor context

Only item 2 can print an error message to the user, this commit
maintains that.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoMerge branch 'memory/core' of git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm
Blue Swirl [Sun, 8 Apr 2012 18:00:42 +0000 (18:00 +0000)]
Merge branch 'memory/core' of git://git./virt/kvm/qemu-kvm

* 'memory/core' of git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm:
  memory: check address space when a listener is registered
  memory: print aliased IO ranges in info mtree
  ioport: use INT64_MAX for IO ranges

12 years agoAdd QEMU_NORETURN to function cpu_io_recompile
Stefan Weil [Sat, 7 Apr 2012 15:58:34 +0000 (17:58 +0200)]
Add QEMU_NORETURN to function cpu_io_recompile

cpu_io_recompile terminates by calling either cpu_abort or
cpu_resume_from_signal which both never return.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoAdd QEMU_NORETURN to function cpu_resume_from_signal
Stefan Weil [Sat, 7 Apr 2012 15:58:33 +0000 (17:58 +0200)]
Add QEMU_NORETURN to function cpu_resume_from_signal

cpu_resume_from_signal terminates by calling longjmp.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoReplace Qemu by QEMU in comments
Stefan Weil [Sat, 7 Apr 2012 07:23:39 +0000 (09:23 +0200)]
Replace Qemu by QEMU in comments

The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
[blauwirbel@gmail.com: fixed comment style in hw/sun4m.c]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoReplace Qemu by QEMU in w32 installation path (prefix)
Stefan Weil [Sat, 7 Apr 2012 07:23:38 +0000 (09:23 +0200)]
Replace Qemu by QEMU in w32 installation path (prefix)

The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoReplace Qemu by QEMU in internal documentation
Stefan Weil [Sat, 7 Apr 2012 07:23:37 +0000 (09:23 +0200)]
Replace Qemu by QEMU in internal documentation

The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoReplace Qemu by QEMU in user visible documentation
Stefan Weil [Sat, 7 Apr 2012 07:23:36 +0000 (09:23 +0200)]
Replace Qemu by QEMU in user visible documentation

The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoremove useless comments in dma
Wanpeng Li [Fri, 6 Apr 2012 07:52:09 +0000 (15:52 +0800)]
remove useless comments in dma

This comment is useless, just removes it and makes the codes clear.

Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotci: Support targets with CONFIG_TCG_PASS_AREG0 (fix broken build)
Stefan Weil [Sat, 7 Apr 2012 09:48:39 +0000 (11:48 +0200)]
tci: Support targets with CONFIG_TCG_PASS_AREG0 (fix broken build)

Builds with --enable-tcg-interpreter failed because more and more
targets (currently alpha and sparc) replaced the global env in AREG0
by function parameters.

Convert the TCG interpreter to use the new helper functions and add
defines for those targets which still use AREG0.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio...
Blue Swirl [Sat, 7 Apr 2012 11:45:25 +0000 (11:45 +0000)]
Merge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu

* 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu:
  Userspace ARM BE8 support
  elf.h: Update EF_ARM_ constants to newer ABI versions
  arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.
  linux-user/arm/syscall_nr.h: Add syscall number for ppoll
  linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
  linux-user/syscall.c: Fix indentation in prctl handling
  linux-user: reserve 4GB of vmem for 32-on-64
  linux-user: resolve reserved_va vma downwards
  linux-user: take RESERVED_VA into account for g2h_valid()
  linux-user: fix fallocate
  linux-user: Add ioctl for BLKBSZGET
  linux-user: add BLKSSZGET ioctl wrapper
  linux-user: fix BLK ioctl arguments
  linux-user: add struct old_dev_t compat
  linux-user: implement device mapper ioctls
  linux-user: target_argv is placed on ts->bprm->argv and can't be freed()
  linux-user: improve fake /proc/self/stat making `ps` not segfault.

12 years agow64: Fix data type of tb_next and other variables used for host addresses
Stefan Weil [Fri, 6 Apr 2012 20:26:15 +0000 (22:26 +0200)]
w64: Fix data type of tb_next and other variables used for host addresses

QEMU host addresses must use uintptr_t to be portable for hosts with
an unusual size of long (w64).

tb_jmp_offset is an uint16_t value, therefore the local variable offset
in function tb_set_jmp_target was changed from unsigned long to uint16_t.

The type cast to long in function tb_add_jump now also uses uintptr_t.
For the bit operation used here, the signedness of the type cast does
not matter.

Some remaining unsigned long values are either only used for ARM assembler
code or will be fixed in a later patch for PPC.

v2:
Fix signature of tb_find_pc in exec.c, too (hint from Blue Swirl, thanks).
There remain lots of other long / unsigned long in exec.c which must be
replaced by uintptr_t. This will be done in a separate patch. Here
only one of these type casts is fixed.

v3:
Also fix signature of page_unprotect.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosoftfloat: roundAndPackInt{32, 64}: Don't assume int32 is 32 bits
Peter Maydell [Thu, 5 Apr 2012 18:12:35 +0000 (19:12 +0100)]
softfloat: roundAndPackInt{32, 64}: Don't assume int32 is 32 bits

Fix code in roundAndPackInt32 that assumed that int32 was only
32 bits, by simply using int32_t instead. Fix the parallel bug
in roundAndPackInt64 as well, although that one is only theoretical
since it's unlikely that int64 will ever be more than 64 bits.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosoftfloat: float*_to_int32_round_to_zero: don't assume int32 is 32 bits
Peter Maydell [Thu, 5 Apr 2012 18:12:34 +0000 (19:12 +0100)]
softfloat: float*_to_int32_round_to_zero: don't assume int32 is 32 bits

Code in the float64_to_int32_round_to_zero() function was assuming
that int32 would not be wider than 32 bits; this meant it might
not correctly detect the overflow case. We take the simple approach
of using int32_t. Also fix equivalent issues in the functions
for other float sizes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoconfigure: require glib 2.12, 2.20 for mingw32
Paolo Bonzini [Thu, 5 Apr 2012 11:01:54 +0000 (13:01 +0200)]
configure: require glib 2.12, 2.20 for mingw32

These are pretty sane requirements to move forward with glib usage.
2.12 is the version found in RHEL/CentOS 5, and 2.20 is the
first version to support g_poll.  Without g_poll, we cannot
integrate well with the glib main loop.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomain-loop: integrate glib sources for w32
Paolo Bonzini [Tue, 20 Mar 2012 09:49:21 +0000 (10:49 +0100)]
main-loop: integrate glib sources for w32

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomain-loop: replace WaitForMultipleObjects with g_poll
Paolo Bonzini [Tue, 20 Mar 2012 09:49:20 +0000 (10:49 +0100)]
main-loop: replace WaitForMultipleObjects with g_poll

On w32, glib implements g_poll using WaitForMultipleObjects
or MsgWaitForMultipleObjects.  This means that we can simplify
our code by switching to g_poll, and at the same time prepare for
adding back glib sources.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomain-loop: interrupt wait when data arrives on a socket
Paolo Bonzini [Tue, 20 Mar 2012 09:49:19 +0000 (10:49 +0100)]
main-loop: interrupt wait when data arrives on a socket

Right now, the main loop is not interrupted when data arrives on a
socket.  To fix this, register each socket to interrupt the main loop
with WSAEventSelect.  This does not replace select, it only communicates
a change in socket state that requires a select call.

Since the interrupt fires only once per recv call, or only once
after a send call returns EWOULDBLOCK we can activate it on all events
unconditionally.  If QEMU is momentarily uninterested on some condition,
the main loop will not busy wait.  Instead, it may get one extra wakeup,
but then it will ignore the condition until progress occurs and/or
qemu_set_fd_handler is called to set a callback.  At this point the
condition will be tested via select and the callback will be invoked
even if it is still disabled on the event.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomain-loop: disable fd_set-based glib integration under w32
Paolo Bonzini [Tue, 20 Mar 2012 09:49:18 +0000 (10:49 +0100)]
main-loop: disable fd_set-based glib integration under w32

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>
12 years agomain loop: use msec-based timeout in glib_select_fill
Paolo Bonzini [Tue, 20 Mar 2012 09:49:17 +0000 (10:49 +0100)]
main loop: use msec-based timeout in glib_select_fill

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>
12 years agotarget-sparc: QOM'ify CPU
Andreas Färber [Wed, 4 Apr 2012 23:29:40 +0000 (01:29 +0200)]
target-sparc: QOM'ify CPU

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>
12 years agotarget-sparc: Rename cpu_init.c
Andreas Färber [Wed, 4 Apr 2012 23:29:39 +0000 (01:29 +0200)]
target-sparc: Rename cpu_init.c

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>
12 years agoUserspace ARM BE8 support
Paul Brook [Fri, 30 Mar 2012 17:02:50 +0000 (18:02 +0100)]
Userspace ARM BE8 support

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>
12 years agoelf.h: Update EF_ARM_ constants to newer ABI versions
Peter Maydell [Fri, 30 Mar 2012 17:02:49 +0000 (18:02 +0100)]
elf.h: Update EF_ARM_ constants to newer ABI versions

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>
12 years agoarm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.
Benoit Canet [Wed, 9 Nov 2011 03:37:23 +0000 (03:37 +0000)]
arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.

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>
12 years agolinux-user/arm/syscall_nr.h: Add syscall number for ppoll
Peter Maydell [Fri, 16 Mar 2012 17:16:36 +0000 (17:16 +0000)]
linux-user/arm/syscall_nr.h: Add syscall number for ppoll

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>
12 years agolinux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
Peter Maydell [Fri, 3 Feb 2012 14:48:03 +0000 (14:48 +0000)]
linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME

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>
12 years agolinux-user/syscall.c: Fix indentation in prctl handling
Peter Maydell [Fri, 3 Feb 2012 14:48:03 +0000 (14:48 +0000)]
linux-user/syscall.c: Fix indentation in prctl handling

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>
12 years agolinux-user: reserve 4GB of vmem for 32-on-64
Alexander Graf [Tue, 13 Dec 2011 23:33:28 +0000 (00:33 +0100)]
linux-user: reserve 4GB of vmem for 32-on-64

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>
12 years agolinux-user: resolve reserved_va vma downwards
Peter Maydell [Thu, 8 Mar 2012 14:40:33 +0000 (14:40 +0000)]
linux-user: resolve reserved_va vma downwards

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>
12 years agolinux-user: take RESERVED_VA into account for g2h_valid()
Alexander Graf [Thu, 2 Feb 2012 02:14:18 +0000 (03:14 +0100)]
linux-user: take RESERVED_VA into account for g2h_valid()

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>
12 years agolinux-user: fix fallocate
Alexander Graf [Mon, 6 Feb 2012 20:37:07 +0000 (21:37 +0100)]
linux-user: fix fallocate

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>
12 years agolinux-user: Add ioctl for BLKBSZGET
Alexander Graf [Thu, 2 Feb 2012 01:22:34 +0000 (02:22 +0100)]
linux-user: Add ioctl for BLKBSZGET

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>
12 years agolinux-user: add BLKSSZGET ioctl wrapper
Alexander Graf [Tue, 31 Jan 2012 19:11:37 +0000 (20:11 +0100)]
linux-user: add BLKSSZGET ioctl wrapper

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>
12 years agolinux-user: fix BLK ioctl arguments
Alexander Graf [Tue, 31 Jan 2012 19:10:20 +0000 (20:10 +0100)]
linux-user: fix BLK ioctl arguments

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>
12 years agolinux-user: add struct old_dev_t compat
Alexander Graf [Tue, 31 Jan 2012 18:44:41 +0000 (19:44 +0100)]
linux-user: add struct old_dev_t compat

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>
12 years agolinux-user: implement device mapper ioctls
Alexander Graf [Tue, 31 Jan 2012 17:42:06 +0000 (18:42 +0100)]
linux-user: implement device mapper ioctls

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>
12 years agolinux-user: target_argv is placed on ts->bprm->argv and can't be freed()
Fabio Erculiani [Tue, 3 Jan 2012 09:38:35 +0000 (09:38 +0000)]
linux-user: target_argv is placed on ts->bprm->argv and can't be freed()

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>
12 years agolinux-user: improve fake /proc/self/stat making `ps` not segfault.
Fabio Erculiani [Tue, 3 Jan 2012 09:38:34 +0000 (09:38 +0000)]
linux-user: improve fake /proc/self/stat making `ps` not segfault.

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>
12 years agoqed: remove incoming live migration blocker
Benoît Canet [Fri, 23 Mar 2012 07:36:54 +0000 (08:36 +0100)]
qed: remove incoming live migration blocker

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqed: honor BDRV_O_INCOMING for incoming live migration
Benoît Canet [Fri, 23 Mar 2012 07:36:53 +0000 (08:36 +0100)]
qed: honor BDRV_O_INCOMING for incoming live migration

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>
12 years agomigration: clear BDRV_O_INCOMING flags on end of incoming live migration
Benoît Canet [Fri, 23 Mar 2012 07:36:52 +0000 (08:36 +0100)]
migration: clear BDRV_O_INCOMING flags on end of incoming live migration

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>
12 years agoqed: add bdrv_invalidate_cache to be called after incoming live migration
Benoît Canet [Fri, 23 Mar 2012 07:36:51 +0000 (08:36 +0100)]
qed: add bdrv_invalidate_cache to be called after incoming live migration

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>
12 years agoblockdev: open images with BDRV_O_INCOMING on incoming live migration
Benoît Canet [Fri, 23 Mar 2012 07:36:50 +0000 (08:36 +0100)]
blockdev: open images with BDRV_O_INCOMING on incoming live migration

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>
12 years agoblock: add a function to clear incoming live migration flags
Benoît Canet [Fri, 23 Mar 2012 07:36:49 +0000 (08:36 +0100)]
block: add a function to clear incoming live migration flags

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>
12 years agoblock: Add new BDRV_O_INCOMING flag to notice incoming live migration
Benoît Canet [Fri, 23 Mar 2012 07:36:48 +0000 (08:36 +0100)]
block: Add new BDRV_O_INCOMING flag to notice incoming live migration

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>
12 years agoblock stream: close unused files and update ->backing_hd
Marcelo Tosatti [Tue, 27 Mar 2012 00:22:10 +0000 (21:22 -0300)]
block stream: close unused files and update ->backing_hd

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>
12 years agoqemu-iotests: Fix call syntax for qemu-io
Stefan Weil [Wed, 14 Mar 2012 18:57:24 +0000 (19:57 +0100)]
qemu-iotests: Fix call syntax for qemu-io

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>
12 years agoqemu-iotests: Fix call syntax for qemu-img
Stefan Weil [Wed, 14 Mar 2012 18:57:23 +0000 (19:57 +0100)]
qemu-iotests: Fix call syntax for qemu-img

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>
12 years agoqemu-iotests: Test unknown qcow2 header extensions
Kevin Wolf [Thu, 16 Feb 2012 15:55:01 +0000 (16:55 +0100)]
qemu-iotests: Test unknown qcow2 header extensions

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>
12 years agoqemu-iotests: qcow2.py
Kevin Wolf [Wed, 15 Feb 2012 15:36:03 +0000 (16:36 +0100)]
qemu-iotests: qcow2.py

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>
12 years agosheepdog: fix send req helpers
Liu Yuan [Tue, 3 Apr 2012 10:04:21 +0000 (18:04 +0800)]
sheepdog: fix send req helpers

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>
12 years agosheepdog: implement SD_OP_FLUSH_VDI operation
Liu Yuan [Tue, 3 Apr 2012 20:03:58 +0000 (04:03 +0800)]
sheepdog: implement SD_OP_FLUSH_VDI operation

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>
12 years agoblock: bdrv_append() fixes
Jeff Cody [Tue, 27 Mar 2012 20:30:19 +0000 (16:30 -0400)]
block: bdrv_append() fixes

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>
12 years agoqed: track dirty flag status
Dong Xu Wang [Thu, 15 Mar 2012 12:13:34 +0000 (20:13 +0800)]
qed: track dirty flag status

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>
12 years agoqemu-img: add dirty flag status
Dong Xu Wang [Thu, 15 Mar 2012 12:13:33 +0000 (20:13 +0800)]
qemu-img: add dirty flag status

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>
12 years agoqed: image fragmentation statistics
Dong Xu Wang [Thu, 15 Mar 2012 12:13:32 +0000 (20:13 +0800)]
qed: image fragmentation statistics

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>
12 years agoqemu-img: add image fragmentation statistics
Dong Xu Wang [Thu, 15 Mar 2012 12:13:31 +0000 (20:13 +0800)]
qemu-img: add image fragmentation statistics

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>
12 years agoblock: document job API
Paolo Bonzini [Fri, 30 Mar 2012 11:17:13 +0000 (13:17 +0200)]
block: document job API

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>
12 years agoblock: set job->speed in block_set_speed
Paolo Bonzini [Fri, 30 Mar 2012 11:17:12 +0000 (13:17 +0200)]
block: set job->speed in block_set_speed

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>
12 years agoblock: fix streaming/closing race
Paolo Bonzini [Fri, 30 Mar 2012 11:17:11 +0000 (13:17 +0200)]
block: fix streaming/closing race

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>
12 years agoblock: cancel jobs when a device is ready to go away
Paolo Bonzini [Fri, 30 Mar 2012 11:17:10 +0000 (13:17 +0200)]
block: cancel jobs when a device is ready to go away

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>
12 years agoblock: disable I/O throttling on sync api
Zhi Yong Wu [Mon, 2 Apr 2012 10:59:34 +0000 (18:59 +0800)]
block: disable I/O throttling on sync api

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>
12 years agoUse DMADirection type for dma_bdrv_io
David Gibson [Tue, 27 Mar 2012 02:42:23 +0000 (13:42 +1100)]
Use DMADirection type for dma_bdrv_io

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>