]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agoslirp: Port redirection option behave differently on Linux and Windows
Taimoor Mirza [Thu, 15 Aug 2013 18:13:28 +0000 (23:13 +0500)]
slirp: Port redirection option behave differently on Linux and Windows

port redirection code uses SO_REUSEADDR socket option before binding to
host port. Behavior of SO_REUSEADDR is different on Windows and Linux.
Relaunching QEMU with same host and guest port redirection values on Linux
throws error but on Windows it does not throw any error.
Problem is discussed in http://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03089.html

Signed-off-by: Taimoor Mirza <tmirza@codesourcery.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agovirtio_pci: fix level interrupts with irqfd
Michael S. Tsirkin [Sun, 1 Sep 2013 08:03:45 +0000 (11:03 +0300)]
virtio_pci: fix level interrupts with irqfd

commit 62c96360ae7f2c7a8b029277fbb7cb082fdef7fd
    virtio-pci: fix level interrupts
only helps systems without irqfd: on systems with irqfd support we
passed in flag requesting irqfd even when msix is disabled.

As a result, for level interrupts we didn't install an fd handler so
unmasking an fd had no effect.

Fix this up.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopc: reduce duplication, fix PIIX descriptions
Michael S. Tsirkin [Tue, 27 Aug 2013 06:48:06 +0000 (09:48 +0300)]
pc: reduce duplication, fix PIIX descriptions

We have a lot of code duplication between machine types,
this increases with each new machine type
and each new field.

This has already introduced a minor bug: description
for pc-1.3 says "Standard PC" while description for
pc-1.4 is "Standard PC (i440FX + PIIX, 1996)"
which makes you think 1.3 is somehow more standard,
or newer, while in fact it's a revision of the same PC.

This patch addresses this issue by using macros, along
the lines used by PC_COMPAT_X_X - only for
non-property options.

The approach can extend to non-PC machine types.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoisa: Fix documentation of isa_register_portio_list()
Hervé Poussineau [Tue, 13 Aug 2013 10:38:34 +0000 (12:38 +0200)]
isa: Fix documentation of isa_register_portio_list()

Commit b40acf9 (ioport: Switch dispatching to memory core layer,
2013-06-24) removed all instances of old_portio.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqom: Assert instance size in object_initialize_with_type()
Andreas Färber [Fri, 30 Aug 2013 16:28:37 +0000 (18:28 +0200)]
qom: Assert instance size in object_initialize_with_type()

This catches objects initializing beyond allocated memory, e.g.,
when subtypes get extended with instance state of their own.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqom: Pass available size to object_initialize()
Andreas Färber [Fri, 23 Aug 2013 17:37:12 +0000 (19:37 +0200)]
qom: Pass available size to object_initialize()

To be passed on to object_initialize_with_type().

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> (virtio-ccw)
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqdev: Pass size to qbus_create_inplace()
Andreas Färber [Fri, 23 Aug 2013 22:02:27 +0000 (00:02 +0200)]
qdev: Pass size to qbus_create_inplace()

To be passed to object_initialize().

Since commit 39355c3826f5d9a2eb1ce3dc9b4cdd68893769d6 the argument is
void*, so drop some superfluous (BusState *) casts or direct parent
field usages.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agovirtio-mmio: Pass size to virtio_mmio_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:33:55 +0000 (20:33 +0200)]
virtio-mmio: Pass size to virtio_mmio_bus_new()

To be passed to qbus_create_initialize().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agovirtio-ccw: Pass size to virtio_ccw_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:27:30 +0000 (20:27 +0200)]
virtio-ccw: Pass size to virtio_ccw_bus_new()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agos390-virtio-bus: Pass size to virtio_s390_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:25:57 +0000 (20:25 +0200)]
s390-virtio-bus: Pass size to virtio_s390_bus_new()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agovirtio-pci: Pass size to virtio_pci_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:35:18 +0000 (20:35 +0200)]
virtio-pci: Pass size to virtio_pci_bus_new()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agousb: Pass size to usb_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:32:04 +0000 (20:32 +0200)]
usb: Pass size to usb_bus_new()

To be passed to qbus_create_inplace().

Use DEVICE() cast to avoid a direct parent field access.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoscsi: Pass size to scsi_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:30:03 +0000 (20:30 +0200)]
scsi: Pass size to scsi_bus_new()

To be passed to qbus_create_inplace().

Use DEVICE() casts instead of direct parent field access.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agopci: Pass size to pci_bus_new_inplace()
Andreas Färber [Fri, 23 Aug 2013 18:23:55 +0000 (20:23 +0200)]
pci: Pass size to pci_bus_new_inplace()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoide: Pass size to ide_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:18:50 +0000 (20:18 +0200)]
ide: Pass size to ide_bus_new()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoipack: Pass size to ipack_bus_new_inplace()
Andreas Färber [Fri, 23 Aug 2013 18:07:28 +0000 (20:07 +0200)]
ipack: Pass size to ipack_bus_new_inplace()

To be passed to qbus_create_inplace().

Simplify DEVICE() cast to avoid parent field access.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agointel-hda: Pass size to hda_codec_bus_init()
Andreas Färber [Fri, 23 Aug 2013 18:05:16 +0000 (20:05 +0200)]
intel-hda: Pass size to hda_codec_bus_init()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqom: Fix object_initialize_with_type() argument name in documentation
Andreas Färber [Fri, 23 Aug 2013 23:12:33 +0000 (01:12 +0200)]
qom: Fix object_initialize_with_type() argument name in documentation

@obj -> @data.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agovirtio: Remove unnecessary OBJECT() casts
Peter Maydell [Fri, 23 Aug 2013 13:38:55 +0000 (14:38 +0100)]
virtio: Remove unnecessary OBJECT() casts

There's no need to cast the first argument of object_initialize()
to Object. Remove these unnecessary casts.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoobject: Fix typo in qom/object.h
Peter Chubb [Wed, 7 Aug 2013 02:31:55 +0000 (12:31 +1000)]
object: Fix typo in qom/object.h

