]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agolibcacard/vscclient: fix leakage of socket on error paths
Alon Levy [Tue, 4 Jun 2013 20:23:37 +0000 (16:23 -0400)]
libcacard/vscclient: fix leakage of socket on error paths

Spotted by Coverity.

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolinux-headers: Update to v3.10-rc5
Alexey Kardashevskiy [Wed, 12 Jun 2013 07:26:55 +0000 (17:26 +1000)]
linux-headers: Update to v3.10-rc5

This adds symbols required for PPC64 pseries platform features:
1. sPAPR live migration;
2. in-kernel XICS interrupt controller.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoKVM: PPC: Add dummy kvm_arch_init_irq_routing()
Scott Wood [Wed, 12 Jun 2013 07:26:54 +0000 (17:26 +1000)]
KVM: PPC: Add dummy kvm_arch_init_irq_routing()

The common KVM code insists on calling kvm_arch_init_irq_routing()
as soon as it sees kernel header support for it (regardless of whether
QEMU supports it).  Provide a dummy function to satisfy this.

Unlike x86, PPC does not have one default irqchip, so there's no common
code that we'd stick here.  Even if you ignore the routes themselves,
which even on x86 are not set up in this function, the initial XICS
kernel implementation will not support IRQ routing, so it's best to
leave even the general feature flags up to the specific irqchip code.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoKVM: S390: Add dummy kvm_arch_init_irq_routing()
Alexey Kardashevskiy [Wed, 12 Jun 2013 07:26:53 +0000 (17:26 +1000)]
KVM: S390: Add dummy kvm_arch_init_irq_routing()

The common KVM code insists on calling kvm_arch_init_irq_routing()
as soon as it sees kernel header support for it (regardless of whether
QEMU supports it).  Provide a dummy function to satisfy this.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoKVM: ARM: Add dummy kvm_arch_init_irq_routing()
Alexey Kardashevskiy [Wed, 12 Jun 2013 07:26:52 +0000 (17:26 +1000)]
KVM: ARM: Add dummy kvm_arch_init_irq_routing()

The common KVM code insists on calling kvm_arch_init_irq_routing()
as soon as it sees kernel header support for it (regardless of whether
QEMU supports it).  Provide a dummy function to satisfy this.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoivshmem: add missing error exit(2)
Stefan Hajnoczi [Mon, 3 Jun 2013 08:58:31 +0000 (10:58 +0200)]
ivshmem: add missing error exit(2)

If the user fails to specify 'chardev' or 'shm' then we cannot continue.
Exit right away so that we don't invoke shm_open(3) with a NULL pointer.

It would be nice to replace exit(1) with error returns in the PCI device
.init() function, but leave that for another patch since exit(1) is
currently used elsewhere.

Spotted by Coverity.

Cc: Cam Macdonell <cam@cs.ualberta.ca>
Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agohw/xen: Use g_free instead of free and fix potential memory leaks
Stefan Weil [Mon, 10 Jun 2013 20:36:22 +0000 (22:36 +0200)]
hw/xen: Use g_free instead of free and fix potential memory leaks

The wrong functions and the missing calls of g_free were reported
by cppcheck.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotarget-sparc: Replace free by g_free
Stefan Weil [Mon, 10 Jun 2013 20:40:52 +0000 (22:40 +0200)]
target-sparc: Replace free by g_free

The wrong function was reported by cppcheck.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agohw/scsi: Don't increment a boolean value
Stefan Weil [Mon, 10 Jun 2013 20:24:56 +0000 (22:24 +0200)]
hw/scsi: Don't increment a boolean value

This fixes a warning from cppcheck.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agodevice tree: Fix cppcheck warning
Stefan Weil [Mon, 10 Jun 2013 20:12:25 +0000 (22:12 +0200)]
device tree: Fix cppcheck warning

Fix this cppcheck warning:

Checking device_tree.c...
device_tree.c:216: style:
 Checking if unsigned variable 'r' is less than zero.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoMakefile: Install qemu-img and qemu-nbd man pages only if built
Andreas Färber [Tue, 11 Jun 2013 11:13:58 +0000 (13:13 +0200)]
Makefile: Install qemu-img and qemu-nbd man pages only if built

When splitting openSUSE's qemu and qemu-linux-user packages we noticed
that for linux-user-only builds unrelated man pages got installed.
It's surely possible to delete them before packaging, but not installing
them in the first place seems more logical.

Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoUnbreak -no-quit for GTK, validate SDL options
Peter Wu [Tue, 11 Jun 2013 08:55:08 +0000 (10:55 +0200)]
Unbreak -no-quit for GTK, validate SDL options

Certain options (-no-frame, -alt-grab, -ctrl-grab) only make sense with SDL.
When compiling without SDL, these options (and -no-quit) print an error message
and exit qemu.

In case QEMU is compiled with SDL support, the three aforementioned options
still do not make sense with other display types. This patch addresses that
issue by printing a warning. I have chosen not to exit QEMU afterwards because
having the option is not harmful and before this patch it would be ignored
anyway.

By delaying the sanity check from compile-time with some ifdefs to run-time,
-no-quit is now also properly supported when compiling without SDL.

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agogtk: implement -full-screen
Peter Wu [Mon, 10 Jun 2013 18:04:43 +0000 (20:04 +0200)]
gtk: implement -full-screen

Aiming for GTK as replacement for SDL, a feature like -full-screen should also
be implemented.

Bringing the window into full-screen mode is done by activating the "Fullscreen"
menu item. This is done after showing the windows to make the cursor and menu
hidden.

