sdk/emulator/qemu.git
10 years agoMerge remote-tracking branch 'kwolf/tags/for-anthony' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:59:58 +0000 (12:59 -0800)]
Merge remote-tracking branch 'kwolf/tags/for-anthony' into staging

Block patches for 2.0 (flushing block-next)

# gpg: Signature made Fri 29 Nov 2013 08:43:18 AM PST using RSA key ID C88F2FD6
# gpg: Can't check signature: public key not found

# By Peter Lieven (17) and others
# Via Kevin Wolf
* kwolf/tags/for-anthony: (41 commits)
  qemu-iotests: Add sample image and test for VMDK version 3
  vmdk: Allow read only open of VMDK version 3
  qemu-iotests: Filter out 'qemu-io> ' prompt
  qemu-iotests: Filter qemu-io output in 025
  block: Use BDRV_O_NO_BACKING where appropriate
  qemu-iotests: Test snapshot mode
  block: Enable BDRV_O_SNAPSHOT with driver-specific options
  qemu-iotests: Make test case 030, 040 and 055 deterministic
  qemu-iotest: Add pause_drive and resume_drive methods
  blkdebug: add "remove_break" command
  qemu-iotests: Drop local version of cancel_and_wait from 040
  sheepdog: support user-defined redundancy option
  sheepdog: refactor do_sd_create()
  qdict: Optimise qdict_do_flatten()
  qdict: Fix memory leak in qdict_do_flatten()
  MAINTAINERS: add sheepdog development mailing list
  COW: Extend checking allocated bits to beyond one sector
  COW: Speed up writes
  qapi: Change BlockDirtyInfo to list
  block: per caller dirty bitmap
  ...

Message-id: 1385743555-27888-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'sstabellini/xen-2013-12-01' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:58:28 +0000 (12:58 -0800)]
Merge remote-tracking branch 'sstabellini/xen-2013-12-01' into staging

# By Paul Durrant (1) and Wei Liu (1)
# Via Stefano Stabellini
* sstabellini/xen-2013-12-01:
  xen-pvdevice: make device-id property compulsory
  xen: fix two errors when debug is enabled

Message-id: alpine.DEB.2.02.1312011829000.3198@kaball.uk.xensource.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'rth/auxv-2' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:57:21 +0000 (12:57 -0800)]
Merge remote-tracking branch 'rth/auxv-2' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/auxv-2:
  linux-user: Use qemu_getauxval for AT_EXECFD
  util: Use qemu_getauxval in linux qemu_cache_utils_init
  tcg-s390: Use qemu_getauxval in query_facilities
  tcg-arm: Use qemu_getauxval
  tcg-ppc64: Use qemu_getauxval
  osdep: Create qemu_getauxval and qemu_init_auxval

Message-id: 1385757754-10702-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:56:51 +0000 (12:56 -0800)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

# By Erik de Castro Lopo (2) and others
# Via Riku Voipio
* riku/linux-user-for-upstream:
  linux-user: pass correct parameter to do_shmctl()
  linux-user: create target_structs header to place ipc_perm and shmid_ds
  flatload: fix non-GOT relocations
  linux-user: Implement handling of 5 POSIX timer syscalls.
  linux-user: Add target struct defs needed for POSIX timer syscalls.

Message-id: cover.1385732338.git.riku.voipio@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'kraxel/tags/pull-usb-1' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:54:35 +0000 (12:54 -0800)]
Merge remote-tracking branch 'kraxel/tags/pull-usb-1' into staging

Improvements for usb3 bulk stream (usb core, xhci).
Bugfixes for uas emulation.
Add remote wakeup support for ehci.
Add suspend support for xhci.
Misc minor tweaks and fixes.

# gpg: Signature made Thu 28 Nov 2013 11:44:49 PM PST using RSA key ID D3E87138
# gpg: Can't check signature: public key not found

# By Hans de Goede (11) and others
# Via Gerd Hoffmann
* kraxel/tags/pull-usb-1:
  usb: move usb_{hi,lo} helpers to header file.
  usb: add vendor request defines
  trace-events: Clean up after removal of old usb-host code
  Revert "usb-tablet: Don't claim wakeup capability for USB-2 version"
  ehci: implement port wakeup
  xhci: Call usb_device_alloc/free_streams
  usb: Add usb_device_alloc/free_streams
  usb: Add max_streams attribute to endpoint info
  uas: s/ui/iu/
  uas: Fix response iu struct definition
  uas: Bounds check tags when using streams
  uas: Streams are numbered 1-y, rather then 0-x
  uas: Fix / cleanup usb_uas_task error handling
  uas: Only use report iu-s for task_mgmt status reporting
  scsi: Add 2 new sense codes needed by uas
  xhci: add support for suspend/resume
  xhci: Add a few missing checks for disconnected devices

Message-id: 1385712381-30918-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:52:50 +0000 (12:52 -0800)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

