]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agoqemu-iotests: add 052 BDRV_O_SNAPSHOT test
Stefan Hajnoczi [Mon, 18 Mar 2013 16:58:54 +0000 (17:58 +0100)]
qemu-iotests: add 052 BDRV_O_SNAPSHOT test

Check that writes to an image opened with BDRV_O_SNAPSHOT do not modify
the underlying image file.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: fix BDRV_O_SNAPSHOT protocol detection
Stefan Hajnoczi [Mon, 18 Mar 2013 16:58:53 +0000 (17:58 +0100)]
block: fix BDRV_O_SNAPSHOT protocol detection

realpath(3) is used to get an absolute path to the image file when
creating a -drive snapshot=on temporary qcow2.  This does not work for
protocols since their filenames ("proto:foo:...") do not correspond to
file system paths.

Commit 7c96d46ec245d73fd76726588409f9abe4bd5dc1 ("Let snapshot work with
protocols") skipped realpath(3) for protocols.  Later on the "raw"
format was introduced and broke the check.

Use path_has_protocol(filename) to decide if this image uses a protocol
or a filename.

Reported-by: Richard Jones <rjones@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Fix segfault in qcow2_invalidate_cache
Kevin Wolf [Mon, 18 Mar 2013 12:08:10 +0000 (13:08 +0100)]
qcow2: Fix segfault in qcow2_invalidate_cache

Need to pass an options QDict to qcow2_open() now. This fixes a segfault
on the migration target with qcow2.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agosheepdog: show error message for halt status
Liu Yuan [Mon, 18 Mar 2013 06:27:55 +0000 (14:27 +0800)]
sheepdog: show error message for halt status

Sheepdog (neither quorum nor unsafe mode) will refuse to serve IO requests when
number of alive nodes is less than that of copies specified by users. This will
return 0x19 to QEMU client which currently doesn't recognize it.

This patch adds an error description when QEMU client receives it, other than
plainly printing 'Invalid error code'

Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agovirtio-blk: cleanup: remove qdev field.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:28 +0000 (17:37 +0100)]
virtio-blk: cleanup: remove qdev field.

The qdev field is no longer needed, just drop it.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-12-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-blk: cleanup: QOM cast
KONRAD Frederic [Mon, 18 Mar 2013 16:37:27 +0000 (17:37 +0100)]
virtio-blk: cleanup: QOM cast

Use QOM casts inside virtio-blk.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-11-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-blk: cleanup: init and exit functions.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:26 +0000 (17:37 +0100)]
virtio-blk: cleanup: init and exit functions.

As all virtio-blk-* are switched to the new API, we can remove the separate
init/exit for the old API.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-10-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-blk-ccw switch to new API.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:25 +0000 (17:37 +0100)]
virtio-blk-ccw switch to new API.

Here the virtio-ccw-s390 is modified for the new API. The device
virtio-ccw-s390 extends virtio-ccw-device as before. It creates and
connects a virtio-ccw during the init. The properties are not modified.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-9-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-blk-s390: switch to the new API.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:24 +0000 (17:37 +0100)]
virtio-blk-s390: switch to the new API.

Here the virtio-blk-s390 is modified for the new API. The device
virtio-blk-s390 extends virtio-s390-device as before. It creates and
connects a virtio-blk during the init. The properties are not modified.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-8-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-blk-pci: switch to new API.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:23 +0000 (17:37 +0100)]
virtio-blk-pci: switch to new API.

Here the virtio-blk-pci is modified for the new API. The device
virtio-blk-pci extends virtio-pci. It creates and connects a virtio-blk
during the init. The properties are not changed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-7-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-blk: add the virtio-blk device.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:22 +0000 (17:37 +0100)]
virtio-blk: add the virtio-blk device.

Create virtio-blk which extends virtio-device, so it can be connected on
virtio-bus.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-6-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-blk: don't use pointer for configuration.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:21 +0000 (17:37 +0100)]
virtio-blk: don't use pointer for configuration.

The configuration field must not be a pointer as it will be used for virtio-blk
properties. So *blk is replaced by blk in VirtIOBlock structure.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-5-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-pci: fix hot unplug.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:20 +0000 (17:37 +0100)]
virtio-pci: fix hot unplug.

Hot unplug failed because it tried to free the virtio device two times.

This fix the issue by removing the call to virtio_bus_destroy_device.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1363624648-16906-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-x-bus: fix allow_hotplug assertion.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:19 +0000 (17:37 +0100)]
virtio-x-bus: fix allow_hotplug assertion.

This set allow_hotplug for each existing virtio-x-bus, allowing the
refactored devices to be hot pluggable.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1363624648-16906-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: make virtio device's structures public.
KONRAD Frederic [Mon, 18 Mar 2013 16:37:18 +0000 (17:37 +0100)]
virtio: make virtio device's structures public.

These structures must be made public to avoid two memory allocations for
refactored virtio devices.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1363624648-16906-2-git-send-email-fred.konrad@greensocs.com

Changes V4 <- V3:
   * Rebased on current git.

Changes V3 <- V2:
    * Style correction spotted by Andreas (virtio-scsi.h).
    * Style correction for virtio-net.h.

Changes V2 <- V1:
    * Move the dataplane include into the header (virtio-blk).
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/pixman.v8' into staging
Anthony Liguori [Mon, 18 Mar 2013 12:34:24 +0000 (07:34 -0500)]
Merge remote-tracking branch 'kraxel/pixman.v8' into staging

# By Gerd Hoffmann (18) and others
# Via Blue Swirl (1) and Gerd Hoffmann (1)
* kraxel/pixman.v8: (37 commits)
  console: remove ds_get_* helper functions
  console: zap color_table
  console: stop using DisplayState in gfx hardware emulation
  console: zap displaystate from dcl callbacks
  cocoa: stop using DisplayState
  spice: stop using DisplayState
  sdl: stop using DisplayState
  vnc: stop using DisplayState
  gtk: stop using DisplayState
  console: add surface_*() getters
  console: rework DisplaySurface handling [dcl/ui side]
  console: rework DisplaySurface handling [vga emu side]
  sdl: drop dead code
  qxl: better vga init in enter_vga_mode
  qxl: zap qxl0 global
  spice: zap sdpy global
  console: kill DisplayState->opaque
  console: fix displaychangelisteners interface
  s390: Fix cpu refactoring fallout.
  target-mips: fix rndrashift_short_acc and code for EXTR_ instructions
  ...