v2: drop -no-frame implementation, use booleans instead of ints and ensure
    consistency between ui state and menu.

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agochar/serial: serial_ioport_write: Factor out common code
Peter Crosthwaite [Mon, 3 Jun 2013 05:14:48 +0000 (15:14 +1000)]
char/serial: serial_ioport_write: Factor out common code

These three lines are common to both FIFO and regular mode. Just factor
them out to outside the if rather than replicate the same lines inside
both if and else.

Cc: qemu-trivial@nongnu.org
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agochar/serial: Use generic Fifo8
Peter Crosthwaite [Mon, 3 Jun 2013 05:13:27 +0000 (15:13 +1000)]
char/serial: Use generic Fifo8

Use the generic Fifo8 helper provided by QEMU, rather than re-implement
privately.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agochar/serial: cosmetic fixes.
Peter Crosthwaite [Mon, 3 Jun 2013 05:12:09 +0000 (15:12 +1000)]
char/serial: cosmetic fixes.

Some cosmetic fixes to char/serial fixing some checkpatch errors.

Cc: qemu-trivial@nongnu.org
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agocurl: Whitespace only changes.
Richard W.M. Jones [Mon, 10 Jun 2013 13:14:35 +0000 (14:14 +0100)]
curl: Whitespace only changes.

Trivial patch to remove odd whitespace.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agointc/xilinx_intc: Use qemu_set_irq
Peter Crosthwaite [Thu, 6 Jun 2013 16:38:03 +0000 (16:38 +0000)]
intc/xilinx_intc: Use qemu_set_irq

Use qemu_set_irq rather than if-elsing qemu_irq_(lower|raise). No
functional change, just reduces verbosity.

Cc: qemu-trivial@nongnu.org
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: Disable host-bsd USB on FreeBSD
Ed Maste [Thu, 6 Jun 2013 13:18:44 +0000 (09:18 -0400)]
configure: Disable host-bsd USB on FreeBSD

It hasn't built since FreeBSD 8.x, and is disabled by a patch in the
FreeBSD ports tree.  FreeBSD is migrating to QEMU's libusb support.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: remove ${config_host_ld} variable
Ed Maste [Thu, 6 Jun 2013 12:53:35 +0000 (08:53 -0400)]
configure: remove ${config_host_ld} variable

It was only used in one place (and already expanded in one other).

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agogitignore: unignore *.patch
Michael Tokarev [Wed, 5 Jun 2013 21:14:54 +0000 (01:14 +0400)]
gitignore: unignore *.patch

This partially reverts:

 commit 082369e62c5bbaba89f173c2b803bc24115bb111
 Author: liguang <lig.fnst@cn.fujitsu.com>
 Date:   Fri Mar 22 16:44:13 2013 +0800

    gitignore: ignore more files

I'm not sure how this went in.  The thing is that
ignoring *.patch, in my opinion, is just wrong.
Especially for downstreams who apply patches for
real.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqemu-char: remove a few needless #includes
Michael Tokarev [Wed, 5 Jun 2013 15:08:59 +0000 (19:08 +0400)]
qemu-char: remove a few needless #includes

This removes <syslog.h> since we don't use
syslogging, and removes second, solaris-specific,
include of <net/if.h> (which is included in
a common part of the file)

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqemu-char: don't issue CHR_EVENT_OPEN in a BH
Michael Roth [Fri, 7 Jun 2013 20:19:53 +0000 (15:19 -0500)]
qemu-char: don't issue CHR_EVENT_OPEN in a BH

When CHR_EVENT_OPENED was initially added, it was CHR_EVENT_RESET,
and it was issued as a bottom-half:

86e94dea5b740dad65446c857f6959eae43e0ba6

Which we basically used to print out a greeting/prompt for the
monitor.

AFAICT the only reason this was ever done in a BH was because in
some cases we'd modify the chr_write handler for a new chardev
backend *after* the site where we issued the reset (see:
86e94d:qemu_chr_open_stdio())

At some point this event was renamed to CHR_EVENT_OPENED, and we've
maintained the use of this BH ever since.

However, due to 9f939df955a4152aad69a19a77e0898631bb2c18, we schedule
the BH via g_idle_add(), which is causing events to sometimes be
delivered after we've already begun processing data from backends,
leading to:

 known bugs:

  QMP:
    session negotation resets with OPENED event, in some cases this
    is causing new sessions to get sporadically reset

 potential bugs:

  hw/usb/redirect.c:
    can_read handler checks for dev->parser != NULL, which may be
    true if CLOSED BH has not been executed yet. In the past, OPENED
    quiesced outstanding CLOSED events prior to us reading client
    data. If it's delayed, our check may allow reads to occur even
    though we haven't processed the OPENED event yet, and when we
    do finally get the OPENED event, our state may get reset.

  qtest.c:
    can begin session before OPENED event is processed, leading to
    a spurious reset of the system and irq_levels

  gdbstub.c:
    may start a gdb session prior to the machine being paused

To fix these, let's just drop the BH.

Since the initial reasoning for using it still applies to an extent,
work around that by deferring the delivery of CHR_EVENT_OPENED until
after the chardevs have been fully initialized, toward the end of
qmp_chardev_add() (or some cases, qemu_chr_new_from_opts()). This
defers delivery long enough that we can be assured a CharDriverState
is fully initialized before CHR_EVENT_OPENED is sent.

Also, rather than requiring each chardev to do an explicit open, do it
automatically, and allow the small few who don't desire such behavior to
suppress the OPENED-on-init behavior by setting a 'explicit_be_open'
flag.