# By Stefan Weil (9) and others
# Via Michael Tokarev
* mjt/trivial-patches:
  eeprom93xx: fix coding style
  hw/ppc/mac.h: remove unused BIOS_FILENAME definition
  Don't crash on keyboard input with no handler
  libcacard/vcard_emul_nss: Remove unused statement (value stored is never read)
  libcacard/cac: Remove unused statement (value stored is never read)
  virtio-net: fix the indent
  misc: Replace 'struct QEMUTimer' by 'QEMUTimer'
  qobject: Fix compiler warning (missing gnu_printf format attribute)
  acpi-build: Fix compiler warning (missing gnu_printf format attribute)
  .gitignore: Ignore config.status
  gtk: Replace conditional debug messages by trace methods
  console: Replace conditional debug messages by trace methods
  trace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)
  trace: Remove trace.h from console.h (less dependencies)

Message-id: 1385408466-13183-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoeeprom93xx: fix coding style
Antony Pavlov [Wed, 4 Dec 2013 06:27:29 +0000 (10:27 +0400)]
eeprom93xx: fix coding style

scripts/checkpatch.pl reports about some style problems,
this commit fixes some of them:

ERROR: space prohibited before open square bracket '['
+    .fields      = (VMStateField []) {

ERROR: space prohibited after that '!' (ctx:BxW)
+    if (! eeprom->eecs && eecs) {
         ^

ERROR: space prohibited after that '!' (ctx:WxW)
+    } else if (eeprom->eecs && ! eecs) {
                                ^

ERROR: space prohibited after that '!' (ctx:WxW)
+    } else if (eecs && ! eeprom->eesk && eesk) {
                        ^

ERROR: switch and case should be at the same indent
                     switch (address >> (eeprom->addrbits - 2)) {
+                        case 0:
[...]
+                        case 1:
[...]
+                        case 2:
[...]
+                        case 3:

ERROR: return is not a function, parentheses are not required
+    return (eeprom->eedo);

ERROR: switch and case should be at the same indent
     switch (nwords) {
+        case 16:
+        case 64:
[...]
+        case 128:
+        case 256:
[...]
+        default:

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Cc: qemu-trivial@nongnu.org
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agohw/ppc/mac.h: remove unused BIOS_FILENAME definition
Michael Tokarev [Mon, 2 Dec 2013 17:17:19 +0000 (21:17 +0400)]
hw/ppc/mac.h: remove unused BIOS_FILENAME definition

This definition has been moved to prep.c.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoDon't crash on keyboard input with no handler
Don Koch [Tue, 19 Nov 2013 20:01:59 +0000 (15:01 -0500)]
Don't crash on keyboard input with no handler

Prevent a call to put_kbd if null.

On shutdown of some OSes, the keyboard handler goes away before the
system is down. If a key is typed during this window, qemu crashes.

Signed-off-by: Don Koch <dkoch@verizon.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard/vcard_emul_nss: Remove unused statement (value stored is never read)
Stefan Weil [Sun, 17 Nov 2013 21:12:18 +0000 (22:12 +0100)]
libcacard/vcard_emul_nss: Remove unused statement (value stored is never read)

Warning from ccc-analyzer:

libcacard/vcard_emul_nss.c:937:9: warning:
 Value stored to 'cert_count' is never read
        cert_count = options->vreader[i].cert_count;
        ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard/cac: Remove unused statement (value stored is never read)
Stefan Weil [Sun, 17 Nov 2013 21:11:23 +0000 (22:11 +0100)]
libcacard/cac: Remove unused statement (value stored is never read)

Warning from ccc-analyzer:

libcacard/cac.c:192:13: warning: Value stored to 'ret' is never read
            ret = VCARD_DONE;
            ^     ~~~~~~~~~~

Here 'ret' is assigned a value inside of a switch statement and also after
that switch statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovirtio-net: fix the indent
Zhi Yong Wu [Wed, 27 Nov 2013 07:35:26 +0000 (15:35 +0800)]
virtio-net: fix the indent

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomisc: Replace 'struct QEMUTimer' by 'QEMUTimer'
Stefan Weil [Sun, 1 Dec 2013 07:49:47 +0000 (08:49 +0100)]
misc: Replace 'struct QEMUTimer' by 'QEMUTimer'

Most code already used QEMUTimer without the redundant 'struct' keyword.

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 agoqobject: Fix compiler warning (missing gnu_printf format attribute)
Stefan Weil [Sun, 17 Nov 2013 18:00:42 +0000 (19:00 +0100)]
qobject: Fix compiler warning (missing gnu_printf format attribute)

gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):

  CC    qobject/qerror.o
qobject/qerror.c: In function ‘qerror_from_info’:
qobject/qerror.c:53:5: error:
 function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
     qerr->err_msg = g_strdup_vprintf(fmt, *va);
     ^

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoacpi-build: Fix compiler warning (missing gnu_printf format attribute)
Stefan Weil [Sun, 17 Nov 2013 18:00:22 +0000 (19:00 +0100)]
acpi-build: Fix compiler warning (missing gnu_printf format attribute)

gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):

  CC    m68k-softmmu/hw/m68k/mcf5206.o
hw/i386/acpi-build.c: In function ‘build_append_nameseg’:
hw/i386/acpi-build.c:294:5: error:
 function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
     g_string_vprintf(s, format, args);
     ^

When this warning is fixed, there is a new compiler warning:

  CC    i386-softmmu/hw/i386/acpi-build.o
hw/i386/acpi-build.c: In function ‘build_append_notify’:
hw/i386/acpi-build.c:632:5: error:
 format not a string literal and no format arguments [-Werror=format-security]
     build_append_nameseg(method, name);
     ^

This is fixed here, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years ago.gitignore: Ignore config.status
Fam Zheng [Fri, 22 Nov 2013 06:39:56 +0000 (14:39 +0800)]
.gitignore: Ignore config.status

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agogtk: Replace conditional debug messages by trace methods
Stefan Weil [Sun, 10 Nov 2013 15:24:02 +0000 (16:24 +0100)]
gtk: Replace conditional debug messages by trace methods

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconsole: Replace conditional debug messages by trace methods
Stefan Weil [Sun, 10 Nov 2013 15:04:16 +0000 (16:04 +0100)]
console: Replace conditional debug messages by trace methods

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotrace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)
Stefan Weil [Sun, 10 Nov 2013 13:20:17 +0000 (14:20 +0100)]
trace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)