11 years agoconsole: remove ds_get_* helper functions
Gerd Hoffmann [Wed, 6 Mar 2013 12:40:47 +0000 (13:40 +0100)]
console: remove ds_get_* helper functions

Switch the few remaining ds_get_* uses in console.c over to the new
surface_* accessors.

While doing so tripped over a few leftovers from commit
a93a4a226a2afba147ba5df688b85d844f537c68 (code using depth == 0
as indicator for textmode rendering).  Fixed them up.

Finally dropped ds_get_* helper helpers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: zap color_table
Gerd Hoffmann [Wed, 6 Mar 2013 08:50:51 +0000 (09:50 +0100)]
console: zap color_table

qemu_create_surface hands out 32bpp surfaces.
So we can just use color_table_rgb directly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: stop using DisplayState in gfx hardware emulation
Gerd Hoffmann [Tue, 5 Mar 2013 14:24:14 +0000 (15:24 +0100)]
console: stop using DisplayState in gfx hardware emulation

Use QemuConsole instead.  Updates interfaces in console.[ch] and adapts
gfx hardware emulation code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: zap displaystate from dcl callbacks
Gerd Hoffmann [Fri, 1 Mar 2013 12:03:04 +0000 (13:03 +0100)]
console: zap displaystate from dcl callbacks

Now that nobody depends on DisplayState in DisplayChangeListener
callbacks any more we can remove the parameter from all callbacks.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agococoa: stop using DisplayState
Gerd Hoffmann [Fri, 1 Mar 2013 11:52:06 +0000 (12:52 +0100)]
cocoa: stop using DisplayState

Rework DisplayStateListener callbacks to not use the DisplayState
any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agospice: stop using DisplayState
Gerd Hoffmann [Thu, 28 Feb 2013 15:42:28 +0000 (16:42 +0100)]
spice: stop using DisplayState

Rework DisplayStateListener callbacks to not use the DisplayState
any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agosdl: stop using DisplayState
Gerd Hoffmann [Fri, 1 Mar 2013 08:01:13 +0000 (09:01 +0100)]
sdl: stop using DisplayState

Rework DisplayStateListener callbacks to not use the DisplayState
any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agovnc: stop using DisplayState
Gerd Hoffmann [Thu, 28 Feb 2013 16:16:48 +0000 (17:16 +0100)]
vnc: stop using DisplayState

Rework DisplayStateListener callbacks to not use the DisplayState
any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agogtk: stop using DisplayState
Gerd Hoffmann [Thu, 28 Feb 2013 15:10:02 +0000 (16:10 +0100)]
gtk: stop using DisplayState

Rework DisplayStateListener callbacks to not use the DisplayState
any more.  Factor out the window size handling to a separate function,
so the zoom callbacks can call that directly instead of abusing the
gd_switch DisplayStateListener callback for that.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: add surface_*() getters
Gerd Hoffmann [Thu, 28 Feb 2013 14:24:14 +0000 (15:24 +0100)]
console: add surface_*() getters

Add convinence wrappers to query DisplaySurface properties.
Simliar to ds_get_*, but operating in the DisplaySurface
not the DisplayState.

With this patch in place ui frontents can stop using DisplayState
in the rendering code paths, they can simply operate using the
DisplaySurface passed in via dpy_gfx_switch callback.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: rework DisplaySurface handling [dcl/ui side]
Gerd Hoffmann [Thu, 28 Feb 2013 14:03:04 +0000 (15:03 +0100)]
console: rework DisplaySurface handling [dcl/ui side]

Replace the dpy_gfx_resize and dpy_gfx_setdata DisplayChangeListener
callbacks with a dpy_gfx_switch callback which notifies the ui code
when the framebuffer backing storage changes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: rework DisplaySurface handling [vga emu side]
Gerd Hoffmann [Thu, 28 Feb 2013 09:48:02 +0000 (10:48 +0100)]
console: rework DisplaySurface handling [vga emu side]

Decouple DisplaySurface allocation & deallocation from DisplayState.
Replace dpy_gfx_resize + dpy_gfx_setdata with a dpy_gfx_replace_surface
function.

This handles the graphic hardware emulation.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agosdl: drop dead code
Gerd Hoffmann [Thu, 28 Feb 2013 09:48:36 +0000 (10:48 +0100)]
sdl: drop dead code

DisplayAllocator removal (commit
187cd1d9f30d13f0d0ef682e4d91cfa3e4cbd472) made this a nop.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: better vga init in enter_vga_mode
Gerd Hoffmann [Thu, 28 Feb 2013 10:08:50 +0000 (11:08 +0100)]
qxl: better vga init in enter_vga_mode

Ask the vga core to update the display.  Will trigger dpy_gfx_resize
if needed.  More complete than just calling dpy_gfx_resize.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: zap qxl0 global
Gerd Hoffmann [Thu, 28 Feb 2013 11:15:00 +0000 (12:15 +0100)]
qxl: zap qxl0 global

DisplayChangeListener is passed now to all DisplayChangeListenerOps
callbacks, so we can use that to access the qxl state and kill the
qxl0 global variable.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agospice: zap sdpy global
Gerd Hoffmann [Thu, 28 Feb 2013 13:47:07 +0000 (14:47 +0100)]
spice: zap sdpy global

DisplayChangeListener is passed now to all DisplayChangeListenerOps
callbacks, so we can use that to access the spice display state and
kill the sdpy global variable.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: kill DisplayState->opaque
Gerd Hoffmann [Thu, 28 Feb 2013 10:34:31 +0000 (11:34 +0100)]
console: kill DisplayState->opaque