We additionally add missing OPENED events for stdio backends on w32,
which were previously not being issued, causing us to not recieve the
banner and initial prompts for qmp/hmp.

Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-id: 1370636393-21044-1-git-send-email-mdroth@linux.vnet.ibm.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Mon, 10 Jun 2013 16:37:47 +0000 (11:37 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Luiz Capitulino (2) and Marcelo Tosatti (1)
# Via Luiz Capitulino
* luiz/queue/qmp:
  correct RTC_CHANGE_EVENT description (v2)
  MAINTAINERS: split Monitor (QMP/HMP) entry
  MAINTAINERS: new maintainers for qapi-schema.json

Message-id: 1370634855-18337-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Mon, 10 Jun 2013 16:37:39 +0000 (11:37 -0500)]
Merge remote-tracking branch 'stefanha/net' into staging

# By Jason Wang (1) and Stefan Hajnoczi (1)
# Via Stefan Hajnoczi
* stefanha/net:
  tap: fix NULL dereference when passing invalid parameters to tap
  vmxnet3: fix NICState cleanup

Message-id: 1370613288-14933-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agogtk: use better icon
Anthony Liguori [Fri, 7 Jun 2013 18:24:17 +0000 (13:24 -0500)]
gtk: use better icon

The current icon looks pretty terrible rendered in Gnome.  This
switches to a transparent SVG which looks much nicer.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agosoftfloat: Fix shift128Right for shift counts 64..127
Peter Maydell [Sun, 2 Jun 2013 15:17:49 +0000 (16:17 +0100)]
softfloat: Fix shift128Right for shift counts 64..127

shift128Right would give the wrong result for a shift count
between 64 and 127. This was never noticed because all of
our uses of this function are guaranteed not to use shift
counts in this range.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1370186269-24353-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agogdbstub: let the debugger resume from guest panicked state
Paolo Bonzini [Mon, 3 Jun 2013 15:06:55 +0000 (17:06 +0200)]
gdbstub: let the debugger resume from guest panicked state

While in general we forbid a "continue" from the guest panicked
state, it makes sense to have an exception for that when continuing
in the debugger.  Perhaps the guest entered that state due to a bug,
for example, and we want to continue no matter what.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Message-id: 1370272015-9659-3-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agogdbstub: fix for commit 87f25c12bfeaaa0c41fb857713bbc7e8a9b757dc
Paolo Bonzini [Mon, 3 Jun 2013 15:06:54 +0000 (17:06 +0200)]
gdbstub: fix for commit 87f25c12bfeaaa0c41fb857713bbc7e8a9b757dc

This commit used the wrong check to prevent an assertion failure.
After this commit, you need to start a guest in the monitor, you
cannot use anymore the "c" command in the debugger.  This is
undesirable.  The commit's aim was to prevent a restart
after a KVM internal error or something like that; use
runstate_needs_reset() for that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Message-id: 1370272015-9659-2-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoxilinx_axidma: Do not set DMA .notify to NULL after notify
Wendy Liang [Fri, 7 Jun 2013 03:05:38 +0000 (13:05 +1000)]
xilinx_axidma: Do not set DMA .notify to NULL after notify

If a stream notify function is not ready, it may re-populate the notify call-
back to indicate it should be re-polled later. This break in this usage, as
immediately following the notify() call, .notify is set to NULL. reverse the
ordering of the notify call and NULL assignment accordingly.

[PC: Reworked commit message]

Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agoxilinx_axienet: Fix bit mask code
Stefan Weil [Sun, 9 Jun 2013 20:56:20 +0000 (22:56 +0200)]
xilinx_axienet: Fix bit mask code

Obviously the code wanted to mask the lower bits but failed to do so
because of a missing "<".

cppcheck detected a conditional expression which was always true (1 < 7).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agocorrect RTC_CHANGE_EVENT description (v2)
Marcelo Tosatti [Fri, 7 Jun 2013 19:52:43 +0000 (16:52 -0300)]
correct RTC_CHANGE_EVENT description (v2)

Fix RTC_CHANGE event description to match implementation.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoMAINTAINERS: split Monitor (QMP/HMP) entry
Luiz Capitulino [Mon, 3 Jun 2013 15:14:26 +0000 (11:14 -0400)]
MAINTAINERS: split Monitor (QMP/HMP) entry

This entry doesn't reflect reality for a few years now. This commit
splits it into Human Monitor (HMP), QAPI and QMP. Markus is dropped
as a maintainer.

This is what we have been for the last few years. Also, it's going
to help me to offload some of this work to someone else in the near
future.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
10 years agoMAINTAINERS: new maintainers for qapi-schema.json
Luiz Capitulino [Mon, 3 Jun 2013 15:11:53 +0000 (11:11 -0400)]
MAINTAINERS: new maintainers for qapi-schema.json

I'm facing two problems lately wrt QMP patch review: increasingly
lack of bandwidth and lack of background in so many different areas
that are getting new QMP commands almost every week.

In order to help me mitigate this problem, I'm adding Eric and Markus
(besides me) as maintainers of the qapi-schema.json file.

Markus has been an old timer reviewer. Eric is being the most active
and prolific reviewer of QMP patches for some time now.

I believe Markus and Eric will keep doing their work as before, but
starting now I'll require the ACK of at least one of them before
appling a patch/series that touches the qapi-schema.json file.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
10 years agotap: fix NULL dereference when passing invalid parameters to tap
Jason Wang [Tue, 4 Jun 2013 05:18:17 +0000 (13:18 +0800)]
tap: fix NULL dereference when passing invalid parameters to tap

This patch forbid the following invalid parameters to tap:

1) fd and vhostfds were specified but vhostfd were not specified
2) vhostfds were specified but fds were not specified
3) fds and vhostfd were specified

For 1 and 2, net_init_tap_one() will still pass NULL as vhostfdname to
monitor_handle_fd_param(), which may crash the qemu.