This reduces the dependencies on trace.h.
Only one source file which needs hcd-ehci.h also needs trace.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotrace: Remove trace.h from console.h (less dependencies)
Stefan Weil [Sun, 10 Nov 2013 13:20:16 +0000 (14:20 +0100)]
trace: Remove trace.h from console.h (less dependencies)

This reduces the dependencies on trace.h.
Only two source files which need console.h also need trace.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoxen-pvdevice: make device-id property compulsory
Paul Durrant [Wed, 13 Nov 2013 15:25:07 +0000 (15:25 +0000)]
xen-pvdevice: make device-id property compulsory

The intention of the Xen PV device is that it is used as a parent
device for PV drivers in Xen HVM guests and the set of PV drivers that
bind to the device is determined by its device ID (and possibly
vendor ID and revision). As such, the device should not have a default
device ID, it should always be supplied by the Xen toolstack.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agoxen: fix two errors when debug is enabled
Wei Liu [Mon, 14 Oct 2013 12:53:53 +0000 (13:53 +0100)]
xen: fix two errors when debug is enabled

This patch fixes:
1. build error in xen_pt.c when XEN_PT_LOGGING_ENABLED is defined
2. debug output format string error when DEBUG_XEN is defined

In the second case I also have the output info in consistent with the
output in mapping function - that is, print start_addr instead of
phys_offset.

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agolinux-user: Use qemu_getauxval for AT_EXECFD
Richard Henderson [Tue, 15 Oct 2013 22:00:36 +0000 (15:00 -0700)]
linux-user: Use qemu_getauxval for AT_EXECFD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoutil: Use qemu_getauxval in linux qemu_cache_utils_init
Richard Henderson [Mon, 10 Jun 2013 16:05:09 +0000 (09:05 -0700)]
util: Use qemu_getauxval in linux qemu_cache_utils_init

With this we no longer pass down envp, and thus all systems can have
the same void prototype.  So also eliminate a useless thunk.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-s390: Use qemu_getauxval in query_facilities
Richard Henderson [Fri, 7 Jun 2013 14:43:33 +0000 (07:43 -0700)]
tcg-s390: Use qemu_getauxval in query_facilities

No need to set up a SIGILL signal handler for detection anymore.

Remove a ton of sanity checks that must be true, given that we're
requiring a 64-bit build (the note about 31-bit KVM is satisfied
by configuring with TCI).

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-arm: Use qemu_getauxval
Richard Henderson [Fri, 7 Jun 2013 14:26:20 +0000 (07:26 -0700)]
tcg-arm: Use qemu_getauxval

Allow host detection on linux systems without glibc 2.16 or later.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Use qemu_getauxval
Richard Henderson [Tue, 4 Jun 2013 18:37:17 +0000 (11:37 -0700)]
tcg-ppc64: Use qemu_getauxval

Allow host detection on linux systems without glibc 2.16 or later.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoosdep: Create qemu_getauxval and qemu_init_auxval
Richard Henderson [Tue, 4 Jun 2013 18:24:49 +0000 (11:24 -0700)]
osdep: Create qemu_getauxval and qemu_init_auxval

Abstract away dependence on a system implementation of getauxval.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoqemu-iotests: Add sample image and test for VMDK version 3
Fam Zheng [Thu, 28 Nov 2013 01:48:04 +0000 (09:48 +0800)]
qemu-iotests: Add sample image and test for VMDK version 3

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovmdk: Allow read only open of VMDK version 3
Fam Zheng [Thu, 28 Nov 2013 01:48:03 +0000 (09:48 +0800)]
vmdk: Allow read only open of VMDK version 3

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Filter out 'qemu-io> ' prompt
Fam Zheng [Mon, 18 Nov 2013 07:13:01 +0000 (15:13 +0800)]
qemu-iotests: Filter out 'qemu-io> ' prompt

This removes "qemu-io> " prompt from qemu-io output in _filter_qemu_io,
and updates all the output files with the following command:

 cd tests/qemu-iotests && sed -i "s/qemu-io> //g" *.out

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Filter qemu-io output in 025
Fam Zheng [Mon, 18 Nov 2013 07:10:58 +0000 (15:10 +0800)]
qemu-iotests: Filter qemu-io output in 025

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Use BDRV_O_NO_BACKING where appropriate
Kevin Wolf [Thu, 28 Nov 2013 10:58:02 +0000 (11:58 +0100)]
block: Use BDRV_O_NO_BACKING where appropriate

