OSDN Git Service

qmiga/qemu.git
9 years agotarget-arm: Fix REVIDR reset value
Sergey Fedorov [Mon, 15 Jun 2015 17:06:08 +0000 (18:06 +0100)]
target-arm: Fix REVIDR reset value

According to ARM Cortex-A53/A57 TRM, REVIDR reset value should be zero. So let
REVIDR reset value be specified by CPU model and correct it for Cortex-A53/A57.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-id: 1433321048-23793-2-git-send-email-serge.fdrv@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/virt: Add cortex-a53 cpu support in machine virt
Shannon Zhao [Mon, 15 Jun 2015 17:06:08 +0000 (18:06 +0100)]
hw/arm/virt: Add cortex-a53 cpu support in machine virt

Add cortex-a53 cpu support in machine virt, so it can be used for TCG
and KVM.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1433207452-4512-3-git-send-email-shannon.zhao@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm/kvm64: Add cortex-a53 cpu support
Shannon Zhao [Mon, 15 Jun 2015 17:06:08 +0000 (18:06 +0100)]
target-arm/kvm64: Add cortex-a53 cpu support

Since commit e353102(target-arm: cpu64: Add support for Cortex-A53) has
added Cortex-A53 cpu support for target-arm, this patch just enables it
for kvm-arm.

Here adding XGENE_POTENZA just makes the enum continuous.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Message-id: 1433207452-4512-2-git-send-email-shannon.zhao@linaro.org
[PMM: Don't add the CPU types to cpus_to_try[]; this array only
 lists old CPUs which were supported in pre-PREFERRED_TARGET kernels]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm/cpu.h: remove pending_exception
Alex Bennée [Mon, 15 Jun 2015 17:06:08 +0000 (18:06 +0100)]
target-arm/cpu.h: remove pending_exception

This isn't used by any of the code. In fact it looks like it was never
used as it came in with ARMv7 support.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1434020015-8868-1-git-send-email-alex.bennee@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/display/exynos4210_fimd: Fix bit-swapping code
Peter Maydell [Mon, 15 Jun 2015 17:06:08 +0000 (18:06 +0100)]
hw/display/exynos4210_fimd: Fix bit-swapping code

fimd_swap_data() includes code to reverse the bits in a
64-bit integer, but an off-by-one error meant that it would
try to shift off the top of the integer. Correct the bug
(spotted by Coverity).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1432912615-23107-1-git-send-email-peter.maydell@linaro.org

9 years agoarm_gic: gic_update should always update all cores
Johan Karlsson [Mon, 15 Jun 2015 17:06:07 +0000 (18:06 +0100)]
arm_gic: gic_update should always update all cores

This patch fixes so that gic_update always updates all the cores with
new pending irq states.  If the function returns early it is possible
to get interrupts that has already been acknowledged.

Signed-off-by: Johan Karlsson <johan.karlsson@enea.com>
[PMM: rebased to apply to current master]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: use extended address bits from supersection short descriptor
Sergey Fedorov [Mon, 15 Jun 2015 17:06:07 +0000 (18:06 +0100)]
target-arm: use extended address bits from supersection short descriptor

Since ARMv7 with LPAE support, a supersection short translation table
descriptor has had extended base address fields which hold bits 39:32 of
translated address. These fields are IMPDEF in ARMv6 and ARMv7 without
LPAE support.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-id: 1433235718-30485-1-git-send-email-serge.fdrv@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: Handle "extended small page" descriptors correctly
Peter Maydell [Mon, 15 Jun 2015 17:06:07 +0000 (18:06 +0100)]
target-arm: Handle "extended small page" descriptors correctly

The old ARMv5-style page table format includes a kind of second level
descriptor named the "extended small page" format, whose primary purpose
is to allow specification of the TEX memory attribute bits on a 4K page.
This exists on ARMv6 and also (as an implementation extension) on XScale
CPUs; it's UNPREDICTABLE on v5.

We were mishandling this in two ways:
 (1) we weren't implementing it for v6 (probably never noticed because
Linux will use the new-style v6 page table format there)
 (2) we were not correctly setting the page_size, which is 4K, not 1K

The latter bug went unnoticed for years because the only thing which
the page_size affects is which TLB entries get flushed when the guest
does a TLB invalidate on an address in the page, and prior to commit
2f0d8631b7 we were doing a full TLB flush very frequently due to Linux's
habit of writing the SCTLR pointlessly a lot.