There's been a cut-and-paste error, it looks like, in the documentation
in qom/object.h.

Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Fri, 30 Aug 2013 17:26:04 +0000 (12:26 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Wenchao Xia (15) and Stefan Weil (1)
# Via Luiz Capitulino
* luiz/queue/qmp:
  monitor: improve auto complete of "help" for single command in sub group
  monitor: allow "help" show message for single command in sub group
  monitor: support sub command in auto completion
  monitor: refine monitor_find_completion()
  monitor: support sub command in help
  monitor: refine parse_cmdline()
  monitor: code move for parse_cmdline()
  monitor: avoid direct use of global variable *mon_cmds
  monitor: split off monitor_data_init()
  monitor: call sortcmdlist() only one time
  monitor: avoid use of global *cur_mon in readline_completion()
  monitor: avoid use of global *cur_mon in monitor_find_completion()
  monitor: avoid use of global *cur_mon in block_completion_it()
  monitor: avoid use of global *cur_mon in file_completion()
  monitor: avoid use of global *cur_mon in cmd_completion()
  monitor: Add missing attributes to local function

Message-id: 1377865357-6742-1-git-send-email-lcapitulino@redhat.com

11 years agoMerge remote-tracking branch 'borntraeger/tags/kdump' into staging
Anthony Liguori [Fri, 30 Aug 2013 17:25:56 +0000 (12:25 -0500)]
Merge remote-tracking branch 'borntraeger/tags/kdump' into staging

This is a set of patches dealing with kdump support for s390x/kvm.
kdump on s390x uses subcode 1 of diagnose 0x308 to put the hardware
in a defined state. This is different from a full reset, since it
does not touch all CPU registers.
These patches define the cpu resets, the subsystem reset a load
function and also wires up the "nmi" command to issue a RESTART
interrupt as defined in the z/Architecture principles of operation.

This allows recent guest kernels with properly setup userspace
to trigger kdump:
- via guest crash
- via nmi from the host

# gpg: Signature made Fri 30 Aug 2013 07:19:18 AM CDT using RSA key ID B5A61C7C
# gpg: Can't check signature: public key not found

# By Christian Borntraeger (5) and Eugene (jno) Dvurechenski (2)
# Via Christian Borntraeger
* borntraeger/tags/kdump:
  s390: wire up nmi command to raise a RESTART interrupt on S390
  s390: Implement load normal reset
  s390/cpu: split CPU reset into architectured functions
  s390: provide a cpu load normal function
  s390: provide I/O subsystem reset
  s390/kvm: basic implementation of diagnose 308 subcode 6
  s390x/kvm: Fix switch/case indentation for handle_diag

Message-id: 1377810649-47484-1-git-send-email-borntraeger@de.ibm.com

11 years agoqcow2-refcount: Repair OFLAG_COPIED errors
Max Reitz [Fri, 30 Aug 2013 12:34:28 +0000 (14:34 +0200)]
qcow2-refcount: Repair OFLAG_COPIED errors

Since the OFLAG_COPIED checks are now executed after the refcounts have
been repaired (if repairing), it is safe to assume that they are correct
but the OFLAG_COPIED flag may be not. Therefore, if its value differs
from what it should be (considering the according refcount), that
discrepancy can be repaired by correctly setting (or clearing that flag.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2-refcount: Move OFLAG_COPIED checks
Max Reitz [Fri, 30 Aug 2013 12:34:27 +0000 (14:34 +0200)]
qcow2-refcount: Move OFLAG_COPIED checks

Move the OFLAG_COPIED checks out of check_refcounts_l1 and
check_refcounts_l2 and after the actual refcount checks/fixes (since the
refcounts might actually change there).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Employ metadata overlap checks
Max Reitz [Fri, 30 Aug 2013 12:34:26 +0000 (14:34 +0200)]
qcow2: Employ metadata overlap checks

The pre-write overlap check function is now called before most of the
qcow2 writes (aborting it on collision or other error).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Metadata overlap checks
Max Reitz [Fri, 30 Aug 2013 12:34:25 +0000 (14:34 +0200)]
qcow2: Metadata overlap checks

Two new functions are added; the first one checks a given range in the
image file for overlaps with metadata (main header, L1 tables, L2
tables, refcount table and blocks).

The second one should be used immediately before writing to the image
file as it calls the first function and, upon collision, marks the
image as corrupt and makes the BDS unusable, thereby preventing
further access.

Both functions take a bitmask argument specifying the structures which
should be checked for overlaps, making it possible to also check
metadata writes against colliding with other structures.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Add corrupt bit
Max Reitz [Fri, 30 Aug 2013 12:34:24 +0000 (14:34 +0200)]
qcow2: Add corrupt bit

This adds an incompatible bit indicating corruption to qcow2. Any image
with this bit set may not be written to unless for repairing (and
subsequently clearing the bit if the repair has been successful).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Snapshotting zero clusters
Max Reitz [Fri, 30 Aug 2013 08:40:15 +0000 (10:40 +0200)]
qemu-iotests: Snapshotting zero clusters

This test creates an image with unallocated zero clusters, then creates
a snapshot. Afterwards, there should be neither any errors nor leaks.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2-refcount: Snapshot update for zero clusters
Max Reitz [Fri, 30 Aug 2013 08:40:14 +0000 (10:40 +0200)]
qcow2-refcount: Snapshot update for zero clusters

Account for all cluster types in qcow2_update_snapshot_refcounts;
this prevents this function from updating the refcount of unallocated
zero clusters which effectively led to wrong adjustments of the refcount
of cluster 0 (the main qcow2 header). This in turn resulted in images
with (unallocated) zero clusters having a cluster 0 refcount greater
than one after creating a snapshot.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agooption: Add assigned flag to QEMUOptionParameter
Max Reitz [Thu, 29 Aug 2013 09:15:44 +0000 (11:15 +0200)]
option: Add assigned flag to QEMUOptionParameter

Adds an "assigned" flag to QEMUOptionParameter which is cleared at the
beginning of parse_option_parameters and set on (successful)
set_option_parameter and set_option_parameter_int.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agogluster: Abort on AIO completion failure
Bharata B Rao [Tue, 27 Aug 2013 08:15:41 +0000 (13:45 +0530)]
gluster: Abort on AIO completion failure

Currently if gluster AIO callback thread fails to notify the QEMU thread about
AIO completion, we try graceful recovery by marking the disk drive as
inaccessible. This error recovery code is race-prone as found by Asias and
Stefan. However as found out by Paolo, this kind of error is impossible and
hence simplify the code that handles this error recovery.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: Remove old raw driver
Kevin Wolf [Wed, 28 Aug 2013 13:15:52 +0000 (15:15 +0200)]
block: Remove old raw driver

This is unused code now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoswitch raw block driver from "raw.o" to "raw_bsd.o"
Laszlo Ersek [Wed, 21 Aug 2013 10:41:23 +0000 (12:41 +0200)]
switch raw block driver from "raw.o" to "raw_bsd.o"

"Incoming" function prototypes and "outgoing" function calls must match
reality. Implemented using the "struct BlockDriver" definition in
"include/block/block_int.h", and gcc errors & warnings.

v1->v2:

On 08/20/13 09:51, Kevin Wolf wrote:
> Am 18.08.2013 um 16:29 hat Paolo Bonzini geschrieben:
>> Il 16/08/2013 16:15, Laszlo Ersek ha scritto:
>>> +static int raw_reopen_prepare(BDRVReopenState *reopen_state,
>>> +                              BlockReopenQueue *queue, Error **errp)
>>>  {
>>> -    return bdrv_reopen_prepare(bs->file);
>>> +    BDRVReopenState tmp = *reopen_state;
>>> +
>>> +    tmp.bs = tmp.bs->file;
>>> +    return bdrv_reopen_prepare(&tmp, queue, errp);
>>>  }
>>
>> This should just return zero, my fault.
>
> Which is because bdrv_reopen_queue() already queues bs->file for reopen.
> The simple return 0; implementation is shared by all other format drivers
> that support reopening images.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoraw_bsd: register bdrv_raw
Laszlo Ersek [Wed, 21 Aug 2013 10:41:22 +0000 (12:41 +0200)]
raw_bsd: register bdrv_raw

On 08/05/13 15:03, Paolo Bonzini wrote:
>
> [...]
>
> 5) Formats are registered with bdrv_register (takes a BlockDriver*). You
> also need to pass the caller of bdrv_register to block_init.

Fill in the BlockDriver structure with the raw_*() functions that have
been added to "block/raw_bsd.c", in the order the fields are defined in
"include/block/block_int.h".

I needed more explanation / naming examples for registering the driver
than what Paolo gave me, so I copied / adapted from "block/qcow2.c". The
parts I took as basis for modification are blamed on

    commit 5efa9d5a8b18841c9c62208a494d7f519238979a
    Author: Anthony Liguori <aliguori@us.ibm.com>
    Date:   Sat May 9 17:03:42 2009 -0500

        Convert block infrastructure to use new module init functionality

    commit 20d97356c9df6d68fbd37d6334fdb7063f24eab6
    Author: Blue Swirl <blauwirbel@gmail.com>
    Date:   Fri Apr 23 20:19:47 2010 +0000

        Fix OpenBSD build

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoraw_bsd: add raw_create_options
Laszlo Ersek [Wed, 21 Aug 2013 10:41:21 +0000 (12:41 +0200)]
raw_bsd: add raw_create_options

On 08/05/13 15:03, Paolo Bonzini wrote:
>
> [...]
>
> 4) There is another member, .create_options, which is an array of
> QEMUOptionParameter structs, terminated by an all-zero item.  The only
> option you need is for the virtual disk size.  You will find something
> to copy from in other block drivers, for example block/qcow2.c.