If you open an image temporarily just because you want to check its size
or get it flushed, there's no real reason to open the whole backing file
chain.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
10 years agoqemu-iotests: Test snapshot mode
Kevin Wolf [Fri, 15 Nov 2013 16:00:41 +0000 (17:00 +0100)]
qemu-iotests: Test snapshot mode

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock: Enable BDRV_O_SNAPSHOT with driver-specific options
Kevin Wolf [Thu, 14 Nov 2013 14:37:12 +0000 (15:37 +0100)]
block: Enable BDRV_O_SNAPSHOT with driver-specific options

In the case of snapshot=on, don't rely on the backing file path in the
temporary image any more, but override the backing file with the given
set of options. This way, block drivers that don't use a file name can
be accessed with snapshot=on, for example:

    -drive file.driver=nbd,file.host=localhost,snapshot=on

Which becomes internally something like:

    file.filename=/tmp/vl.AWQZCu,backing.file.driver=nbd,backing.file.host=localhost

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Make test case 030, 040 and 055 deterministic
Fam Zheng [Wed, 20 Nov 2013 02:01:56 +0000 (10:01 +0800)]
qemu-iotests: Make test case 030, 040 and 055 deterministic

Pause the drive and start the block job, so we won't miss the block job.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotest: Add pause_drive and resume_drive methods
Fam Zheng [Wed, 20 Nov 2013 02:01:55 +0000 (10:01 +0800)]
qemu-iotest: Add pause_drive and resume_drive methods

They wrap blkdebug "break" and "remove_break".

Add optional argument "resume" to cancel_and_wait().

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblkdebug: add "remove_break" command
Fam Zheng [Wed, 20 Nov 2013 02:01:54 +0000 (10:01 +0800)]
blkdebug: add "remove_break" command

This adds "remove_break" command which is the reverse of blkdebug
command "break": it removes all breakpoints with given tag and resumes
all the requests.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Drop local version of cancel_and_wait from 040
Fam Zheng [Wed, 20 Nov 2013 02:01:53 +0000 (10:01 +0800)]
qemu-iotests: Drop local version of cancel_and_wait from 040

iotests.py already has one.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agosheepdog: support user-defined redundancy option
Liu Yuan [Thu, 7 Nov 2013 14:56:38 +0000 (22:56 +0800)]
sheepdog: support user-defined redundancy option

Sheepdog support two kinds of redundancy, full replication and erasure coding.

# create a fully replicated vdi with x copies
 -o redundancy=x (1 <= x <= SD_MAX_COPIES)

# create a erasure coded vdi with x data strips and y parity strips
 -o redundancy=x:y (x must be one of {2,4,8,16} and 1 <= y < SD_EC_MAX_STRIP)

E.g, to convert a vdi into sheepdog vdi 'test' with 8:3 erasure coding scheme

$ qemu-img convert -o redundancy=8:3 linux-0.2.img sheepdog:test

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agosheepdog: refactor do_sd_create()
Liu Yuan [Thu, 7 Nov 2013 14:56:37 +0000 (22:56 +0800)]
sheepdog: refactor do_sd_create()

We can actually use BDRVSheepdogState *s to pass most of the parameters.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqdict: Optimise qdict_do_flatten()
Kevin Wolf [Wed, 20 Nov 2013 12:09:21 +0000 (13:09 +0100)]
qdict: Optimise qdict_do_flatten()

Nested QDicts used to be both entered recursively in order to move their
entries to the target QDict and also be moved themselves to the target
QDict like all other objects. This is harmless because for the top
level, qdict_do_flatten() will encounter the (now empty) QDict for a
second time and then delete it, but at the same time it's obviously
unnecessary overhead. Just delete nested QDicts directly after moving
all of their entries.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqdict: Fix memory leak in qdict_do_flatten()
Kevin Wolf [Wed, 20 Nov 2013 12:09:20 +0000 (13:09 +0100)]
qdict: Fix memory leak in qdict_do_flatten()

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMAINTAINERS: add sheepdog development mailing list
Liu Yuan [Wed, 20 Nov 2013 07:51:59 +0000 (15:51 +0800)]
MAINTAINERS: add sheepdog development mailing list

This will help people find mailing list relevant to sheepdog.

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoCOW: Extend checking allocated bits to beyond one sector
Charlie Shepherd [Fri, 15 Nov 2013 18:47:02 +0000 (19:47 +0100)]
COW: Extend checking allocated bits to beyond one sector

cow_co_is_allocated() only checks one sector's worth of allocated bits
before returning. This is allowed but (slightly) inefficient, so extend
it to check all of the file's metadata sectors.

Signed-off-by: Charlie Shepherd <charlie@ctshepherd.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
[kwolf: silenced compiler warning (-Wmaybe-uninitialized for changed)]
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoCOW: Speed up writes
Charlie Shepherd [Fri, 15 Nov 2013 18:47:01 +0000 (19:47 +0100)]
COW: Speed up writes

Process a whole sector's worth of COW bits by reading a sector, setting
the bits after skipping any already set bits, then writing it out again.
Make sure we only flush once before writing metadata, and only if we
need to write metadata.