(We can assume that after commit 2f0d8631b7 the bug went unnoticed
for a year because nobody's actually using the Zaurus/XScale emulation...)

Report the correct page size for these descriptors, and permit them
on ARMv6 CPUs. This fixes a problem where a kernel image for Zaurus
can boot the kernel OK but gets random segfaults when it tries to
run userspace programs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1432844085-16441-1-git-send-email-peter.maydell@linaro.org

9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20150615-1' into staging
Peter Maydell [Mon, 15 Jun 2015 15:15:32 +0000 (16:15 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20150615-1' into staging

audio: remove obsolete backends (esd, fmod, winwave).
audio: stop using global variables, small fixes.
audio: remove some obsolte and unused code.

# gpg: Signature made Mon Jun 15 13:24:44 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-audio-20150615-1:
  ossaudio: use trace events instead of debug config flag
  alsaaudio: use trace events instead of verbose
  dsoundaudio: remove primary buffer
  dsoundaudio: remove *_retries kludges
  audio: remove plive
  audio: remove LOG_TO_MONITOR along with default_mon
  MAINTAINERS: remove malc from audio
  sdlaudio: do not allow multiple instances
  coreaudio: do not use global variables where possible
  dsoundaudio: do not use global variables
  paaudio: fix possible resource leak
  wavaudio: do not use global variables
  ossaudio: do not use global variables
  alsaaudio: do not use global variables
  paaudio: do not use global variables
  audio: expose drv_opaque to init_out and init_in
  only enable dsound in case the header file is present
  audio: remove winwave audio driver
  audio: remove fmod backend
  audio: remove esd backend

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/borntraeger/tags/s390x-20150615' into staging
Peter Maydell [Mon, 15 Jun 2015 12:24:50 +0000 (13:24 +0100)]
Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20150615' into staging

s390x/kvm/watchdog

1. Implement a diag288 based watchdog
2. Fix virtio-ccw BIOS for gcc >= 4.9

# gpg: Signature made Mon Jun 15 12:36:25 2015 BST using RSA key ID B5A61C7C
# gpg: Good signature from "Christian Borntraeger (IBM) <borntraeger@de.ibm.com>"

* remotes/borntraeger/tags/s390x-20150615:
  s390/bios: build with -fdelete-null-pointer-checks
  watchdog: Add new Virtual Watchdog action INJECT-NMI
  nmi: Implement inject_nmi() for non-monitor context use
  s390x/watchdog: diag288 migration support
  s390x/kvm: diag288 instruction interception and handling
  s390x/watchdog: introduce diag288 watchdog device
  watchdog: change option wording to allow for more watchdogs

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agos390/bios: build with -fdelete-null-pointer-checks
Aurelien Jarno [Mon, 15 Jun 2015 10:24:03 +0000 (12:24 +0200)]
s390/bios: build with -fdelete-null-pointer-checks

Starting with version 4.9, GCC assumes it can't safely dereference null
pointers, and uses this for some optimizations. On s390, the lowcore
memory is located at address 0, so this assumption is wrong and breaks
the s390-ccw firmware. Pass -fdelete-null-pointer-checks to avoid that.

Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <1434363843-14576-1-git-send-email-aurelien@aurel32.net>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
9 years agoossaudio: use trace events instead of debug config flag
Kővágó, Zoltán [Fri, 12 Jun 2015 12:33:07 +0000 (14:33 +0200)]
ossaudio: use trace events instead of debug config flag

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoalsaaudio: use trace events instead of verbose
Kővágó, Zoltán [Fri, 12 Jun 2015 12:33:06 +0000 (14:33 +0200)]
alsaaudio: use trace events instead of verbose

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agodsoundaudio: remove primary buffer
Kővágó, Zoltán [Fri, 12 Jun 2015 12:33:05 +0000 (14:33 +0200)]
dsoundaudio: remove primary buffer

Enabling this option just creates a playback buffer with the specified settings,
and then ignores it. It's probably some outdated hack to set audio formats on
windows. (The first created stream dictates all other streams settings, at least
on some Windows versions). Setting DAC_FIXED_SETTINGS should have the same
effect as setting (the now removed) primary buffer.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agodsoundaudio: remove *_retries kludges
Kővágó, Zoltán [Fri, 12 Jun 2015 12:33:04 +0000 (14:33 +0200)]
dsoundaudio: remove *_retries kludges

According to MSDN this may happen when the window is not in the foreground, but
the default is 1 since a long time (which means no retries), so it should be ok.
I've found no problems during testing it on Windows 7 and wine, so this was
probably only the case with some old Windows versions.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoaudio: remove plive
Kővágó, Zoltán [Fri, 12 Jun 2015 12:33:03 +0000 (14:33 +0200)]
audio: remove plive

It was useless even 3 years ago, so it can probably safely go away:
https://lists.nongnu.org/archive/html/qemu-devel/2012-03/msg02427.html

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoaudio: remove LOG_TO_MONITOR along with default_mon
Kővágó, Zoltán [Fri, 12 Jun 2015 12:33:02 +0000 (14:33 +0200)]
audio: remove LOG_TO_MONITOR along with default_mon

Setting QEMU_AUDIO_LOG_TO_MONITOR=1 can crash qemu (if qemu tries to log
to the monitor before it's being initialized), and also nothing else in
qemu logs to the monitor.

This log to monitor feature was the last thing that used the default_mon
variable, so I removed it too (as using it can cause problems).

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoMAINTAINERS: remove malc from audio
Gerd Hoffmann [Tue, 9 Jun 2015 10:51:36 +0000 (12:51 +0200)]
MAINTAINERS: remove malc from audio

email bounces, with a appearently permanent error:
"av1474@comtv.ru mail receiving disabled, rejecting"

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
9 years agosdlaudio: do not allow multiple instances
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:55 +0000 (23:03 +0200)]
sdlaudio: do not allow multiple instances

Since SDL uses a lot of global data, we can't create independent
instances of sdl audio backend.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agocoreaudio: do not use global variables where possible
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:54 +0000 (23:03 +0200)]
coreaudio: do not use global variables where possible

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agodsoundaudio: do not use global variables
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:52 +0000 (23:03 +0200)]
dsoundaudio: do not use global variables

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agopaaudio: fix possible resource leak
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:53 +0000 (23:03 +0200)]
paaudio: fix possible resource leak

qpa_audio_init did not clean up resources properly if the initialization
failed. This hopefully fixes it.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agowavaudio: do not use global variables
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:51 +0000 (23:03 +0200)]
wavaudio: do not use global variables

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoossaudio: do not use global variables
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:50 +0000 (23:03 +0200)]
ossaudio: do not use global variables

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoalsaaudio: do not use global variables
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:48 +0000 (23:03 +0200)]
alsaaudio: do not use global variables

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agopaaudio: do not use global variables
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:49 +0000 (23:03 +0200)]
paaudio: do not use global variables

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoaudio: expose drv_opaque to init_out and init_in
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:47 +0000 (23:03 +0200)]
audio: expose drv_opaque to init_out and init_in

Currently the opaque pointer returned by audio_driver's init is only
exposed to the driver's fini, but not to audio_pcm_ops. This way if
someone wants to share a variable with the driver and the pcm, he must
use global variables. This patch fixes it by adding a third parameter to
audio_pcm_op's init_out and init_in.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoonly enable dsound in case the header file is present
Gerd Hoffmann [Wed, 10 Jun 2015 07:07:35 +0000 (09:07 +0200)]
only enable dsound in case the header file is present

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Mon, 15 Jun 2015 09:43:06 +0000 (10:43 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer core and image format patches

# gpg: Signature made Fri Jun 12 16:08:53 2015 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (25 commits)
  block: Fix reopen flag inheritance
  block: Add BlockDriverState.inherits_from
  block: Add list of children to BlockDriverState
  queue.h: Add QLIST_FIX_HEAD_PTR()
  block: Drain requests before swapping nodes in bdrv_swap()
  block: Move flag inheritance to bdrv_open_inherit()
  block: Use QemuOpts in bdrv_open_common()
  block: Use macro for cache option names
  vmdk: Use bdrv_open_image()
  quorum: Use bdrv_open_image()
  check-qdict: Test cases for new functions
  qdict: Add qdict_{set,copy}_default()
  qdict: Add qdict_array_entries()
  iotests: Add tests for overriding BDRV_O_PROTOCOL
  block: driver should override flags in bdrv_open()
  block: Change bitmap truncate conditional to assertion
  block: record new size in bdrv_dirty_bitmap_truncate
  raw-posix: Fix .bdrv_co_get_block_status() for unaligned image size
  vmdk: Use vmdk_find_index_in_cluster everywhere
  vmdk: Fix index_in_cluster calculation in vmdk_co_get_block_status
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoaudio: remove winwave audio driver
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:46 +0000 (23:03 +0200)]
audio: remove winwave audio driver

