]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
9 years agotarget-ppc: enable virtio endian ambivalent support
Greg Kurz [Tue, 24 Jun 2014 17:51:19 +0000 (19:51 +0200)] 
target-ppc: enable virtio endian ambivalent support

The device endianness is the cpu endianness at device reset time.

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>
9 years agovirtio-9p: use virtio wrappers to access headers
Greg Kurz [Tue, 24 Jun 2014 17:49:49 +0000 (19:49 +0200)] 
virtio-9p: use virtio wrappers to access headers

Note that st*_raw and ld*_raw are effectively replaced by st*_p and ld*_p.

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>
9 years agovirtio-serial-bus: use virtio wrappers to access headers
Rusty Russell [Tue, 24 Jun 2014 17:49:31 +0000 (19:49 +0200)] 
virtio-serial-bus: use virtio wrappers to access headers

We also fix max_nr_ports at reset time as the device endianness may have
changed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
[ pass VirtIODevice * to memory accessors,
  fix max_nr_ports at reset time,
  Greg Kurz <gkurz@linux.vnet.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>
9 years agovirtio-scsi: use virtio wrappers to access headers
Rusty Russell [Tue, 24 Jun 2014 17:48:53 +0000 (19:48 +0200)] 
virtio-scsi: use virtio wrappers to access headers

Note that st*_raw and ld*_raw are effectively replaced by st*_p and ld*_p.

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: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-blk: use virtio wrappers to access headers
Rusty Russell [Tue, 24 Jun 2014 17:43:44 +0000 (19:43 +0200)] 
virtio-blk: use virtio wrappers to access headers

Note that st*_raw and ld*_raw are effectively replaced by st*_p and ld*_p.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
[ pass VirtIODevice * to memory accessors,
  Greg Kurz <gkurz@linux.vnet.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>
9 years agovirtio-balloon: use virtio wrappers to access page frame numbers
Rusty Russell [Tue, 24 Jun 2014 17:43:22 +0000 (19:43 +0200)] 
virtio-balloon: use virtio wrappers to access page frame numbers

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
[ pass VirtIODevice * to memory accessors,
  Greg Kurz <gkurz@linux.vnet.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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 years agoPPC: e500: Only create dt entries for existing serial ports
Alexander Graf [Wed, 4 Jun 2014 11:48:18 +0000 (13:48 +0200)] 
PPC: e500: Only create dt entries for existing serial ports

When the user specifies -nodefaults he can tell us that he doesn't want any
serial ports spawned by default. While we do honor that wish, we still create
device tree entries for those non-existent devices.

Make device tree generation depend on whether the device is actually available.

Signed-off-by: Alexander Graf <agraf@suse.de>
9 years agospapr_pci: Use XICS interrupt allocator and do not cache interrupts in PHB
Alexey Kardashevskiy [Fri, 30 May 2014 09:34:20 +0000 (19:34 +1000)] 
spapr_pci: Use XICS interrupt allocator and do not cache interrupts in PHB

Currently SPAPR PHB keeps track of all allocated MSI (here and below
MSI stands for both MSI and MSIX) interrupt because
XICS used to be unable to reuse interrupts. This is a problem for
dynamic MSI reconfiguration which happens when guest reloads a driver
or performs PCI hotplug. Another problem is that the existing
implementation can enable MSI on 32 devices maximum
(SPAPR_MSIX_MAX_DEVS=32) and there is no good reason for that.

This makes use of new XICS ability to reuse interrupts.

This reorganizes MSI information storage in sPAPRPHBState. Instead of
static array of 32 descriptors (one per a PCI function), this patch adds
a GHashTable when @config_addr is a key and (first_irq, num) pair is
a value. GHashTable can dynamically grow and shrink so the initial limit
of 32 devices is gone.

This changes migration stream as @msi_table was a static array while new
@msi_devs is a dynamic hash table. This adds temporary array which is
used for migration, it is populated in "spapr_pci"::pre_save() callback
and expanded into the hash table in post_load() callback. Since
the destination side does not know the number of MSI-enabled devices
in advance and cannot pre-allocate the temporary array to receive
migration state, this makes use of new VMSTATE_STRUCT_VARRAY_ALLOC macro
which allocates the array automatically.

This resets the MSI configuration space when interrupts are released by
the ibm,change-msi RTAS call.

This fixed traces to be more informative.

This changes vmstate_spapr_pci_msi name from "...lsi" to "...msi" which
was incorrect by accident. As the internal representation changed,
thus bumps migration version number.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
[agraf: drop g_malloc_n usage]
Signed-off-by: Alexander Graf <agraf@suse.de>
9 years agovmstate: Add preallocation for migrating arrays (VMS_ALLOC flag)
Alexey Kardashevskiy [Fri, 30 May 2014 09:34:19 +0000 (19:34 +1000)] 
vmstate: Add preallocation for migrating arrays (VMS_ALLOC flag)

There are few helpers already to support array migration. However they all
require the destination side to preallocate arrays before migration which
is not always possible due to unknown array size as it might be some
sort of dynamic state. One of the examples is an array of MSIX-enabled
devices in SPAPR PHB - this array may vary from 0 to 65536 entries and
its size depends on guest's ability to enable MSIX or do PCI hotplug.

This adds new VMSTATE_VARRAY_STRUCT_ALLOC macro which is pretty similar to
VMSTATE_STRUCT_VARRAY_POINTER_INT32 but it can alloc memory for migratign
array on the destination side.

This defines VMS_ALLOC flag for a field.

This changes vmstate_base_addr() to do the allocation when receiving
migration.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Juan Quintela <quintela@redhat.com>
[agraf: drop g_malloc_n usage]
Signed-off-by: Alexander Graf <agraf@suse.de>
9 years agoxics: Implement xics_ics_free()
Alexey Kardashevskiy [Fri, 30 May 2014 09:34:18 +0000 (19:34 +1000)] 
xics: Implement xics_ics_free()

This implements interrupt release function so IRQs can be returned back
to the pool for reuse in cases such as PCI hot plug.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
9 years agospapr: Remove @next_irq
Alexey Kardashevskiy [Fri, 30 May 2014 09:34:17 +0000 (19:34 +1000)] 
spapr: Remove @next_irq

This removes @next_irq from sPAPREnvironment which was used in old
IRQ allocator as XICS is now responsible for IRQs and keeps track of
allocated IRQs.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
9 years agospapr: Move interrupt allocator to xics
Alexey Kardashevskiy [Fri, 30 May 2014 09:34:15 +0000 (19:34 +1000)] 
spapr: Move interrupt allocator to xics

The current allocator returns IRQ numbers from a pool and does not
support IRQs reuse in any form as it did not keep track of what it
previously returned, it only keeps the last returned IRQ. Some use
cases such as PCI hot(un)plug may require IRQ release and reallocation.

This moves an allocator from SPAPR to XICS.

This switches IRQ users to use new API.

This uses LSI/MSI flags to know if interrupt is allocated.

The interrupt release function will be posted as a separate patch.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
9 years agoxics: Disable flags reset on xics reset
Alexey Kardashevskiy [Fri, 30 May 2014 09:34:14 +0000 (19:34 +1000)] 
xics: Disable flags reset on xics reset

Since islsi[] array has been merged into the ICSState struct,
we must not reset flags as they tell if the interrupt is in use.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
9 years agoxics: Add xics_find_source()
Alexey Kardashevskiy [Fri, 30 May 2014 09:34:13 +0000 (19:34 +1000)] 
xics: Add xics_find_source()

PAPR allows having multiple interrupt sources such as PHB.

This adds a source lookup function and makes use of it.

Since at the moment QEMU only supports a single source,
no change in behaviour is expected.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
9 years agoxics: Add flags for interrupts
Alexey Kardashevskiy [Fri, 30 May 2014 09:34:12 +0000 (19:34 +1000)] 
xics: Add flags for interrupts

The existing interrupt allocation scheme in SPAPR assumes that
interrupts are allocated at the start time, continously and the config
will not change. However, there are cases when this is not going to work
such as:

1. migration - we will have to have an ability to choose interrupt
numbers for devices in the command line and this will create gaps in
interrupt space.

2. PCI hotplug - interrupts from unplugged device need to be returned
back to interrupt pool, otherwise we will quickly run out of interrupts.

This replaces a separate lslsi[] array with a byte in the ICSIRQState
struct and defines "LSI" and "MSI" flags. Neither of these flags set
signals that the descriptor is not allocated and not in use.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
9 years agospapr: Add RTAS sysparm SPLPAR Characteristics
Sam bobroff [Wed, 25 Jun 2014 03:54:32 +0000 (13:54 +1000)] 
spapr: Add RTAS sysparm SPLPAR Characteristics

Add support for the SPLPAR Characteristics parameter to the emulated
RTAS call ibm,get-system-parameter.

The support provides just enough information to allow "cat
/proc/powerpc/lparcfg" to succeed without generating a kernel error
message.

Without this patch the above command will produce the following kernel
message: arch/powerpc/platforms/pseries/lparcfg.c \
parse_system_parameter_string Error calling get-system-parameter \
(0xfffffffd)

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>