Signed-off-by: Charlie Shepherd <charlie@ctshepherd.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqapi: Change BlockDirtyInfo to list
Fam Zheng [Wed, 13 Nov 2013 10:29:44 +0000 (18:29 +0800)]
qapi: Change BlockDirtyInfo to list

We have multiple dirty bitmaps in BDS now, switch QAPI to allow query
it (BlockInfo.dirty_bitmaps), and also drop old BlockInfo.dirty.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: per caller dirty bitmap
Fam Zheng [Wed, 13 Nov 2013 10:29:43 +0000 (18:29 +0800)]
block: per caller dirty bitmap

Previously a BlockDriverState has only one dirty bitmap, so only one
caller (e.g. a block job) can keep track of writing. This changes the
dirty bitmap to a list and creates a BdrvDirtyBitmap for each caller, the
lifecycle is managed with these new functions:

    bdrv_create_dirty_bitmap
    bdrv_release_dirty_bitmap

Where BdrvDirtyBitmap is a linked list wrapper structure of HBitmap.

In place of bdrv_set_dirty_tracking, a BdrvDirtyBitmap pointer argument
is added to these functions, since each caller has its own dirty bitmap:

    bdrv_get_dirty
    bdrv_dirty_iter_init
    bdrv_get_dirty_count

bdrv_set_dirty and bdrv_reset_dirty prototypes are unchanged but will
internally walk the list of all dirty bitmaps and set them one by one.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agolinux-user: pass correct parameter to do_shmctl()
Petar Jovanovic [Wed, 30 Oct 2013 13:46:32 +0000 (14:46 +0100)]
linux-user: pass correct parameter to do_shmctl()

Fix shmctl issue by passing correct parameter buf to do_shmctl().

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: create target_structs header to place ipc_perm and shmid_ds
Petar Jovanovic [Wed, 30 Oct 2013 13:46:31 +0000 (14:46 +0100)]
linux-user: create target_structs header to place ipc_perm and shmid_ds

Creating target_structs header in linux-user/$arch/ and making
target_ipc_perm and target_shmid_ds its first inhabitants.
The struct defintions may/should be further fine-tuned by arch maintainers.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoflatload: fix non-GOT relocations
Corey J. Boyle [Sat, 5 Oct 2013 11:46:31 +0000 (07:46 -0400)]
flatload: fix non-GOT relocations

Use target address rather than host address when performing
non-GOT relocations

Signed-off-by: Corey J. Boyle <corey@kansanian.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Implement handling of 5 POSIX timer syscalls.
Erik de Castro Lopo [Fri, 29 Nov 2013 07:39:23 +0000 (18:39 +1100)]
linux-user: Implement handling of 5 POSIX timer syscalls.

Implement timer_create, timer_settime, timer_gettime, timer_getoverrun
and timer_delete.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Add target struct defs needed for POSIX timer syscalls.
Erik de Castro Lopo [Fri, 29 Nov 2013 07:39:22 +0000 (18:39 +1100)]
linux-user: Add target struct defs needed for POSIX timer syscalls.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agousb: move usb_{hi,lo} helpers to header file.
Gerd Hoffmann [Wed, 20 Nov 2013 06:33:28 +0000 (07:33 +0100)]
usb: move usb_{hi,lo} helpers to header file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb: add vendor request defines
Gerd Hoffmann [Tue, 19 Nov 2013 11:37:58 +0000 (12:37 +0100)]
usb: add vendor request defines

Add defines for vendor specific usb control requests.
Group defines by Device / Interface / Endpoint while
being at it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agotrace-events: Clean up after removal of old usb-host code
Markus Armbruster [Mon, 25 Nov 2013 12:08:18 +0000 (13:08 +0100)]
trace-events: Clean up after removal of old usb-host code

Commit b5613fd neglected to drop the trace events along with the code.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoRevert "usb-tablet: Don't claim wakeup capability for USB-2 version"
Gerd Hoffmann [Wed, 20 Nov 2013 13:32:27 +0000 (14:32 +0100)]
Revert "usb-tablet: Don't claim wakeup capability for USB-2 version"

This reverts commit aa1c9e971e80d25b92908dce3dec7c38b49480ea.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoehci: implement port wakeup
Gerd Hoffmann [Wed, 20 Nov 2013 13:10:19 +0000 (14:10 +0100)]
ehci: implement port wakeup

Update portsc register and raise irq in case a suspended
port is woken up, so remote wakeup works on our ehci ports.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoblock/stream: Don't stream unbacked devices
Max Reitz [Wed, 13 Nov 2013 19:37:58 +0000 (20:37 +0100)]
block/stream: Don't stream unbacked devices

If a block device is unbacked, a streaming blockjob should immediately
finish instead of beginning to try to stream, then noticing the backing
file does not contain even the first sector (since it does not exist)
and then finishing normally.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: implement .bdrv_get_allocated_file_size
Liu Yuan [Wed, 7 Aug 2013 08:59:53 +0000 (16:59 +0800)]
sheepdog: implement .bdrv_get_allocated_file_size

With this patch, qemu-img info sheepdog:image will show disk size for sheepdog
images.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoTest coroutine execution order
Charlie Shepherd [Thu, 8 Aug 2013 02:23:14 +0000 (03:23 +0100)]
Test coroutine execution order