DirectSound should be a superior choice on Windows.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoaudio: remove fmod backend
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:45 +0000 (23:03 +0200)]
audio: remove fmod backend

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoaudio: remove esd backend
Kővágó, Zoltán [Wed, 3 Jun 2015 21:03:44 +0000 (23:03 +0200)]
audio: remove esd backend

ESD is no longer developed and replaced by PulseAudio.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Fri, 12 Jun 2015 17:04:14 +0000 (18:04 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Fri Jun 12 15:57:47 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request:
  qemu-iotests: expand test 093 to support group throttling
  throttle: Update throttle infrastructure copyright
  throttle: add the name of the ThrottleGroup to BlockDeviceInfo
  throttle: acquire the ThrottleGroup lock in bdrv_swap()
  throttle: Add throttle group support
  throttle: Add throttle group infrastructure tests
  throttle: Add throttle group infrastructure
  throttle: Extract timers from ThrottleState into a separate structure
  raw-posix: Fix .bdrv_co_get_block_status() for unaligned image size
  Revert "iothread: release iothread around aio_poll"

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoblock: Fix reopen flag inheritance
Kevin Wolf [Thu, 9 Apr 2015 16:54:04 +0000 (18:54 +0200)]
block: Fix reopen flag inheritance

When reopening an image, the block layer already takes care to reopen
bs->file as well with recalculated inherited flags. The same must happen
for any other child (most notably missing before this patch: backing
files).

If bs->file (or any other child) didn't originally inherit from bs, e.g.
because it was created separately and then only referenced, it must not
inherit flags on reopen either, so check the inherited_from field before
propagation the reopen down.

VMDK already reopened its extents manually; this code can now be
dropped.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
9 years agoblock: Add BlockDriverState.inherits_from
Kevin Wolf [Thu, 9 Apr 2015 16:47:50 +0000 (18:47 +0200)]
block: Add BlockDriverState.inherits_from

Currently, the block layer assumes that any block node can have only one
parent, and if it has a parent, that it inherits some options/flags from
this parent.

This is not true any more: With references used in block device
creation, a single node can be used by multiple parents, or it can be
created separately and not inherit flags from any parent.

To handle reopens correctly, a node must know from which parent it
inherited options. This patch adds the information to BlockDriverState.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
9 years agoblock: Add list of children to BlockDriverState
Kevin Wolf [Wed, 8 Apr 2015 11:49:41 +0000 (13:49 +0200)]
block: Add list of children to BlockDriverState

This allows iterating over all children of a given BDS, not only
including bs->file and bs->backing_hd, but also driver-specific
ones like VMDK extents or Quorum children.

For bdrv_swap(), the list of children of the swapped BDS stays at that
BDS (because that's where the pointers stay as well). The list head
moves and pointers to it must be fixed up therefore.

The list of children in the parent of the swapped BDS is not affected by
the swap. The contents of the BDS objects is swapped, so the existing
pointer in the parent automatically points to the newly swapped in BDS.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
9 years agoqueue.h: Add QLIST_FIX_HEAD_PTR()
Kevin Wolf [Wed, 10 Jun 2015 11:47:35 +0000 (13:47 +0200)]
queue.h: Add QLIST_FIX_HEAD_PTR()

If the head of a list has been moved to a different memory location, the
le_prev link in the first list entry has to be fixed up. Provide a macro
that implements this fixup.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
9 years agoblock: Drain requests before swapping nodes in bdrv_swap()
Kevin Wolf [Wed, 10 Jun 2015 11:33:17 +0000 (13:33 +0200)]
block: Drain requests before swapping nodes in bdrv_swap()

bdrv_swap() requires that there are no requests in flight on either of
the two devices. The request coroutine would work on the wrong
BlockDriverState object (with bs->opaque even being interpreted as a
different type potentially) and all sorts of bad things would result
from this.

The currently existing callers mostly ensure that there is no I/O
pending on nodes that are swapped. In detail, this is:

1. Live snapshots. This goes through qmp_transaction(), which calls
   bdrv_drain_all() before doing anything. The command is executed
   synchronously, so no new I/O can be issued concurrently.

2. snapshot=on in bdrv_open(). We're in the middle of opening the image
   (both the original image and its temporary overlay), so there can't
   be any I/O in flight yet.

3. Mirroring. bdrv_drain() is already used on the source device so that
   the mirror doesn't miss anything. However, the main loop runs between
   that and the bdrv_swap() (which is actually a bug, being addressed in
   another series), so there is a small window in which new I/O might be
   issued that would be in flight during bdrv_swap().

It is safer to just drain the request queue of both devices in
bdrv_swap() instead of relying on callers to do the right thing.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
9 years agoblock: Move flag inheritance to bdrv_open_inherit()
Kevin Wolf [Wed, 8 Apr 2015 11:43:47 +0000 (13:43 +0200)]
block: Move flag inheritance to bdrv_open_inherit()

Instead of letting every caller of bdrv_open() determine the right flags
for its child node manually and pass them to the function, pass the
parent node and the role of the newly opened child (like backing file,
protocol layer, etc.).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
9 years agoblock: Use QemuOpts in bdrv_open_common()
Kevin Wolf [Tue, 7 Apr 2015 15:12:56 +0000 (17:12 +0200)]
block: Use QemuOpts in bdrv_open_common()

Instead of manually parsing options and then deleting them from the
options QDict, just use QemuOpts like most other places that deal with
block device options.

More options will be added there and then QemuOpts is a lot more
manageable than open-coding everything.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
9 years agoblock: Use macro for cache option names
Kevin Wolf [Tue, 7 Apr 2015 14:55:00 +0000 (16:55 +0200)]
block: Use macro for cache option names

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
9 years agovmdk: Use bdrv_open_image()
Kevin Wolf [Tue, 7 Apr 2015 13:35:59 +0000 (15:35 +0200)]
vmdk: Use bdrv_open_image()

Besides standardising on a single interface for opening child nodes,
this patch allows the user to specify options to individual extent
nodes. Overriding file names isn't possible with this yet, so it's of
limited usefulness, but still a step forward.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
9 years agoquorum: Use bdrv_open_image()
Kevin Wolf [Wed, 21 Jan 2015 17:49:28 +0000 (18:49 +0100)]
quorum: Use bdrv_open_image()

Besides standardising on a single interface for opening child nodes,
this simplifies the .bdrv_open() implementation of the quorum block
driver by using block layer functionality for handling BlockdevRefs.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
9 years agocheck-qdict: Test cases for new functions
Kevin Wolf [Thu, 28 May 2015 15:37:55 +0000 (17:37 +0200)]
check-qdict: Test cases for new functions

This adds test cases for the following new QDict functions:

* qdict_array_entries()
* qdict_set_default_str()
* qdict_copy_default()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
9 years agoqdict: Add qdict_{set,copy}_default()
Kevin Wolf [Mon, 19 Jan 2015 20:22:45 +0000 (21:22 +0100)]
qdict: Add qdict_{set,copy}_default()

In the block layer functions that determine options for a child block
device, it's a common pattern to either copy options from the parent's
options or to set a default string if the option isn't explicitly set
yet for the child. Provide convenience functions so that it becomes a
one-liner for each option.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
9 years agoqdict: Add qdict_array_entries()
Kevin Wolf [Wed, 21 Jan 2015 16:15:44 +0000 (17:15 +0100)]
qdict: Add qdict_array_entries()

This counts the entries in a flattened array in a QDict without
actually splitting the QDict into a QList.

bdrv_open_image() doesn't take a QList, but rather a QDict and a key
prefix string, so this is more convenient for block drivers which have a
dynamically sized list of child nodes (e.g. Quorum) and are to be
converted to using bdrv_open_image() as the standard interface for
opening child nodes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Peter Maydell [Fri, 12 Jun 2015 14:39:05 +0000 (15:39 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

# gpg: Signature made Fri Jun 12 13:57:20 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/net-pull-request:
  qmp/hmp: add rocker device support
  rocker: bring link up/down on PHY enable/disable
  rocker: update tests using hw-derived interface names
  rocker: Add support for phys name
  iohandler: Change return type of qemu_set_fd_handler to "void"
  event-notifier: Always return 0 for posix implementation
  xen_backend: Remove unused error handling of qemu_set_fd_handler
  oss: Remove unused error handling of qemu_set_fd_handler
  alsaaudio: Remove unused error handling of qemu_set_fd_handler
  main-loop: Drop qemu_set_fd_handler2
  Change qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handler
  tap: Drop tap_can_send
  net/socket: Drop net_socket_can_send
  netmap: Drop netmap_can_send
  l2tpv3: Drop l2tpv3_can_send
  stubs: Add qemu_set_fd_handler

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoiotests: Add tests for overriding BDRV_O_PROTOCOL
Max Reitz [Thu, 19 Mar 2015 18:53:17 +0000 (14:53 -0400)]
iotests: Add tests for overriding BDRV_O_PROTOCOL

This adds tests for overriding the qemu-internal BDRV_O_PROTOCOL flag by
explicitly specifying a block driver. As one test must be run over the
NBD protocol while the other must not, this patch adds two separate
iotests.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: driver should override flags in bdrv_open()
Max Reitz [Thu, 19 Mar 2015 18:53:16 +0000 (14:53 -0400)]
block: driver should override flags in bdrv_open()

The BDRV_O_PROTOCOL flag should have an impact only if no driver is
specified explicitly. Therefore, if bdrv_open() is called with an
explicit block driver argument (either through the options QDict or
through the drv parameter) and that block driver is a protocol block
driver, BDRV_O_PROTOCOL should be set; if it is a format block driver,
BDRV_O_PROTOCOL should be unset.

While there was code to unset the flag in case a format block driver
has been selected, it only followed the bdrv_fill_options() function
call whereas the flag in fact needs to be adjusted before it is used
there.

With that change, BDRV_O_PROTOCOL will always be set if the BDS should
be a protocol driver; if the driver has been specified explicitly, the
new code will set it; and bdrv_fill_options() will only "probe" a
protocol driver if BDRV_O_PROTOCOL is set. The probing after
bdrv_fill_options() cannot select a protocol driver.

Thus, bdrv_open_image() to open BDS.file is never called if a protocol
BDS is about to be created. With that change in turn it is impossible to
call bdrv_open_common() with a protocol drv and file != NULL, which
allows us to remove the bdrv_swap() call.

This change breaks a test case in qemu-iotest 051:
"-drive file=t.qcow2,file.driver=qcow2" now works because the explicitly
specified "qcow2" overrides the BDRV_O_PROTOCOL which is automatically
set for the "file" BDS (and the filename is just passed down).
Therefore, this patch removes that test case.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: Change bitmap truncate conditional to assertion
John Snow [Wed, 10 Jun 2015 17:24:54 +0000 (13:24 -0400)]
block: Change bitmap truncate conditional to assertion

This is an artifact of an older version that had both all-bitmap and
single-bitmap truncate functions, and some info got lost in the shuffle.

Bitmaps can only be frozen during a backup operation, and a backup
operation should prevent a resize operation, so just assert that this
cannot happen.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: record new size in bdrv_dirty_bitmap_truncate
John Snow [Mon, 8 Jun 2015 20:49:15 +0000 (16:49 -0400)]
block: record new size in bdrv_dirty_bitmap_truncate

ce1ffea8 neglected to update the BdrvDirtyBitmap structure
itself for internal consistency. It's currently not an issue,
but for migration and persistence series this will cause headaches.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoraw-posix: Fix .bdrv_co_get_block_status() for unaligned image size
Kevin Wolf [Tue, 9 Jun 2015 08:45:16 +0000 (10:45 +0200)]
raw-posix: Fix .bdrv_co_get_block_status() for unaligned image size

Image files with an unaligned image size have a final hole that starts
at EOF, i.e. in the middle of a sector. Currently, *pnum == 0 is
returned when checking the status of this sector. In qemu-img, this
triggers an assertion failure.

In order to fix this, one type for the sector that contains EOF must be
found. Treating a hole as data is safe, so this patch rounds the
calculated number of data sectors up, so that a partial sector at EOF is
treated as a full data sector.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1229394

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Cole Robinson <crobinso@redhat.com>
9 years agovmdk: Use vmdk_find_index_in_cluster everywhere
Fam Zheng [Thu, 4 Jun 2015 06:02:57 +0000 (14:02 +0800)]
vmdk: Use vmdk_find_index_in_cluster everywhere

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agovmdk: Fix index_in_cluster calculation in vmdk_co_get_block_status
Fam Zheng [Thu, 4 Jun 2015 06:02:56 +0000 (14:02 +0800)]
vmdk: Fix index_in_cluster calculation in vmdk_co_get_block_status

It has the similar issue with b1649fae49a8. Since the calculation
is repeated for a few times already, introduce a function so it can be
reused.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoqcow2: Add DEFAULT_L2_CACHE_CLUSTERS
Max Reitz [Mon, 1 Jun 2015 16:09:19 +0000 (18:09 +0200)]
qcow2: Add DEFAULT_L2_CACHE_CLUSTERS

If a relatively large cluster size is chosen, the default of 1 MB L2
cache is not really appropriate. In this case, unless overridden by the
user, the default cache size should not be determined by its size in
bytes but by the number of L2 tables (clusters) it is supposed to
contain.

Note that without this patch, MIN_L2_CACHE_SIZE will effectively take
over the same role. However, providing space for just two L2 tables is
not enough to be the default.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoiotests: qcow2 COW with minimal L2 cache size
Max Reitz [Mon, 1 Jun 2015 16:09:18 +0000 (18:09 +0200)]
iotests: qcow2 COW with minimal L2 cache size

This adds a test case to test 103 for performing a COW operation in a
qcow2 image using an L2 cache with minimal size (which should be at
least two clusters so the COW can access both source and destination
simultaneously).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoqcow2: Set MIN_L2_CACHE_SIZE to 2
Max Reitz [Mon, 1 Jun 2015 16:09:17 +0000 (18:09 +0200)]
qcow2: Set MIN_L2_CACHE_SIZE to 2

The L2 cache must cover at least two L2 tables, because during COW two
L2 tables are accessed simultaneously.

Reported-by: Alexander Graf <agraf@suse.de>
Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Tested-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoqemu-iotests: Fix 128 if sudo required
Fam Zheng [Tue, 19 May 2015 10:46:13 +0000 (10:46 +0000)]
qemu-iotests: Fix 128 if sudo required

If passwordless "sudo" works, use it in the qemu-io cmd.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoiotests: remove assertIsNotNone call
John Snow [Fri, 22 May 2015 16:01:41 +0000 (12:01 -0400)]
iotests: remove assertIsNotNone call

RHEL6 doesn't have Python 2.7, so replace this call with
assertNotEqual(x, None) which will work just as well.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/aurel/tags/pull-sh4-next-20150612' into staging
Peter Maydell [Fri, 12 Jun 2015 13:31:13 +0000 (14:31 +0100)]
Merge remote-tracking branch 'remotes/aurel/tags/pull-sh4-next-20150612' into staging

sh4 linux-user cpu and hwcap
misc optimizations and cleanup
convert r2d to new MMIO accessor style

# gpg: Signature made Fri Jun 12 11:28:43 2015 BST using RSA key ID 1DDD8C9B
# gpg: Good signature from "Aurelien Jarno <aurelien@aurel32.net>"
# gpg:                 aka "Aurelien Jarno <aurelien@jarno.fr>"
# gpg:                 aka "Aurelien Jarno <aurel32@debian.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 7746 2642 A9EF 94FD 0F77  196D BA9C 7806 1DDD 8C9B

* remotes/aurel/tags/pull-sh4-next-20150612:
  target-sh4: remove dead code
  target-sh4: factorize fmov implementation
  target-sh4: split out Q and M from of SR and optimize div1
  target-sh4: optimize negc using add2 and sub2
  target-sh4: optimize subc using sub2
  target-sh4: optimize addc using add2
  target-sh4: Split out T from SR
  target-sh4: use bit number for SR constants
  sh4/r2d: convert to new MMIO accessor style
  linux-user: Add HWCAP for SH4
  linux-user: Default sh4 to sh7785

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoqemu-iotests: expand test 093 to support group throttling
Alberto Garcia [Mon, 8 Jun 2015 16:17:48 +0000 (18:17 +0200)]
qemu-iotests: expand test 093 to support group throttling

This patch improves the test by attaching a different number of drives
to the VM and putting them in the same throttling group. The test
verifies that the I/O is evenly distributed among all members of the
group, and that the limits are enforced.

By default the test is repeated 3 times with 1, 2 and 3 drives, but
the maximum number of simultaneous drives is configurable.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 513df1da5c658878191b579ebcddd985adcd4122.1433779731.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agothrottle: Update throttle infrastructure copyright
Alberto Garcia [Mon, 8 Jun 2015 16:17:47 +0000 (18:17 +0200)]
throttle: Update throttle infrastructure copyright

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 07dcd4ed02f0110b13b3140f477b761b8bb8e270.1433779731.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agothrottle: add the name of the ThrottleGroup to BlockDeviceInfo
Alberto Garcia [Mon, 8 Jun 2015 16:17:46 +0000 (18:17 +0200)]
throttle: add the name of the ThrottleGroup to BlockDeviceInfo

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 172df91f09c69c6f0440a697bbd1b3f95b077ee4.1433779731.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agothrottle: acquire the ThrottleGroup lock in bdrv_swap()
Alberto Garcia [Mon, 8 Jun 2015 16:17:45 +0000 (18:17 +0200)]
throttle: acquire the ThrottleGroup lock in bdrv_swap()

bdrv_swap() touches the fields of a BlockDriverState that are
protected by the ThrottleGroup lock. Although those fields end up in
their original place, they are temporarily swapped in the process,
so there's a chance that an operation on a member of the same group
happening on a different thread can try to use them.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: d92dc40d7c4f1fc5cda5cbbf4ffb7a4670b79d17.1433779731.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agothrottle: Add throttle group support
Alberto Garcia [Mon, 8 Jun 2015 16:17:44 +0000 (18:17 +0200)]
throttle: Add throttle group support

The throttle group support use a cooperative round robin scheduling
algorithm.

The principles of the algorithm are simple:
- Each BDS of the group is used as a token in a circular way.
- The active BDS computes if a wait must be done and arms the right
  timer.
- If a wait must be done the token timer will be armed so the token
  will become the next active BDS.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: f0082a86f3ac01c46170f7eafe2101a92e8fde39.1433779731.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agothrottle: Add throttle group infrastructure tests
Alberto Garcia [Mon, 8 Jun 2015 16:17:43 +0000 (18:17 +0200)]
throttle: Add throttle group infrastructure tests

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: ba7b9dc7fca43efbb31d5f3aad91a8dbdbea635b.1433779731.git.berto@igalia.com
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agothrottle: Add throttle group infrastructure
Alberto Garcia [Mon, 8 Jun 2015 16:17:42 +0000 (18:17 +0200)]
throttle: Add throttle group infrastructure

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 2fdb4de17210b733a13eb472c33cd08b45f8fd21.1433779731.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agothrottle: Extract timers from ThrottleState into a separate structure
Benoît Canet [Mon, 8 Jun 2015 16:17:41 +0000 (18:17 +0200)]
throttle: Extract timers from ThrottleState into a separate structure

Group throttling will share ThrottleState between multiple bs.
As a consequence the ThrottleState will be accessed by multiple aio
context.

Timers are tied to their aio context so they must go out of the
ThrottleState structure.

This commit paves the way for each bs of a common ThrottleState to
have its own timer.

Signed-off-by: Benoit Canet <benoit.canet@nodalink.com>
Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 6cf9ea96d8b32ae2f8769cead38f68a6a0c8c909.1433779731.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoraw-posix: Fix .bdrv_co_get_block_status() for unaligned image size
Kevin Wolf [Tue, 9 Jun 2015 08:55:08 +0000 (10:55 +0200)]
raw-posix: Fix .bdrv_co_get_block_status() for unaligned image size

Image files with an unaligned image size have a final hole that starts
at EOF, i.e. in the middle of a sector. Currently, *pnum == 0 is
returned when checking the status of this sector. In qemu-img, this
triggers an assertion failure.

In order to fix this, one type for the sector that contains EOF must be
found. Treating a hole as data is safe, so this patch rounds the
calculated number of data sectors up, so that a partial sector at EOF is
treated as a full data sector.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1229394

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1433840108-9996-1-git-send-email-kwolf@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoRevert "iothread: release iothread around aio_poll"
Stefan Hajnoczi [Wed, 3 Jun 2015 09:15:33 +0000 (10:15 +0100)]
Revert "iothread: release iothread around aio_poll"

This reverts commit a0710f7995f914e3044e5899bd8ff6c43c62f916.

In qemu-devel email message <556DBF87.2020908@de.ibm.com>, Christian
Borntraeger writes:

  Having many guests all with a kernel/ramdisk (via -kernel) and
  several null block devices will result in hangs. All hanging
  guests are in partition detection code waiting for an I/O to return
  so very early maybe even the first I/O.

  Reverting that commit "fixes" the hangs.

Reverting this commit for the 2.4 release.  More time is needed to
investigate and correct this patch.

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqmp/hmp: add rocker device support
Scott Feldman [Thu, 11 Jun 2015 01:21:21 +0000 (18:21 -0700)]
qmp/hmp: add rocker device support

Add QMP/HMP support for rocker devices.  This is mostly for debugging purposes
to see inside the device's tables and port configurations.  Some examples:

(qemu) info rocker sw1
name: sw1
id: 0x0000013512005452
ports: 4

(qemu) info rocker-ports sw1
            ena/    speed/ auto
      port  link    duplex neg?
     sw1.1  up     10G  FD  No
     sw1.2  up     10G  FD  No
     sw1.3  !ena   10G  FD  No
     sw1.4  !ena   10G  FD  No

(qemu) info rocker-of-dpa-flows sw1
prio tbl hits key(mask) --> actions
2    60       pport 1 vlan 1 LLDP src 00:02:00:00:02:00 dst 01:80:c2:00:00:0e
2    60       pport 1 vlan 1 ARP src 00:02:00:00:02:00 dst 00:02:00:00:03:00
2    60       pport 2 vlan 2 IPv6 src 00:02:00:00:03:00 dst 33:33:ff:00:00:02 proto 58
3    50       vlan 2 dst 33:33:ff:00:00:02 --> write group 0x32000001 goto tbl 60
2    60       pport 2 vlan 2 IPv6 src 00:02:00:00:03:00 dst 33:33:ff:00:03:00 proto 58
3    50  1    vlan 2 dst 33:33:ff:00:03:00 --> write group 0x32000001 goto tbl 60
2    60       pport 2 vlan 2 ARP src 00:02:00:00:03:00 dst 00:02:00:00:02:00
3    50  2    vlan 2 dst 00:02:00:00:02:00 --> write group 0x02000001 goto tbl 60
2    60  1    pport 2 vlan 2 IP src 00:02:00:00:03:00 dst 00:02:00:00:02:00 proto 1
3    50  2    vlan 1 dst 00:02:00:00:03:00 --> write group 0x01000002 goto tbl 60
2    60  1    pport 1 vlan 1 IP src 00:02:00:00:02:00 dst 00:02:00:00:03:00 proto 1
2    60       pport 1 vlan 1 IPv6 src 00:02:00:00:02:00 dst 33:33:ff:00:00:01 proto 58
3    50       vlan 1 dst 33:33:ff:00:00:01 --> write group 0x31000000 goto tbl 60
2    60       pport 1 vlan 1 IPv6 src 00:02:00:00:02:00 dst 33:33:ff:00:02:00 proto 58
3    50  1    vlan 1 dst 33:33:ff:00:02:00 --> write group 0x31000000 goto tbl 60
1    60  173  pport 2 vlan 2 LLDP src <any> dst 01:80:c2:00:00:0e --> write group 0x02000000
1    60  6    pport 2 vlan 2 IPv6 src <any> dst <any> --> write group 0x02000000
1    60  174  pport 1 vlan 1 LLDP src <any> dst 01:80:c2:00:00:0e --> write group 0x01000000
1    60  174  pport 2 vlan 2 IP src <any> dst <any> --> write group 0x02000000
1    60  6    pport 1 vlan 1 IPv6 src <any> dst <any> --> write group 0x01000000
1    60  181  pport 2 vlan 2 ARP src <any> dst <any> --> write group 0x02000000
1    10  715  pport 2 --> apply new vlan 2 goto tbl 20
1    60  177  pport 1 vlan 1 ARP src <any> dst <any> --> write group 0x01000000
1    60  174  pport 1 vlan 1 IP src <any> dst <any> --> write group 0x01000000
1    10  717  pport 1 --> apply new vlan 1 goto tbl 20
1    0   1432 pport 0(0xffff) --> goto tbl 10

(qemu) info rocker-of-dpa-groups sw1
id (decode) --> buckets
0x32000001 (type L2 multicast vlan 2 index 1) --> groups [0x02000001,0x02000000]
0x02000001 (type L2 interface vlan 2 pport 1) --> pop vlan out pport 1
0x01000002 (type L2 interface vlan 1 pport 2) --> pop vlan out pport 2
0x02000000 (type L2 interface vlan 2 pport 0) --> pop vlan out pport 0
0x01000000 (type L2 interface vlan 1 pport 0) --> pop vlan out pport 0
0x31000000 (type L2 multicast vlan 1 index 0) --> groups [0x01000002,0x01000000]

[Added "query-" prefixes to rocker.json commands as suggested by Eric
Blake <eblake@redhat.com>.
--Stefan]

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Message-id: 1433985681-56138-5-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agorocker: bring link up/down on PHY enable/disable
Scott Feldman [Thu, 11 Jun 2015 01:21:20 +0000 (18:21 -0700)]
rocker: bring link up/down on PHY enable/disable

When the OS driver enables/disables the port, go ahead and set the port's
link status to up/down in response to the change.  This more closely
emulates real hardware when the PHY for the port is brought up/down
and the PHY negotiates carrier (link status) with link partner.  In
the case of qemu, the virtual rocker device can't really do link
negotiation with the link partner as that requires signally over a
physical medium (the wire), so just pretend the negotiation was
successful and bring the link up when the port is enabled.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1433985681-56138-4-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agorocker: update tests using hw-derived interface names
Scott Feldman [Thu, 11 Jun 2015 01:21:19 +0000 (18:21 -0700)]
rocker: update tests using hw-derived interface names

With previous patch to support phy name attribute for each port, the OS
can name port interfaces using the hw-derived name.  So update rocker
tests to use the new hw-derived interface names.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1433985681-56138-3-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agorocker: Add support for phys name
David Ahern [Thu, 11 Jun 2015 01:21:18 +0000 (18:21 -0700)]
rocker: Add support for phys name

Add ROCKER_TLV_CMD_PORT_SETTINGS_PHYS_NAME to port settings. This attribute
exports the port name to the guest OS allowing it to name interfaces with
sensible defaults.

Mostly done by Scott for phys_id support; adapted to phys_name by David.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Message-id: 1433985681-56138-2-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoiohandler: Change return type of qemu_set_fd_handler to "void"
Fam Zheng [Thu, 4 Jun 2015 06:45:24 +0000 (14:45 +0800)]
iohandler: Change return type of qemu_set_fd_handler to "void"

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-14-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoevent-notifier: Always return 0 for posix implementation
Fam Zheng [Thu, 4 Jun 2015 06:45:23 +0000 (14:45 +0800)]
event-notifier: Always return 0 for posix implementation

qemu_set_fd_handler cannot fail, let's always return 0.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-13-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoxen_backend: Remove unused error handling of qemu_set_fd_handler
Fam Zheng [Thu, 4 Jun 2015 06:45:22 +0000 (14:45 +0800)]
xen_backend: Remove unused error handling of qemu_set_fd_handler

The function cannot fail, so the check is superfluous.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-12-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agooss: Remove unused error handling of qemu_set_fd_handler
Fam Zheng [Thu, 4 Jun 2015 06:45:21 +0000 (14:45 +0800)]
oss: Remove unused error handling of qemu_set_fd_handler

The function cannot fail, so the check is superfluous.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-11-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoalsaaudio: Remove unused error handling of qemu_set_fd_handler
Fam Zheng [Thu, 4 Jun 2015 06:45:20 +0000 (14:45 +0800)]
alsaaudio: Remove unused error handling of qemu_set_fd_handler

The function cannot fail, so the check is superfluous.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-10-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agomain-loop: Drop qemu_set_fd_handler2
Fam Zheng [Thu, 4 Jun 2015 06:45:19 +0000 (14:45 +0800)]
main-loop: Drop qemu_set_fd_handler2

All users are converted to qemu_set_fd_handler now, drop
qemu_set_fd_handler2 and IOHandlerRecord.fd_read_poll.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-9-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoChange qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handler
Fam Zheng [Thu, 4 Jun 2015 06:45:18 +0000 (14:45 +0800)]
Change qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handler

Done with following Coccinelle semantic patch, plus manual cosmetic changes in
net/*.c.

    @@
    expression E1, E2, E3, E4;
    @@
    -   qemu_set_fd_handler2(E1, NULL, E2, E3, E4);
    +   qemu_set_fd_handler(E1, E2, E3, E4);

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-8-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agotap: Drop tap_can_send
Fam Zheng [Thu, 4 Jun 2015 06:45:17 +0000 (14:45 +0800)]
tap: Drop tap_can_send

This callback is called by main loop before polling s->fd, if it returns
false, the fd will not be polled in this iteration.

This is redundant with checks inside read callback. After this patch,
the data will be sent to peer when it arrives. If the device can't
receive, it will be queued to incoming_queue, and when the device status
changes, this queue will be flushed.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-7-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agonet/socket: Drop net_socket_can_send
Fam Zheng [Thu, 4 Jun 2015 06:45:16 +0000 (14:45 +0800)]
net/socket: Drop net_socket_can_send

This callback is called by main loop before polling s->fd, if it returns
false, the fd will not be polled in this iteration.

This is redundant with checks inside read callback. After this patch,
the data will be sent to peer when it arrives. If the device can't
receive, it will be queued to incoming_queue, and when the device status
changes, this queue will be flushed.

If the peer is not ready, disable the read poll until send completes.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-6-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agonetmap: Drop netmap_can_send
Fam Zheng [Thu, 4 Jun 2015 06:45:15 +0000 (14:45 +0800)]
netmap: Drop netmap_can_send

This callback is called by main loop before polling s->fd, if it returns
false, the fd will not be polled in this iteration.

This is redundant with checks inside read callback. After this patch,
the data will be copied from s->fd to s->iov when it arrives. If the
device can't receive, it will be queued to incoming_queue, and when the
device status changes, this queue will be flushed.

Also remove the qemu_can_send_packet() check in netmap_send. If it's
true, we are good; if it's false, the qemu_sendv_packet_async would
return 0 and read poll will be disabled until netmap_send_completed is
called.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-5-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agol2tpv3: Drop l2tpv3_can_send
Fam Zheng [Thu, 4 Jun 2015 06:45:14 +0000 (14:45 +0800)]
l2tpv3: Drop l2tpv3_can_send

This callback is called by main loop before polling s->fd, if it returns
false, the fd will not be polled in this iteration.

This is redundant with checks inside read callback. After this patch,
the data will be copied from s->fd to s->msgvec when it arrives. If the
device can't receive, it will be queued to incoming_queue, and when the
device status changes, this queue will be flushed.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-4-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agostubs: Add qemu_set_fd_handler
Fam Zheng [Thu, 4 Jun 2015 06:45:12 +0000 (14:45 +0800)]
stubs: Add qemu_set_fd_handler

Some qemu_set_fd_handler2 stub callers will be converted to
call qemu_set_fd_handler, add this stub for them before making the
change.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-2-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/lalrae/tags/mips-20150612' into staging
Peter Maydell [Fri, 12 Jun 2015 11:49:40 +0000 (12:49 +0100)]
Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150612' into staging

MIPS patches 2015-06-12

Changes:
* improve dp8393x network card and rc4030 chipset emulation
* support misaligned R6 and MSA memory accesses
* support MIPS eXtended and Large Physical Addressing
* add Config5.FRE bit and ERETNC instruction (Config5.LLB)
* support ememsize on MALTA

# gpg: Signature made Fri Jun 12 09:38:11 2015 BST using RSA key ID 0B29DA6B
# gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8DD3 2F98 5495 9D66 35D4  4FC0 5211 8E3C 0B29 DA6B

* remotes/lalrae/tags/mips-20150612: (29 commits)
  target-mips: enable XPA and LPA features
  target-mips: remove misleading comments in translate_init.c
  target-mips: add MTHC0 and MFHC0 instructions
  target-mips: add CP0.PageGrain.ELPA support
  target-mips: support Page Frame Number Extension field
  target-mips: extend selected CP0 registers to 64-bits in MIPS32
  target-mips: correct MFC0 for CP0.EntryLo in MIPS64
  net/dp8393x: fix hardware reset
  net/dp8393x: correctly reset in_use field
  net/dp8393x: add load/save support
  net/dp8393x: add PROM to store MAC address
  net/dp8393x: QOM'ify
  net/dp8393x: use dp8393x_ prefix for all functions
  net/dp8393x: do not use old_mmio accesses
  net/dp8393x: always calculate proper checksums
  dma/rc4030: convert to QOM
  dma/rc4030: use trace events instead of custom logging
  dma/rc4030: document register at offset 0x210
  dma/rc4030: do not use old_mmio accesses
  dma/rc4030: use AddressSpace and address_space_rw in users
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20150612' into...
Peter Maydell [Fri, 12 Jun 2015 10:06:03 +0000 (11:06 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150612' into staging

migration/next for 20150612

# gpg: Signature made Fri Jun 12 05:56:21 2015 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"

* remotes/juanquintela/tags/migration/20150612: (21 commits)
  Remove unneeded memset
  Rename RDMA structures to make destination clear
  Teach analyze-migration.py about section footers
  Add a protective section footer
  Disable section footers on older machine types
  Merge section header writing
  Move loadvm_handlers into MigrationIncomingState
  Move copy out of qemu_peek_buffer
  Create MigrationIncomingState
  qemu_ram_foreach_block: pass up error value, and down the ramblock name
  Split header writing out of qemu_savevm_state_begin
  Add qemu_get_counted_string to read a string prefixed by a count byte
  migration: Use normal VMStateDescriptions for Subsections
  migration: create savevm_state
  migration: Remove duplicated assignment of SETUP status
  rdma: Fix qemu crash when IPv6 address is used for migration
  arch_init: Clean up the duplicate variable 'len' defining in ram_load()
  migration: reduce include files
  migration: Add myself to the copyright list of both files
  migration: move savevm.c inside migration/
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-sh4: remove dead code
Aurelien Jarno [Sun, 24 May 2015 23:28:56 +0000 (01:28 +0200)]
target-sh4: remove dead code

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-sh4: factorize fmov implementation
Aurelien Jarno [Sun, 24 May 2015 23:28:56 +0000 (01:28 +0200)]
target-sh4: factorize fmov implementation

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-sh4: split out Q and M from of SR and optimize div1
Aurelien Jarno [Sun, 24 May 2015 23:28:56 +0000 (01:28 +0200)]
target-sh4: split out Q and M from of SR and optimize div1

Splitting Q and M out of SR, it's possible to optimize div1 by using
TCG code instead of an helper.

At the same time removed the now unused gen_copy_bit_i32 function.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-sh4: optimize negc using add2 and sub2
Aurelien Jarno [Sun, 24 May 2015 23:28:56 +0000 (01:28 +0200)]
target-sh4: optimize negc using add2 and sub2

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-sh4: optimize subc using sub2
Aurelien Jarno [Sun, 24 May 2015 23:28:56 +0000 (01:28 +0200)]
target-sh4: optimize subc using sub2

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-sh4: optimize addc using add2
Aurelien Jarno [Sun, 24 May 2015 23:28:56 +0000 (01:28 +0200)]
target-sh4: optimize addc using add2

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-sh4: Split out T from SR
Aurelien Jarno [Sun, 24 May 2015 23:28:56 +0000 (01:28 +0200)]
target-sh4: Split out T from SR

In preparation for more efficient setting of this field.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-sh4: use bit number for SR constants
Aurelien Jarno [Sun, 24 May 2015 23:28:56 +0000 (01:28 +0200)]
target-sh4: use bit number for SR constants

Use the bit number for SR constants instead of using a bit mask. This
make possible to also use the constants for shifts.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agosh4/r2d: convert to new MMIO accessor style
Aurelien Jarno [Wed, 3 Jun 2015 21:16:43 +0000 (23:16 +0200)]
sh4/r2d: convert to new MMIO accessor style

The documentation is clear to use 16-bit accesses for all registers.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agolinux-user: Add HWCAP for SH4
Richard Henderson [Sat, 23 May 2015 22:06:54 +0000 (15:06 -0700)]
linux-user: Add HWCAP for SH4

Only exposing FPU and LLSC as the only features
supported by the translator.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agolinux-user: Default sh4 to sh7785
Richard Henderson [Sat, 23 May 2015 22:06:53 +0000 (15:06 -0700)]
linux-user: Default sh4 to sh7785

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: enable XPA and LPA features
Leon Alrae [Tue, 14 Apr 2015 09:33:43 +0000 (10:33 +0100)]
target-mips: enable XPA and LPA features

Enable XPA in MIPS32R5-generic and LPA in MIPS64R6-generic.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>