Code taken and adapted from "block/qcow2.c", as suggested. The code being
copied/modified is blamed on

    commit 20d97356c9df6d68fbd37d6334fdb7063f24eab6
    Author: Blue Swirl <blauwirbel@gmail.com>
    Date:   Fri Apr 23 20:19:47 2010 +0000

        Fix OpenBSD build

and

    commit 7c80ab3f21f0b1342f23057d4345ae266c7348d9
    Author: Jes Sorensen <Jes.Sorensen@redhat.com>
    Date:   Fri Dec 17 16:02:39 2010 +0100

        block/qcow2.c: rename qcow_ functions to qcow2_

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoraw_bsd: introduce "special members"
Laszlo Ersek [Wed, 21 Aug 2013 10:41:20 +0000 (12:41 +0200)]
raw_bsd: introduce "special members"

On 08/05/13 15:03, Paolo Bonzini wrote:
>
> [...]
>
> 3) These members are special
>
>     .format_name   is the string "raw"
>     .bdrv_open     raw_open should set bs->sg to bs->file->sg and return 0
>     .bdrv_close    raw_close should do nothing
>     .bdrv_probe    raw_probe should just return 1.

v1->v2:

On 08/20/13 10:11, Kevin Wolf wrote:
> Am 16.08.2013 um 16:15 hat Laszlo Ersek geschrieben:

>> +static int raw_probe(void)
>> +{
>> +    return 1;
>> +}
>
> Maybe add a comment here like "smallest possible positive score so that
> raw is used if and only if no other block driver works".

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoraw_bsd: add raw_create()
Laszlo Ersek [Wed, 21 Aug 2013 10:41:19 +0000 (12:41 +0200)]
raw_bsd: add raw_create()

On 08/05/13 15:03, Paolo Bonzini wrote:
>
> [...]
>
> 2) This is also a simple forwarder function:
>
>     .bdrv_create
>
> but there is no BlockDriverState argument so the forwarded-to function
> does not have a bs->file argument either.  The forwarded-to function is
> bdrv_create_file.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoraw_bsd: emit debug events in bdrv_co_readv() and bdrv_co_writev()
Laszlo Ersek [Wed, 21 Aug 2013 10:41:18 +0000 (12:41 +0200)]
raw_bsd: emit debug events in bdrv_co_readv() and bdrv_co_writev()

On 08/05/13 15:03, Paolo Bonzini wrote:
>
> [...]
>
> 1) BlockDriver is a struct in which these function members are
> interesting:
>
>     .bdrv_reopen_prepare
>     .bdrv_co_readv
>     .bdrv_co_writev
>     .bdrv_co_is_allocated
>     .bdrv_co_write_zeroes
>     .bdrv_co_discard
>     .bdrv_getlength
>     .bdrv_get_info
>     .bdrv_truncate
>     .bdrv_is_inserted
>     .bdrv_media_changed
>     .bdrv_eject
>     .bdrv_lock_medium
>     .bdrv_ioctl
>     .bdrv_aio_ioctl
>     .bdrv_has_zero_init
>
> They should be implemented as simple forwarders (see above). There are
> 16 functions listed here, you can easily see how this already accounts
> for 100+ SLOC roughly...
>
> The implementations of bdrv_co_readv and bdrv_co_writev should also call
> BLKDBG_EVENT on bs->file too, before forwarding to bs->file.  The events
> to be generated are BLKDBG_READ_AIO and BLKDBG_WRITE_AIO.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoadd skeleton for BSD licensed "raw" BlockDriver
Laszlo Ersek [Wed, 21 Aug 2013 10:41:17 +0000 (12:41 +0200)]
add skeleton for BSD licensed "raw" BlockDriver