This patch adds a test for coroutine execution order in test-coroutine -
this catches a bug in the CPC coroutine implementation.

Signed-off-by: Charlie Shepherd <charlie@ctshepherd.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoutil/error: Save errno from clobbering
Max Reitz [Thu, 7 Nov 2013 19:10:29 +0000 (20:10 +0100)]
util/error: Save errno from clobbering

There may be calls to error_setg() and especially error_setg_errno()
which blindly (and until now wrongly) assume these functions not to
clobber errno (e.g., they pass errno to error_setg_errno() and return
-errno afterwards). Instead of trying to find and fix all of these
constructs, just make sure error_setg() and error_setg_errno() indeed do
not clobber errno.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-img: conditionally zero out target on convert
Peter Lieven [Thu, 24 Oct 2013 10:07:06 +0000 (12:07 +0200)]
qemu-img: conditionally zero out target on convert

If the target has_zero_init = 0, but supports efficiently
writing zeroes by unmapping we call bdrv_make_zero to
avoid fully allocating the target. This currently works
only for iscsi.  It can be extended to raw with
BLKDISCARDZEROES for example.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-img: add support for fully allocated images
Peter Lieven [Thu, 24 Oct 2013 10:07:05 +0000 (12:07 +0200)]
qemu-img: add support for fully allocated images

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks
Peter Lieven [Thu, 24 Oct 2013 10:07:04 +0000 (12:07 +0200)]
block/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks

this patch does 2 things:
a) only do additional call outs if BDRV_BLOCK_ZERO is not already set.
b) use the newly introduced bdrv_unallocated_blocks_are_zero()
   to return the zero state of an unallocated block. the used callout
   to bdrv_has_zero_init() is only valid right after bdrv_create.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: introduce bdrv_make_zero
Peter Lieven [Thu, 24 Oct 2013 10:07:03 +0000 (12:07 +0200)]
block: introduce bdrv_make_zero

this patch adds a call to completely zero out a block device.
the operation is sped up by checking the block status and
only writing zeroes to the device if they currently do not
return zeroes. optionally the zero writing can be sped up
by setting the flag BDRV_REQ_MAY_UNMAP to emulate the zero
write by unmapping if the driver supports it.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoiscsi: add bdrv_co_write_zeroes
Peter Lieven [Thu, 24 Oct 2013 10:07:02 +0000 (12:07 +0200)]
iscsi: add bdrv_co_write_zeroes

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoiscsi: simplify iscsi_co_discard
Peter Lieven [Thu, 24 Oct 2013 10:07:01 +0000 (12:07 +0200)]
iscsi: simplify iscsi_co_discard

now that bdrv_co_discard can handle limits we do not need
the request split logic here anymore.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoiscsi: set limits in BlockDriverState
Peter Lieven [Thu, 24 Oct 2013 10:07:00 +0000 (12:07 +0200)]
iscsi: set limits in BlockDriverState

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: honour BlockLimits in bdrv_co_discard
Peter Lieven [Thu, 24 Oct 2013 10:06:59 +0000 (12:06 +0200)]
block: honour BlockLimits in bdrv_co_discard

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: honour BlockLimits in bdrv_co_do_write_zeroes
Peter Lieven [Thu, 24 Oct 2013 10:06:58 +0000 (12:06 +0200)]
block: honour BlockLimits in bdrv_co_do_write_zeroes

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/raw: copy BlockLimits on raw_open
Peter Lieven [Thu, 24 Oct 2013 10:06:57 +0000 (12:06 +0200)]
block/raw: copy BlockLimits on raw_open

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add BlockLimits structure to BlockDriverState
Peter Lieven [Thu, 24 Oct 2013 10:06:56 +0000 (12:06 +0200)]
block: add BlockLimits structure to BlockDriverState

this patch adds BlockLimits which introduces discard and write_zeroes
limits and alignment information to the BlockDriverState.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/iscsi: add .bdrv_get_info
Peter Lieven [Thu, 24 Oct 2013 10:06:55 +0000 (12:06 +0200)]
block/iscsi: add .bdrv_get_info

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add wrappers for logical block provisioning information
Peter Lieven [Thu, 24 Oct 2013 10:06:54 +0000 (12:06 +0200)]
block: add wrappers for logical block provisioning information

This adds 2 wrappers to read the unallocated_blocks_are_zero and
can_write_zeroes_with_unmap info from the BDI. The wrappers are
required to check for the existence of a backing_hd and
if the devices are opened with the correct flags.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add logical block provisioning info to BlockDriverInfo
Peter Lieven [Thu, 24 Oct 2013 10:06:53 +0000 (12:06 +0200)]
block: add logical block provisioning info to BlockDriverInfo

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: introduce BDRV_REQ_MAY_UNMAP request flag
Peter Lieven [Thu, 24 Oct 2013 10:06:52 +0000 (12:06 +0200)]
block: introduce BDRV_REQ_MAY_UNMAP request flag

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add flags to bdrv_*_write_zeroes
Peter Lieven [Thu, 24 Oct 2013 10:06:51 +0000 (12:06 +0200)]
block: add flags to bdrv_*_write_zeroes

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: make BdrvRequestFlags public
Peter Lieven [Thu, 24 Oct 2013 10:06:50 +0000 (12:06 +0200)]
block: make BdrvRequestFlags public

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoOpen 2.0 development tree
Anthony Liguori [Wed, 27 Nov 2013 22:02:45 +0000 (14:02 -0800)]
Open 2.0 development tree

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoUpdate version for 1.7.0 release
Anthony Liguori [Wed, 27 Nov 2013 19:30:46 +0000 (11:30 -0800)]
Update version for 1.7.0 release

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoqemu-iotests: Fix test 041
Max Reitz [Mon, 25 Nov 2013 19:28:56 +0000 (20:28 +0100)]
qemu-iotests: Fix test 041