Also remove the unnecessary has_fd check.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <shajnocz@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Fri, 7 Jun 2013 13:40:52 +0000 (08:40 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Kevin Wolf (19) and others
# Via Stefan Hajnoczi
* stefanha/block: (26 commits)
  hmp: add parameters device and -v for info block
  hmp: show ImageInfo in 'info block'
  qmp: add ImageInfo in BlockDeviceInfo used by query-block
  block: add image info query function bdrv_query_image_info()
  block: add snapshot info query function bdrv_query_snapshot_info_list()
  ide-test: Add FLUSH CACHE test case
  ide: Set BSY bit during FLUSH
  ide-test: Add enum value for DEV
  blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events
  Make qemu-io commands available in HMP
  qemu-io: Use the qemu version for -V
  qemu-io: Interface cleanup
  qemu-io: Move remaining helpers from cmd.c
  qemu-io: Move command_loop() and friends
  qemu-io: Move functions for registering and running commands
  qemu-io: Move qemu_strsep() to cutils.c
  qemu-io: Move 'quit' function
  qemu-io: Move 'help' function
  qemu-io: Factor out qemuio_command
  qemu-io: Split off commands to qemu-io-cmds.c
  ...

Message-id: 1370606325-10680-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging
Anthony Liguori [Fri, 7 Jun 2013 13:40:24 +0000 (08:40 -0500)]
Merge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging

# By Cornelia Huck
# Via Cornelia Huck
* cohuck/virtio-ccw-upstr:
  virtio-ccw: Fix unsetting of indicators.
  s390x/css: Fix concurrent sense.

Message-id: 1370592676-22532-1-git-send-email-cornelia.huck@de.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agohmp: add parameters device and -v for info block
Wenchao Xia [Thu, 6 Jun 2013 04:28:01 +0000 (12:28 +0800)]
hmp: add parameters device and -v for info block

With these parameters, user can choose the information to be showed,
to avoid message flood in the monitor.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agohmp: show ImageInfo in 'info block'
Wenchao Xia [Thu, 6 Jun 2013 04:28:00 +0000 (12:28 +0800)]
hmp: show ImageInfo in 'info block'

Now human monitor can show image details, include internal
snapshot and backing chain info for every block device.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqmp: add ImageInfo in BlockDeviceInfo used by query-block
Wenchao Xia [Thu, 6 Jun 2013 04:27:59 +0000 (12:27 +0800)]
qmp: add ImageInfo in BlockDeviceInfo used by query-block

Now image info will be retrieved as an embbed json object inside
BlockDeviceInfo, backing chain info and all related internal snapshot
info can be got in the enhanced recursive structure of ImageInfo. New
recursive member *backing-image is added to reflect the backing chain
status.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add image info query function bdrv_query_image_info()
Wenchao Xia [Thu, 6 Jun 2013 04:27:58 +0000 (12:27 +0800)]
block: add image info query function bdrv_query_image_info()

This patch adds function bdrv_query_image_info(), which will
retrieve image info in qmp object format. The implementation is
based on the code moved from qemu-img.c, but uses block layer
function to get snapshot info.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add snapshot info query function bdrv_query_snapshot_info_list()
Wenchao Xia [Thu, 6 Jun 2013 04:27:57 +0000 (12:27 +0800)]
block: add snapshot info query function bdrv_query_snapshot_info_list()

This patch adds function bdrv_query_snapshot_info_list(), which will
retrieve snapshot info of an image in qmp object format. The implementation
is based on the code moved from qemu-img.c with modification to fit more
for qmp based block layer API.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide-test: Add FLUSH CACHE test case
Kevin Wolf [Wed, 5 Jun 2013 13:17:58 +0000 (15:17 +0200)]
ide-test: Add FLUSH CACHE test case

This checks in particular that BSY is set while the flush request is in
flight.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Set BSY bit during FLUSH
Andreas Färber [Wed, 5 Jun 2013 13:17:57 +0000 (15:17 +0200)]
ide: Set BSY bit during FLUSH

The implementation of the ATA FLUSH command invokes a flush at the block
layer, which may on raw files on POSIX entail a synchronous fdatasync().
This may in some cases take so long that the SLES 11 SP1 guest driver
reports I/O errors and filesystems get corrupted or remounted read-only.

Avoid this by setting BUSY_STAT, so that the guest is made aware we are
in the middle of an operation and no ATA commands are attempted to be
processed concurrently.

Addresses BNC#637297.

Suggested-by: Gonglei (Arei) <arei.gonglei@huawei.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide-test: Add enum value for DEV
Kevin Wolf [Wed, 5 Jun 2013 13:17:56 +0000 (15:17 +0200)]
ide-test: Add enum value for DEV

Get rid of the magic number.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events
Kevin Wolf [Wed, 5 Jun 2013 13:17:55 +0000 (15:17 +0200)]
blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMake qemu-io commands available in HMP
Kevin Wolf [Wed, 5 Jun 2013 12:19:41 +0000 (14:19 +0200)]
Make qemu-io commands available in HMP

It was decided to not make this command available in QMP in order to
make clear that this is not supposed to be a stable API and should be
used only for testing and debugging purposes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Use the qemu version for -V
Kevin Wolf [Wed, 5 Jun 2013 12:19:40 +0000 (14:19 +0200)]
qemu-io: Use the qemu version for -V

Always printing 0.0.1 and never updating the version number wasn't very
useful. qemu-io is released with qemu, so using the same version number
makes most sense.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Interface cleanup
Kevin Wolf [Wed, 5 Jun 2013 12:19:39 +0000 (14:19 +0200)]
qemu-io: Interface cleanup

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Move remaining helpers from cmd.c
Kevin Wolf [Wed, 5 Jun 2013 12:19:38 +0000 (14:19 +0200)]
qemu-io: Move remaining helpers from cmd.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Move command_loop() and friends
Kevin Wolf [Wed, 5 Jun 2013 12:19:37 +0000 (14:19 +0200)]
qemu-io: Move command_loop() and friends

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Move functions for registering and running commands
Kevin Wolf [Wed, 5 Jun 2013 12:19:36 +0000 (14:19 +0200)]
qemu-io: Move functions for registering and running commands

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Move qemu_strsep() to cutils.c
Kevin Wolf [Wed, 5 Jun 2013 12:19:35 +0000 (14:19 +0200)]
qemu-io: Move qemu_strsep() to cutils.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Move 'quit' function
Kevin Wolf [Wed, 5 Jun 2013 12:19:34 +0000 (14:19 +0200)]
qemu-io: Move 'quit' function

This one only makes sense in the context of the qemu-io tool, so move it
to qemu-io.c. Adapt coding style and register it like other commands.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Move 'help' function
Kevin Wolf [Wed, 5 Jun 2013 12:19:33 +0000 (14:19 +0200)]
qemu-io: Move 'help' function

No reason to treat it different from other commands. Move it to
qemu-io-cmds.c, adapt the coding style and register it like any other
command.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Factor out qemuio_command
Kevin Wolf [Wed, 5 Jun 2013 12:19:32 +0000 (14:19 +0200)]
qemu-io: Factor out qemuio_command

It's duplicated code. Move it to qemu-io-cmds.c because it's not
dependent on any static data of the qemu-io tool.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Split off commands to qemu-io-cmds.c
Kevin Wolf [Wed, 5 Jun 2013 12:19:31 +0000 (14:19 +0200)]
qemu-io: Split off commands to qemu-io-cmds.c

This is the implementation of all qemu-io commands that make sense to be
called from the qemu monitor, i.e. everything except open, close and
quit.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Don't use global bs in command implementations
Kevin Wolf [Wed, 5 Jun 2013 12:19:30 +0000 (14:19 +0200)]
qemu-io: Don't use global bs in command implementations

Pass in the BlockDriverState to the command handlers instead of using
the global variable. This is an important step to make the commands
usable outside of qemu-io.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Handle cvtnum() errors in 'alloc'
Kevin Wolf [Wed, 5 Jun 2013 12:19:29 +0000 (14:19 +0200)]
qemu-io: Handle cvtnum() errors in 'alloc'

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Make cvtnum() a wrapper around strtosz_suffix()
Kevin Wolf [Wed, 5 Jun 2013 12:19:28 +0000 (14:19 +0200)]
qemu-io: Make cvtnum() a wrapper around strtosz_suffix()

No reason to implement the same thing multiple times. A nice side effect
is that fractional numbers like 0.5M can be used in qemu-io now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agocutils: Support 'P' and 'E' suffixes in strtosz()
Kevin Wolf [Wed, 5 Jun 2013 12:19:27 +0000 (14:19 +0200)]
cutils: Support 'P' and 'E' suffixes in strtosz()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Remove unused args_command
Kevin Wolf [Wed, 5 Jun 2013 12:19:26 +0000 (14:19 +0200)]
qemu-io: Remove unused args_command

The original intention seems to be something with handling multiple
images at once, but this has never been implemented and the only
function ever registered is implemented to make everything behave like a
"global" command. Just do that unconditionally now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agovirtio-ccw: Fix unsetting of indicators.
Cornelia Huck [Wed, 5 Jun 2013 15:13:05 +0000 (17:13 +0200)]
virtio-ccw: Fix unsetting of indicators.

Interpretation of the ccws to register (configuration) indicators contained
a thinko: We want to disallow reading from 0, but setting the indicator
pointer to 0 is fine.

Let's fix the handling for CCW_CMD_SET{,_CONF}_IND.

Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x/css: Fix concurrent sense.
Cornelia Huck [Wed, 5 Jun 2013 14:54:05 +0000 (16:54 +0200)]
s390x/css: Fix concurrent sense.

Fix an off-by-one error when indicating availablity of concurrent
sense data.

Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agoblockdev: reset werror/rerror on drive_del
Stefan Hajnoczi [Wed, 5 Jun 2013 08:33:14 +0000 (10:33 +0200)]
blockdev: reset werror/rerror on drive_del

Paolo Bonzini <pbonzini@redhat.com> suggested the following test case:

1. Launch a guest and wait at the GRUB boot menu:

  qemu-system-x86_64 -enable-kvm -m 1024 \
   -drive if=none,cache=none,file=test.img,id=foo,werror=stop,rerror=stop
   -device virtio-blk-pci,drive=foo,id=virtio0,addr=4

2. Hot unplug the device:

  (qemu) drive_del foo

3. Select the first boot menu entry

Without this patch the guest pauses due to ENOMEDIUM.  The guest is
stuck in a continuous pause loop since the I/O request is retried and
fails immediately again when the guest is resumed.

With this patch the error is reported to the guest.

Note that this scenario actually happens sometimes during libvirt disk
hot unplug, where device_del is followed by drive_del.  I/O may still be
submitted to the drive after drive_del if the guest does not process the
PCI hot unplug notification.

Reported-by: Dafna Ron <dron@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
10 years agovmxnet3: fix NICState cleanup
Stefan Hajnoczi [Tue, 4 Jun 2013 12:47:26 +0000 (14:47 +0200)]
vmxnet3: fix NICState cleanup

Use qemu_del_nic() instead of qemu_del_net_client() to correctly free
the entire NICState.

Cc: qemu-stable@nongnu.org
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMerge remote-tracking branch 'sstabellini/xen_fixes_20130603' into staging
Anthony Liguori [Tue, 4 Jun 2013 19:58:58 +0000 (14:58 -0500)]
Merge remote-tracking branch 'sstabellini/xen_fixes_20130603' into staging

* sstabellini/xen_fixes_20130603:
  xen: use pc_init_pci instead of pc_init_pci_no_kvmclock
  xen: remove xen_vcpu_init
  xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional)
  xen_machine_pv: do not create a dummy CPU in machine->init
  main_loop: do not set nonblocking if xen_enabled()
  xen: simplify xen_enabled

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Tue, 4 Jun 2013 14:26:49 +0000 (09:26 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Stefan Hajnoczi (6) and others
# Via Kevin Wolf
* kwolf/for-anthony:
  block: dump snapshot and image info to specified output
  block: move qmp and info dump related code to block/qapi.c
  block: move snapshot code in block.c to block/snapshot.c
  block: drop bs_snapshots global variable
  qemu-iotests: make create_image() common
  qemu-iotests: make compare_images() common
  qemu-iotests: make cancel_and_wait() common
  qemu-iotests: make assert_no_active_block_jobs() common
  block: add block driver read only whitelist
  qemu-iotests: fix 054 cluster size help output

Message-id: 1370349940-4703-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Tue, 4 Jun 2013 14:26:29 +0000 (09:26 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

pci: misc cleanups

This includes some pci-related cleanups,
and fw cfg cleanups which will be useful for on-going
pci related work.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Sun 02 Jun 2013 02:46:52 PM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Michael S. Tsirkin (8) and Laszlo Ersek (1)
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  pvpanic: use FWCfgState explicitly
  fw_cfg: fw_cfg is a singleton
  fw_cfg: add API to find FW cfg object
  fw_cfg: move typedef to qemu/typedefs.h
  refer to FWCfgState explicitly
  apic: rename apic specific bitopts
  firmware_abi: move to include/hw/nvram/
  dec.c - move to pci-bridge
  q35: set fw_name

Message-id: 1370202787-3712-1-git-send-email-mst@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoblock: dump snapshot and image info to specified output
Wenchao Xia [Sat, 25 May 2013 03:09:45 +0000 (11:09 +0800)]
block: dump snapshot and image info to specified output

bdrv_snapshot_dump() and bdrv_image_info_dump() do not dump to a buffer now,
some internal buffers are still used for format control, which have no
chance to be truncated. As a result, these two functions have no more issue
of truncation, and they can be used by both qemu and qemu-img with correct
parameter specified.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: move qmp and info dump related code to block/qapi.c
Wenchao Xia [Sat, 25 May 2013 03:09:44 +0000 (11:09 +0800)]
block: move qmp and info dump related code to block/qapi.c

This patch is a pure code move patch, except following modification:
1 get_human_readable_size() is changed to static function.
2 dump_human_image_info() is renamed to bdrv_image_info_dump().
3 in qmp_query_block() and qmp_query_blockstats, use bdrv_next(bs)
instead of direct traverse of global array 'bdrv_states'.
4 collect_snapshots() and collect_image_info() are renamed, unused parameter
*fmt in collect_image_info() is removed.
5 code style fix.

To avoid conflict and tip better, macro in header file is BLOCK_QAPI_H
instead of QAPI_H. Now block.h and snapshot.h are at the same level in
include path, block_int.h and qapi.h will both include them.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: move snapshot code in block.c to block/snapshot.c
Wenchao Xia [Sat, 25 May 2013 03:09:43 +0000 (11:09 +0800)]
block: move snapshot code in block.c to block/snapshot.c

All snapshot related code, except bdrv_snapshot_dump() and
bdrv_is_snapshot(), is moved to block/snapshot.c. bdrv_snapshot_dump()
will be moved to another file later. bdrv_is_snapshot() is not related
with internal snapshot. It also fixes small code style errors reported
by check script.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: drop bs_snapshots global variable
Stefan Hajnoczi [Sat, 25 May 2013 03:09:42 +0000 (11:09 +0800)]
block: drop bs_snapshots global variable

The bs_snapshots global variable points to the BlockDriverState which
will be used to save vmstate.  This is really a savevm.c concept but was
moved into block.c:bdrv_snapshots() when it became clear that hotplug
could result in a dangling pointer.

While auditing the block layer's global state I came upon bs_snapshots
and realized that a variable is not necessary here.  Simply find the
first BlockDriverState capable of internal snapshots each time this is
needed.

The behavior of bdrv_snapshots() is preserved across hotplug because new
drives are always appended to the bdrv_states list.  This means that
calling the new find_vmstate_bs() function is idempotent - it returns
the same BlockDriverState unless it was hot-unplugged.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: make create_image() common
Stefan Hajnoczi [Tue, 28 May 2013 15:11:37 +0000 (17:11 +0200)]
qemu-iotests: make create_image() common

Both 030 and 041 use create_image().  Move it to iotests.py.

Also drop ImageStreamingTestCase since the class now has no methods.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: make compare_images() common
Stefan Hajnoczi [Tue, 28 May 2013 15:11:36 +0000 (17:11 +0200)]
qemu-iotests: make compare_images() common

The iotests.compare_images() function returns True if two image files
have the identical data.  Previously this was implemented by converting
images to raw and then comparing their contents using Python.  Since
"qemu-img compare" is now available and is more efficient, switch to it.

This function will be reused by the 'drive-backup' test case.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: make cancel_and_wait() common
Stefan Hajnoczi [Tue, 28 May 2013 15:11:35 +0000 (17:11 +0200)]
qemu-iotests: make cancel_and_wait() common

The cancel_and_wait() function has been duplicated in 030 and 041.  Move
it into iotests.py and let it return the event so tests can perform
additional asserts.

Note that 041's cancel_and_wait(wait_ready=True) is replaced by
wait_ready_and_cancel(), which uses the new wait_ready() and
cancel_and_wait() underneath.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: make assert_no_active_block_jobs() common
Stefan Hajnoczi [Tue, 28 May 2013 15:11:34 +0000 (17:11 +0200)]
qemu-iotests: make assert_no_active_block_jobs() common

Tests 030 and 041 both use query-block-jobs to check whether any block
jobs are active.  Make this code common so that 'drive-backup' and other
new feature tests will be able to reuse it.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: add block driver read only whitelist
Fam Zheng [Wed, 29 May 2013 11:35:40 +0000 (19:35 +0800)]
block: add block driver read only whitelist

We may want to include a driver in the whitelist for read only tasks
such as diagnosing or exporting guest data (with libguestfs as a good
example). This patch introduces a readonly whitelist option, and for
backward compatibility, the old configure option --block-drv-whitelist
is now an alias to rw whitelist.

Drivers in readonly list is only permitted to open file readonly, and
returns -ENOTSUP for RW opening.

E.g. To include vmdk readonly, and others read+write:
    ./configure --target-list=x86_64-softmmu \
                --block-drv-rw-whitelist=qcow2,raw,file,qed \
                --block-drv-ro-whitelist=vmdk

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: fix 054 cluster size help output
Stefan Hajnoczi [Tue, 28 May 2013 09:19:51 +0000 (11:19 +0200)]
qemu-iotests: fix 054 cluster size help output

Commit f3f4d2c09b9cf46903ba38425ec46c44185162bd added a hint to increase
the cluster size when a large image cannot be created.  Test 054 now has
outdated output and fails because the golden output does not match.

This patch updates the 054 golden output.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agogtk: don't use g_object_unref on GdkCursor
Anthony Liguori [Mon, 3 Jun 2013 20:37:23 +0000 (15:37 -0500)]
gtk: don't use g_object_unref on GdkCursor

It's not a GObject.

Cc: Gerd Hoffman <kraxel@redhat.com>
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - Fix summary to agree with code (Peter)

10 years agogtk: don't resize window when enabling scaling
Anthony Liguori [Mon, 3 Jun 2013 20:36:51 +0000 (15:36 -0500)]
gtk: don't resize window when enabling scaling

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agofix double free the memslot in kvm_set_phys_mem
Xiao Guangrong [Fri, 31 May 2013 08:52:18 +0000 (16:52 +0800)]
fix double free the memslot in kvm_set_phys_mem

Luiz Capitulino reported that guest refused to boot and qemu
complained with:
kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument

It is caused by commit 235e8982ad that did double free for the memslot
so that the second one raises the -EINVAL error

Fix it by reset memory size only if it is needed

Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoconfigure: Report unknown target names more helpfully
Peter Maydell [Mon, 20 May 2013 15:16:16 +0000 (16:16 +0100)]
configure: Report unknown target names more helpfully

If the user specifies a target list themselves, check each entry
to make sure it's a target we recognise. This allows us to print
a helpful error message, rather than falling through (where we
would probably eventually end up hitting the uninformative
"ERROR: Unsupported target CPU").

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1369062976-301-3-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoconfigure: Autogenerate default target list
Peter Maydell [Mon, 20 May 2013 15:16:15 +0000 (16:16 +0100)]
configure: Autogenerate default target list

Autogenerate the default target list based on what files exist
in default-configs; this allows us to remove one of the places
that has to be kept up to date with a complete list of every
target we support.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1369062976-301-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'pmaydell/arm-devs.next' into staging
Anthony Liguori [Mon, 3 Jun 2013 18:24:25 +0000 (13:24 -0500)]
Merge remote-tracking branch 'pmaydell/arm-devs.next' into staging

# By Peter Crosthwaite (20) and others
# Via Peter Maydell
* pmaydell/arm-devs.next: (24 commits)
  i.MX: Improve EPIT timer code.
  exynos4210.c: register rom_mem for memory migration
  hw/arm/exynos4210.c: convert chipid_and_omr to an mmio region
  i.MX: split GPT and EPIT timer implementation
  sd/sd.c: Fix "inquiry" ACMD41
  sd/sdhci:ADMA: fix interrupt
  sd/sdhci.c: Fix bdata_read DPRINT message
  sd/sdhci: Fix Buffer Write Ready interrupt
  sd/sdhci.c: Only reset data_count on new commands
  xilinx_spips: lqspi: Fix byte/misaligned access
  xilinx_spips: lqspi: Push more data to tx-fifo
  xilinx_spips: Multiple debug verbosity levels
  xilinx_spips: Debug msgs for Snoop state
  xilinx_spips: Fix striping behaviour
  xilinx_spips: Fix CTRL register RW bits
  xilinx_spips: lqspi: Dont touch config register
  xilinx_spips: Implement automatic CS
  xilinx_spips: Add automatic start support
  xilinx_spips: Trash LQ page cache on mode change
  xilinx_spips: Fix QSPI FIFO size
  ...

Message-id: 1370277021-26129-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoi.MX: Improve EPIT timer code.
Jean-Christophe DUBOIS [Mon, 3 Jun 2013 16:17:46 +0000 (17:17 +0100)]
i.MX: Improve EPIT timer code.

* Unify function and type naming
* use dynamic cast whenever possible
* simplify Debug printf.
* use new style device intialization.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Reviewed-by: Peter Chubb <peter.chubb@nicta.com.au>
Message-id: 1369839656-24466-1-git-send-email-jcd@tribudubois.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoexynos4210.c: register rom_mem for memory migration
Igor Mitsyanko [Mon, 3 Jun 2013 16:17:46 +0000 (17:17 +0100)]
exynos4210.c: register rom_mem for memory migration

Even if we do not register newly created RAM MemoryRegion for migration with
vmstate_register_ram_global() function, ram_save_setup() still saves this region
to snapshot file with empty idstr=="". Consequently this results in error during
VM loading in ram_load().
Register rom_mem for migration.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Message-id: 1368199981-45292-3-git-send-email-i.mitsyanko@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agohw/arm/exynos4210.c: convert chipid_and_omr to an mmio region
Igor Mitsyanko [Mon, 3 Jun 2013 16:17:46 +0000 (17:17 +0100)]
hw/arm/exynos4210.c: convert chipid_and_omr to an mmio region

Exynos SoC was misusing memory_region_init_ram_ptr(): this interface can safely
be used only for memory regions which size is a multiple of target page size.
Change chipid_and_omr memory to an mmio region to fix this.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Message-id: 1368199981-45292-2-git-send-email-i.mitsyanko@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoi.MX: split GPT and EPIT timer implementation
Jean-Christophe DUBOIS [Mon, 3 Jun 2013 16:17:45 +0000 (17:17 +0100)]
i.MX: split GPT and EPIT timer implementation

There is no common code between these 2 timer implementation.
So it is better to split them.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Message-id: 1368990197-19694-1-git-send-email-jcd@tribudubois.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agosd/sd.c: Fix "inquiry" ACMD41
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:45 +0000 (17:17 +0100)]
sd/sd.c: Fix "inquiry" ACMD41

QEMU models two (of the three) ACMD41 has two modes, "inquiry" and
"first". The selection logic for which of the two is incorrect - it
compares != 0 for the entire argument value rather than only bits 23:0
as per the spec. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 3ef0a7fd1b2f3ebb23b4fdeabcc14caf3fad6d71.1369622254.git.peter.crosthwaite@xilinx.com
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agosd/sdhci:ADMA: fix interrupt
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:45 +0000 (17:17 +0100)]
sd/sdhci:ADMA: fix interrupt