On 08/05/13 15:03, Paolo Bonzini wrote:
>
>
> ----- Original Message -----
>> From: "Laszlo Ersek" <lersek@redhat.com>
>> To: "Paolo Bonzini" <pbonzini@redhat.com>
>> Sent: Monday, August 5, 2013 2:43:46 PM
>> Subject: Re: [PATCH 1/2] raw: add license header
>>
>> On 08/02/13 00:27, Paolo Bonzini wrote:
>>> On 08/01/2013 10:13 AM, Christoph Hellwig wrote:
>>>> On Wed, Jul 31, 2013 at 08:19:51AM +0200, Paolo Bonzini wrote:
>>>>> Most of the block layer is under the BSD license, thus it is
>>>>> reasonable to license block/raw.c the same way.  CCed people should
>>>>> ACK by replying with a Signed-off-by line.
>>>>
>>>> The coded was intended to be GPLv2.
>>>
>>> Laszlo, would you be willing to do clean-room reverse engineering?
>>>
>>> (No rants, please. :))
>>
>> What's the scope exactly?
>
> It's quite small, it's a file full of forwarders like
>
> static void raw_foo(BlockDriverState *bs)
> {
>     return bdrv_foo(bs->file);
> }
>
> It's 170 lines of code, all as boring as this.  I only picked you
> because I'm quite certain you have never seen the file (and the answer
> confirmed it).
>
> Basically:
>
> 1) BlockDriver is a struct in which these function members are
> interesting:
>
>     .bdrv_reopen_prepare
>     .bdrv_co_readv
>     .bdrv_co_writev
>     .bdrv_co_is_allocated
>     .bdrv_co_write_zeroes
>     .bdrv_co_discard
>     .bdrv_getlength
>     .bdrv_get_info
>     .bdrv_truncate
>     .bdrv_is_inserted
>     .bdrv_media_changed
>     .bdrv_eject
>     .bdrv_lock_medium
>     .bdrv_ioctl
>     .bdrv_aio_ioctl
>     .bdrv_has_zero_init
>
> They should be implemented as simple forwarders (see above).
> There are 16 functions listed here, you can easily see how this
> already accounts for 100+ SLOC roughly...
>
> The implementations of bdrv_co_readv and bdrv_co_writev should also
> call BLKDBG_EVENT on bs->file too, before forwarding to bs->file.  The
> events to be generated are BLKDBG_READ_AIO and BLKDBG_WRITE_AIO.
>
> 2) This is also a simple forwarder function:
>
>     .bdrv_create
>
> but there is no BlockDriverState argument so the forwarded-to function
> does not have a bs->file argument either.  The forwarded-to function
> is bdrv_create_file.
>
> 3) These members are special
>
>     .format_name   is the string "raw"
>     .bdrv_open     raw_open should set bs->sg to bs->file->sg and return 0
>     .bdrv_close    raw_close should do nothing
>     .bdrv_probe    raw_probe should just return 1.
>
> 4) There is another member, .create_options, which is an array of
> QEMUOptionParameter structs, terminated by an all-zero item.  The only
> option you need is for the virtual disk size.  You will find something
> to copy from in other block drivers, for example block/qcow2.c.
>
> 5) Formats are registered with bdrv_register (takes a BlockDriver*).
> You also need to pass the caller of bdrv_register to block_init.
>
> 6) I'm not sure how to organize the patch series, so I'll leave this to
> your creativity.  I guess in this case move/copy detection of git should
> be disabled.  I would definitely include this spec in the commit
> message as a proof of clean-room reverse engineering.
>
> 7) Remember a BSD header like the one in block.c.
>
> Paolo

This patch implements the email up to the paragraph ending with "100+ SLOC
roughly". The skeleton is generated from the list there, with a simple
shell loop using "sed" and the raw_foo() template.

The BSD license block is copied (and reflowed) from
"util/qemu-progress.c".

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock/qcow2.h: Avoid "1LL << 63" (shifts into sign bit)
Peter Maydell [Fri, 23 Aug 2013 16:35:45 +0000 (17:35 +0100)]
block/qcow2.h: Avoid "1LL << 63" (shifts into sign bit)

The expression "1LL << 63" tries to shift the 1 into the sign bit of a
'long long', which provokes a clang sanitizer warning:

runtime error: left shift of 1 by 63 places cannot be represented in type 'long long'

Use "1ULL << 63" as the definition of QCOW_OFLAG_COPIED instead
to avoid this. For consistency, we also update the other QCOW_OFLAG
definitions to use the ULL suffix rather than LL, though only the
shift by 63 is undefined behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Update reference output for 051
Kevin Wolf [Wed, 28 Aug 2013 14:12:20 +0000 (16:12 +0200)]
qemu-iotests: Update reference output for 051

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoRevert "block: Disable driver-specific options for 1.6"
Kevin Wolf [Wed, 28 Aug 2013 07:50:40 +0000 (09:50 +0200)]
Revert "block: Disable driver-specific options for 1.6"

This reverts commit 8afaefb8919dc8746a57c450a758717c516c7b0a.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqapi-types.py: Split off generate_struct_fields()
Kevin Wolf [Tue, 2 Jul 2013 10:18:18 +0000 (12:18 +0200)]
qapi-types.py: Split off generate_struct_fields()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblock: Remove redundant assertion
Kevin Wolf [Mon, 15 Apr 2013 08:59:42 +0000 (10:59 +0200)]
block: Remove redundant assertion

The failing condition is checked immediately before the assertion, so
keeping the assertion is kind of redundant.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Change default for new images to compat=1.1
Kevin Wolf [Mon, 19 Aug 2013 08:38:01 +0000 (10:38 +0200)]
qcow2: Change default for new images to compat=1.1

By the time that qemu 1.7 will be released, enough time will have passed
since qemu 1.1, which is the first version to understand version 3
images, that changing the default shouldn't hurt many people any more
and the benefits of using the new format outweigh the pain.

qemu-iotests already runs with compat=1.1 by default.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agos390: wire up nmi command to raise a RESTART interrupt on S390
Eugene (jno) Dvurechenski [Wed, 5 Dec 2012 14:50:07 +0000 (15:50 +0100)]
s390: wire up nmi command to raise a RESTART interrupt on S390