It's broken by design.  There can be multiple DisplayChangeListener
instances, so they simply can't store state in the (single) DisplayState
struct.  Try 'qemu -display gtk -vnc :0', watch it crash & burn.

With DisplayChangeListenerOps having a more sane interface now we can
simply use the DisplayChangeListener pointer to get access to our
private data instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: fix displaychangelisteners interface
Gerd Hoffmann [Tue, 13 Nov 2012 13:51:41 +0000 (14:51 +0100)]
console: fix displaychangelisteners interface

Split callbacks into separate Ops struct.  Pass DisplayChangeListener
pointer as first argument to all callbacks.  Uninline a bunch of
display functions and move them from console.h to console.c

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agos390: Fix cpu refactoring fallout.
Cornelia Huck [Fri, 15 Mar 2013 09:57:40 +0000 (10:57 +0100)]
s390: Fix cpu refactoring fallout.

Commit 259186a7 "cpu: Move halted and interrupt_request fields to CPUState"
seems to have missed one instance in target-s390x/kvm.c:

/home/cohuck/git/qemu/target-s390x/kvm.c: In function ‘kvm_arch_process_async_events’:
/home/cohuck/git/qemu/target-s390x/kvm.c:319: error: ‘CPUS390XState’ has no member named ‘halted’
/home/cohuck/git/qemu/target-s390x/kvm.c:320: warning: control reaches end of non-void function
make[1]: *** [target-s390x/kvm.o] Error 1

Let's just switch to cs->halted.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sun, 17 Mar 2013 17:44:47 +0000 (17:44 +0000)]
Merge branch 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm:
  xilinx_spips: QOM styling fixes
  xilinx_spips: Add missing dual-bus snoop commands
  xilinx_spips: Fix bus setup conditional check
  xilinx_spips: Set unused IRQs to NULL
  xilinx_zynq: added pl330 to machine model
  pl330: Initial version
  iov: Factor out hexdumper
  hw/vexpress: Set reset values for daughterboard oscillators
  hw/arm_sysctl: Implement SYS_CFG_OSC function
  hw/vexpress: Pass voltage sensor properties to sysctl device
  hw/arm_sysctl: Implement SYS_CFG_VOLT
  qdev: Implement (variable length) array properties
  hw/arm_sysctl: Convert from qdev init to instance_init
  hw/arm_sysctl: Implement SYS_CFG_DVIMODE as a no-op
  hw/arm_sysctl: Implement SYS_CFG_MUXFPGA writes as a no-op
  hw/arm_sysctl: Handle SYS_CFGCTRL in a more structured way
  hw/vexpress: Pass proc_id via VEDBoardInfo

11 years agotarget-mips: fix rndrashift_short_acc and code for EXTR_ instructions
Petar Jovanovic [Fri, 15 Mar 2013 17:56:19 +0000 (18:56 +0100)]
target-mips: fix rndrashift_short_acc and code for EXTR_ instructions

Fix for rndrashift_short_acc to set correct value to higher 64 bits.
This change also corrects conditions when bit 23 of the DSPControl register
is set.

The existing test files have been extended with several examples that
trigger the issues. One bug/example in the test file for EXTR_RS_W has been
found and reported by Klaus Peichl.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoxilinx_spips: QOM styling fixes
Peter Crosthwaite [Fri, 15 Mar 2013 16:41:59 +0000 (16:41 +0000)]
xilinx_spips: QOM styling fixes

Few fixes for the latest QOM styling guides.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: de9daeee6c142e8b57ad042fd680cedcdc94d2fc.1362373359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Add missing dual-bus snoop commands
Nathan Rossi [Fri, 15 Mar 2013 16:41:59 +0000 (16:41 +0000)]
xilinx_spips: Add missing dual-bus snoop commands

Added additional commands to the switch to check for when snooping commands in
dual bus mode setups. Cleaned up code to use an enum.

Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 848c116c711dab0af10729a487968384aadd9faf.1362373359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Fix bus setup conditional check
Nathan Rossi [Fri, 15 Mar 2013 16:41:59 +0000 (16:41 +0000)]
xilinx_spips: Fix bus setup conditional check

The R_LQPSI_CFG register has the LQSPI_CFG_SEP_BUS and LQSPI_CFG_TWO_MEM bits.

Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: d76c8e364c80a42352ae4f0661aff2cd17ad32a4.1362373359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Set unused IRQs to NULL
Peter Crosthwaite [Fri, 15 Mar 2013 16:41:58 +0000 (16:41 +0000)]
xilinx_spips: Set unused IRQs to NULL

Unused CS lines should init to 0 to avoid segfaulting when accessing an
unattached QSPI controller.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: c1e45198032106e69e8fe9339fc2e6348d524fcd.1362373359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_zynq: added pl330 to machine model
Peter Crosthwaite [Fri, 15 Mar 2013 16:41:58 +0000 (16:41 +0000)]
xilinx_zynq: added pl330 to machine model

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 5bc295bd2aa50dfe573f428574dbd7d8add7b3f8.1361853677.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agopl330: Initial version
Peter Crosthwaite [Fri, 15 Mar 2013 16:41:58 +0000 (16:41 +0000)]
pl330: Initial version

Device model for Primecell PL330 DMA controller.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Tested-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 098aac26233d7334bed2bca4f06f539638ca6d24.1361853677.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoiov: Factor out hexdumper
Peter Crosthwaite [Fri, 15 Mar 2013 16:41:58 +0000 (16:41 +0000)]
iov: Factor out hexdumper

Factor out the hexdumper functionality from iov for all to use. Useful for
creating verbose debug printfery that dumps packet data.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: faaac219c55ea586d3f748befaf5a2788fd271b8.1361853677.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/vexpress: Set reset values for daughterboard oscillators
Peter Maydell [Fri, 15 Mar 2013 16:41:58 +0000 (16:41 +0000)]
hw/vexpress: Set reset values for daughterboard oscillators