Performing multiple drive-mirror blockjobs on the same qemu instance
results in the image file used for the block device being replaced by
the newly mirrored file, which is not what we want.

Fix this by performing one dedicated test per sync mode.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1385407736-13941-3-git-send-email-mreitz@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoblock/drive-mirror: Reuse backing HD for sync=none
Max Reitz [Mon, 25 Nov 2013 19:28:55 +0000 (20:28 +0100)]
block/drive-mirror: Reuse backing HD for sync=none

For "none" sync mode in "absolute-paths" mode, the current image should
be used as the backing file for the newly created image.

The current behavior is:
a) If the image to be mirrored has a backing file, use that (which is
   wrong, since the operations recorded by "none" are applied to the
   image itself, not to its backing file).
b) If the image to be mirrored lacks a backing file, the target doesn't
   have one either (which is not really wrong, but not really right,
   either; "none" records a set of operations executed on the image
   file, therefore having no backing file to apply these operations on
   seems rather pointless).

For a, this is clearly a bugfix. For b, it is still a bugfix, although
it might break existing API - but since that case crashed qemu just
three weeks ago (before 1452686495922b81d6cf43edf025c1aef15965c0), we
can safely assume there is no such API relying on that case yet.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1385407736-13941-2-git-send-email-mreitz@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoxhci: Call usb_device_alloc/free_streams
Hans de Goede [Tue, 19 Nov 2013 13:36:58 +0000 (14:36 +0100)]
xhci: Call usb_device_alloc/free_streams

Note this code is not as KISS as I would like, the reason for this is that
the Linux kernel interface wants streams on eps belonging to one interface
to be allocated in one call. Things will also work if we do this one ep at a
time (as long as all eps support the same amount of streams), but lets stick
to the kernel API.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb: Add usb_device_alloc/free_streams
Hans de Goede [Tue, 19 Nov 2013 13:36:57 +0000 (14:36 +0100)]
usb: Add usb_device_alloc/free_streams

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb: Add max_streams attribute to endpoint info
Hans de Goede [Tue, 19 Nov 2013 13:36:56 +0000 (14:36 +0100)]
usb: Add max_streams attribute to endpoint info

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: s/ui/iu/
Hans de Goede [Tue, 19 Nov 2013 13:37:04 +0000 (14:37 +0100)]
uas: s/ui/iu/

The various uas data structures are called IU-s, which is short for
Information Unit, rather then UI-s.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Fix response iu struct definition
Hans de Goede [Thu, 31 Oct 2013 09:35:31 +0000 (10:35 +0100)]
uas: Fix response iu struct definition

This patch mirrors a patch to the Linux uas kernel driver which I've just
submitted. It looks like the qemu uas struct definitions were taken from
the Linux kernel driver, and have inherited the same mistake.

Besides fixing the response iu struct, the patch also drops the add_info
parameter from the usb_uas_queue_response() function, it is always 0 anyways,
and expressing 3 zero-bytes as a function argument is a bit hard.

Below is the long explanation for this change taken from the kernel commit:

The response iu struct before this patch has a size of 7 bytes, which is weird
since all other iu-s are explictly padded to a multiple of 4 bytes.

Submitting a 7 byte bulk transfer to the status endpoint of a real uasp device
when expecting a response iu results in an USB babble error, as the device
actually sends 8 bytes.

Up on closer reading of the UAS spec:
http://www.t10.org/cgi-bin/ac.pl?t=f&f=uas2r00.pdf

The reason for this becomes clear, the 2 entries in "Table 17 — RESPONSE IU"
are numbered 4 and 6, looking at other iu definitions in the spec, esp.
multi-byte fields, this indicates that the ADDITIONAL RESPONSE INFORMATION
field is not a 2 byte field as one might assume at a first look, but is
a multi-byte field containing 3 bytes.

This also aligns with the SCSI Architecture Model 4 spec, which UAS is based
on which states in paragraph "7.1 Task management function procedure calls"
that the "Additional Response Information" output argument for a Task
management function procedure call is 3 bytes.

Last but not least I've verified this by sending a logical unit reset task
management call with an invalid lun to an actual uasp device, and received
back a response-iu with byte 6 being 0, and byte 7 being 9, which is the
responce code for an invalid iu, which confirms that the response code is
being reported in byte 7 of the response iu rather then in byte 6.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Bounds check tags when using streams
Hans de Goede [Thu, 24 Oct 2013 17:15:53 +0000 (18:15 +0100)]
uas: Bounds check tags when using streams

Disallow the guest to cause us to address the data3 and status3 arrays
out of bounds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Streams are numbered 1-y, rather then 0-x
Hans de Goede [Thu, 24 Oct 2013 17:15:52 +0000 (18:15 +0100)]
uas: Streams are numbered 1-y, rather then 0-x