There is the 'nmi' command that is used to trigger a guest dump via kdump feature on x86.
s390 uses RESTART interrupt to trigger kdump.
So, this patch provides a mean to use 'nmi' command on s390 to raise RESTART interrupt.

The CPU to receive the RESTART interrupt is the "default" one.

There is an infrastructure to select the "default" CPU using 'cpu' command.
The 'info cpus' command can be used to see which one is the "default".

In order to wire up the RESTART to 'nmi' command we had to:
1. implement the kvm_s390_cpu_restart function by exporting the existing code
2. implement s390_cpu_restart function as kvm-aware wrapper
3. modify the qmp_inject_nmi function to enable (for s390) the scan for
   "default" CPU and call s390_cpu_restart for it;
3. fix some messages.

Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
11 years agos390: Implement load normal reset
Christian Borntraeger [Thu, 25 Jul 2013 14:57:45 +0000 (16:57 +0200)]
s390: Implement load normal reset

kdump on s390 uses a load normal reset to bring the system in a defined
state by doing a subsystem reset. The issuing CPUs will have an initial
CPU reset, all other CPUs will have a CPU reset as defined in POP (no
register content will change).

Implement this as architectured.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
11 years agos390/cpu: split CPU reset into architectured functions
Christian Borntraeger [Fri, 28 Jun 2013 08:51:09 +0000 (10:51 +0200)]
s390/cpu: split CPU reset into architectured functions

s390 provides several CPU resets:
- CPU reset, clears interrupts, stop processing, clears TLB, but does
  not touch registers
- initial CPU reset, like CPU reset, but also clears PSW, prefix, FPC,
  timer and control registers. It does not touch gprs, fprs and acrs (!)
- Power on reset: the full monty

wire up CPUClass reset to the full monty, but provide the lesser resets
as part of S390CPUClass.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
11 years agomonitor: improve auto complete of "help" for single command in sub group
Wenchao Xia [Tue, 27 Aug 2013 12:38:27 +0000 (20:38 +0800)]
monitor: improve auto complete of "help" for single command in sub group

Now special case "help *" in auto completion can work with sub commands,
such as "help info u*".

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: allow "help" show message for single command in sub group
Wenchao Xia [Tue, 27 Aug 2013 12:38:26 +0000 (20:38 +0800)]
monitor: allow "help" show message for single command in sub group

A new parameter type 'S' is introduced to allow user input any string.
"help info block" works normal now.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: support sub command in auto completion
Wenchao Xia [Tue, 27 Aug 2013 12:38:25 +0000 (20:38 +0800)]
monitor: support sub command in auto completion

This patch allows auto completion work normal for sub command case,
"info block [DEVICE]" can auto complete now, by re-enter the completion
function. In original code "info" is treated as a special case, now it
is treated as a sub command group, global variable info_cmds is not used
any more.

"help" command is still treated as a special case, since it is not a sub
command group but want to auto complete command in root command table.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: refine monitor_find_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:24 +0000 (20:38 +0800)]
monitor: refine monitor_find_completion()

In order to support sub command in auto completion, a reentrant function
is needed, so monitor_find_completion() is split into two parts. The
first part does parsing of user input which need to be done only once,
the second part does the auto completion job according to the parsing
result, which contains the necessary code to support sub command and
works as the reentrant function. The global "info_cmds" is still used
in second part, which will be replaced by sub command code later.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: support sub command in help
Wenchao Xia [Tue, 27 Aug 2013 12:38:23 +0000 (20:38 +0800)]
monitor: support sub command in help

The old code in help_cmd() uses global 'info_cmds' and treats it as a
special case. Actually 'info_cmds' is a sub command group of 'mon_cmds',
in order to avoid direct use of it, help_cmd() needs to change its work
mechanism to support sub command and not treat it as a special case
any more.

To support sub command, help_cmd() will first parse the input and then call
help_cmd_dump(), which works as a reentrant function. When it meets a sub
command, it simply enters the function again. Since help dumping needs to
know whole input to printf full help message include prefix, for example,
"help info block" need to printf prefix "info", so help_cmd_dump() takes all
args from input and extra parameter arg_index to identify the progress.
Another function help_cmd_dump_one() is introduced to printf the prefix
and command's help message.

Now help supports sub command, so later if another sub command group is
added in any depth, help will automatically work for it. Still "help info
block" will show error since command parser reject additional parameter,
which can be improved later. "log" is still treated as a special case.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: refine parse_cmdline()
Wenchao Xia [Tue, 27 Aug 2013 12:38:22 +0000 (20:38 +0800)]
monitor: refine parse_cmdline()

Since this function will be used by help_cmd() later, so improve
it to make it more generic and easier to use. free_cmdline_args()
is added too as paired function to free the result.

One change of this function is that, when the valid args in input
exceed the limit of MAX_ARGS, it fails now, instead of return with
MAX_ARGS of parsed args in old code. This should not impact much
since it is rare that user input many args in monitor's "help" and
auto complete scenario.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: code move for parse_cmdline()
Wenchao Xia [Tue, 27 Aug 2013 12:38:21 +0000 (20:38 +0800)]
monitor: code move for parse_cmdline()

help_cmd() need this function later, so move it. get_str() is called by
parse_cmdline() so it is moved also. Some code style error reported by
check script, is also fixed.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: avoid direct use of global variable *mon_cmds
Wenchao Xia [Tue, 27 Aug 2013 12:38:20 +0000 (20:38 +0800)]
monitor: avoid direct use of global variable *mon_cmds

New member *cmd_table is added in structure Monitor to avoid direct usage of
*mon_cmds. Now monitor have an associated command table, when global variable
*info_cmds is also discarded, structure Monitor would gain full control about
how to deal with user input.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: split off monitor_data_init()
Wenchao Xia [Tue, 27 Aug 2013 12:38:19 +0000 (20:38 +0800)]
monitor: split off monitor_data_init()

In qmp_human_monitor_command(), the monitor need to initialized for
basic functionalities, and later more init code will be added, so
split off this function. Note that it is different with QMP mode
monitor which accept json string from monitor's input,
qmp_human_monitor_command() retrieve the human style command from
QMP input, then send the command to a normal mode monitor.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: call sortcmdlist() only one time
Wenchao Xia [Tue, 27 Aug 2013 12:38:18 +0000 (20:38 +0800)]
monitor: call sortcmdlist() only one time

It doesn't need to be done for every monitor, so change it.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: avoid use of global *cur_mon in readline_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:17 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in readline_completion()