Set the reset values for the VExpress daughterboard oscillators
via the new sysctl properties.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/arm_sysctl: Implement SYS_CFG_OSC function
Peter Maydell [Fri, 15 Mar 2013 16:41:57 +0000 (16:41 +0000)]
hw/arm_sysctl: Implement SYS_CFG_OSC function

Implement the SYS_CFG_OSC function. Since the idea of
programmable clock rates doesn't make much sense for QEMU,
we simply allow the clock rate to be read back as written.
The number and value of the daughterboard oscillators varies
between daughterboards, so we provide an array property to
allow their reset values to be configured.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/vexpress: Pass voltage sensor properties to sysctl device
Peter Maydell [Fri, 15 Mar 2013 16:41:57 +0000 (16:41 +0000)]
hw/vexpress: Pass voltage sensor properties to sysctl device

Pass voltage sensor properties to the sysctl device. Since
these are daughterboard specific, we specify them via the
VEDBoardInfo structure.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1359985476-29380-9-git-send-email-peter.maydell@linaro.org

11 years agohw/arm_sysctl: Implement SYS_CFG_VOLT
Peter Maydell [Fri, 15 Mar 2013 16:41:57 +0000 (16:41 +0000)]
hw/arm_sysctl: Implement SYS_CFG_VOLT

Implement the SYS_CFG_VOLT registers which return the voltage
of various supplies on motherboard and daughterboard. Since
QEMU implements a perfectly stable power supply these registers
always return a constant value. The number and value of the
daughterboard voltages is dependent on the specific daughterboard,
so we use a property array to allow the board to configure them
appropriately.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoqdev: Implement (variable length) array properties
Peter Maydell [Fri, 15 Mar 2013 16:41:57 +0000 (16:41 +0000)]
qdev: Implement (variable length) array properties

Add support for declaring array properties for qdev devices.
These work by defining an initial static property 'len-arrayname'
which the user of the device should set to the desired size
of the array. When this property is set, memory is allocated
for the array elements, and dynamic properties "arrayname[0]",
"arrayname[1]"... are created so the user of the device can
then set the values of the individual array elements.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/arm_sysctl: Convert from qdev init to instance_init
Peter Maydell [Fri, 15 Mar 2013 16:41:56 +0000 (16:41 +0000)]
hw/arm_sysctl: Convert from qdev init to instance_init

Convert this device from old-style qdev init to an instance_init
function. We don't need a realize function yet, though.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/arm_sysctl: Implement SYS_CFG_DVIMODE as a no-op
Peter Maydell [Fri, 15 Mar 2013 16:41:56 +0000 (16:41 +0000)]
hw/arm_sysctl: Implement SYS_CFG_DVIMODE as a no-op

SYS_CFG_DVIMODE allows the guest to select whether the
output DVI signal is VGA, SVGA, XGA, SGA or UXGA. Since
this makes no difference to QEMU, implement writes as a
no-op so Linux doesn't complain.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/arm_sysctl: Implement SYS_CFG_MUXFPGA writes as a no-op
Peter Maydell [Fri, 15 Mar 2013 16:41:56 +0000 (16:41 +0000)]
hw/arm_sysctl: Implement SYS_CFG_MUXFPGA writes as a no-op

SYS_CFG_MUXFPGA allows the guest to select whether the
video output should come from the motherboard's LCD
controller or the daughterboard's one. Since QEMU doesn't
currently support selecting the video output like this,
implement as a no-op, so Linux doesn't complain about
the register not being implemented.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/arm_sysctl: Handle SYS_CFGCTRL in a more structured way
Peter Maydell [Fri, 15 Mar 2013 16:41:56 +0000 (16:41 +0000)]
hw/arm_sysctl: Handle SYS_CFGCTRL in a more structured way

The SYS_CFGCTRL register consists of separate fields
for DCC, function, site, position and device, as well
as a read/write bit. Refactor the code handling SYS_CFGCTRL
writes to make it easier to add support for functions
like SYS_CFG_OSC which support multiple device fields.
We also pull the handling out into its own function for
clarity, as there are potentially a lot of implementable
subfunctions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/vexpress: Pass proc_id via VEDBoardInfo
Peter Maydell [Fri, 15 Mar 2013 16:41:56 +0000 (16:41 +0000)]
hw/vexpress: Pass proc_id via VEDBoardInfo

Pass the daughterboard-specific proc_id property to the code that
creates the sysctl device via the VEDBoardInfo struct, rather than
by having the daughterboard init function write to a uint32_t*
argument. This is a cleaner way to pass the info around, and
is in line with the way we are going to handle voltage and
oscillator initialization.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoFix TAGS creation
David Gibson [Tue, 12 Mar 2013 02:57:28 +0000 (13:57 +1100)]
Fix TAGS creation

Currently the Makefile creates TAGS for emacs with the command:
    find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
