]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
10 years agovirtio-net: use virtio wrappers to access headers
Rusty Russell [Tue, 24 Jun 2014 17:42:54 +0000 (19:42 +0200)]
virtio-net: use virtio wrappers to access headers

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
[ pass VirtIODevice * to memory accessors,
  converted new tswap locations to virtio_tswap,
  Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio: allow byte swapping for vring
Rusty Russell [Tue, 24 Jun 2014 17:40:16 +0000 (19:40 +0200)]
virtio: allow byte swapping for vring

Quoting original text from Rusty: "This is based on a simpler patch by Anthony
Liguouri".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
[ add VirtIODevice * argument to most helpers,
  Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio: memory accessors for endian-ambivalent targets
Greg Kurz [Tue, 24 Jun 2014 17:39:55 +0000 (19:39 +0200)]
virtio: memory accessors for endian-ambivalent targets

This is the virtio-access.h header file taken from Rusty's "endian-ambivalent
targets using legacy virtio" patch. It introduces helpers that should be used
when accessing vring data or by drivers for data that contains headers.
The virtio config space is also target endian, but the current code already
handles that with the virtio_is_big_endian() helper. There is no obvious
benefit at using the virtio accessors in this case.

Now we have two distinct paths: a fast inline one for fixed endian targets,
and a slow out-of-line one for targets that define the new TARGET_IS_BIENDIAN
macro.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
[ relicensed virtio-access.h to GPLv2+ on Rusty's request,
  pass &address_space_memory to physical memory accessors,
  per-device endianness,
  virtio tswap16 and tswap64 helpers,
  faspath for fixed endian targets,
  Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Cc: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio: add endian-ambivalent support to VirtIODevice
Greg Kurz [Tue, 24 Jun 2014 17:38:54 +0000 (19:38 +0200)]
virtio: add endian-ambivalent support to VirtIODevice

Some CPU families can dynamically change their endianness. This means we
can have little endian ppc or big endian arm guests for example. This has
an impact on legacy virtio data structures since they are target endian.
We hence introduce a new property to track the endianness of each virtio
device. It is reasonnably assumed that endianness won't change while the
device is in use : we hence capture the device endianness when it gets
reset.

We migrate this property in a subsection, after the device descriptor. This
means the load code must not rely on it until it is restored. As a consequence,
the vring sanity checks had to be moved after the call to vmstate_load_state().
We enforce paranoia by poisoning the property at the begining of virtio_load().

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agocpu: introduce CPUClass::virtio_is_big_endian()
Greg Kurz [Tue, 24 Jun 2014 17:33:21 +0000 (19:33 +0200)]
cpu: introduce CPUClass::virtio_is_big_endian()

If we want to support targets that can change endianness (modern PPC and
ARM for the moment), we need to add a per-CPU class method to be called
from the virtio code. The virtio_ prefix in the name is a hint for people
to avoid misusage (aka. anywhere but from the virtio code).

The default behaviour is to return the compile-time default target
endianness.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoexec: introduce target_words_bigendian() helper
Greg Kurz [Tue, 24 Jun 2014 17:26:29 +0000 (19:26 +0200)]
exec: introduce target_words_bigendian() helper

We currently have a virtio_is_big_endian() helper that provides the target
endianness to the virtio code. As of today, the helper returns a fixed
compile-time value. Of course, this will have to change if we want to
support target endianness changes at run-time.

Let's move the TARGET_WORDS_BIGENDIAN bits out to a new helper and have
virtio_is_big_endian() implemented on top of it.

This patch doesn't change any functionality.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio: add subsections to the migration stream
Greg Kurz [Tue, 24 Jun 2014 17:22:30 +0000 (19:22 +0200)]
virtio: add subsections to the migration stream

There is a need to add some more fields to VirtIODevice that should be
migrated (broken status, endianness). The problem is that we do not
want to break compatibility while adding a new feature... This issue has
been addressed in the generic VMState code with the use of optional
subsections. As a *temporary* alternative to port the whole virtio
migration code to VMState, this patch mimics a similar subsectionning
ability for virtio, using the VMState code.

Since each virtio device is streamed in its own section, the idea is to
stream subsections between the end of the device section and the start
of the next sections. This allows an older QEMU to complain and exit
when fed with subsections:

Unknown savevm section type 5
load of migration failed

Suggested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio-rng: implement per-device migration calls
Greg Kurz [Tue, 24 Jun 2014 17:20:23 +0000 (19:20 +0200)]
virtio-rng: implement per-device migration calls

While we are here, we also check virtio_load() return value.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio-balloon: implement per-device migration calls
Greg Kurz [Tue, 24 Jun 2014 17:20:08 +0000 (19:20 +0200)]
virtio-balloon: implement per-device migration calls

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio-serial: implement per-device migration calls
Greg Kurz [Tue, 24 Jun 2014 17:19:48 +0000 (19:19 +0200)]
virtio-serial: implement per-device migration calls

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio-blk: implement per-device migration calls
Greg Kurz [Tue, 24 Jun 2014 17:19:23 +0000 (19:19 +0200)]
virtio-blk: implement per-device migration calls

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio-net: implement per-device migration calls
Greg Kurz [Tue, 24 Jun 2014 17:19:03 +0000 (19:19 +0200)]
virtio-net: implement per-device migration calls

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio: introduce device specific migration calls
Greg Kurz [Tue, 24 Jun 2014 17:15:31 +0000 (19:15 +0200)]
virtio: introduce device specific migration calls

In order to migrate virtio subsections, they should be streamed after
the device itself. We need the device specific code to be called from
the common migration code to achieve this. This patch introduces load
and save methods for this purpose.

Suggested-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio-serial: don't migrate the config space
Alexander Graf [Tue, 24 Jun 2014 17:13:50 +0000 (19:13 +0200)]
virtio-serial: don't migrate the config space

The device configuration is set at realize time and never changes. It
should not be migrated as it is done today. For the sake of compatibility,
let's just skip them at load time.

Signed-off-by: Alexander Graf <agraf@suse.de>
[ added missing casts to uint16_t *,
  added From, SoB and commit message,
  Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovirtio-net: byteswap virtio-net header
Cédric Le Goater [Tue, 24 Jun 2014 17:11:32 +0000 (19:11 +0200)]
virtio-net: byteswap virtio-net header

TCP connectivity fails when the guest has a different endianness.
The packets are silently dropped on the host by the tap backend
when they are read from user space because the endianness of the
virtio-net header is in the wrong order. These lines may appear
in the guest console:

[  454.709327] skbuff: bad partial csum: csum=8704/4096 len=74
[  455.702554] skbuff: bad partial csum: csum=8704/4096 len=74

The issue that got first spotted with a ppc64le PowerKVM guest,
but it also exists for the less common case of a x86_64 guest run
by a big-endian ppc64 TCG hypervisor.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
[ Ported from PowerKVM,
  Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovhost-user: typo fixups
Michael S. Tsirkin [Sun, 29 Jun 2014 14:58:48 +0000 (17:58 +0300)]
vhost-user: typo fixups

Fix typo in field name.
Strip two consequitive empty lines.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovhost-user: fix regions provied with VHOST_USER_SET_MEM_TABLE message
Damjan Marion [Thu, 26 Jun 2014 21:01:32 +0000 (23:01 +0200)]
vhost-user: fix regions provied with VHOST_USER_SET_MEM_TABLE message

Old code was affected by memory gaps which resulted in buffer pointers
pointing to address outside of the mapped regions.

Here we are introducing following changes:
 - new function qemu_get_ram_block_host_ptr() returns host pointer
   to the ram block, it is needed to calculate offset of specific
   region in the host memory
 - new field mmap_offset is added to the VhostUserMemoryRegion. It
   contains offset where specific region starts in the mapped memory.
   As there is stil no wider adoption of vhost-user agreement was made
   that we will not bump version number due to this change
 - other fileds in VhostUserMemoryRegion struct are not changed, as
   they are all needed for usermode app implementation
 - region data is not taken from ram_list.blocks anymore, instead we
   use region data which is alredy calculated for use in vhost-net
 - Now multiple regions can have same FD and user applicaton can call
   mmap() multiple times with the same FD but with different offset
   (user needs to take care for offset page alignment)

Signed-off-by: Damjan Marion <damarion@cisco.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Damjan Marion <damarion@cisco.com>
10 years agonuma: Reject configuration if not all node IDs are present
Eduardo Habkost [Thu, 26 Jun 2014 21:33:20 +0000 (18:33 -0300)]
numa: Reject configuration if not all node IDs are present

We don't support sparse NUMA node IDs yet, so this changes QEMU to
reject configs where not all nodes are present.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agonuma: Reject duplicate node IDs
Eduardo Habkost [Thu, 26 Jun 2014 21:33:19 +0000 (18:33 -0300)]
numa: Reject duplicate node IDs

The same nodeid shouldn't appear multiple times in the command-line.

In addition to detecting command-line mistakes, this will fix a bug
where nb_numa_nodes may become larger than MAX_NODES (and cause
out-of-bounds access on the numa_info array).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agonuma: Keep track of NUMA nodes present on the command-line
Eduardo Habkost [Thu, 26 Jun 2014 21:33:18 +0000 (18:33 -0300)]
numa: Keep track of NUMA nodes present on the command-line

Based on "enable sparse node numbering" patch from Nishanth Aravamudan,
but without the code to actually support sparse node IDs. This just adds
the code to keep track of present/non-present nodes on the command-line,
without changing any behavior.

Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
[Rename max_numa_node to max_numa_nodeid -Eduardo]
[Initialize max_numa_nodeid to 0 -Eduardo]
[Use MAX() macro when setting max_numa_nodeid -Eduardo]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoAllow mismatched virtio config-len
Dr. David Alan Gilbert [Fri, 27 Jun 2014 19:02:48 +0000 (20:02 +0100)]
Allow mismatched virtio config-len

Commit 'virtio: validate config_len on load' restricted config_len
loaded from the wire to match the config_len that the device had.

Unfortunately, there are cases where this isn't true, the one
we found it on was the wce addition in virtio-blk.

Allow mismatched config-lengths:
   *) If the version on the wire is shorter then fine
   *) If the version on the wire is longer, load what we have space
      for and skip the rest.

(This is mst@redhat.com's rework of what I originally posted)

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopc: make isapc and pc-0.10 to pc-0.13 have 1.7.0 memory layout
Don Slutz [Wed, 25 Jun 2014 20:19:07 +0000 (16:19 -0400)]
pc: make isapc and pc-0.10 to pc-0.13 have 1.7.0 memory layout

QEMU 2.0 changed memory layout for isapc and pc-0.10 to pc-0.13.
This prevents migration from QEMU 1.7.0 for these
machine types when -m 3.5G is specified.

Paolo Bonzini asked that:

    smbios_legacy_mode = true;
    has_reserved_memory = false;
    option_rom_has_mr = true;
    rom_file_has_mr = false;

also be done.

Cc: qemu-stable@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Don Slutz <dslutz@verizon.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Fixes: https://bugs.launchpad.net/qemu/+bug/1334307
Tested-by: "Slutz, Donald Christopher" <dslutz@verizon.com>
10 years agovhost-user: fix wrong ids in documentation
Damjan Marion [Wed, 25 Jun 2014 12:49:36 +0000 (14:49 +0200)]
vhost-user: fix wrong ids in documentation

Signed-off-by: Damjan Marion <damarion@cisco.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agomc146818rtc: add rtc-reset-reinjection QMP command
Marcelo Tosatti [Tue, 24 Jun 2014 21:55:11 +0000 (18:55 -0300)]
mc146818rtc: add rtc-reset-reinjection QMP command

It is necessary to reset RTC interrupt reinjection backlog if
guest time is synchronized via a different mechanism, such as
QGA's guest-set-time command.

Failing to do so causes both corrections to be applied (summed),
resulting in an incorrect guest time.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopc: Fix "prog_if" typo on PC_COMPAT_2_0
Eduardo Habkost [Tue, 24 Jun 2014 22:57:55 +0000 (19:57 -0300)]
pc: Fix "prog_if" typo on PC_COMPAT_2_0

The property name is "prog_if", not "prof_if".

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reported-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopc: Move q35 compat props to PC_COMPAT_*
Eduardo Habkost [Wed, 25 Jun 2014 02:04:44 +0000 (23:04 -0300)]
pc: Move q35 compat props to PC_COMPAT_*

For each compat property on PC_Q35_COMPAT_*, there are only two
possibilities:

 * If the device is never instantiated when using a machine other than
   pc-q35, then the compat property can be safely added to
   PC_COMPAT_*;
 * If the device can be instantiated when using a machine other than
   pc-q35, that means the other machines also need the compat property
   to be set.

That means we don't need separate PC_Q35_COMPAT_* macros at all, today.

The hpet.hpet-intcap case is interesting: piix and q35 do have something
that emulates different defaults, but the machine-specific default is
applied _after_ compat_props are applied, by simply checking if the
property is zero (which is the real default on the hpet code).

The hpet.hpet-intcap=0x4 compat property can (should?) be applied to
piix too, because 0x4 was the default on both piix and q35 before the
hpet-intcap property was introduced.

Now, if one day we change the default HPET intcap on one of the PC
machine-types again, we may want to introduce PC_{Q35,I440FX}_COMPAT
macros. But while we don't need that, we can keep the code simple.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Cc: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agonuma: fix comment
Michael S. Tsirkin [Tue, 24 Jun 2014 05:50:30 +0000 (08:50 +0300)]
numa: fix comment

s/if given for/is given for/;

Reported-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoopenrisc: fix comment
Michael S. Tsirkin [Tue, 24 Jun 2014 04:44:30 +0000 (07:44 +0300)]
openrisc: fix comment

Fix English in comment:

s/the each/each/

s/  \*\// \*\//

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
10 years agonuma: fix comment
Michael S. Tsirkin [Tue, 24 Jun 2014 04:43:37 +0000 (07:43 +0300)]
numa: fix comment

Fix up English in comments:
s/the each/each/

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/riku/linux-user-for-upstream' into staging
Peter Maydell [Sun, 29 Jun 2014 15:44:13 +0000 (16:44 +0100)]
Merge remote-tracking branch 'remotes/riku/linux-user-for-upstream' into staging

* remotes/riku/linux-user-for-upstream:
  linux-user: support the SIOCGIFINDEX ioctl
  linux-user: support the KDSIGACCEPT ioctl
  linux-user: allow NULL tv argument for settimeofday
  linux-user: respect timezone for settimeofday
  linux-user: fix struct target_epoll_event layout for MIPS
  linux-user: support strace of epoll_create1
  linux-user: allow NULL arguments to mount
  linux-user: support SO_PASSSEC setsockopt option
  linux-user: support SO_{SND, RCV}BUFFORCE setsockopt options
  linux-user: support SO_ACCEPTCONN getsockopt option
  linux-user: translate the result of getsockopt SO_TYPE
  linux-user: added fake open() for /proc/self/cmdline
  Add support for MAP_NORESERVE mmap flag.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/xtensa/tags/20140629-xtensa' into staging
Peter Maydell [Sun, 29 Jun 2014 15:17:50 +0000 (16:17 +0100)]
Merge remote-tracking branch 'remotes/xtensa/tags/20140629-xtensa' into staging

Xtensa fixes and improvements queue 2014-06-29:
- fix FLASH mapping to boot region for KC705;
- clean up boot parameters passing;
- add uImage, DTB and initrd support.

# gpg: Signature made Sat 28 Jun 2014 23:40:32 BST using RSA key ID F83FA044
# gpg: Good signature from "Max Filippov <max.filippov@cogentembedded.com>"
# gpg:                 aka "Max Filippov <jcmvbkbc@gmail.com>"

* remotes/xtensa/tags/20140629-xtensa:
  hw/xtensa/xtfpga: implement initrd loading
  hw/xtensa/xtfpga: implement DTB loading
  hw/xtensa/xtfpga: implement uImage loading
  hw/xtensa/xtfpga: add memory info to bootparam
  hw/xtensa/xtfpga: refactor bootparameters filling
  hw/xtensa/xtfpga: use symbolic constants for bootparam tags
  hw/xtensa/xtfpga: retrieve parameters from machine_opts
  hw/xtensa: replace fprintfs with error_report
  hw/xtensa: remove extraneous xtensa_ prefix from file names
  hw/xtensa/xtfpga: fix FLASH mapping to boot region for KC705

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Sun, 29 Jun 2014 14:24:54 +0000 (15:24 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block patches for 2.1.0-rc0

# gpg: Signature made Fri 27 Jun 2014 19:50:32 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (47 commits)
  iotests: Fix 083 for out-of-tree builds
  iotests: Drop Python version from 065's Shebang
  iotests: Use $PYTHON for Python scripts
  iotests: Source common.env
  configure: Enable out-of-tree iotests
  iotests: Allow out-of-tree run
  block.c: Don't return success for bdrv_append_temp_snapshot() failure
  qemu-iotests: Add TestRepairQuorum to 041 to test drive-mirror node-name mode.
  block: Add replaces argument to drive-mirror
  blockjob: Fix recent BLOCK_JOB_ERROR regression
  blockjob: Fix recent BLOCK_JOB_READY regression
  virtio-blk: Rename complete_request_early to complete_request_vring
  virtio-blk: Unify {non-,}dataplane's request handlings
  virtio-blk: Schedule BH in the right context
  virtio-blk: Export request handling functions to dataplane
  virtio-blk: Make request completion function virtual
  block: acquire AioContext in qmp_query_blockstats()
  block: make bdrv_query_stats() static
  virtio-blk: Fix and clean up the in_sg and out_sg check
  virtio-blk: Fill in VirtIOBlockReq.out in dataplane code
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Sun, 29 Jun 2014 12:39:04 +0000 (13:39 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  docs/qmp: Fix documentation of BLOCK_JOB_READY to match code
  char: report frontend open/closed state in 'query-chardev'
  virtio-serial: report frontend connection state via monitor
  qmp: add qmp-events.txt back
  qapi event: clean up in callers
  qapi script: clean up in scripts
  qapi: ignore generated event files
  qapi: move event defines

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Peter Maydell [Sun, 29 Jun 2014 11:45:54 +0000 (12:45 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

Net patches

# gpg: Signature made Fri 27 Jun 2014 14:10:57 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/net-pull-request:
  hw/net/eepro100: Implement read-only bits in MDI registers
  net: move queue number into NICPeers
  net: L2TPv3 transport
  qemu-bridge-helper: Fix fd leak in main()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agolinux-user: support the SIOCGIFINDEX ioctl
Paul Burton [Sun, 22 Jun 2014 10:25:48 +0000 (11:25 +0100)]
linux-user: support the SIOCGIFINDEX ioctl

Add a definition of the SIOCGIFINDEX ioctl, allowing its use by target
programs.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: support the KDSIGACCEPT ioctl
Paul Burton [Sun, 22 Jun 2014 10:25:47 +0000 (11:25 +0100)]
linux-user: support the KDSIGACCEPT ioctl

Add a definition of the KDSIGACCEPT ioctl & allow its use by target
programs.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: allow NULL tv argument for settimeofday
Paul Burton [Sun, 22 Jun 2014 10:25:41 +0000 (11:25 +0100)]
linux-user: allow NULL tv argument for settimeofday

The tv argument to the settimeofday syscall is allowed to be NULL, if
the program only wishes to provide the timezone. QEMU previously
returned -EFAULT when tv was NULL. Instead, execute the syscall &
provide NULL to the kernel as the target program expected.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: respect timezone for settimeofday
Paul Burton [Sun, 22 Jun 2014 10:25:40 +0000 (11:25 +0100)]
linux-user: respect timezone for settimeofday

The settimeofday syscall accepts a tz argument indicating the desired
timezone to the kernel. QEMU previously ignored any argument provided
by the target program & always passed NULL to the kernel. Instead,
translate the argument & pass along the data userland provided.

Although this argument is described by the settimeofday man page as
obsolete, it is used by systemd as of version 213.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: fix struct target_epoll_event layout for MIPS
Paul Burton [Sun, 22 Jun 2014 10:25:39 +0000 (11:25 +0100)]
linux-user: fix struct target_epoll_event layout for MIPS

MIPS requires the pad field to 64b-align the data field just as ARM
does.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: support strace of epoll_create1
Paul Burton [Sun, 22 Jun 2014 10:25:38 +0000 (11:25 +0100)]
linux-user: support strace of epoll_create1

Add the epoll_create1 syscall to strace.list in order to display that
syscall when it occurs, rather than a message about the syscall being
unknown despite QEMU already implementing support for it.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: allow NULL arguments to mount
Paul Burton [Sun, 22 Jun 2014 10:25:37 +0000 (11:25 +0100)]
linux-user: allow NULL arguments to mount

Calls to the mount syscall can legitimately provide NULL as the value
for the source of filesystemtype arguments, which QEMU would previously
reject & return -EFAULT to the target program. An example of this is
remounting an already mounted filesystem with different properties.

Instead of rejecting such syscalls with -EFAULT, pass NULL along to the
kernel as the target program expects.

Additionally this patch fixes a potential memory leak when DEBUG_REMAP
is enabled and lock_user_string fails on the target or filesystemtype
arguments but a prior argument was non-NULL and already locked.

Since the patch already touched most lines of the TARGET_NR_mount case,
it fixes the indentation & coding style for good measure.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: support SO_PASSSEC setsockopt option
Paul Burton [Sun, 22 Jun 2014 10:25:36 +0000 (11:25 +0100)]
linux-user: support SO_PASSSEC setsockopt option

Translate the SO_PASSSEC option to setsockopt to the host value &
perform the syscall as expected, allowing use of the option by target
programs.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: support SO_{SND, RCV}BUFFORCE setsockopt options
Paul Burton [Sun, 22 Jun 2014 10:25:35 +0000 (11:25 +0100)]
linux-user: support SO_{SND, RCV}BUFFORCE setsockopt options

Translate the SO_SNDBUFFORCE & SO_RCVBUFFORCE options to setsockopt to
the host values & perform the syscall as expected, allowing use of those
options by target programs.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: support SO_ACCEPTCONN getsockopt option
Paul Burton [Sun, 22 Jun 2014 10:25:34 +0000 (11:25 +0100)]
linux-user: support SO_ACCEPTCONN getsockopt option

Translate the SO_ACCEPTCONN option to the host value & execute the
syscall as expected.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: translate the result of getsockopt SO_TYPE
Paul Burton [Sun, 22 Jun 2014 10:25:33 +0000 (11:25 +0100)]
linux-user: translate the result of getsockopt SO_TYPE

QEMU previously passed the result of the host syscall directly to the
target program. This is a problem if the host & target have different
representations of socket types, as is the case when running a MIPS
target program on an x86 host. Introduce a host_to_target_sock_type
helper function mirroring the existing target_to_host_sock_type, and
call it to translate the value provided by getsockopt when called for
the SO_TYPE option.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: added fake open() for /proc/self/cmdline
Wim Vander Schelden [Wed, 18 Jun 2014 09:02:39 +0000 (11:02 +0200)]
linux-user: added fake open() for /proc/self/cmdline

Signed-off-by: Wim Vander Schelden <wim@fixnum.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoAdd support for MAP_NORESERVE mmap flag.
Christophe Lyon [Mon, 3 Feb 2014 16:04:32 +0000 (17:04 +0100)]
Add support for MAP_NORESERVE mmap flag.

mmap_flags_tbl contains a list of mmap flags, and how to map them to
the target. This patch adds MAP_NORESERVE, which was missing to the
list.

Signed-off-by: Christophe Lyon <christophe.lyon@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging
Peter Maydell [Sun, 29 Jun 2014 10:59:00 +0000 (11:59 +0100)]
Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging

Patch queue for ppc - 2014-06-27

Changes include:

  - instruction emulation fixes
  - linux-user fixes
  - mac99: layout fixes
  - pseries: Initial VFIO support
  - pseries: support for UUID
  - pseries: support for -boot m

# gpg: Signature made Fri 27 Jun 2014 12:51:01 BST using RSA key ID 03FEDC60
# gpg: Can't check signature: public key not found

* remotes/agraf/tags/signed-ppc-for-upstream: (32 commits)
  PPC: e500: Only create dt entries for existing serial ports
  spapr_pci: Use XICS interrupt allocator and do not cache interrupts in PHB
  vmstate: Add preallocation for migrating arrays (VMS_ALLOC flag)
  xics: Implement xics_ics_free()
  spapr: Remove @next_irq
  spapr: Move interrupt allocator to xics
  xics: Disable flags reset on xics reset
  xics: Add xics_find_source()
  xics: Add flags for interrupts
  spapr: Add RTAS sysparm SPLPAR Characteristics
  spapr: Add RTAS sysparm UUID
  spapr: Fix RTAS sysparm DIAGNOSTICS_RUN_MODE
  spapr: Add rtas_st_buffer utility function
  spapr: Define a 2.1 pseries machine
  spapr: Fix code design style (s/SPAPRMachine/sPAPRMachineState)
  target-ppc: Add support for POWER8 pvr 0x4D0000
  uninorth: Fix PCI hole size
  mac99: Add motherboard devices before PCI cards
  target-ppc: Remove unused gen_qemu_ld8s()
  target-ppc: Remove unused IMM and d extract helpers
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20140627' into staging
Peter Maydell [Sun, 29 Jun 2014 10:43:30 +0000 (11:43 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140627' into staging

A series of patches to the s390-ccw bios:
- code cleanup
- improved error reporting
- most important, support to ipl (boot) from ECKD DASD (CDL, LDL or CMS
  formatted)

# gpg: Signature made Fri 27 Jun 2014 12:03:30 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/s390x-20140627:
  pc-bios/s390-ccw: update binary
  pc-bios/s390-ccw: IPL from LDL/CMS-formatted ECKD DASD
  pc-bios/s390-ccw: IPL from CDL-formatted ECKD DASD
  pc-bios/s390-ccw: factor out ipl code
  pc-bios/s390-ccw: Add fill_hex_val func to provide better msgs
  pc-bios/s390-ccw: Unify error handling
  pc-bios/s390-ccw: add some utility code
  pc-bios/s390-ccw: handle different sector sizes
  pc-bios/s390-ccw: cleanup and enhance bootmap defintions
  pc-bios/s390-ccw: make checkpatch happy

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotcg/ppc: Fix support for 64-bit PPC MacOSX hosts
Peter Maydell [Thu, 26 Jun 2014 15:37:17 +0000 (16:37 +0100)]
tcg/ppc: Fix support for 64-bit PPC MacOSX hosts

Add back in the support for 64-bit PPC MacOSX hosts that was
broken in the recent merge of the 32-bit and 64-bit TCG backends.

Reported-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: Andreas Färber <andreas.faerber@web.de>
10 years agohw/xtensa/xtfpga: implement initrd loading
Max Filippov [Sat, 21 Jun 2014 09:35:35 +0000 (13:35 +0400)]
hw/xtensa/xtfpga: implement initrd loading

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agohw/xtensa/xtfpga: implement DTB loading
Max Filippov [Mon, 23 Jun 2014 14:45:43 +0000 (18:45 +0400)]
hw/xtensa/xtfpga: implement DTB loading

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agohw/xtensa/xtfpga: implement uImage loading
Max Filippov [Mon, 4 Mar 2013 03:07:52 +0000 (07:07 +0400)]
hw/xtensa/xtfpga: implement uImage loading

Provide a simple bootloader code at the reset address that jumps to the
loaded image entry point when it's not equal to the reset address. This
is needed because the old method of setting pc doesn't work due to cpu
reset done after the machine setup.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agohw/xtensa/xtfpga: add memory info to bootparam
Max Filippov [Mon, 23 Jun 2014 13:24:48 +0000 (17:24 +0400)]
hw/xtensa/xtfpga: add memory info to bootparam

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agohw/xtensa/xtfpga: refactor bootparameters filling
Max Filippov [Sat, 21 Jun 2014 09:10:38 +0000 (13:10 +0400)]
hw/xtensa/xtfpga: refactor bootparameters filling

Separate filling first/last tag and size calculation from the kernel
command line setup.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agohw/xtensa/xtfpga: use symbolic constants for bootparam tags
Max Filippov [Sat, 21 Jun 2014 06:29:29 +0000 (10:29 +0400)]
hw/xtensa/xtfpga: use symbolic constants for bootparam tags

Import bootparam tag names from linux/arch/xtensa/include/asm/bootparam.h
No functional changes.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agohw/xtensa/xtfpga: retrieve parameters from machine_opts
Max Filippov [Mon, 23 Jun 2014 14:42:39 +0000 (18:42 +0400)]
hw/xtensa/xtfpga: retrieve parameters from machine_opts

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agohw/xtensa: replace fprintfs with error_report
Max Filippov [Sat, 21 Jun 2014 12:14:56 +0000 (16:14 +0400)]
hw/xtensa: replace fprintfs with error_report

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agohw/xtensa: remove extraneous xtensa_ prefix from file names
Max Filippov [Sat, 21 Jun 2014 06:39:58 +0000 (10:39 +0400)]
hw/xtensa: remove extraneous xtensa_ prefix from file names

While at it rename lx60 (named after the first board of the family) to
more generic xtfpga (the family name).

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agohw/xtensa/xtfpga: fix FLASH mapping to boot region for KC705
Max Filippov [Fri, 20 Jun 2014 14:02:10 +0000 (18:02 +0400)]
hw/xtensa/xtfpga: fix FLASH mapping to boot region for KC705

On KC705 bootloader area is located at FLASH offset 0x06000000, not 0 as
on older xtfpga boards.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
10 years agoiotests: Fix 083 for out-of-tree builds
Max Reitz [Sat, 24 May 2014 21:25:00 +0000 (23:25 +0200)]
iotests: Fix 083 for out-of-tree builds

iotest 083 filters out debug messages from nbd, which are prefixed (and
recognized) by __FILE__. However, the current filter (/^nbd\.c…/) is
valid for in-tree builds only, as out-of-tree builds will have a path
before that filename (e.g. "/tmp/qemu/nbd.c"). Fix this by adding .*
before "nbd\.c".

While working on this, also fix the regexes: '.' should be escaped and a
single backslash is not enough for escaping when enclosed by double
quotes.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoiotests: Drop Python version from 065's Shebang
Max Reitz [Sat, 24 May 2014 21:24:59 +0000 (23:24 +0200)]
iotests: Drop Python version from 065's Shebang

Test 065 specified python2 to be used in its Shebang; this might not
work on systems without a python2 symlink and furthermore it is now
counter-productive, as the check script compares the Shebang to
"#!/usr/bin/env python" and only uses the Python interpreter selected by
configure on an exact match.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoiotests: Use $PYTHON for Python scripts
Max Reitz [Sat, 24 May 2014 21:24:58 +0000 (23:24 +0200)]
iotests: Use $PYTHON for Python scripts

Instead of invoking Python scripts directly via ./, use $PYTHON to
obtain the correct Python interpreter command.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoiotests: Source common.env
Max Reitz [Sat, 24 May 2014 21:24:57 +0000 (23:24 +0200)]
iotests: Source common.env

Source common.env in the iotests' check script.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoconfigure: Enable out-of-tree iotests
Max Reitz [Sat, 24 May 2014 21:24:56 +0000 (23:24 +0200)]
configure: Enable out-of-tree iotests

In order to allow out-of-tree iotests, create a symlink for the check
script in the build tree.

While doing so, also write configured options relevant to the iotests to
common.env in the build tree; currently, this is the command to invoke
Python 2.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoiotests: Allow out-of-tree run
Max Reitz [Sat, 24 May 2014 21:24:55 +0000 (23:24 +0200)]
iotests: Allow out-of-tree run

As out-of-tree builds are preferred for qemu, running the qemu-iotests
in that out-of-tree build should be supported as well. To do so, a
symbolic link has to be created pointing to the check script in the
source directory. That script will check whether it has been run through
a symlink, and if so, will assume it is run in the build tree. All
output and temporary operations performed by iotests are then redirected
here and, unless specified otherwise by the user, QEMU_PROG etc. will be
set to paths appropriate for the build tree.

Also, drop making every test case executable if it is not yet, as this
would modify the source tree which is not desired for out-of-tree runs
and should be fixed in the repository anyway.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock.c: Don't return success for bdrv_append_temp_snapshot() failure
Chen Gang [Mon, 23 Jun 2014 15:28:23 +0000 (23:28 +0800)]
block.c: Don't return success for bdrv_append_temp_snapshot() failure

When failure occurs, 'ret' need be set, or may return 0 to indicate
success. Previously, an error was set in errp, but 0 was returned
anyway. So let bdrv_append_temp_snapshot() return an error code and
use that for the bdrv_open() return value.

Also, error_propagate() need be called only one time within a function.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Add TestRepairQuorum to 041 to test drive-mirror node-name mode.
Benoît Canet [Fri, 27 Jun 2014 16:25:26 +0000 (18:25 +0200)]
qemu-iotests: Add TestRepairQuorum to 041 to test drive-mirror node-name mode.

The to-replace-node-name is designed to allow repairing a broken Quorum file.
This patch introduces a new class TestRepairQuorum testing that the feature
works.
Some further work will be done on QEMU to improve the robustness of the tests.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Add replaces argument to drive-mirror
Benoît Canet [Fri, 27 Jun 2014 16:25:25 +0000 (18:25 +0200)]
block: Add replaces argument to drive-mirror

drive-mirror will bdrv_swap the new BDS named node-name with the one
pointed by replaces when the mirroring is finished.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblockjob: Fix recent BLOCK_JOB_ERROR regression
Markus Armbruster [Fri, 27 Jun 2014 17:24:14 +0000 (19:24 +0200)]
blockjob: Fix recent BLOCK_JOB_ERROR regression

Commit 5a2d2cb screwed up the the value of members device and action,
breaking tests/qemu-iotests/041.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblockjob: Fix recent BLOCK_JOB_READY regression
Markus Armbruster [Fri, 27 Jun 2014 17:24:13 +0000 (19:24 +0200)]
blockjob: Fix recent BLOCK_JOB_READY regression

Commit bcada37 dropped the (up to now undocumented) members type, len,
offset, speed, breaking tests/qemu-iotests/040 and 041.

Restore and document them.  This fixes 040, and partially fixes 041.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agodocs/qmp: Fix documentation of BLOCK_JOB_READY to match code
Markus Armbruster [Fri, 27 Jun 2014 17:24:15 +0000 (19:24 +0200)]
docs/qmp: Fix documentation of BLOCK_JOB_READY to match code

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agovirtio-blk: Rename complete_request_early to complete_request_vring
Fam Zheng [Tue, 17 Jun 2014 06:32:10 +0000 (14:32 +0800)]
virtio-blk: Rename complete_request_early to complete_request_vring

The old name is misleading in its new usage, so rename it.

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Unify {non-,}dataplane's request handlings
Fam Zheng [Tue, 17 Jun 2014 06:32:09 +0000 (14:32 +0800)]
virtio-blk: Unify {non-,}dataplane's request handlings

This drops request handling code from dataplane, and uses code from
hw/block/virtio-blk.c.

It starts to use multiwrite as non-dataplane does.

Dataplane sets VirtIOBlock.complete_request to vring version, and calls
into non-dataplane's process handling. In complete_request_early,
qiov.size is added to vring push length, because it's also called in rw
completion now.

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Schedule BH in the right context
Fam Zheng [Tue, 17 Jun 2014 06:32:08 +0000 (14:32 +0800)]
virtio-blk: Schedule BH in the right context

The BH must be called in the AioContext of bs. Currently it is only the
main loop, but with coming changes, it could also be a dataplane
IOThread.

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Export request handling functions to dataplane
Fam Zheng [Tue, 17 Jun 2014 06:32:07 +0000 (14:32 +0800)]
virtio-blk: Export request handling functions to dataplane

So that dataplane can use virtio_blk_handle_request and
virtio_submit_multiwrite.

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Make request completion function virtual
Fam Zheng [Tue, 17 Jun 2014 06:32:06 +0000 (14:32 +0800)]
virtio-blk: Make request completion function virtual

virtio_blk_req_complete will call VirtIOBlock.complete_request() to push
data and notify guest. No functional change.

Later, this will allow dataplane to provide it's own (vring_) version.

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: acquire AioContext in qmp_query_blockstats()
Stefan Hajnoczi [Tue, 17 Jun 2014 06:32:05 +0000 (14:32 +0800)]
block: acquire AioContext in qmp_query_blockstats()

Make query-blockstats safe for dataplane by acquiring the
BlockDriverState's AioContext.  This ensures that the dataplane IOThread
and the main loop's monitor code do not race.

Note the assumption that acquiring the drive's BDS AioContext also
protects ->file and ->backing_hd.  This assumption is made by other
aio_context_acquire() callers too.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: make bdrv_query_stats() static
Stefan Hajnoczi [Tue, 17 Jun 2014 06:32:04 +0000 (14:32 +0800)]
block: make bdrv_query_stats() static

This function is only called from block/qapi.c.  There is no need to
keep it public.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Fix and clean up the in_sg and out_sg check
Fam Zheng [Wed, 11 Jun 2014 04:11:50 +0000 (12:11 +0800)]
virtio-blk: Fix and clean up the in_sg and out_sg check

out_sg is checked by iov_to_buf below, so it can be dropped.

Add assert and iov_discard_back around in_sg, as the in_sg is handled in
dataplane code.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Fill in VirtIOBlockReq.out in dataplane code
Fam Zheng [Wed, 11 Jun 2014 04:11:49 +0000 (12:11 +0800)]
virtio-blk: Fill in VirtIOBlockReq.out in dataplane code

VirtIOBlockReq is allocated in process_request, and freed in command
functions.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Convert VirtIOBlockReq.out to structrue
Fam Zheng [Wed, 11 Jun 2014 04:11:48 +0000 (12:11 +0800)]
virtio-blk: Convert VirtIOBlockReq.out to structrue

The virtio code currently assumes that the outhdr is in its own iovec.
This is not guaranteed by the spec, so we should relax this assumption.

Convert the VirtIOBlockReq.out field to structrue so that we can use
iov_to_buf and then discard the header from the beginning of iovec.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Use VirtIOBlockReq.in to drop VirtIOBlockReq.inhdr
Fam Zheng [Wed, 11 Jun 2014 04:11:47 +0000 (12:11 +0800)]
virtio-blk: Use VirtIOBlockReq.in to drop VirtIOBlockReq.inhdr

In current virtio spec, inhdr is a single byte, and is unlikely to
change for both functionality and compatibility considerations.
Non-dataplane uses .in, and we are on the way to converge them. So
let's unify it to get cleaner code.

Remove .inhdr and use .in.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Replace VirtIOBlockRequest with VirtIOBlockReq
Fam Zheng [Wed, 11 Jun 2014 04:11:46 +0000 (12:11 +0800)]
virtio-blk: Replace VirtIOBlockRequest with VirtIOBlockReq

Field "inhdr" is added temporarily for a more mechanical change, and
will be dropped in the next commit.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Drop VirtIOBlockRequest.read
Fam Zheng [Wed, 11 Jun 2014 04:11:45 +0000 (12:11 +0800)]
virtio-blk: Drop VirtIOBlockRequest.read

Since it's set but not used.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Drop bounce buffer from dataplane code
Fam Zheng [Wed, 11 Jun 2014 04:11:44 +0000 (12:11 +0800)]
virtio-blk: Drop bounce buffer from dataplane code

The block layer will handle the unaligned request.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Convert VirtIOBlockReq.elem to pointer
Fam Zheng [Wed, 11 Jun 2014 04:11:43 +0000 (12:11 +0800)]
virtio-blk: Convert VirtIOBlockReq.elem to pointer

This will make converging with dataplane code easier.

Add virtio_blk_free_request to handle the freeing of request internal
fields.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Move VirtIOBlockReq to header
Fam Zheng [Wed, 11 Jun 2014 04:11:42 +0000 (12:11 +0800)]
virtio-blk: Move VirtIOBlockReq to header

For later reusing by dataplane code.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agonbd: Don't validate from and len in NBD_CMD_DISC.
Hani Benhabiles [Sun, 18 May 2014 10:50:05 +0000 (11:50 +0100)]
nbd: Don't validate from and len in NBD_CMD_DISC.

These values aren't used in this case.

Currently, the from field in the request sent by the nbd kernel module leading
to a false error message when ending the connection with the client.

$ qemu-nbd some.img -v
// After nbd-client -d /dev/nbd0
nbd.c:nbd_trip():L1031: From: 18446744073709551104, Len: 0, Size: 20971520,
Offset: 0
nbd.c:nbd_trip():L1032: requested operation past EOF--bad client?
nbd.c:nbd_receive_request():L638: read failed

Signed-off-by: Hani Benhabiles <kroosec@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agonbd: Don't export a block device with no medium.
Hani Benhabiles [Sun, 18 May 2014 10:50:04 +0000 (11:50 +0100)]
nbd: Don't export a block device with no medium.

The device is exported with erroneous values and can't be read.

Before the patch:
$ sudo nbd-client localhost -p 10809 /dev/nbd0 -name floppy0
Negotiation: ..size = 17592186044415MB
bs=1024, sz=18446744073709547520 bytes

$ sudo mount /dev/nbd0 /mnt/tmp/
mount: block device /dev/nbd0 is write-protected, mounting read-only
mount: /dev/nbd0: can't read superblock

After the patch:
(qemu) nbd_server_add ide0-hd0
(qemu) nbd_server_add floppy0
Device 'floppy0' has no medium

Signed-off-by: Hani Benhabiles <kroosec@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agochar: report frontend open/closed state in 'query-chardev'
Laszlo Ersek [Thu, 26 Jun 2014 15:50:03 +0000 (17:50 +0200)]
char: report frontend open/closed state in 'query-chardev'

In addition to the on-line reporting added in the previous patch, allow
libvirt to query frontend state independently of events.

Libvirt's path to identify the guest agent channel it cares about differs
between the event added in the previous patch and the QMP response field
added here. The event identifies the frontend device, by "id". The
'query-chardev' QMP command identifies the backend device (again by "id").
The association is under libvirt's control.

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

Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agovirtio-serial: report frontend connection state via monitor
Laszlo Ersek [Thu, 26 Jun 2014 15:50:02 +0000 (17:50 +0200)]
virtio-serial: report frontend connection state via monitor

Libvirt wants to know about the guest-side connection state of some
virtio-serial ports (in particular the one(s) assigned to guest agent(s)).
Report such states with a new monitor event.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1080376
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqmp: add qmp-events.txt back
Luiz Capitulino [Thu, 26 Jun 2014 13:33:47 +0000 (09:33 -0400)]
qmp: add qmp-events.txt back

The conversion of events to the QAPI, resulted in the removal of the
docs/qmp/qmp-events.txt file. This was done to avoid having duplicated
information between qmp-events.txt and qapi-event.json.

However, qmp-events.txt contains examples and we're still not sure
how to proper install QAPI docs in the host. To avoid harming users,
it's better to re-add qmp-events.txt for now and deal with the
duplication later.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoqapi event: clean up in callers
Wenchao Xia [Tue, 24 Jun 2014 23:34:00 +0000 (16:34 -0700)]
qapi event: clean up in callers

This patch improves docs and address small issues in event
callers.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: clean up in scripts
Wenchao Xia [Tue, 24 Jun 2014 23:33:59 +0000 (16:33 -0700)]
qapi script: clean up in scripts

This patch improve docs and uses c_type(argentry, is_param=True)
in script.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: ignore generated event files
Wenchao Xia [Tue, 24 Jun 2014 23:33:58 +0000 (16:33 -0700)]
qapi: ignore generated event files

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: move event defines
Wenchao Xia [Tue, 24 Jun 2014 23:33:57 +0000 (16:33 -0700)]
qapi: move event defines

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotcg/ppc: Fix failure in tcg_out_mem_long
Richard Henderson [Fri, 27 Jun 2014 04:26:00 +0000 (21:26 -0700)]
tcg/ppc: Fix failure in tcg_out_mem_long

With rt != r0 on loads, we use rt for scratch.  If we need an index
register different from base, we can't use rt, but r0 is usable.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-id: 1403843160-30332-1-git-send-email-rth@twiddle.net
Tested-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoblock: Add node-name argument to drive-mirror
Benoît Canet [Mon, 16 Jun 2014 10:00:55 +0000 (12:00 +0200)]
block: Add node-name argument to drive-mirror

This new argument can be used to specify the node-name of the new mirrored BDS.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoquorum: Add the rewrite-corrupted parameter to quorum
Benoît Canet [Wed, 11 Jun 2014 13:24:10 +0000 (15:24 +0200)]
quorum: Add the rewrite-corrupted parameter to quorum

On read operations when this parameter is set and some replicas are corrupted
while quorum can be reached quorum will proceed to rewrite the correct version
of the data to fix the corrupted replicas.

This will shine with SSD where the FTL will remap the same block at another
place on rewrite.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>