It is easier to simply make the arrays one larger, rather then
substracting one everywhere.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Fix / cleanup usb_uas_task error handling
Hans de Goede [Thu, 24 Oct 2013 17:15:51 +0000 (18:15 +0100)]
uas: Fix / cleanup usb_uas_task error handling

-The correct error if we cannot find the dev is INCORRECT_LUN rather then
 INVALID_INFO_UNIT
-Move the device not found check to the top so we only need to do it once
-Remove the dev->lun != lun checks, dev is returned by scsi_device_find
 which searches by lun, so this will never trigger

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Only use report iu-s for task_mgmt status reporting
Hans de Goede [Thu, 24 Oct 2013 17:15:50 +0000 (18:15 +0100)]
uas: Only use report iu-s for task_mgmt status reporting

Regular scsi cmds should always report their status using a sense-iu, using
the sense code to report any errors.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoscsi: Add 2 new sense codes needed by uas
Hans de Goede [Thu, 24 Oct 2013 17:15:49 +0000 (18:15 +0100)]
scsi: Add 2 new sense codes needed by uas

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoxhci: add support for suspend/resume
Gerd Hoffmann [Fri, 8 Nov 2013 10:43:20 +0000 (11:43 +0100)]
xhci: add support for suspend/resume

The OS can ask the xhci controller to save and restore its
internal state, which is used by the OS when the system is
suspended and resumed.

This patch handles writes to the save + restore bits in the
command register.  Only thing it does is updating the
restore error bit in the status register to signal an error
on restore.  The guest OS should do a full reinitialization
after resume then.

This is the minimal patch which gets S3 going with xhci.
Implementing full save/restore support is TBD.

https://bugzilla.redhat.com/show_bug.cgi?id=1012365

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoxhci: Add a few missing checks for disconnected devices
Hans de Goede [Tue, 19 Nov 2013 13:36:59 +0000 (14:36 +0100)]
xhci: Add a few missing checks for disconnected devices

One of the reworks of qemu's usb core made changes to usb-port's disconnect
handling. Now ports with a device will always have a non 0 dev member, but
if the device is not attached (which is possible with usb redirection),
dev->attached will be 0.

So supplement all checks for dev to also check dev->attached, and add an
extra check in a path where a device check was completely missing.

This fixes various crashes (asserts triggering) I've been seeing when xhci
attached usb devices get disconnected at the wrong time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoUpdate version for v1.7.0-rc2 release
Anthony Liguori [Tue, 26 Nov 2013 04:37:12 +0000 (20:37 -0800)]
Update version for v1.7.0-rc2 release

10 years agocurses: fixup SIGWINCH handler mess
Gerd Hoffmann [Fri, 22 Nov 2013 14:35:03 +0000 (15:35 +0100)]
curses: fixup SIGWINCH handler mess

Don't run code in the signal handler, only set a flag.
Use sigaction(2) to avoid non-portable signal(2) semantics.
Make #ifdefs less messy.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1385130903-20531-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoqga: Fix two format strings for MinGW
Stefan Weil [Mon, 25 Nov 2013 19:54:17 +0000 (20:54 +0100)]
qga: Fix two format strings for MinGW

Both code locations cause a compiler warning. Using "%s" instead of "%lu"
would result in a program crash if the wrong code were executed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1385409257-2522-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoPPC: BookE: Make FIT/WDT timers at best millisecond grained
Alexander Graf [Mon, 25 Nov 2013 21:46:55 +0000 (22:46 +0100)]
PPC: BookE: Make FIT/WDT timers at best millisecond grained

The default granularity for the FIT timer on 440 is on every 0x1000th
transition of TB from 0 to 1. Translated that means 48828 times a second.

Since interrupts are quite expensive for 440 and we don't really care
about the accuracy of the FIT to that significance, let's force FIT and
WDT to at best millisecond granularity.

This basically restores behavior as it was in QEMU 1.6, where timers
could only deal with millisecond granularities at all.

This patch greatly improves performance with the 440 target and restores
roughly the same performance level that QEMU 1.6 had for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
Message-id: 1385416015-22775-3-git-send-email-agraf@suse.de
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoPPC: Make BookE FIT/WDT timers more lazy
Alexander Graf [Mon, 25 Nov 2013 21:46:54 +0000 (22:46 +0100)]
PPC: Make BookE FIT/WDT timers more lazy

Today we fire FIT and WDT timer events every time the respective bit
position in TB flips from 0 -> 1.

However, there is no need to do this if the end result would be that
we're changing a TSR bit that is set to 1 to 1 again. No guest visible
change would have occured.

So whenever we see that the TSR bit to our timer is already set, don't
even bother to update the timer that would potentially fire it off.

However, we do need to make sure that we update our timer that notifies
us of the TB flip when the respective TSR bit gets unset. In that case
we do care about the flip and need to notify the guest again. So add
a callback into our timer handlers when TSR bits get unset.

This improves performance for me when the guest is busy processing things.

Signed-off-by: Alexander Graf <agraf@suse.de>
Message-id: 1385416015-22775-2-git-send-email-agraf@suse.de
Signed-off-by: Anthony Liguori <aliguori@amazon.com>