Now all completion functions do not use *cur_mon any more, instead
they use rs->mon. In short, structure ReadLineState decide where
the complete action would be taken now.

Tested with the case that qemu have two telnet monitors, auto
completion function works normal.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: avoid use of global *cur_mon in monitor_find_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:16 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in monitor_find_completion()

Parameter *mon is added, and local variable *mon added in previous patch
is removed. The caller readline_completion(), pass rs->mon as value, which
should be initialized in readline_init() called by monitor_init().

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: avoid use of global *cur_mon in block_completion_it()
Wenchao Xia [Tue, 27 Aug 2013 12:38:15 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in block_completion_it()

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: avoid use of global *cur_mon in file_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:14 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in file_completion()

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: avoid use of global *cur_mon in cmd_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:13 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in cmd_completion()

A new local variable *mon is added in monitor_find_completion()
to make compile pass, which will be removed later in
conversion patch for monitor_find_completion().

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomonitor: Add missing attributes to local function
Stefan Weil [Thu, 22 Aug 2013 19:30:09 +0000 (21:30 +0200)]
monitor: Add missing attributes to local function

Function expr_error gets a format string and variable arguments like printf.
It also never returns. Add the necessary attributes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agos390: provide a cpu load normal function
Christian Borntraeger [Thu, 25 Jul 2013 14:45:51 +0000 (16:45 +0200)]
s390: provide a cpu load normal function

Some code needs to perform an IPL-like bootup that mimics the
ESA (31bit) restart. Provide a cpu class method that does so.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
11 years agos390: provide I/O subsystem reset
Christian Borntraeger [Thu, 25 Jul 2013 14:37:37 +0000 (16:37 +0200)]
s390: provide I/O subsystem reset

Provide a function that resets the I/O subsystem.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
11 years agos390/kvm: basic implementation of diagnose 308 subcode 6
Eugene (jno) Dvurechenski [Wed, 19 Jun 2013 15:27:15 +0000 (17:27 +0200)]
s390/kvm: basic implementation of diagnose 308 subcode 6

Linux uses a check for subcode 6 to decide if other subcodes are
available. Provide a minimal implementation for subcode 6, as well
as for subcode 5.

Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[Move code from kvm.c into misc_helper.c]

11 years agos390x/kvm: Fix switch/case indentation for handle_diag
Christian Borntraeger [Fri, 30 Aug 2013 09:06:56 +0000 (11:06 +0200)]
s390x/kvm: Fix switch/case indentation for handle_diag

This alignes case statements to switch statements in the handle_diag
function as mandated by coding style.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
11 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5
Anthony Liguori [Thu, 29 Aug 2013 22:21:51 +0000 (17:21 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5

* qemu-kvm/uq/master:
  kvm-stub: fix compilation
  kvm: shorten the parameter list for get_real_device()
  kvm: i386: fix LAPIC TSC deadline timer save/restore
  kvm-all.c: max_cpus should not exceed KVM vcpu limit
  kvm: Simplify kvm_handle_io
  kvm: x86: fix setting IA32_FEATURE_CONTROL with nested VMX disabled
  kvm: add KVM_IRQFD_FLAG_RESAMPLE support
  kvm: migrate vPMU state
  target-i386: remove tabs from target-i386/cpu.h
  Initialize IA32_FEATURE_CONTROL MSR in reset and migration

Conflicts:
target-i386/cpu.h
target-i386/kvm.c

aliguori: fixup trivial conflicts due to whitespace and added cpu
          argument

Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
11 years agoMerge remote-tracking branch 'sweil/mingw' into stable-1.5
Anthony Liguori [Thu, 29 Aug 2013 22:20:17 +0000 (17:20 -0500)]
Merge remote-tracking branch 'sweil/mingw' into stable-1.5

# By Stefan Weil
# Via Stefan Weil
* sweil/mingw:
  gtk: Remove unused include statements which are not portable
  w32: Add an icon resource
  w32: Fix broken out-of-tree builds (missing version.o)

Message-id: 1377607132-21336-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
11 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into stable-1.5
Anthony Liguori [Thu, 29 Aug 2013 22:19:19 +0000 (17:19 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into stable-1.5

pc,pci,virtio fixes and cleanups

This includes pc and pci cleanups, future-proofing of ROM files,
and a virtio bugfix correcting splice on virtio console.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 26 Aug 2013 01:34:20 AM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Markus Armbruster (5) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table
  pc_piix: Kill pc_init1() memory region args
  pc: pc_compat_1_4() now can call pc_compat_1_5()
  pc: Create pc_compat_*() functions
  pc: Kill pc_init_pci_1_0()
  pc: Don't explode QEMUMachineInitArgs into local variables needlessly
  pc: Don't prematurely explode QEMUMachineInitArgs
  ppc: Don't duplicate QEMUMachineInitArgs in PPCE500Params
  ppc: Don't explode QEMUMachineInitArgs into local variables needlessly
  sun4: Don't prematurely explode QEMUMachineInitArgs
  q35: Add PCIe switch to example q35 configuration
  loader: store FW CFG ROM files in RAM
  arch_init: align MR size to target page size
  pc: cleanup 1.4 compat support

Message-id: 1377535318-30491-1-git-send-email-mst@redhat.com

11 years agotcg-i386: Remove abort from GETPC_LDST
Richard Henderson [Thu, 29 Aug 2013 15:21:37 +0000 (08:21 -0700)]
tcg-i386: Remove abort from GETPC_LDST

Indeed, remove it entirely and remove the is_tcg_gen_code check
from GETPC_EXT.

Fixes https://bugs.launchpad.net/qemu/+bug/1218098 wherein a call
to a "normal" helper function performed a sequence of tail calls
all the way into the memory helper functions, leading to a stack
frame in which the memory helper function appeared to be called
directly from tcg.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotarget-mips: fix get_physical_address() #if 0 build error
James Hogan [Tue, 27 Aug 2013 16:48:36 +0000 (17:48 +0100)]
target-mips: fix get_physical_address() #if 0 build error

In get_physical_address() is a qemu_log() call inside an #if 0 block.
When enabled the following build error is hit:

target-mips/helper.c In function ‘get_physical_address’:
target-mips/helper.c:220:13: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘hwaddr’ [-Werror=format]

Fix the *physical (hwaddr) formatting by using "%"HWADDR_PRIx instead of
TARGET_FMT_lx.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agokvm-stub: fix compilation
Paolo Bonzini [Tue, 27 Aug 2013 15:13:44 +0000 (17:13 +0200)]
kvm-stub: fix compilation

Non-KVM targets fail compilation on the uq/master branch.
Fix the prototype of kvm_irqchip_add_irqfd_notifier to match
the one in kvm-all.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
11 years agohw: Clean up bogus default boot order
Markus Armbruster [Fri, 16 Aug 2013 11:13:50 +0000 (13:13 +0200)]
hw: Clean up bogus default boot order

We set default boot order "cad" in every single machine definition
except "pseries" and "moxiesim", even though very few boards actually
care for boot order, and "cad" makes sense for even fewer.

Machines that care:

* pc and its variants

  Accept up to three letters 'a', 'b' (undocumented alias for 'a'),
  'c', 'd' and 'n'.  Reject all others (fatal with -boot).

* nseries (n800, n810)

  Check whether order starts with 'n'.  Silently ignored otherwise.

* prep, g3beige, mac99

  Extract the first character the machine understands (subset of
  'a'..'f').  Silently ignored otherwise.

* spapr

  Accept an arbitrary string (vl.c restricts it to contain only
  'a'..'p', no duplicates).

* sun4[mdc]

  Use the first character.  Silently ignored otherwise.

Strip characters these machines ignore from their default boot order.

For all other machines, remove the unused default boot order
alltogether.

Note that my rename of QEMUMachine member boot_order to
default_boot_order and QEMUMachineInitArgs member boot_device to
boot_order has a welcome side effect: it makes every use of boot
orders visible in this patch, for easy review.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: add config space access traces
Alexey Kardashevskiy [Wed, 21 Aug 2013 04:42:06 +0000 (14:42 +1000)]
pci: add config space access traces

This adds pci_cfg_read and pci_cfg_write traces for config spaces
accesses.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agogtk: Remove unused include statements which are not portable
Stefan Weil [Sun, 18 Aug 2013 07:26:34 +0000 (09:26 +0200)]
gtk: Remove unused include statements which are not portable

These include files don't exist for MinGW and are not needed for Linux
(and hopefully for other hosts as well), so remove them.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
11 years agow32: Add an icon resource
Stefan Weil [Sat, 17 Aug 2013 07:32:04 +0000 (09:32 +0200)]
w32: Add an icon resource

The QEMU mascot which was already used for the NSIS installer
is now used for all QEMU executables.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
11 years agow32: Fix broken out-of-tree builds (missing version.o)
Stefan Weil [Fri, 16 Aug 2013 19:51:53 +0000 (21:51 +0200)]
w32: Fix broken out-of-tree builds (missing version.o)

Commit 0b516ef0dfad9a7b34c675c98e8ec92ab4d38466 added version.o to all
executables, but broke out-of-tree builds: for those builds the pattern
rule %.o: %.rc from rules.mak does not match, so version.o was no longer
built.

Adding explicit build rules fixes this.

Reported-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agopc: fix regression for 64 bit PCI memory
Michael S. Tsirkin [Tue, 27 Aug 2013 05:37:26 +0000 (08:37 +0300)]
pc: fix regression for 64 bit PCI memory

commit 398489018183d613306ab022653552247d93919f
    pc: limit 64 bit hole to 2G by default
introduced a way for management to control
the window allocated to the 64 bit PCI hole.

This is useful, but existing management tools do not know how to set
this property.  As a result, e.g. specifying a large ivshmem device with
size > 4G is broken by default.  For example this configuration no
longer works:

-device ivshmem,size=4294967296,chardev=cfoo
-chardev socket,path=/tmp/sock,id=cfoo,server,nowait

Fix this by detecting that hole size was not specified
and defaulting to the backwards-compatible value of 1 << 62.

Cc: qemu-stable@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Introduce helper to retrieve a PCI device's DMA address space
Alexey Kardashevskiy [Fri, 9 Aug 2013 15:09:08 +0000 (01:09 +1000)]
pci: Introduce helper to retrieve a PCI device's DMA address space

A PCI device's DMA address space (possibly an IOMMU) is returned by a
method on the PCIBus.  At the moment that only has one caller, so the
method is simply open coded.  We'll need another caller for VFIO, so
this patch introduces a helper/wrapper function.

If IOMMU is not set, the pci_device_iommu_address_space() function
returns the parent's IOMMU skipping the "bus master" address space as
otherwise proper emulation would require more effort for no benefit.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[aik: added inheritance from parent if iommu is not set for the current bus]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agotcg-i386: Use new return-argument ld/st helpers
Richard Henderson [Thu, 25 Jul 2013 17:16:52 +0000 (07:16 -1000)]
tcg-i386: Use new return-argument ld/st helpers

Discontinue the jump-around-jump-to-jump scheme, trading it for a single
immediate move instruction.  The two extra jumps always consume 7 bytes,
whereas the immediate move is either 5 or 7 bytes depending on where the
code_gen_buffer gets located.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Tidy softmmu_template.h
Richard Henderson [Fri, 26 Jul 2013 18:29:15 +0000 (08:29 -1000)]
tcg: Tidy softmmu_template.h

Avoid a loop in the tlb_fill path; the fill will either succeed or
generate an exception.

Inline the slow_ld/st function; it was a complete copy of the main
helper except for the actual cross-page unaligned code, and the
compiler was inlining it anyway.

Add unlikely markers optimizing for the most common case of simple
tlb miss.

Make sure the compiler can optimize away the unaligned paths for a
1 byte access.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Add mmu helpers that take a return address argument
Richard Henderson [Thu, 25 Jul 2013 00:54:12 +0000 (14:54 -1000)]
tcg: Add mmu helpers that take a return address argument

Allow the code that tcg generates to be less obtuse, passing in
the return address directly instead of computing it in the helper.

Maintain the old entrance point unchanged as an alternate entry point.

Delete the helper_st*_cmmu prototypes; the implementations did not exist.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-i386: Tidy qemu_ld/st slow path
Richard Henderson [Thu, 25 Jul 2013 16:33:33 +0000 (06:33 -1000)]
tcg-i386: Tidy qemu_ld/st slow path

Use existing stack space for arguments; don't push/pop.
Use less ifdefs and more C ifs.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-i386: Try pc-relative lea for constant formation
Richard Henderson [Thu, 25 Jul 2013 20:00:41 +0000 (10:00 -1000)]
tcg-i386: Try pc-relative lea for constant formation

Use a 7 byte lea before the ultimate 10 byte movq.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-i386: Add and use tcg_out64
Richard Henderson [Thu, 25 Jul 2013 19:42:17 +0000 (09:42 -1000)]
tcg-i386: Add and use tcg_out64

No point in splitting the write into 32-bit pieces.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Tidy generated code for tcg_outN
Richard Henderson [Wed, 14 Aug 2013 16:46:38 +0000 (09:46 -0700)]
tcg: Tidy generated code for tcg_outN

Aliasing was forcing s->code_ptr to be re-read after the store.
Keep the pointer in a local variable to help the compiler.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Mon, 26 Aug 2013 14:19:50 +0000 (09:19 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Alex Bligh (32) and others
# Via Stefan Hajnoczi
* stefanha/block: (42 commits)
  win32-aio: drop win32_aio_flush_cb()
  aio-win32: replace incorrect AioHandler->opaque usage with ->e
  aio / timers: remove dummy_io_handler_flush from tests/test-aio.c
  aio / timers: Remove legacy interface
  aio / timers: Switch entire codebase to the new timer API
  aio / timers: Add scripts/switch-timer-api
  aio / timers: Add test harness for AioContext timers
  aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API
  aio / timers: Convert rtc_clock to be a QEMUClockType
  aio / timers: Remove main_loop_timerlist
  aio / timers: Rearrange timer.h & make legacy functions call non-legacy
  aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms
  aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline
  aio / timers: Remove alarm timers
  aio / timers: Add documentation and new format calls
  aio / timers: Use all timerlists in icount warp calculations
  aio / timers: Introduce new API timer_new and friends
  aio / timers: On timer modification, qemu_notify or aio_notify
  aio / timers: Convert mainloop to use timeout
  aio / timers: Convert aio_poll to use AioContext timers' deadline
  ...

Message-id: 1377202298-22896-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
11 years agoMerge remote-tracking branch 'afaerber/tags/0.15-maintainer-for-anthony' into staging
Anthony Liguori [Mon, 26 Aug 2013 14:19:36 +0000 (09:19 -0500)]
Merge remote-tracking branch 'afaerber/tags/0.15-maintainer-for-anthony' into staging

MAINTAINERS update for stable-0.15

# gpg: Signature made Thu 22 Aug 2013 10:59:31 AM CDT using RSA key ID 3E7E013F
# gpg: Can't check signature: public key not found

# By Andreas Färber
# Via Andreas Färber
* afaerber/tags/0.15-maintainer-for-anthony:
  MAINTAINERS: Take over 0.15 maintenance

11 years agovirtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor...
yinyin [Thu, 22 Aug 2013 06:47:16 +0000 (14:47 +0800)]
virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table

virtqueue_get_avail_bytes: when found a indirect desc, we need loop over it.
           /* loop over the indirect descriptor table */
           indirect = 1;
           max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
           num_bufs = i = 0;
           desc_pa = vring_desc_addr(desc_pa, i);
But, It init i to 0, then use i to update desc_pa. so we will always get:
desc_pa = vring_desc_addr(desc_pa, 0);
the last two line should swap.

Cc: qemu-stable@nongnu.org
Signed-off-by: Yin Yin <yin.yin@cs2c.com.cn>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agodisas-objdump: Pass --adjust-vma to objdump
Richard Henderson [Sat, 17 Aug 2013 06:29:47 +0000 (23:29 -0700)]
disas-objdump: Pass --adjust-vma to objdump

This gives the dumped blob its correct address during disassembly,
which makes pc-relative insns much easier to interpret.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agodisas: Add disas-objdump.pl
Richard Henderson [Sat, 17 Aug 2013 06:29:46 +0000 (23:29 -0700)]
disas: Add disas-objdump.pl

The script massages the output produced for architectures that are
not supported internally by qemu though an external objdump program
for disassembly.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agodisas: Implement fallback to dump object code as hex
Richard Henderson [Sat, 17 Aug 2013 06:29:45 +0000 (23:29 -0700)]
disas: Implement fallback to dump object code as hex

The OBJD-[HT] tags will be used by a script to run the hex blob
through objdump --disassemble.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agokvm: shorten the parameter list for get_real_device()
Wei Yang [Thu, 22 Aug 2013 16:40:12 +0000 (18:40 +0200)]
kvm: shorten the parameter list for get_real_device()

get_real_device() has 5 parameters with the last 4 is contained in the first
structure.

This patch removes the last 4 parameters and directly use them from the first
parameter.

Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agowin32-aio: drop win32_aio_flush_cb()
Stefan Hajnoczi [Thu, 22 Aug 2013 13:28:36 +0000 (15:28 +0200)]
win32-aio: drop win32_aio_flush_cb()

The io_flush argument to qemu_aio_set_event_notifier() has been removed
since the block layer learnt to drain requests by itself.  Fix the
Windows build for win32-aio.o by updating the
qemu_aio_set_event_notifier() call and dropping win32_aio_flush_cb().

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoaio-win32: replace incorrect AioHandler->opaque usage with ->e
Stefan Hajnoczi [Thu, 22 Aug 2013 13:28:35 +0000 (15:28 +0200)]
aio-win32: replace incorrect AioHandler->opaque usage with ->e

The AioHandler->opaque field does not exist in aio-win32.c.  The code
that uses it was incorrectly copied from aio-posix.c.  For Windows we
can use AioHandler->e to match against AioContext->notifier.

This patch fixes the Windows build for aio-win32.o.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoaio / timers: remove dummy_io_handler_flush from tests/test-aio.c
Alex Bligh [Thu, 22 Aug 2013 18:59:16 +0000 (19:59 +0100)]
aio / timers: remove dummy_io_handler_flush from tests/test-aio.c

Remove dummy_io_handler_flush from tests/test-aio.c as it does
nothing now.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoaio / timers: Remove legacy interface
Alex Bligh [Wed, 21 Aug 2013 15:03:09 +0000 (16:03 +0100)]
aio / timers: Remove legacy interface

Remove the legacy interface from include/qemu/timers.h.

Ensure struct QEMUClock is not exposed at all.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoaio / timers: Switch entire codebase to the new timer API
Alex Bligh [Wed, 21 Aug 2013 15:03:08 +0000 (16:03 +0100)]
aio / timers: Switch entire codebase to the new timer API

This is an autogenerated patch using scripts/switch-timer-api.

Switch the entire code base to using the new timer API.

Note this patch may introduce some line length issues.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>