That works only if xargs ends up invoking etags just once.  If xargs runs
etags several times, as it will if there are enough files, then the later
invocations will overwrite the output from the earlier invocations.  This
patch uses the etags --append option to fix the bug.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Message-id: 1363057048-21534-1-git-send-email-david@gibson.dropbear.id.au
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Fri, 15 Mar 2013 15:47:21 +0000 (10:47 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Stefan Hajnoczi (14) and others
# Via Stefan Hajnoczi
* stefanha/block: (28 commits)
  blockdev: Fix up copyright and permission notice
  qemu-iotests: use -nographic in test case 007
  qemu-iotests: add tests for rebasing zero clusters
  dataplane: fix hang introduced by AioContext transition
  coroutine: use AioContext for CoQueue BH
  threadpool: drop global thread pool
  block: add bdrv_get_aio_context()
  aio: add a ThreadPool instance to AioContext
  threadpool: add thread_pool_new() and thread_pool_free()
  threadpool: move globals into struct ThreadPool
  main-loop: add qemu_get_aio_context()
  sheepdog: set io_flush handler in do_co_req
  sheepdog: use non-blocking fd in coroutine context
  qcow2: make is_allocated return true for zero clusters
  qcow2: drop unnecessary flush in qcow2_update_snapshot_refcount()
  qcow2: drop flush in update_cluster_refcount()
  qcow2: flush in qcow2_update_snapshot_refcount()
  qcow2: set L2 cache dependency in qcow2_alloc_bytes()
  qcow2: flush refcount cache correctly in qcow2_write_snapshots()
  qcow2: flush refcount cache correctly in alloc_refcount_block()
  ...

11 years agoMerge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging
Anthony Liguori [Fri, 15 Mar 2013 15:47:00 +0000 (10:47 -0500)]
Merge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging

# By Christian Borntraeger (1) and Cornelia Huck (1)
# Via Cornelia Huck
* cohuck/virtio-ccw-upstr:
  virtio-ccw: Wire up virtio-rng.
  virtio-ccw: remove qdev_unparent in unplug routing

11 years agoblockdev: Fix up copyright and permission notice
Markus Armbruster [Thu, 14 Mar 2013 12:59:53 +0000 (13:59 +0100)]
blockdev: Fix up copyright and permission notice

Screwed up in commit 666daa68.  Thanks to Kevin Wolf for reminding me
to fix this.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-iotests: use -nographic in test case 007
Stefan Hajnoczi [Thu, 14 Mar 2013 16:06:55 +0000 (17:06 +0100)]
qemu-iotests: use -nographic in test case 007

A comment explains that -nographic hangs test case 007.  This is no
longer the case so add -nographic.  This makes the test suite faster and
more pleasant to run since no windows pop up.

I am not sure exactly when -nographic starting working for this case but
there is no fundamental reason why graphics are needed here.  Make sure
the serial port is not on stdio, it would conflict with the monitor.

Also remove unnecessary trailing whitespace on these lines.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: add tests for rebasing zero clusters
Paolo Bonzini [Wed, 13 Mar 2013 14:58:13 +0000 (15:58 +0100)]
qemu-iotests: add tests for rebasing zero clusters

If zero clusters are erroneously treated as unallocated, "qemu-img rebase"
will copy the backing file's contents onto the cluster.

The bug existed also in image streaming, but since the root cause was in
qcow2's is_allocated implementation it is enough to test it with qemu-img.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agodataplane: fix hang introduced by AioContext transition
Paolo Bonzini [Wed, 13 Mar 2013 14:14:15 +0000 (15:14 +0100)]
dataplane: fix hang introduced by AioContext transition

The bug is that the EventNotifiers do have a NULL io_flush callback.
Because _none_ of the callbacks on the dataplane AioContext have such a
callback, aio_poll will simply do nothing.  Fixed by adding the callbacks:
the ioeventfd will always be polled (this can change in the future to
pause/resume the processing during live snapshots or similar operations);
the ioqueue will be polled if there are outstanding requests.

I must admit I have screwed up my testing somehow, because commit
2c20e71 does not work even if cherry-picked on top of 1.4.0, and this
patch fixes it there as well.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agocoroutine: use AioContext for CoQueue BH
Stefan Hajnoczi [Thu, 7 Mar 2013 12:41:50 +0000 (13:41 +0100)]
coroutine: use AioContext for CoQueue BH

CoQueue uses a BH to awake coroutines that were made ready to run again
using qemu_co_queue_next() or qemu_co_queue_restart_all().  The BH
currently runs in the iothread AioContext and would break coroutines
that run in a different AioContext.

This is a slightly tricky problem because the lifetime of the BH exceeds
that of the CoQueue.  This means coroutines can be awoken after CoQueue
itself has been freed.  Also, there is no qemu_co_queue_destroy()
function which we could use to handle freeing resources.

Introducing qemu_co_queue_destroy() has a ripple effect of requiring us
to also add qemu_co_mutex_destroy() and qemu_co_rwlock_destroy(), as
well as updating all callers.  Avoid doing that.

We also cannot switch from BH to GIdle function because aio_poll() does
not dispatch GIdle functions.  (GIdle functions make memory management
slightly easier because they free themselves.)

Finally, I don't want to move unlock_queue and unlock_bh into
AioContext.  That would break encapsulation - AioContext isn't supposed
to know about CoQueue.

This patch implements a different solution: each qemu_co_queue_next() or
qemu_co_queue_restart_all() call creates a new BH and list of coroutines
to wake up.  Callers tend to invoke qemu_co_queue_next() and
qemu_co_queue_restart_all() occasionally after blocking I/O, so creating
a new BH for each call shouldn't be massively inefficient.

Note that this patch does not add an interface for specifying the
AioContext.  That is left to future patches which will convert CoQueue,
CoMutex, and CoRwlock to expose AioContext.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agothreadpool: drop global thread pool
Stefan Hajnoczi [Thu, 7 Mar 2013 12:41:49 +0000 (13:41 +0100)]
threadpool: drop global thread pool

Now that each AioContext has a ThreadPool and the main loop AioContext
can be fetched with bdrv_get_aio_context(), we can eliminate the concept
of a global thread pool from thread-pool.c.

The submit functions must take a ThreadPool* argument.

block/raw-posix.c and block/raw-win32.c use
aio_get_thread_pool(bdrv_get_aio_context(bs)) to fetch the main loop's
ThreadPool.

tests/test-thread-pool.c must be updated to reflect the new
thread_pool_submit() function prototypes.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoblock: add bdrv_get_aio_context()
Stefan Hajnoczi [Thu, 7 Mar 2013 12:41:48 +0000 (13:41 +0100)]
block: add bdrv_get_aio_context()

For now bdrv_get_aio_context() is just a stub that calls
qemu_aio_get_context() since the block layer is currently tied to the
main loop AioContext.

Add the stub now so that the block layer can begin accessing its
AioContext.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoaio: add a ThreadPool instance to AioContext
Stefan Hajnoczi [Thu, 7 Mar 2013 12:41:47 +0000 (13:41 +0100)]
aio: add a ThreadPool instance to AioContext

This patch adds a ThreadPool to AioContext.  It's possible that some
AioContext instances will never use the ThreadPool, so defer creation
until aio_get_thread_pool().

The reason why AioContext should have the ThreadPool is because the
ThreadPool is bound to a AioContext instance where the work item's
callback function is invoked.  It doesn't make sense to keep the
ThreadPool pointer anywhere other than AioContext.  For example,
block/raw-posix.c can get its AioContext's ThreadPool and submit work.

Special note about headers: I used struct ThreadPool in aio.h because
there is a circular dependency if aio.h includes thread-pool.h.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agothreadpool: add thread_pool_new() and thread_pool_free()
Stefan Hajnoczi [Thu, 7 Mar 2013 12:41:46 +0000 (13:41 +0100)]
threadpool: add thread_pool_new() and thread_pool_free()

ThreadPool is tied to an AioContext through its event notifier, which
dictates in which AioContext the work item's callback function will be
invoked.

In order to support multiple AioContexts we need to support multiple
ThreadPool instances.

This patch adds the new/free functions.  The free function deserves
special attention because it quiesces remaining worker threads.  This
requires a new condition variable and a "stopping" flag to let workers
know they should terminate once idle.

We never needed to do this before since the global threadpool was not
explicitly destroyed until process termination.

Also stash the AioContext pointer in ThreadPool so that we can call
aio_set_event_notifier() in thread_pool_free().  We didn't need to hold
onto AioContext previously since there was no free function.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agothreadpool: move globals into struct ThreadPool
Stefan Hajnoczi [Thu, 7 Mar 2013 12:41:45 +0000 (13:41 +0100)]
threadpool: move globals into struct ThreadPool

Move global variables into a struct so multiple thread pools can be
supported in the future.

This patch does not change thread-pool.h interfaces.  There is still a
global thread pool and it is not yet possible to create/destroy
individual thread pools.  Moving the variables into a struct first makes
later patches easier to review.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomain-loop: add qemu_get_aio_context()
Stefan Hajnoczi [Thu, 7 Mar 2013 12:41:44 +0000 (13:41 +0100)]
main-loop: add qemu_get_aio_context()

It is very useful to get the main loop AioContext, which is a static
variable in main-loop.c.

I'm not sure whether qemu_get_aio_context() will be necessary in the
future once devices focus on using their own AioContext instead of the
main loop AioContext, but for now it allows us to refactor code to
support multiple AioContext while actually passing the main loop
AioContext.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agosheepdog: set io_flush handler in do_co_req
MORITA Kazutaka [Tue, 12 Mar 2013 07:05:43 +0000 (16:05 +0900)]
sheepdog: set io_flush handler in do_co_req

If an io_flush handler is not set, qemu_aio_wait doesn't invoke
callbacks.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosheepdog: use non-blocking fd in coroutine context
MORITA Kazutaka [Tue, 12 Mar 2013 07:05:42 +0000 (16:05 +0900)]
sheepdog: use non-blocking fd in coroutine context

Using a blocking socket in the coroutine context reduces the chance of
switching to other work.  This patch makes the sheepdog driver use a
non-blocking fd always.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: make is_allocated return true for zero clusters
Paolo Bonzini [Wed, 6 Mar 2013 17:02:01 +0000 (18:02 +0100)]
qcow2: make is_allocated return true for zero clusters

Otherwise, live migration of the top layer will miss zero clusters and
let the backing file show through.  This also matches what is done in qed.

QCOW2_CLUSTER_ZERO clusters are invalid in v2 image files.  Check this
directly in qcow2_get_cluster_offset instead of replicating the test
everywhere.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: drop unnecessary flush in qcow2_update_snapshot_refcount()
Stefan Hajnoczi [Mon, 4 Mar 2013 14:02:35 +0000 (15:02 +0100)]
qcow2: drop unnecessary flush in qcow2_update_snapshot_refcount()

We already flush when the function completes.  There is no need to flush
after every compressed cluster.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: drop flush in update_cluster_refcount()
Stefan Hajnoczi [Mon, 4 Mar 2013 14:02:34 +0000 (15:02 +0100)]
qcow2: drop flush in update_cluster_refcount()

The update_cluster_refcount() function increments/decrements a cluster's
refcount and then returns the new refcount value.

There is no need to flush since both update_cluster_refcount() callers
already take care of this:

1. qcow2_alloc_bytes() calls update_cluster_refcount() when compressed
   sectors will be appended to an existing cluster with enough free
   space.  qcow2_alloc_bytes() already flushes so there is no need to do
   so in update_cluster_refcount().

2. qcow2_update_snapshot_refcount() sets a cache dependency on refcounts
   if it needs to update L2 entries.  It also flushes before completing.

Removing this flush significantly speeds up qcow2 snapshot creation:

  $ qemu-img create -f qcow2 test.qcow2 -o size=50G,preallocation=metadata
  $ time qemu-img snapshot -c new test.qcow2

Time drops from more than 3 minutes to under 1 second.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: flush in qcow2_update_snapshot_refcount()
Stefan Hajnoczi [Mon, 4 Mar 2013 14:02:33 +0000 (15:02 +0100)]
qcow2: flush in qcow2_update_snapshot_refcount()

Users of qcow2_update_snapshot_refcount() do not flush consistently.
qcow2_snapshot_create() flushes but qcow2_snapshot_goto() and
qcow2_snapshot_delete() do not.

Solve this by moving the bdrv_flush() into
qcow2_update_snapshot_refcount().

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: set L2 cache dependency in qcow2_alloc_bytes()
Stefan Hajnoczi [Mon, 4 Mar 2013 14:02:32 +0000 (15:02 +0100)]
qcow2: set L2 cache dependency in qcow2_alloc_bytes()

Compressed writes use qcow2_alloc_bytes() to allocate space with byte
granularity.  The affected clusters' refcounts will be incremented but
we do not need to flush yet.

Set a L2 cache dependency on the refcount block cache, so that the
refcounts get written out before the L2 updates.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: flush refcount cache correctly in qcow2_write_snapshots()
Stefan Hajnoczi [Mon, 4 Mar 2013 14:02:31 +0000 (15:02 +0100)]
qcow2: flush refcount cache correctly in qcow2_write_snapshots()

Since qcow2 metadata is cached we need to flush the caches, not just the
underlying file.  Use bdrv_flush(bs) instead of bdrv_flush(bs->file).

Also add the error return path when bdrv_flush() fails and move the
flush after checking for qcow2_alloc_clusters() failure so that the
qcow2_alloc_clusters() error return value takes precedence.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: flush refcount cache correctly in alloc_refcount_block()
Stefan Hajnoczi [Mon, 4 Mar 2013 14:02:30 +0000 (15:02 +0100)]
qcow2: flush refcount cache correctly in alloc_refcount_block()

update_refcount() affects the refcount cache, it does not write to disk.
Therefore bdrv_flush(bs->file) does nothing.  We need to flush the
refcount cache in order to write out the refcount updates!

While we're here also add error returns when qcow2_cache_flush() fails.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Allow lazy refcounts to be enabled on the command line
Kevin Wolf [Fri, 15 Mar 2013 09:35:08 +0000 (10:35 +0100)]
qcow2: Allow lazy refcounts to be enabled on the command line

qcow2 images now accept a boolean lazy_refcounts options. Use it like
this:

  -drive file=test.qcow2,lazy_refcounts=on

If the option is specified on the command line, it overrides the default
specified by the qcow2 header flags that were set when creating the
image.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Support driver specific options in drive_init()
Kevin Wolf [Fri, 15 Mar 2013 09:35:07 +0000 (10:35 +0100)]
block: Support driver specific options in drive_init()

Any non-default -drive options are now passed down to the block drivers.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblockdev: Keep a copy of DriveInfo.serial
Kevin Wolf [Fri, 15 Mar 2013 09:35:06 +0000 (10:35 +0100)]
blockdev: Keep a copy of DriveInfo.serial

Pointing to a QemuOpts element is surprising and can lead to subtle
use-after-free errors when the QemuOpts is freed after all options are
parsed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-option: Add qemu_opts_absorb_qdict()
Kevin Wolf [Fri, 15 Mar 2013 09:35:05 +0000 (10:35 +0100)]
qemu-option: Add qemu_opts_absorb_qdict()

This adds a function that adds all entries of a QDict to a QemuOpts if
the keys are known, and leaves only the rest in the QDict.

This way a single QDict of -drive options can be processed in multiple
places (generic block layer, block driver, backing file block driver,
etc.), where each part picks the options it knows. If at the end of the
process the QDict isn't empty, the user specified an invalid option.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Add options QDict to bdrv_open_common()
Kevin Wolf [Fri, 15 Mar 2013 09:35:04 +0000 (10:35 +0100)]
block: Add options QDict to bdrv_open_common()

The options are passed down to the block drivers, which are supposed to
remove all options they have processed. Anything that is left over in
the end is an unknown option and results in an error.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoAdd qdict_clone_shallow()
Kevin Wolf [Fri, 15 Mar 2013 09:35:03 +0000 (10:35 +0100)]
Add qdict_clone_shallow()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Add options QDict to bdrv_open() prototype
Kevin Wolf [Fri, 15 Mar 2013 09:35:02 +0000 (10:35 +0100)]
block: Add options QDict to bdrv_open() prototype

It doesn't do anything yet except storing the options QDict in the
BlockDriverState.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Add options QDict to .bdrv_open()
Kevin Wolf [Fri, 15 Mar 2013 09:35:01 +0000 (10:35 +0100)]
block: Add options QDict to .bdrv_open()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqga/main.c: Don't use g_key_file_get/set_int64
Peter Crosthwaite [Fri, 15 Mar 2013 05:04:39 +0000 (15:04 +1000)]
qga/main.c: Don't use g_key_file_get/set_int64

These functions don't exist until glib version 2.26. QEMU is currently only
mandating glib 2.12.

This patch replaces the functions with g_key_file_get/set_integer.

Unbreaks the build on Ubuntu 10.04 and RHEL 5.6.

Regression was introduced by 39097daf15c42243742667607d2cad2c9dc4f764

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 1363323879-682-1-git-send-email-peter.crosthwaite@xilinx.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/chardev.5' into staging
Anthony Liguori [Thu, 14 Mar 2013 19:54:37 +0000 (14:54 -0500)]
Merge remote-tracking branch 'kraxel/chardev.5' into staging

* kraxel/chardev.5:
  spice-qemu-char: Remove dead debugging code
  spice-qemu-char: Fix name parameter issues after qapi-ifying
  qemu-char.c: fix waiting for telnet connection message
  Revert "hmp: Disable chardev-add and chardev-remove"
  chardev: add udp support to qapi
  chardev: add memory (ringbuf) support to qapi
  chardev: add vc support to qapi
  chardev: add spice support to qapi
  chardev: add pipe support to qapi
  chardev: add console support to qapi
  chardev: switch pty init to qapi
  chardev: switch parallel init to qapi
  chardev: switch serial/tty init to qapi
  chardev: add stdio support to qapi
  chardev: switch file init to qapi
  chardev: add braille support to qapi
  chardev: add msmouse support to qapi
  chardev: switch null init to qapi
  chardev: add mux chardev support to qapi
  chardev: add support for qapi-based chardev initialization

Conflicts:
ui/console.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Thu, 14 Mar 2013 19:50:58 +0000 (14:50 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

# By Andreas Färber (16) and Igor Mammedov (1)
# Via Andreas Färber
* afaerber/qom-cpu:
  target-lm32: Update VMStateDescription to LM32CPU
  target-arm: Override do_interrupt for ARMv7-M profile
  cpu: Replace do_interrupt() by CPUClass::do_interrupt method
  cpu: Pass CPUState to cpu_interrupt()
  exec: Pass CPUState to cpu_reset_interrupt()
  cpu: Move halted and interrupt_request fields to CPUState
  target-cris/helper.c: Update Coding Style
  target-i386: Update VMStateDescription to X86CPU
  cpu: Introduce cpu_class_set_vmsd()
  cpu: Register VMStateDescription through CPUState
  stubs: Add a vmstate_dummy struct for CONFIG_USER_ONLY
  vmstate: Make vmstate_register() static inline
  target-sh4: Move PVR/PRR/CVR into SuperHCPUClass
  target-sh4: Introduce SuperHCPU subclasses
  cpus: Replace open-coded CPU loop in qmp_memsave() with qemu_get_cpu()
  monitor: Use qemu_get_cpu() in monitor_set_cpu()
  cpu: Fix qemu_get_cpu() to return NULL if CPU not found

11 years agoMerge remote-tracking branch 'mdroth/qga-pull-3-11-2013' into staging
Anthony Liguori [Thu, 14 Mar 2013 19:50:30 +0000 (14:50 -0500)]
Merge remote-tracking branch 'mdroth/qga-pull-3-11-2013' into staging

# By Laszlo Ersek (3) and others
# Via Michael Roth
* mdroth/qga-pull-3-11-2013:
  qga: implement qmp_guest_set_vcpus() for Linux with sysfs
  qga: implement qmp_guest_get_vcpus() for Linux with sysfs
  qga: introduce guest-get-vcpus / guest-set-vcpus with stubs
  qga: add guest-set-time command
  qga: add guest-get-time command
  qemu-ga: use key-value store to avoid recycling fd handles after restart
  qemu-ga: make guest-sync-delimited available during fsfreeze
  qemu-ga: fix confusing GAChannelMethod comparison
  qga: cast to int for DWORD type

11 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Thu, 14 Mar 2013 19:50:21 +0000 (14:50 -0500)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

# By Peter Maydell (5) and others
# Via Riku Voipio
* riku/linux-user-for-upstream:
  linux-user/syscall.c: Don't warn about unimplemented get_robust_list
  linux-user: Implement accept4
  linux-user: Implement sendfile and sendfile64
  linux-user: make bogus negative iovec lengths fail EINVAL
  linux-user: Fix layout of usage table to account for option text
  linux-user: Add more sparc syscall numbers
  linux-user: Support setgroups syscall with no groups
  linux-user: fix futex strace of FUTEX_CLOCK_REALTIME
  linux-user/syscall.c: handle FUTEX_WAIT_BITSET in do_futex
  linux-user: improve print_fcntl()
  linux-user: Add Alpha socket constants

11 years agospice-qemu-char: Remove dead debugging code
Hans de Goede [Wed, 13 Mar 2013 13:59:44 +0000 (14:59 +0100)]
spice-qemu-char: Remove dead debugging code

Since commit d62e5f7036a018b2ad09f17ebd481bd28953d783
"chardev: add spice support to qapi"

It is impossible to set the debug parameter, so all the dprintf calls
are essentially nops. Since we've not needed the debug parameter in ages this
is not a problem, if it later turns out we do need some more debugging options
we can add more trace-points.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agospice-qemu-char: Fix name parameter issues after qapi-ifying
Hans de Goede [Wed, 13 Mar 2013 09:41:31 +0000 (10:41 +0100)]
spice-qemu-char: Fix name parameter issues after qapi-ifying

The strings passed in through the qapi calls are dynamic memory, since
we want to have them stick around longer then just the call to
qemu_chr_open_spice_* we need to strdup them.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agogtk: fix vc initialization
Anthony Liguori [Wed, 13 Mar 2013 17:21:04 +0000 (12:21 -0500)]
gtk: fix vc initialization

    commit 01f45d986fb0b7c2d4f0466efe3cde9708f325be
    Author: Anthony Liguori <aliguori@us.ibm.com>
    Date:   Tue Mar 5 23:21:32 2013 +0530

       qemu-char: move text console init to console.c

Broke vc initialization for GTK.  It's a simple typo.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char.c: fix waiting for telnet connection message
Igor Mitsyanko [Sun, 10 Mar 2013 13:58:05 +0000 (17:58 +0400)]
qemu-char.c: fix waiting for telnet connection message

Current colon position in "waiting for telnet connection" message template
produces messages like:
QEMU waiting for connection on: telnet::127.0.0.16666,server

After moving a colon to the right, we will get a correct messages like:
QEMU waiting for connection on: telnet:127.0.0.1:6666,server

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoRevert "hmp: Disable chardev-add and chardev-remove"
Gerd Hoffmann [Thu, 28 Feb 2013 07:46:10 +0000 (08:46 +0100)]
Revert "hmp: Disable chardev-add and chardev-remove"

This reverts commit 8a14952c9d2f5fa2b3caa6dc286b62ed5d26bca7.

11 years agochardev: add udp support to qapi
Gerd Hoffmann [Wed, 27 Feb 2013 13:10:47 +0000 (14:10 +0100)]
chardev: add udp support to qapi

This patch adds 'udp' support to qapi.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: add memory (ringbuf) support to qapi
Gerd Hoffmann [Tue, 26 Feb 2013 15:21:11 +0000 (16:21 +0100)]
chardev: add memory (ringbuf) support to qapi

This patch adds 'memory' support to qapi and also switches over
the memory chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: add vc support to qapi
Gerd Hoffmann [Mon, 25 Feb 2013 14:52:32 +0000 (15:52 +0100)]
chardev: add vc support to qapi

This patch adds 'vc' support to qapi and also switches over the
vc chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agochardev: add spice support to qapi
Gerd Hoffmann [Mon, 25 Feb 2013 11:39:06 +0000 (12:39 +0100)]
chardev: add spice support to qapi

This patch adds 'spicevmc' and 'spiceport' support to qapi and also
switches over the spice chardev initialization to the new qapi code
path.

11 years agochardev: add pipe support to qapi
Gerd Hoffmann [Mon, 25 Feb 2013 10:50:55 +0000 (11:50 +0100)]
chardev: add pipe support to qapi

This patch adds 'pipe' support to qapi and also switches over the
pipe chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>