]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
12 years agovl.c: Guard against GThread double-initialization
Andreas Färber [Mon, 31 Oct 2011 18:14:56 +0000 (19:14 +0100)]
vl.c: Guard against GThread double-initialization

GThread-ERROR **: GThread system may only be initialized once.
aborting...

Making the g_thread_init() call in vl.c conditional resolves an abort on
Mac OS X, where coroutine-gthread.c seems to call it before vl.c.

Reported-by: Juan Pineda <juan@logician.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Daniel P. Berrange <berrange@redhat.com>
12 years agoMAINTAINERS: Add Cocoa maintainer
Andreas Färber [Sun, 30 Oct 2011 17:08:01 +0000 (18:08 +0100)]
MAINTAINERS: Add Cocoa maintainer

Degrade cocoa.m from Maintained to Odd Fixes.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'kraxel/usb.29' into staging
Anthony Liguori [Tue, 1 Nov 2011 18:09:31 +0000 (13:09 -0500)]
Merge remote-tracking branch 'kraxel/usb.29' into staging

12 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Tue, 1 Nov 2011 18:08:33 +0000 (13:08 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

12 years agoMerge remote-tracking branch 'spice/spice.v46' into staging
Anthony Liguori [Tue, 1 Nov 2011 18:06:46 +0000 (13:06 -0500)]
Merge remote-tracking branch 'spice/spice.v46' into staging

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Tue, 1 Nov 2011 18:06:17 +0000 (13:06 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

12 years agoopencores_eth: fix RX path: FCS, padding and TL
Max Filippov [Thu, 27 Oct 2011 22:10:27 +0000 (02:10 +0400)]
opencores_eth: fix RX path: FCS, padding and TL

OpenCores 10/100 Mbps Ethernet MAC specification doesn't clearly state
whether FCS is counted in the RX frame length or not. Looks like it is.
Append zero FCS to the received frames.

Get rid of big static buffer for RX frame padding, optimize it for the
most common MINFL value range.

Set RXD_TL for the long frames only when HUGEN bit is set.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: flush migration data to disk.
Gerd Hoffmann [Thu, 27 Oct 2011 07:12:04 +0000 (09:12 +0200)]
migration: flush migration data to disk.

This patch increases robustness when migrating to a file with
two little changes:

 (1) Before closing the migration file handle checks if it happens to be
     a regular file and if so it issues a fsync.  This way the data is
     flushed to disk before qemu sends the migration completed event.
 (2) It adds error checking.  In case either fsync or close syscall
     fails pass up the error (and fail migration).

[ v2: return -errno instead of -1 ]

Cc: Juan Quintela <quintela@redhat.com>
Cc: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoadd test-coroutine to checks
Gerd Hoffmann [Thu, 1 Sep 2011 15:42:19 +0000 (17:42 +0200)]
add test-coroutine to checks

There is a "test-coroutine" which isn't in the list.
Add it so "make check" runs it too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoadd "make check" target
Gerd Hoffmann [Thu, 1 Sep 2011 15:42:18 +0000 (17:42 +0200)]
add "make check" target

Add some Makefile glue so we have a simple "make check"
to run the unit tests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomove checks to separate variable
Gerd Hoffmann [Thu, 1 Sep 2011 15:42:17 +0000 (17:42 +0200)]
move checks to separate variable

Create a new CHECKS variable.  Put the checks there instead
of adding them to the TOOLS variable.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoProbe for libcheck by default.
Gerd Hoffmann [Thu, 1 Sep 2011 15:42:16 +0000 (17:42 +0200)]
Probe for libcheck by default.

Probe for libcheck and build checks (if found) by default.
Can be explicitly disabled using --disable-check-utests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoia64-dis.c: Undefine ABS to avoid clash with glib
Peter Maydell [Sat, 29 Oct 2011 11:58:26 +0000 (12:58 +0100)]
ia64-dis.c: Undefine ABS to avoid clash with glib

Undefine ABS to avoid a clash with the macro that glib.h
helpfully defines for us (and a resulting build failure
on ia64 hosts).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoFix segfault on migration completion
Luiz Capitulino [Fri, 28 Oct 2011 16:59:52 +0000 (14:59 -0200)]
Fix segfault on migration completion

A simple migration reproduces it:

1. Start the source VM with:

   # qemu [...] -S

2. Start the destination VM with:

   # qemu <source VM cmd-line> -incoming tcp:0:4444

3. In the source VM:

   (qemu) migrate -d tcp:0:4444

4. The source VM will segfault as soon as migration completes (might not
   happen in the first try)

What is happening here is that qemu_file_put_notify() can end up closing
's->file' (in which case it's also set to NULL). The call stack is rather
complex, but Eduardo helped tracking it to:

select loop -> migrate_fd_put_notify() -> qemu_file_put_notify() ->
buffered_put_buffer() -> migrate_fd_put_ready() ->
migrate_fd_completed() -> migrate_fd_cleanup().

To be honest, it's not completely clear to me in which cases 's->file'
is not closed (on error maybe)? But I doubt this fix will make anything
worse.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd qapi related generated files to .gitignore
David Gibson [Fri, 28 Oct 2011 04:26:18 +0000 (15:26 +1100)]
Add qapi related generated files to .gitignore

.gitignore already lists the qapi-generated subdirectory which includes a
number of files generated during build.  However, there are some additional
files generated by the qapi build which go in the top level directory.

This patch adds them to .gitignore, removing the irritating noise from
diffs and the like.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-barrier: Fix build failure on PowerPC Mac OS X
Eric Sunshine [Tue, 1 Nov 2011 09:39:49 +0000 (05:39 -0400)]
qemu-barrier: Fix build failure on PowerPC Mac OS X

qemu-barrier.h tests if macro __powerpc__ is defined, however, the
preprocessor on PowerPC Mac OS X defines only __POWERPC__, not
__powerpc__.  Resolve by testing instead for qemu-provided _ARCH_PPC.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agofw_cfg: Use g_file_get_contents instead of multiple fread() calls
Pavel Borzenkov [Mon, 24 Oct 2011 11:31:30 +0000 (07:31 -0400)]
fw_cfg: Use g_file_get_contents instead of multiple fread() calls

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoSimplify cpu_exec_all to tcg_exec_all
Jan Kiszka [Mon, 26 Sep 2011 07:40:39 +0000 (09:40 +0200)]
Simplify cpu_exec_all to tcg_exec_all

After the removal of the non-threaded mode cpu_exec_all is now only used
by TCG. Refactor it accordingly, also dropping its unused return value.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMake cpu_single_env thread-local
Paolo Bonzini [Fri, 28 Oct 2011 09:52:42 +0000 (10:52 +0100)]
Make cpu_single_env thread-local

Make cpu_single_env thread-local. This fixes a regression
in handling of multi-threaded programs in linux-user mode
(bug 823902).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Peter Maydell: rename tls_cpu_single_env to cpu_single_env]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agodarwin-user/main.c: Drop unused cpu_single_env definition
Paolo Bonzini [Fri, 28 Oct 2011 09:52:41 +0000 (10:52 +0100)]
darwin-user/main.c: Drop unused cpu_single_env definition

Drop the cpu_single_env definition as it is unused.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-tls.h: Add abstraction layer for TLS variables
Peter Maydell [Fri, 28 Oct 2011 09:52:40 +0000 (10:52 +0100)]
qemu-tls.h: Add abstraction layer for TLS variables

Add an abstraction layer for defining and using thread-local
variables. For the moment this is implemented only for Linux,
which means they can only be used in restricted circumstances.
The abstraction layer allows us to add POSIX and Win32 support
later.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoError check find_ram_offset
Alex Williamson [Mon, 31 Oct 2011 14:54:09 +0000 (08:54 -0600)]
Error check find_ram_offset

Spotted via code review, we initialize offset to 0 to avoid a
compiler warning, but in the unlikely case that offset is
never set to something else, we should abort instead of return
a value that will almost certainly cause problems.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agousb-host: fix host close
Gerd Hoffmann [Fri, 28 Oct 2011 14:13:50 +0000 (16:13 +0200)]
usb-host: fix host close

The whole usb_host_close() function is skipped in case the device is not
in attached state.  This is wrong though, only then usb_device_detach()
must be skipped, all other cleanup (especially device reset and closing
the file handle) still needs to be done.  There are code paths where
usb_host_close() is called with the device in detached state already.

This fixes usb-host devices not being released and returned to the host
after removing them with device_del.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb: change VID/PID for usb-hub and usb-msd to prevent conflict
Roy Tam [Thu, 15 Sep 2011 03:25:47 +0000 (11:25 +0800)]
usb: change VID/PID for usb-hub and usb-msd to prevent conflict

Some USB drivers, for example USBASPI.SYS, will skip different type of
device which has same VID/PID. The following patch helps preventing
usb-msd being skipped by the driver.

Signed-off-by: Roy Tam <roytam@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoSupport running QEMU on Valgrind
Stefan Weil [Mon, 31 Oct 2011 20:29:46 +0000 (21:29 +0100)]
Support running QEMU on Valgrind

Valgrind is a tool which can automatically detect many kinds of bugs.

Running QEMU on Valgrind with x86_64 hosts was not possible because
Valgrind aborts when memalign is called with an alignment larger than
1 MiB. QEMU normally uses 2 MiB on Linux x86_64.

Now the alignment is reduced to the page size when QEMU is running on
Valgrind.

v2:
Instead of using the macro RUNNING_ON_VALGRIND from valgrind.h,
the patch now uses a hack from libvirt which tests for the pre-loaded
vgpreload_*.so shared libraries. This avoids the need for valgrind.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMAINTAINERS: Add PReP maintainer
Andreas Färber [Mon, 31 Oct 2011 23:03:07 +0000 (00:03 +0100)]
MAINTAINERS: Add PReP maintainer

Officially take on maintainership for PReP and upgrade to Odd Fixes.

Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Alexander Graf <agraf@suse.de>
Cc: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotrace: Add wildcard trace event support
Mark Wu [Mon, 31 Oct 2011 03:29:04 +0000 (11:29 +0800)]
trace: Add wildcard trace event support

A basic wildcard matching is supported in both the monitor command
"trace-event" and the events list file. That means you can enable/disable
the events having a common prefix in a batch. For example, virtio-blk trace
events could be enabled using:
    trace-event virtio_blk_* on

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agousb-hub: wakeup on attach
Gerd Hoffmann [Fri, 14 Oct 2011 09:36:43 +0000 (11:36 +0200)]
usb-hub: wakeup on attach

When attaching a new device we must send a wakeup request to the root
hub, otherwise the guest will not notice the new device in case the
usb hub is suspended.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl: create slots on post_load in vga state
Alon Levy [Tue, 25 Oct 2011 13:39:50 +0000 (15:39 +0200)]
qxl: create slots on post_load in vga state

RHBZ 740547

If we migrate when the device is in vga state the guest
still believes the slots are created, and will cause operations
that reference the slots, causing a "panic: virtual address out of range"
on the first of them. Easy to see by migrating in vga mode with
a driver loaded, for instance windows cmd window in full screen mode,
and then exiting vga mode back to native mode will cause said panic.

Fixed by doing the slot recreation in post_load for vga mode as well.
Note that compat does not require any changes because it creates it's
only slot by a side effect of QXL_IO_SET_MODE.

Signed-off-by: Alon Levy <alevy@redhat.com>
12 years agoqxl: make sure we continue to run with a shared buffer
Gerd Hoffmann [Fri, 21 Oct 2011 19:53:54 +0000 (21:53 +0200)]
qxl: make sure we continue to run with a shared buffer

The qxl renderer works only with a shared displaysurface.  So better
make sure we actually have one and restore it when needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl: stride fixup
Gerd Hoffmann [Fri, 21 Oct 2011 13:59:07 +0000 (15:59 +0200)]
qxl: stride fixup

spice uses negative stride value to signal the bitmap is upside down.
The qxl renderer (used for scl, vnc and screenshots) wants a positive
value because it is easier to work with.  The positive value is then
stored in the very same variable, which has the drawback that the
upside-down test works only once.  Fix by using two variables.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoacl: Fix use after free in qemu_acl_reset()
Markus Armbruster [Fri, 28 Oct 2011 15:07:02 +0000 (17:07 +0200)]
acl: Fix use after free in qemu_acl_reset()

Reproducer:

    $ MALLOC_PERTURB_=234 qemu-system-x86_64 -vnc :0,acl,sasl [...]
    QEMU 0.15.50 monitor - type 'help' for more information
    (qemu) acl_add vnc.username fred allow
    acl: added rule at position 1
    (qemu) acl_reset vnc.username
    Segmentation fault (core dumped)

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqapi: fix typos in documentation JSON examples
Stefan Hajnoczi [Fri, 28 Oct 2011 14:58:26 +0000 (15:58 +0100)]
qapi: fix typos in documentation JSON examples

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agosysbus: Supply missing va_end()
Markus Armbruster [Fri, 28 Oct 2011 08:52:25 +0000 (10:52 +0200)]
sysbus: Supply missing va_end()

C99 7.15.1: Each invocation of the va_start and va_copy macros shall
be matched by a corresponding invocation of the va_end macro in the
same function.

Spotted by Coverity.  Harmless on the (common) systems where va_end()
does nothing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agonet: tap-linux: Fix unhelpful error message
Luiz Capitulino [Fri, 14 Oct 2011 18:05:10 +0000 (15:05 -0300)]
net: tap-linux: Fix unhelpful error message

I'm getting:

    could not configure /dev/net/tun (tap%d): Operation not permitted

When the ioctl() fails, ifr.ifr_name will most likely not be overwritten.
So we better only use it when ifname contains a string.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Mon, 31 Oct 2011 20:05:40 +0000 (15:05 -0500)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 31 Oct 2011 16:09:00 +0000 (11:09 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

Conflicts:
block/vmdk.c

12 years agoMerge remote-tracking branch 'aneesh/for-upstream-7' into staging
Anthony Liguori [Mon, 31 Oct 2011 16:06:02 +0000 (11:06 -0500)]
Merge remote-tracking branch 'aneesh/for-upstream-7' into staging

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Mon, 31 Oct 2011 16:02:29 +0000 (11:02 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

Conflicts:
ui/spice-core.c

12 years agoMerge remote-tracking branch 'qemu-kvm-tmp/uq/master' into staging
Anthony Liguori [Mon, 31 Oct 2011 16:00:27 +0000 (11:00 -0500)]
Merge remote-tracking branch 'qemu-kvm-tmp/uq/master' into staging

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 31 Oct 2011 15:23:15 +0000 (10:23 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

12 years agoMerge remote-tracking branch 'alon/pull-libcacard-assert' into staging
Anthony Liguori [Mon, 31 Oct 2011 15:14:06 +0000 (10:14 -0500)]
Merge remote-tracking branch 'alon/pull-libcacard-assert' into staging

12 years agoMerge remote-tracking branch 'spice/spice.v45' into staging
Anthony Liguori [Mon, 31 Oct 2011 15:12:14 +0000 (10:12 -0500)]
Merge remote-tracking branch 'spice/spice.v45' into staging

12 years agohw/9pfs: Replace rwlocks with RCU variants of interfaces.
Harsh Prateek Bora [Thu, 13 Oct 2011 20:35:02 +0000 (02:05 +0530)]
hw/9pfs: Replace rwlocks with RCU variants of interfaces.

Use QLIST_INSERT_HEAD_RCU and rcu_read_lock/unlock instead of rwlocks.
Use v9fs_synth_mutex as a write-only mutex to handle concurrent writers.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agoqemu-queue: Introduce QLIST_INSERT_HEAD_RCU and dummy RCU wrappers.
Harsh Prateek Bora [Tue, 25 Oct 2011 06:40:40 +0000 (12:10 +0530)]
qemu-queue: Introduce QLIST_INSERT_HEAD_RCU and dummy RCU wrappers.

SynthFS needs a QLIST_INSERT_HEAD_RCU to make sure list instructions are not
re-ordered and therefore avoiding a crash. There may be parallel readers which
should be allowed for lock-free access and this variant allows us to get rid
of rwlocks used by readers.

SynthFS is a special case where we dont really need full RCU capabilities as
it doesnt allow list entry deletion but concurrent readers/writers and
instruction re-ordering should not result in a crash.

Also, once the real rcu is available, dummy rcu macro definitions will go away
and the code will still work as expected.

This patchwork is based on inputs from Paolo Bonzini.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/9pfs: Add synthetic file system support using 9p
Aneesh Kumar K.V [Tue, 25 Oct 2011 06:40:40 +0000 (12:10 +0530)]
hw/9pfs: Add synthetic file system support using 9p

This patch create a synthetic file system with mount tag
v_synth when -virtfs_synth command line option is specified
in qemu. The synthetic file system can be mounted in guest
using 9p using the below command line

mount -t 9p -oversion=9p2000.L,trans=virtio v_synth  <mountpint>

Synthetic file system enabled different qemu subsystem to register
callbacks for read and write events from guest. The subsystem
can create directories and files in the synthetic file system as show
in ex below

    qemu_v9fs_synth_mkdir(NULL, 0777, "test2", &node);
    qemu_v9fs_synth_add_file(node, 0777, "testfile",
                             my_test_read, NULL, NULL);

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/9pfs: Abstract open state of fid to V9fsFidOpenState
Aneesh Kumar K.V [Tue, 25 Oct 2011 06:40:40 +0000 (12:10 +0530)]
hw/9pfs: Abstract open state of fid to V9fsFidOpenState

To implement synthetic file system in Qemu we may not really
require file descriptor and Dir *. Make generic code use
V9fsFidOpenState instead.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/9pfs: Read-only support for 9p export
M. Mohan Kumar [Tue, 25 Oct 2011 06:40:39 +0000 (12:10 +0530)]
hw/9pfs: Read-only support for 9p export

A new fsdev parameter "readonly" is introduced to control accessing 9p export.
"readonly" can be used to specify the access type. By default "rw" access
is given to 9p export.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agoqemu: Add opt_set_bool functionality
M. Mohan Kumar [Tue, 25 Oct 2011 06:40:39 +0000 (12:10 +0530)]
qemu: Add opt_set_bool functionality

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agoconfigure: Update configure so that open_by_handle_at check returns correct value
Aneesh Kumar K.V [Tue, 25 Oct 2011 06:40:39 +0000 (12:10 +0530)]
configure: Update configure so that open_by_handle_at check returns correct value

According to David Gibson for some compiler/libc combinations, open_by_handle_at
test in configure isn't quite right: because the file_handle pointer is never
dereferenced, gcc doesn't complain even if it is undefined. Change the test
as suggested by him.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/9pfs: Fix error handling in local_mknod
Aneesh Kumar K.V [Tue, 25 Oct 2011 06:40:39 +0000 (12:10 +0530)]
hw/9pfs: Fix error handling in local_mknod

Update local_chown to remove unnecessary if loop

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/vexpress.c, hw/realview.c: Add PL041 to VExpress, Realview boards
Peter Maydell [Fri, 28 Oct 2011 09:55:38 +0000 (10:55 +0100)]
hw/vexpress.c, hw/realview.c: Add PL041 to VExpress, Realview boards

Instantiate the PL041 audio on the Versatile Express and
Realview board models.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoAdd AACI audio playback support to the ARM Versatile/PB platform
Mathieu Sonet [Fri, 28 Oct 2011 09:55:37 +0000 (10:55 +0100)]
Add AACI audio playback support to the ARM Versatile/PB platform

This driver emulates the ARM AACI interface (PL041) connected to a LM4549 codec.
It enables audio playback for the Versatile/PB platform.

Limitations:
- Supports only a playback on one channel (Versatile/Vexpress)
- Supports only one TX FIFO in compact-mode or non-compact mode.
- Supports playback of 12, 16, 18 and 20 bits samples.
- Record is not supported.
- The PL041 is hardwired to a LM4549 codec.

Versatile/PB test build:
linux-2.6.38.5
buildroot-2010.11
alsa-lib-1.0.22
alsa-utils-1.0.22
mpg123-0.66

Qemu host: Ubuntu 10.04 in Vmware/OS X

Playback tested successfully with speaker-test/aplay/mpg123.

Signed-off-by: Mathieu Sonet <contact@elasticsheep.com>
[Peter Maydell: fixed typo in code clearing SL1RXBUSY/SL2RXBUSY
 bits, as spotted by Andrzej Zaborowski]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoMAINTAINERS: update wiki URL and machine names for target-xtensa
Max Filippov [Thu, 27 Oct 2011 22:11:05 +0000 (02:11 +0400)]
MAINTAINERS: update wiki URL and machine names for target-xtensa

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcg: Optimize some forms of deposit.
Richard Henderson [Thu, 27 Oct 2011 21:15:00 +0000 (14:15 -0700)]
tcg: Optimize some forms of deposit.

If the deposit replaces the entire word, optimize to a move.

If we're inserting to the top of the word, avoid the mask of arg2
as we'll be shifting out all of the garbage and shifting in zeros.

If the host is 32-bit, reduce a 64-bit deposit to a 32-bit deposit
when possible.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/9pfs: Make VirtFS tracing work correctly
Aneesh Kumar K.V [Mon, 24 Oct 2011 09:39:49 +0000 (15:09 +0530)]
hw/9pfs: Make VirtFS tracing work correctly

this patch fix multiple issues with VirtFS tracing.
a) Add tracepoint to the correct code path. We handle error in complete_pdu
b) Fix indentation in python script
c) Fix variable naming issue in python script

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec-all: Fix void pointer arithmetic
Stefan Weil [Sun, 23 Oct 2011 06:19:10 +0000 (08:19 +0200)]
exec-all: Fix void pointer arithmetic

Adding an offset to a void pointer works with gcc but is not allowed
by the current C standards. With -pedantic, gcc complains:

exec-all.h:344: error: pointer of type ‘void *’ used in arithmetic

Fix this, and also replace (unsigned long) by (uintptr_t) in the same
statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoAdd linux-headers/asm to .gitignore
David Gibson [Thu, 20 Oct 2011 00:41:01 +0000 (11:41 +1100)]
Add linux-headers/asm to .gitignore

linux-headers/asm is a symlink generated during configure.  It should not,
therefore be committed to git, nor show up in git diffs and the like.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoscsi-disk: add scsi-block for device passthrough
Paolo Bonzini [Tue, 25 Oct 2011 10:53:37 +0000 (12:53 +0200)]
scsi-disk: add scsi-block for device passthrough

scsi-block is a new device that supports device passthrough of Linux
block devices (i.e. /dev/sda, not /dev/sg0).  It uses SG_IO for commands
other than I/O commands, and regular AIO read/writes for I/O commands.
Besides being simpler to configure (no mapping required to scsi-generic
device names), this removes the need for a large bounce buffer and,
in the future, will get scatter/gather support for free from scsi-disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: push request restart to SCSIDevice
Paolo Bonzini [Tue, 25 Oct 2011 10:53:36 +0000 (12:53 +0200)]
scsi: push request restart to SCSIDevice

The request restart mechanism is generic and could be reused for
scsi-generic.  In the meanwhile, pushing it to SCSIDevice avoids
that scsi_dma_restart_bh looks at SCSIGenericReqs when working on
a scsi-block device.

The code is the same that is already in hw/scsi-disk.c, with
the type flags replaced by req->cmd.mode and a more generic way to
requeue SCSI_XFER_NONE commands.

I also added a missing call to qemu_del_vm_change_state_handler.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-generic: bump SCSIRequest reference count until aio completion runs
Paolo Bonzini [Tue, 25 Oct 2011 10:53:35 +0000 (12:53 +0200)]
scsi-generic: bump SCSIRequest reference count until aio completion runs

Same as before, but for scsi-generic.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: bump SCSIRequest reference count until aio completion runs
Paolo Bonzini [Tue, 25 Oct 2011 10:53:34 +0000 (12:53 +0200)]
scsi-disk: bump SCSIRequest reference count until aio completion runs

In some cases a request may be canceled before the completion callback
runs.  Keep a reference to the request between starting an AIO operation
and the corresponding scsi_req_cancel or scsi_*_complete.

When a request has to be retried, the request can be dropped because
scsi_dma_restart_bh only looks at requests that are enqueued.  As such,
they always have at least a reference.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: do not call transfer_data after canceling a request
Paolo Bonzini [Tue, 25 Oct 2011 10:53:33 +0000 (12:53 +0200)]
scsi: do not call transfer_data after canceling a request

Otherwise, if cancellation is "faked" by the AIO layer and goes
through qemu_aio_flush, the whole request is completed synchronously
during scsi_req_cancel.

Using the enqueued flag would work here, but not in the next patches,
so I'm introducing a new io_canceled flag.  That's because scsi_req_data
is a synchronous callback and the enqueued flag might be reset by the
time it returns.  scsi-disk cannot unref the request until after calling
scsi_req_data.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: pass cdb to alloc_req
Paolo Bonzini [Wed, 12 Oct 2011 10:58:31 +0000 (12:58 +0200)]
scsi: pass cdb to alloc_req

This will let scsi-block choose between passthrough and emulation.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: export scsi_generic_reqops
Paolo Bonzini [Wed, 12 Oct 2011 10:54:31 +0000 (12:54 +0200)]
scsi: export scsi_generic_reqops

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: make reqops const
Paolo Bonzini [Wed, 12 Oct 2011 10:57:59 +0000 (12:57 +0200)]
scsi: make reqops const

Also delete a stale occurrence of SCSIReqOps inside SCSIDeviceInfo.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: move max_lba to SCSIDevice
Paolo Bonzini [Thu, 13 Oct 2011 08:39:50 +0000 (10:39 +0200)]
scsi: move max_lba to SCSIDevice

The field is only in scsi-disk for now.  Moving it up to SCSIDevice makes
it easier to reuse the scsi-generic reqops elsewhere.

At the same time, make scsi-generic get max_lba from snooped READ CAPACITY
commands as well.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: small clean up to INQUIRY
Paolo Bonzini [Wed, 12 Oct 2011 12:27:40 +0000 (14:27 +0200)]
scsi-disk: small clean up to INQUIRY

Set s->removable, s->qdev.blocksize and s->qdev.type in the callers
of scsi_initfn.

With this in place, s->qdev.type is allowed, and we can just reuse it
as the first byte in VPD data (just like we do in standard INQUIRY data).
Also set s->removable is set consistently and we can use it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: remove cluster_size
Paolo Bonzini [Thu, 13 Oct 2011 08:35:46 +0000 (10:35 +0200)]
scsi-disk: remove cluster_size

This field is redundant, and having it makes it more complicated
to share reqops between the upcoming scsi-block and scsi-generic.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: do not duplicate BlockDriverState member
Paolo Bonzini [Wed, 12 Oct 2011 10:54:16 +0000 (12:54 +0200)]
scsi-disk: do not duplicate BlockDriverState member

Same as for scsi-generic, avoid duplication even if it causes longer
lines.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-generic: snoop READ CAPACITY commands to get block size
Paolo Bonzini [Thu, 13 Oct 2011 08:36:27 +0000 (10:36 +0200)]
scsi-generic: snoop READ CAPACITY commands to get block size

Instead of "guessing" the block size when there is no medium in the
drive, wait for the guest to send a READ CAPACITY command and snoop
it from there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-generic: look at host status
Paolo Bonzini [Wed, 12 Oct 2011 12:53:43 +0000 (14:53 +0200)]
scsi-generic: look at host status

Pass down the host status so that failing transport can be detected
by the guest.  Similar treatment of host status could be done in
virtio-blk, too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-generic: check ioctl statuses when SG_IO succeeds
Paolo Bonzini [Wed, 12 Oct 2011 12:49:48 +0000 (14:49 +0200)]
scsi-generic: check ioctl statuses when SG_IO succeeds

A succeeding ioctl does not imply that the SCSI command succeeded.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-generic: remove scsi_req_fixup
Paolo Bonzini [Wed, 12 Oct 2011 09:54:59 +0000 (11:54 +0200)]
scsi-generic: remove scsi_req_fixup

This is not needed anymore, since asynchronous ioctls were introduced
by commit 221f715 (new scsi-generic abstraction, use SG_IO, 2009-03-28).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-generic: drop SCSIGenericState
Paolo Bonzini [Wed, 12 Oct 2011 10:49:35 +0000 (12:49 +0200)]
scsi-generic: drop SCSIGenericState

It is not needed, because s->bs is already stored in SCSIDevice, and
can be reached from the conf.bs member.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: fix retrying a flush
Paolo Bonzini [Tue, 4 Oct 2011 13:36:05 +0000 (15:36 +0200)]
scsi-disk: fix retrying a flush

Flush does not go anymore through scsi_disk_emulate_command.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0
Paolo Bonzini [Mon, 3 Oct 2011 11:57:06 +0000 (13:57 +0200)]
scsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0

Tested by the Windows Logo Kit SCSI Compliance test. From SBC-3, paragraph
5.25: "The LOGICAL BLOCK ADDRESS field shall be set to zero if the PMI
bit is set to zero. If the PMI bit is set to zero and the LOGICAL BLOCK
ADDRESS field is not set to zero, then the device server shall terminate
the command with CHECK CONDITION status with the sense key set to ILLEGAL
REQUEST and the additional sense code set to INVALID FIELD IN CDB".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: add channel to addressing
Paolo Bonzini [Wed, 27 Jul 2011 21:24:50 +0000 (23:24 +0200)]
scsi: add channel to addressing

This also requires little more than adding the new argument to
scsi_device_find, and the qdev property.  All devices by default
end up on channel 0.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: allow arbitrary LUNs
Paolo Bonzini [Sat, 13 Aug 2011 16:55:17 +0000 (18:55 +0200)]
scsi: allow arbitrary LUNs

This only requires changes in two places: in SCSIBus, we need to look
for a free LUN if somebody creates a device with a pre-existing scsi-id
but the default LUN (-1, meaning "search for a free spot"); in vSCSI,
we need to actually parse the LUN according to the SCSI spec.

For vSCSI, max_target/max_lun are set according to the logical unit
addressing format in SAM.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: implement REPORT LUNS for arbitrary LUNs
Paolo Bonzini [Wed, 14 Sep 2011 18:39:36 +0000 (20:39 +0200)]
scsi: implement REPORT LUNS for arbitrary LUNs

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: remove devs array from SCSIBus
Paolo Bonzini [Thu, 28 Jul 2011 16:02:13 +0000 (18:02 +0200)]
scsi: remove devs array from SCSIBus

Change the devs array into a linked list, and add a scsi_device_find
function to navigate the children list instead.  This lets the SCSI
bus use more complex addressing, and HBAs can talk to the correct device
when there are multiple LUNs per target.

scsi_device_find may return another LUN on the same target if none is
found that matches exactly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqdev: switch children device list to QTAILQ
Paolo Bonzini [Wed, 14 Sep 2011 07:28:06 +0000 (09:28 +0200)]
qdev: switch children device list to QTAILQ

SCSI buses will need to read the children list first-to-last.  This
requires using a QTAILQ, because hell breaks loose if you just try
inserting at the tail (thus reversing the order of all existing
visits from last-to-first to first-to-tail).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo)
Paolo Bonzini [Sat, 13 Aug 2011 13:44:45 +0000 (15:44 +0200)]
scsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: report media changed via GET EVENT STATUS NOTIFICATION
Paolo Bonzini [Tue, 13 Sep 2011 14:26:51 +0000 (16:26 +0200)]
scsi-disk: report media changed via GET EVENT STATUS NOTIFICATION

This adds support for media change notification via the GET EVENT STATUS
NOTIFICATION command, used by Linux versions 2.6.38 and newer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: support READ DVD STRUCTURE
Paolo Bonzini [Tue, 13 Sep 2011 13:57:15 +0000 (15:57 +0200)]
scsi-disk: support READ DVD STRUCTURE

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: support DVD profile in GET CONFIGURATION
Paolo Bonzini [Tue, 13 Sep 2011 13:22:31 +0000 (15:22 +0200)]
scsi-disk: support DVD profile in GET CONFIGURATION

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi/scsi-disk: make mode page values coherent between the two
Paolo Bonzini [Tue, 13 Sep 2011 13:08:22 +0000 (15:08 +0200)]
atapi/scsi-disk: make mode page values coherent between the two

This patch adds to scsi-disk the missing mode page 0x01 for both disk
and CD-ROM drives, and mode page 0x0e for CD drives only.

A few offsets were wrong in atapi.c.  Also change the 2Ah mode page to
expose DVD media read capabilities in the IDE cdrom.  This lets you run
dvd+rw-mediainfo on the virtual DVD drives.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: store valid mode pages in a table
Paolo Bonzini [Tue, 13 Sep 2011 12:50:15 +0000 (14:50 +0200)]
scsi-disk: store valid mode pages in a table

A small refactoring of the MODE SENSE implementation in scsi-disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: add stubs for more MMC commands
Paolo Bonzini [Tue, 13 Sep 2011 12:33:47 +0000 (14:33 +0200)]
scsi-disk: add stubs for more MMC commands

This patch adds a few stub implementations for MMC commands to
scsi-disk, to be filled in later in the series.  It also adds to
scsi-defs.h constants for commands implemented by ide/atapi.c,
when missing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: fix coding style issues (braces)
Paolo Bonzini [Mon, 17 Oct 2011 14:39:27 +0000 (16:39 +0200)]
scsi-disk: fix coding style issues (braces)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: report media changed via unit attention sense codes
Paolo Bonzini [Tue, 13 Sep 2011 14:26:06 +0000 (16:26 +0200)]
scsi-disk: report media changed via unit attention sense codes

Building on the previous patch, this one adds a media change callback
to scsi-disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: notify the device when unit attention is reported
Paolo Bonzini [Tue, 13 Sep 2011 14:19:53 +0000 (16:19 +0200)]
scsi: notify the device when unit attention is reported

Reporting media change events via unit attention sense codes requires
a small state machine: first report "NO MEDIUM", then report "MEDIUM MAY
HAVE CHANGED".  Unfortunately there is no good hooking point for the
device to notice that its pending unit attention condition has been
reported.  This patch reworks the generic machinery to add one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi: cleanup/fix mode sense results
Paolo Bonzini [Mon, 17 Oct 2011 14:34:59 +0000 (16:34 +0200)]
atapi: cleanup/fix mode sense results

The first two bytes (after the 8-byte ATAPI header) are the mode page
number and the number of bytes after the length field itself.  Make
this clear in the code.

The AUDIO_CTL page was filled with wrong values.  It is not anymore in
MMC, but at least keep the values sane.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi: move GESN definitions to scsi-defs.h
Paolo Bonzini [Tue, 13 Sep 2011 14:00:52 +0000 (16:00 +0200)]
atapi: move GESN definitions to scsi-defs.h

As a complement to the previous patch, move definitions for GET EVENT
STATUS NOTIFICATION from the two functions to scsi-defs.h.

The NCR_* constants are just bit values corresponding to the ENC_*
values, with no offsets even, so keep just one copy.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi/scsi: unify definitions for MMC
Paolo Bonzini [Tue, 13 Sep 2011 12:41:56 +0000 (14:41 +0200)]
atapi/scsi: unify definitions for MMC

The definitions in ide/internal.h are duplicates, since ATAPI commands
actually come from SCSI.  Use the ones in scsi-defs.h and move the
missing ones there.  Two exceptions:

- MODE_PAGE_WRITE_PARMS conflicts with the "flexible disk geometry"
page in scsi-disk.c.  It is unused, so pick the latter.

- GPCMD_* is left in ide/internal.h, at least for now.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: pass correct sense code for ENOMEDIUM
Paolo Bonzini [Mon, 19 Sep 2011 15:19:21 +0000 (17:19 +0200)]
scsi: pass correct sense code for ENOMEDIUM

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoDocumentation: Add syntax for using sheepdog devices
Ronnie Sahlberg [Fri, 28 Oct 2011 09:13:39 +0000 (20:13 +1100)]
Documentation: Add syntax for using sheepdog devices

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: reinitialize across bdrv_close()/bdrv_open()
Stefan Hajnoczi [Thu, 27 Oct 2011 09:54:28 +0000 (10:54 +0100)]
block: reinitialize across bdrv_close()/bdrv_open()

Several BlockDriverState fields are not being reinitialized across
bdrv_close()/bdrv_open().  Make sure they are reset to their default
values.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: set bs->read_only before .bdrv_open()
Stefan Hajnoczi [Thu, 27 Oct 2011 09:54:27 +0000 (10:54 +0100)]
block: set bs->read_only before .bdrv_open()

Several block drivers set bs->read_only in .bdrv_open() but
block.c:bdrv_open_common() clobbers its value.  Additionally, QED uses
bdrv_is_read_only() in .bdrv_open() to decide whether to perform
consistency checks.

The correct ordering is to initialize bs->read_only from the open flags
before calling .bdrv_open().  This way block drivers can override it if
necessary and can use bdrv_is_read_only() in .bdrv_open().

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-io: delete bs instead of leaking it
Stefan Hajnoczi [Thu, 27 Oct 2011 09:54:26 +0000 (10:54 +0100)]
qemu-io: delete bs instead of leaking it

Using bdrv_close() is not enough to free a BlockDriverState.  Since we
explicitly create it with bdrv_new(), use bdrv_delete() to close and
delete it.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>