The end of transfer check was occurring and potentially returning before
the interrupt flag was checked. This means the interrupt will be missed
if it occurs on the last packet. Fix by checking for the interrupt
before checking for the end of transfer.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 9969ec154777957ec738fc4e539d68e7494d0081.1369370934.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agosd/sdhci.c: Fix bdata_read DPRINT message
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:45 +0000 (17:17 +0100)]
sd/sdhci.c: Fix bdata_read DPRINT message

This message was printing out the data in decimal only, which is not
very friendly to the debugging developer. Add hex variant in
parenthesis to make it consistent with other similar messages in this
module.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: d624179649137832eaa8caa263ef9589b4395d5e.1369370934.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agosd/sdhci: Fix Buffer Write Ready interrupt
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:44 +0000 (17:17 +0100)]
sd/sdhci: Fix Buffer Write Ready interrupt

This interrupt is not risen after the last block is written to sd. It
is mutually exclusive with the end of transfer conditions. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 7ca9fd3e03ce1bec94aff08f607c15a0ec3d3371.1369370934.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agosd/sdhci.c: Only reset data_count on new commands
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:44 +0000 (17:17 +0100)]
sd/sdhci.c: Only reset data_count on new commands

The data_count variable was being reset on every transfer, including
DMA transfer resumptions. This is incorrect, it should only be set
on a new command.

Manifests as a bug when using ADMA and there is a timer delay between
ADMA frames where the fifo is left in a non empty state.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 15a98609cc32315211b0963091a8efd67522e160.1369370934.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoxilinx_spips: lqspi: Fix byte/misaligned access
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:44 +0000 (17:17 +0100)]
xilinx_spips: lqspi: Fix byte/misaligned access

The LQSPI bus attachment supports byte/halfword and misaligned
accesses. Fixed. Refactored the LQSPI cache to be byte-wise
instead of word wise accordingly.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 5ec47b13563ad2d22105a1f26186d7756718394b.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoxilinx_spips: lqspi: Push more data to tx-fifo
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:44 +0000 (17:17 +0100)]
xilinx_spips: lqspi: Push more data to tx-fifo

Do 16 words per fifo flush. Increases performance and decreases
debug verbosity. This data depth has no real hardware analogue,
so just go with something that has reasonable performance.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 5621ee4621941d3639b5cacfdec26bd3148f31d5.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoxilinx_spips: Multiple debug verbosity levels
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:43 +0000 (17:17 +0100)]
xilinx_spips: Multiple debug verbosity levels

The debug printfs on every SPI operation is extremely verbose. Add
a second level of debug for this.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: f63478b8e5b29cc011cdc10e29f8537bb2fc2b5e.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoxilinx_spips: Debug msgs for Snoop state
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:43 +0000 (17:17 +0100)]
xilinx_spips: Debug msgs for Snoop state

This is worth keeping track of when debugging the device model.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: d3b44ecf23d671798b062eee5dc362c716ea54cd.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoxilinx_spips: Fix striping behaviour
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:43 +0000 (17:17 +0100)]
xilinx_spips: Fix striping behaviour

The QSPI controller was using byte-wide stripes when striping across
the two flashes in dual parallel mode. The real hardware however uses
individual bit striping. QEMU misbehaves in the (corner) case where
data is written/read in dual-parallel mode and read/written back in
single mode.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 718a61df1bf746ec06f6da44d12f8317af7b08ce.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoxilinx_spips: Fix CTRL register RW bits
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:43 +0000 (17:17 +0100)]
xilinx_spips: Fix CTRL register RW bits

The CTRL register was RAZ/WI on some of the RW bits. Even though the
function behind these bits is invalid in QEMU, they should still be
guest accessible. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: b7aaad93163ce4af0c428635804ac7b77a567b25.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>