OSDN Git Service

qmiga/qemu.git
5 years agos390x/tcg: Implement VECTOR UNPACK *
David Hildenbrand [Thu, 7 Mar 2019 12:15:39 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR UNPACK *

Combine all variant in a single handler. As source and destination
have different element sizes, we can't use gvec expansion. Expand
manually. Also watch out for overlapping source and destination
registers. Use a safe evaluation order depending on the operation.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-33-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR STORE WITH LENGTH
David Hildenbrand [Thu, 7 Mar 2019 12:15:38 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR STORE WITH LENGTH

Very similar to VECTOR LOAD WITH LENGTH, just the opposite direction.
Properly probe write access before modifying memory.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-32-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR STORE MULTIPLE
David Hildenbrand [Thu, 7 Mar 2019 12:15:37 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR STORE MULTIPLE

Similar to VECTOR LOAD MULTIPLE, just the opposite direction. Probe
write access first.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-31-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR STORE ELEMENT
David Hildenbrand [Thu, 7 Mar 2019 12:15:36 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR STORE ELEMENT

As we only store one element, there is nothing to consider regarding
exceptions.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-30-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR STORE
David Hildenbrand [Thu, 7 Mar 2019 12:15:35 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR STORE

Properly probe the whole access first.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-29-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Provide probe_write_access helper
David Hildenbrand [Thu, 7 Mar 2019 12:15:34 +0000 (13:15 +0100)]
s390x/tcg: Provide probe_write_access helper

Instead of checking e.g. the first access on every touched page, we should
check the actual access, otherwise we might get false positives when Low
Address Protection (LAP) is active. As probe_write() can only deal with
accesses to one page, we have to loop.

Use i64 for the length, although not needed - easier to reuse
TCG temps we already have in the translation functions where this will
be used. Also allow it to be used from other helpers.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-28-david@redhat.com>
[CH: add missing page_check_range()]
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR SIGN EXTEND TO DOUBLEWORD
David Hildenbrand [Thu, 7 Mar 2019 12:15:33 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR SIGN EXTEND TO DOUBLEWORD

Load both elements signed and store them into the two 64 bit elements.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-27-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR SELECT
David Hildenbrand [Thu, 7 Mar 2019 12:15:32 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR SELECT

Provide an implementation based on i64 and on real host vectors.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-26-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR SCATTER ELEMENT
David Hildenbrand [Thu, 7 Mar 2019 12:15:31 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR SCATTER ELEMENT

Similar to VECTOR GATHER ELEMENT, but the other direction.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-25-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR REPLICATE IMMEDIATE
David Hildenbrand [Thu, 7 Mar 2019 12:15:30 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR REPLICATE IMMEDIATE

Like VECTOR REPLICATE, but the element to be replicated comes from an
immediate.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-24-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR REPLICATE
David Hildenbrand [Thu, 7 Mar 2019 12:15:29 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR REPLICATE

Replicate via the special gvec helper.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-23-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR PERMUTE DOUBLEWORD IMMEDIATE
David Hildenbrand [Thu, 7 Mar 2019 12:15:28 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR PERMUTE DOUBLEWORD IMMEDIATE

Read the whole input before modifying the destination vector.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-22-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR PERMUTE
David Hildenbrand [Thu, 7 Mar 2019 12:15:27 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR PERMUTE

Take care of overlying inputs and outputs by using a temporary vector.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-21-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR PACK *
David Hildenbrand [Thu, 7 Mar 2019 12:15:26 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR PACK *

This is a big one. Luckily we only have a limited set of such nasty
instructions.

We'll implement all variants with helpers, except when sources and
the destination don't overlap for VECTOR PACK. Provide different helpers
when the cc is to be modified. We'll return the cc then via env->cc_op.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-20-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR MERGE (HIGH|LOW)
David Hildenbrand [Thu, 7 Mar 2019 12:15:25 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR MERGE (HIGH|LOW)

We cannot use gvec expansion as source and destination elements are
have different element numbers. So we'll expand using a fancy loop.
Also, we have to take care of overlapping source and destination
registers, therefore use a safe evaluation irder depending on the
operation.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-19-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD WITH LENGTH
David Hildenbrand [Thu, 7 Mar 2019 12:15:24 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD WITH LENGTH

We can reuse the helper introduced along with VECTOR LOAD TO BLOCK
BOUNDARY. We just have to take care of converting the highest index into
a length.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-18-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD VR FROM GRS DISJOINT
David Hildenbrand [Thu, 7 Mar 2019 12:15:23 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD VR FROM GRS DISJOINT

Fairly easy, just load from to gprs into a single vector.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-17-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD VR ELEMENT FROM GR
David Hildenbrand [Thu, 7 Mar 2019 12:15:22 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD VR ELEMENT FROM GR

Very similar to VECTOR LOAD GR FROM VR ELEMENT, just the opposite
direction. Also provide a fast path in case we don't care about the
register content.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-16-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD TO BLOCK BOUNDARY
David Hildenbrand [Thu, 7 Mar 2019 12:15:21 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD TO BLOCK BOUNDARY

Very similar to LOAD COUNT TO BLOCK BOUNDARY, but instead of only
calculating, the actual vector is loaded. Use a temporary vector to
not modify the real vector on exceptions. Initialize that one to zero,
to not leak any data. Provide a fast path if we're loading a full
vector.

As we don't have gvec ool handlers for single vectors, just calculate
the vector address manually.

We can reuse the helper later on for VECTOR LOAD WITH LENGTH. In fact,
we are going to name it "vll" right from the beginning, because that's
a better match.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-15-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD MULTIPLE
David Hildenbrand [Thu, 7 Mar 2019 12:15:20 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD MULTIPLE

Try to load the last element first. Access to the first element will
be checked afterwards. This way, we can guarantee that the vector is
not modified before we checked for all possible exceptions. (16 vectors
cannot cross more than two pages)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-14-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD LOGICAL ELEMENT AND ZERO
David Hildenbrand [Thu, 7 Mar 2019 12:15:19 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD LOGICAL ELEMENT AND ZERO

Fairly easy, zero out the vector before we load the desired element.
Load the element before touching the vector.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-13-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD GR FROM VR ELEMENT
David Hildenbrand [Thu, 7 Mar 2019 12:15:18 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD GR FROM VR ELEMENT

To avoid an helper, we have to do the actual calculation of the element
address (offset in cpu_env + cpu_env) manually. Factor that out into
get_vec_element_ptr_i64(). The same logic will be reused for "VECTOR
LOAD VR ELEMENT FROM GR".

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-12-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD ELEMENT IMMEDIATE
David Hildenbrand [Thu, 7 Mar 2019 12:15:17 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD ELEMENT IMMEDIATE

Take care of properly sign-extending the immediate.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-11-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD ELEMENT
David Hildenbrand [Thu, 7 Mar 2019 12:15:16 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD ELEMENT

Fairly easy, load with desired size and store it into the right element.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-10-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD AND REPLICATE
David Hildenbrand [Thu, 7 Mar 2019 12:15:15 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD AND REPLICATE

We can use tcg_gen_gvec_dup_i64() to carry out the duplication.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-9-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR LOAD
David Hildenbrand [Thu, 7 Mar 2019 12:15:14 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR LOAD

When loading from memory, load both elements into temps first before
modifying the target vector

Loading with strange alingment from the end of the address space will
not properly wrap, we can ignore that for now.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-8-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR GENERATE MASK
David Hildenbrand [Thu, 7 Mar 2019 12:15:13 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR GENERATE MASK

Add gen_gvec_dupi() for handling duplication of immediates, so it can
be reused later.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-7-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR GENERATE BYTE MASK
David Hildenbrand [Thu, 7 Mar 2019 12:15:12 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR GENERATE BYTE MASK

Let's optimize it for the common cases (setting a vector to zero or all
ones) - courtesy of Richard.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-6-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Implement VECTOR GATHER ELEMENT
David Hildenbrand [Thu, 7 Mar 2019 12:15:11 +0000 (13:15 +0100)]
s390x/tcg: Implement VECTOR GATHER ELEMENT

Let's start with a more involved one, but it is the first in the list
of vector support instructions (introduced with the vector facility).

Good thing is, we need a lot of basic infrastructure for this. Reading
and writing vector elements as well as checking element validity.

All vector instruction related translation functions will reside in
translate_vx.inc.c, to be included in translate.c - similar to how
other architectures handle it.

While at it, directly add some documentation (which contains parts about
things added in follow-up patches, but splitting this up does not make
too much sense). Also add ES_* defines heavily used later.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-5-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Utilities for vector instruction helpers
David Hildenbrand [Thu, 7 Mar 2019 12:15:10 +0000 (13:15 +0100)]
s390x/tcg: Utilities for vector instruction helpers

We'll have to read/write vector elements quite frequently from helpers.
The tricky bit is properly taking care of endianess. Handle it similar
to aarch64.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-4-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Check vector register instructions at central point
David Hildenbrand [Thu, 7 Mar 2019 12:15:09 +0000 (13:15 +0100)]
s390x/tcg: Check vector register instructions at central point

Check them at a central point. We'll use a new instruction flag to
flag all vector instructions (IF_VEC) and handle it very similar to
AFP, whereby we use another unused position in the PSW mask to store
the state of vector register enablement per translation block.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-3-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tcg: Define vector instruction formats
David Hildenbrand [Thu, 7 Mar 2019 12:15:08 +0000 (13:15 +0100)]
s390x/tcg: Define vector instruction formats

These are the new instruction formats related to vector instructions as
up to the z14 (a.k.a. latest PoP).

As v2 appeares (like x2 in VRX) with d2/b2 in VRV, we have to assign it a
higher field number to avoid collisions.

Properly take care of the MSB (to be able to address 32 registers) for
each vector register field stored in the RXB field (Bit 36 - 30  for all
vector instructions). As we have 32 bit vector registers and the
"v" fields are only 4 bit in size, the 5th bit is stored in the RXB.
We use a new type to indicate that the MSB has to be fetched from the
RXB.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-2-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agotarget/s390x: Remove non-architected entries from struct LowCore
Thomas Huth [Tue, 5 Mar 2019 08:46:21 +0000 (09:46 +0100)]
target/s390x: Remove non-architected entries from struct LowCore

There are some fields in our struct LowCore which apparently have
been copied from a very old version of the Linux kernel. These
fields are not architected in the "Principles of Operation", and
only used on these memory locations in Linux kernels older than
2.6.29. Newer Linux kernels moved the entries to different locations
or are not using them at all anymore. Thus we should never access
these fields from the QEMU side, so they should be removed.

While we're at it, also add a QEMU_BUILD_BUG_ON() statement to
assert that struct LowCore has the right size.

Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1551775581-27989-1-git-send-email-thuth@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-03-08' into staging
Peter Maydell [Sat, 9 Mar 2019 20:55:44 +0000 (20:55 +0000)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-03-08' into staging

nbd patches for 2019-03-08

- support TLS client authorization in NBD servers
- iotest 223 race fix

# gpg: Signature made Fri 08 Mar 2019 17:37:59 GMT
# gpg:                using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2019-03-08:
  iotests: Wait for qemu to end in 223
  nbd: fix outdated qapi docs syntax for tls-creds
  nbd: allow authorization with nbd-server-start QMP command
  qemu-nbd: add support for authorization of TLS clients

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Sat, 9 Mar 2019 17:35:48 +0000 (17:35 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

# gpg: Signature made Fri 08 Mar 2019 16:53:34 GMT
# gpg:                using RSA key 9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  iothread: document about why we need explicit aio_poll()
  iothread: push gcontext earlier in the thread_fn
  iothread: create main loop unconditionally
  iothread: create the gcontext unconditionally
  iothread: replace init_done_cond with a semaphore
  hw/block/virtio-blk: Clean req->dev repetitions
  MAINTAINERS: add missing support status fields

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Sat, 9 Mar 2019 14:43:39 +0000 (14:43 +0000)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- qcow2: Support for external data files
- qcow2: Default to 4KB for the qcow2 cache entry size
- Apply block driver whitelist for -drive format=help
- Several qemu-iotests improvements

# gpg: Signature made Fri 08 Mar 2019 12:54:27 GMT
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (33 commits)
  qcow2 spec: Describe string header extensions
  qemu-iotests: Add dependency to qemu-nbd tool
  ahci-test: Add dependency to qemu-img tool
  qemu-iotests: amend with external data file
  qemu-iotests: General tests for qcow2 with external data file
  qemu-iotests: Preallocation with external data file
  qcow2: Implement data-file-raw create option
  qcow2: Store data file name in the image
  qcow2: Creating images with external data file
  qcow2: Add basic data-file infrastructure
  qcow2: Support external data file in qemu-img check
  qcow2: Return error for snapshot operation with data file
  qcow2: External file I/O
  qcow2: Prepare qcow2_co_block_status() for data file
  qcow2: Return 0/-errno in qcow2_alloc_compressed_cluster_offset()
  qcow2: Don't assume 0 is an invalid cluster offset
  qcow2: Prepare count_contiguous_clusters() for external data file
  qcow2: Prepare qcow2_get_cluster_type() for external data file
  qcow2: Pass bs to qcow2_get_cluster_type()
  qcow2: Basic definitions for external data files
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-2019-03-08' into...
Peter Maydell [Fri, 8 Mar 2019 18:29:41 +0000 (18:29 +0000)]
Merge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-2019-03-08' into staging

Fixes mixed up operands in CADDN and CADD

# gpg: Signature made Fri 08 Mar 2019 09:45:05 GMT
# gpg:                using RSA key 6E636A7E83F2DD0CFA6E6E370AD2C6396B69CA14
# gpg:                issuer "kbastian@mail.uni-paderborn.de"
# gpg: Good signature from "Bastian Koppelmann <kbastian@mail.uni-paderborn.de>" [full]
# Primary key fingerprint: 6E63 6A7E 83F2 DD0C FA6E  6E37 0AD2 C639 6B69 CA14

* remotes/bkoppelmann/tags/pull-tricore-2019-03-08:
  tricore: fixed RCR_CADDN instruction
  tricore: fixed RCR_CADD instruction

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-03-08' into...
Peter Maydell [Fri, 8 Mar 2019 16:31:34 +0000 (16:31 +0000)]
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-03-08' into staging

- qtest fixes
- Some generic clean-ups by Philippe
- macOS CI testing via cirrus-ci.com

# gpg: Signature made Fri 08 Mar 2019 08:58:47 GMT
# gpg:                using RSA key 2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2019-03-08:
  cirrus.yml: Add macOS continuous integration task
  tests/bios-tables: Improve portability by searching bash in the $PATH
  vhost-user-test: fix leaks
  tests: Do not use "\n" in g_test_message() strings
  hw/devices: Remove unused TC6393XB_RAM definition
  hw: Remove unused 'hw/devices.h' include
  tests: Move qdict-test-data.txt to tests/data/qobject/

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
# Conflicts:
# tests/vhost-user-test.c

5 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-hppa-20190307' into staging
Peter Maydell [Fri, 8 Mar 2019 15:17:01 +0000 (15:17 +0000)]
Merge remote-tracking branch 'remotes/rth/tags/pull-hppa-20190307' into staging

Fix use after free on temporary.
Optmize branch to next insn via br r0.

# gpg: Signature made Fri 08 Mar 2019 01:53:16 GMT
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-hppa-20190307:
  target/hppa: Optimize blr r0,rn
  target/hppa: Do not return freed temporary

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream-qgraph' into staging
Peter Maydell [Fri, 8 Mar 2019 14:05:17 +0000 (14:05 +0000)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream-qgraph' into staging

qgraph project from GSoC 2018

# gpg: Signature made Thu 07 Mar 2019 16:29:17 GMT
# gpg:                using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream-qgraph: (57 commits)
  qos-test: megasas test node
  qos-test: e1000 test node
  qos-test: eepro100 test node
  qos-test: es1370 test node
  qos-test: vmxnet3 test node
  qos-test: usb-hcd-ohci test node
  qos-test: spapr-phb test node
  qos-test: pcnet test node
  qos-test: nvme test node
  qos-test: ne2k_pci test node
  qos-test: ipoctal232 test node
  qos-test: tpci200 test node
  qos-test: ac97 test node
  tests: move virtio entirely to qos-test
  tests/libqos: remove pre-qgraph QVirtioPCIDevice API
  qos-test: virtio-scsi test node
  tests/libqos: virtio-scsi driver and interface nodes
  qos-test: vhost-user test node
  vhost-user-test: always use 256 MiB of guest memory
  tests/libqos: support multiqueue for virtio-net
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
Peter Maydell [Fri, 8 Mar 2019 11:55:53 +0000 (11:55 +0000)]
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging

Slirp updates

Greg Kurz (1):
  slirp: Fix build with gcc 9

Marc-André Lureau (7):
  slirp: adapt a subset of QEMU vmstate code
  slirp: use libslirp migration code
  slirp: use "slirp_" prefix for inet_aton() win32 implementation
  slirp: move sources to src/ subdirectory
  slirp: add a standalone Makefile
  build-sys: link with slirp as an external project
  slirp: remove QEMU Makefile.objs

Samuel Thibault (2):
  slirp: fix big/little endian conversion in ident protocol
  slirp: Mark pieces missing IPv6 support

Vic Lee (1):
  slirp: check for ioctlsocket error and 0-length udp payload.

William Bowling (1):
  slirp: check sscanf result when emulating ident

# gpg: Signature made Thu 07 Mar 2019 11:51:20 GMT
# gpg:                using RSA key E61DBB15D4172BDEC97E92D9DB550E89F0FA54F3
# gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>" [unknown]
# gpg:                 aka "Samuel Thibault <sthibault@debian.org>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@gnu.org>" [unknown]
# gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>" [unknown]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: E61D BB15 D417 2BDE C97E  92D9 DB55 0E89 F0FA 54F3

* remotes/thibault/tags/samuel-thibault:
  slirp: remove QEMU Makefile.objs
  build-sys: link with slirp as an external project
  slirp: add a standalone Makefile
  slirp: move sources to src/ subdirectory
  slirp: use "slirp_" prefix for inet_aton() win32 implementation
  slirp: use libslirp migration code
  slirp: adapt a subset of QEMU vmstate code
  slirp: Mark pieces missing IPv6 support
  slirp: fix big/little endian conversion in ident protocol
  slirp: check sscanf result when emulating ident
  slirp: check for ioctlsocket error and 0-length udp payload.
  slirp: Fix build with gcc 9

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoqcow2 spec: Describe string header extensions
Kevin Wolf [Thu, 7 Mar 2019 16:49:55 +0000 (17:49 +0100)]
qcow2 spec: Describe string header extensions

Be more specific about the string representation in header extensions.

Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agoqemu-iotests: Add dependency to qemu-nbd tool
Philippe Mathieu-Daudé [Thu, 7 Mar 2019 15:10:46 +0000 (16:10 +0100)]
qemu-iotests: Add dependency to qemu-nbd tool

Since a9660664fde, some iotests use qemu-nbd.
Add a dependency to build it before using it.
This fixes:

  $ make check-block
    GEN     qemu-img-cmds.h
    CC      qemu-img.o
    LINK    qemu-img
    CC      qemu-io.o
    LINK    qemu-io
    CC      tests/qemu-iotests/socket_scm_helper.o
    LINK    tests/qemu-iotests/socket_scm_helper
  tests/qemu-iotests-quick.sh
  check: qemu-nbd not found
  make: *** [tests/Makefile.include:1059: check-tests/qemu-iotests-quick.sh] Error 1

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoahci-test: Add dependency to qemu-img tool
Philippe Mathieu-Daudé [Thu, 7 Mar 2019 15:10:45 +0000 (16:10 +0100)]
ahci-test: Add dependency to qemu-img tool

Since the ahci-test uses qemu-img, add a dependency to build it
before using it.
This fixes:

  $ gmake check-qtest V=1
  QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/ahci-test
  Failed to execute child process "/tmp/qemu-test.19tMRF/qemu-img" (No such file or directory)
  ERROR:tests/libqos/libqos.c:192:mkimg: assertion failed: (ret && !err)

Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqemu-iotests: amend with external data file
Kevin Wolf [Tue, 26 Feb 2019 14:00:29 +0000 (15:00 +0100)]
qemu-iotests: amend with external data file

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqemu-iotests: General tests for qcow2 with external data file
Kevin Wolf [Fri, 22 Feb 2019 10:45:50 +0000 (11:45 +0100)]
qemu-iotests: General tests for qcow2 with external data file

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqemu-iotests: Preallocation with external data file
Kevin Wolf [Thu, 21 Feb 2019 15:35:52 +0000 (16:35 +0100)]
qemu-iotests: Preallocation with external data file

Test that preallocating metadata results in a somewhat larger qcow2
file, but preallocating data only affects the disk usage of the data
file and the qcow2 file stays small.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Implement data-file-raw create option
Kevin Wolf [Fri, 22 Feb 2019 13:29:38 +0000 (14:29 +0100)]
qcow2: Implement data-file-raw create option

Provide an option to force QEMU to always keep the external data file
consistent as a standalone read-only raw image.

At the moment, this means making sure that write_zeroes requests are
forwarded to the data file instead of just updating the metadata, and
checking that no backing file is used.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Store data file name in the image
Kevin Wolf [Tue, 15 Jan 2019 18:02:40 +0000 (19:02 +0100)]
qcow2: Store data file name in the image

Rather than requiring that the external data file node is passed
explicitly when creating the qcow2 node, store the filename in the
designated header extension during .bdrv_create and read it from there
as a default during .bdrv_open.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Creating images with external data file
Kevin Wolf [Mon, 14 Jan 2019 15:57:27 +0000 (16:57 +0100)]
qcow2: Creating images with external data file

This adds a .bdrv_create option to use an external data file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Add basic data-file infrastructure
Kevin Wolf [Tue, 29 Jan 2019 16:13:57 +0000 (17:13 +0100)]
qcow2: Add basic data-file infrastructure

This adds a .bdrv_open option to specify the external data file node.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Support external data file in qemu-img check
Kevin Wolf [Wed, 27 Feb 2019 16:26:40 +0000 (17:26 +0100)]
qcow2: Support external data file in qemu-img check

For external data files, data clusters must be excluded from the
refcount calculations. Instead, an implicit refcount of 1 is assumed for
the COPIED flag.

Compressed clusters and internal snapshots are incompatible with
external data files, so print an error if they are in use for images
with an external data file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Return error for snapshot operation with data file
Kevin Wolf [Wed, 27 Feb 2019 16:25:08 +0000 (17:25 +0100)]
qcow2: Return error for snapshot operation with data file

Internal snapshots and an external data file are incompatible because
snapshots require refcounting and non-linear mapping. Return an error
for all of the snapshot operations if an external data file is in use.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: External file I/O
Kevin Wolf [Tue, 15 Jan 2019 19:39:06 +0000 (20:39 +0100)]
qcow2: External file I/O

This changes the qcow2 implementation to direct all guest data I/O to
s->data_file rather than bs->file, while metadata I/O still uses
bs->file. At the moment, this is still always the same, but soon we'll
add options to set s->data_file to an external data file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Prepare qcow2_co_block_status() for data file
Kevin Wolf [Wed, 27 Feb 2019 12:22:56 +0000 (13:22 +0100)]
qcow2: Prepare qcow2_co_block_status() for data file

Offset 0 cannot be assumed to mean an unallocated cluster any more.
Instead, the cluster type needs to be checked.

*file must refer to the data file instead of the image file if a valid
offset is returned from qcow2_co_block_status().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Return 0/-errno in qcow2_alloc_compressed_cluster_offset()
Kevin Wolf [Wed, 27 Feb 2019 09:26:24 +0000 (10:26 +0100)]
qcow2: Return 0/-errno in qcow2_alloc_compressed_cluster_offset()

qcow2_alloc_compressed_cluster_offset() used to return the cluster
offset for success and 0 for error. This doesn't only conflict with 0 as
a valid host offset, but also loses the error code.

Similar to the change made to qcow2_alloc_cluster_offset() for
uncompressed clusters in commit 148da7ea9d6, make the function return
0/-errno and return the allocated cluster offset in a by-reference
parameter.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Don't assume 0 is an invalid cluster offset
Kevin Wolf [Fri, 18 Jan 2019 13:40:36 +0000 (14:40 +0100)]
qcow2: Don't assume 0 is an invalid cluster offset

The cluster allocation code uses 0 as an invalid offset that is used in
case of errors or as "offset not yet determined". With external data
files, a host cluster offset of 0 becomes valid, though.

Define a constant INV_OFFSET (which is not cluster aligned and will
therefore never be a valid offset) that can be used for such purposes.

This removes the additional host_offset == 0 check that commit
ff52aab2df5 introduced; the confusion between an invalid offset and
(erroneous) allocation at offset 0 is removed with this change.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Prepare count_contiguous_clusters() for external data file
Kevin Wolf [Fri, 18 Jan 2019 12:44:40 +0000 (13:44 +0100)]
qcow2: Prepare count_contiguous_clusters() for external data file

Offset 0 can be valid for normal (allocated) clusters now, so use
qcow2_get_cluster_type() instead.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Prepare qcow2_get_cluster_type() for external data file
Kevin Wolf [Tue, 29 Jan 2019 12:47:24 +0000 (13:47 +0100)]
qcow2: Prepare qcow2_get_cluster_type() for external data file

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Pass bs to qcow2_get_cluster_type()
Kevin Wolf [Thu, 17 Jan 2019 17:42:40 +0000 (18:42 +0100)]
qcow2: Pass bs to qcow2_get_cluster_type()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Basic definitions for external data files
Kevin Wolf [Mon, 14 Jan 2019 15:48:25 +0000 (16:48 +0100)]
qcow2: Basic definitions for external data files

This adds basic constants, struct fields and helper function for
external data file support to the implementation.

QCOW2_INCOMPAT_MASK and QCOW2_AUTOCLEAR_MASK are not updated yet so that
opening images with an external data file still fails (we don't handle
them correctly yet).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Extend spec for external data files
Kevin Wolf [Tue, 29 Jan 2019 14:25:21 +0000 (15:25 +0100)]
qcow2: Extend spec for external data files

This adds external data file to the qcow2 spec as a new incompatible
feature.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Simplify preallocation code
Kevin Wolf [Thu, 21 Feb 2019 14:48:11 +0000 (15:48 +0100)]
qcow2: Simplify preallocation code

Image creation already involves a bdrv_co_truncate() call, which allows
to specify a preallocation mode. Just pass the right mode there and
remove the code that is made redundant by this.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqemu-iotests: Test qcow2 preallocation modes
Kevin Wolf [Thu, 21 Feb 2019 15:30:33 +0000 (16:30 +0100)]
qemu-iotests: Test qcow2 preallocation modes

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu-iotests: Ensure GNU sed is used
Philippe Mathieu-Daudé [Thu, 7 Mar 2019 14:58:39 +0000 (15:58 +0100)]
qemu-iotests: Ensure GNU sed is used

Various sed regexp from common.filter use sed GNU extensions.
Instead of spending time to write these regex to be POSIX compliant,
verify the GNU sed is available and use it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqemu-iotests: Improve portability by searching bash in the $PATH
Philippe Mathieu-Daudé [Thu, 7 Mar 2019 14:58:38 +0000 (15:58 +0100)]
qemu-iotests: Improve portability by searching bash in the $PATH

Bash is not always installed as /bin/bash. In particular on OpenBSD,
the package installs it in /usr/local/bin.
Use the 'env' shebang to search bash in the $PATH.

Patch created mechanically by running:

  $ git grep -lE '#! ?/bin/bash' -- tests/qemu-iotests \
    | while read f; do \
      sed -i 's|^#!.\?/bin/bash$|#!/usr/bin/env bash|' $f; \
    done

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agotests/bios-tables: Improve portability by searching bash in the $PATH
Philippe Mathieu-Daudé [Thu, 7 Mar 2019 14:58:37 +0000 (15:58 +0100)]
tests/bios-tables: Improve portability by searching bash in the $PATH

Bash is not always installed as /bin/bash. In particular on OpenBSD,
the package installs it in /usr/local/bin.
Use the 'env' shebang to search bash in the $PATH.

Reviewed-by: Kamil Rytarowski <n54@gmx.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agotests/multiboot: Improve portability by searching bash in the $PATH
Philippe Mathieu-Daudé [Thu, 7 Mar 2019 14:58:36 +0000 (15:58 +0100)]
tests/multiboot: Improve portability by searching bash in the $PATH

Bash is not always installed as /bin/bash. In particular on OpenBSD,
the package installs it in /usr/local/bin.
Use the 'env' shebang to search bash in the $PATH.

Reviewed-by: Kamil Rytarowski <n54@gmx.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoiotests: check whitelisted formats
Andrey Shinkevich [Thu, 7 Mar 2019 13:34:00 +0000 (16:34 +0300)]
iotests: check whitelisted formats

Some test cases require specific formats. The method decorator
skip_if_unsupported() checks if requested formats are whitelisted.
The test #139 was selected for a sample output, after running
$ ./check -qcow2 131-140

137 3s ...
138 0s ...
139 2s ...
    [case not run] testBlkDebug (__main__.TestBlockdevDel): formats ['blkdebug'] are not whitelisted
    [case not run] testBlkVerify (__main__.TestBlockdevDel): formats ['blkverify'] are not whitelisted
    [case not run] testQuorum (__main__.TestBlockdevDel): formats ['quorum'] are not whitelisted
140 0s ...
Not run: 131 135 136
Some cases not run in: 139
Passed all 7 tests

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoiotests: ask QEMU for supported formats
Andrey Shinkevich [Thu, 7 Mar 2019 13:33:59 +0000 (16:33 +0300)]
iotests: ask QEMU for supported formats

Supported formats listed by 'qemu' may differ from those listed by
'qemu-img' due to whitelists. Some test cases require specific formats
that may be used with qemu. They can be inquired directly by running
'qemu -drive format=help'. The response takes whitelists into account.
The method supported_formats() serves for that. The method decorator
skip_if_unsupported() checks if all requested formats are whitelisted.
If not, the test case will be skipped. That has been implemented in
the 'check' file in the way similar to the 'test notrun' mechanism.

Suggested-by: Roman Kagan <rkagan@virtuozzo.com>
Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: iterate_format with account of whitelisting
Andrey Shinkevich [Thu, 7 Mar 2019 13:33:58 +0000 (16:33 +0300)]
block: iterate_format with account of whitelisting

bdrv_iterate_format (which is currently only used for printing out the
formats supported by the block layer) doesn't take format whitelisting
into account.

This creates a problem for tests: they enumerate supported formats to
decide which tests to enable, but then discover that QEMU doesn't let
them actually use some of those formats.

To avoid that, exclude formats that are not whitelisted from
enumeration, if whitelisting is in use.  Since we have separate
whitelists for r/w and r/o, take this a parameter to
bdrv_iterate_format, and print two lists of supported formats (r/w and
r/o) in main qemu.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoiotests: open notrun files in text mode
Andrey Shinkevich [Thu, 7 Mar 2019 13:33:57 +0000 (16:33 +0300)]
iotests: open notrun files in text mode

Replace the binary mode with the default text one when *.notrun
files are opened for skipped tests. That change is made for the
compatibility with Python 3 which returns error otherwise.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Default to 4KB for the qcow2 cache entry size
Alberto Garcia [Wed, 13 Feb 2019 16:48:53 +0000 (18:48 +0200)]
qcow2: Default to 4KB for the qcow2 cache entry size

QEMU 2.12 (commit 1221fe6f636754ab5f2c1c87caa77633e9123622) introduced
a new setting called l2-cache-entry-size that allows making entries on
the qcow2 L2 cache smaller than the cluster size.

I have been performing several tests with different cluster and entry
sizes and all of them show that reducing the entry size (aka L2 slice)
consistently improves I/O performance, notably during random I/O (all
tests done with sequential I/O show similar results). This is to be
expected because loading and evicting an L2 slice is more expensive
the larger the slice is.

Here are some numbers on fully populated 40GB qcow2 images. The
rightmost column represents the maximum L2 cache size in both cases.

   Cluster size = 64 KB
   |-------------+--------------+--------------+--------------|
   |             | 1MB L2 cache | 3MB L2 cache | 5MB L2 cache |
   |-------------+--------------+--------------+--------------|
   |  4KB slices |    6545 IOPS |   12045 IOPS |   55680 IOPS |
   | 16KB slices |    5177 IOPS |    9798 IOPS |   56278 IOPS |
   | 64KB slices |    2718 IOPS |    5326 IOPS |   57355 IOPS |
   |-------------+--------------+--------------+--------------|

   Cluster size = 256 KB
   |--------------+----------------+--------------+-----------------|
   |              | 512KB L2 cache | 1MB L2 cache | 1280KB L2 cache |
   |--------------+----------------+--------------+-----------------|
   |   4KB slices |      8539 IOPS |   21071 IOPS |      55417 IOPS |
   |  64KB slices |      3598 IOPS |    9772 IOPS |      57687 IOPS |
   | 256KB slices |      1415 IOPS |    4120 IOPS |      58001 IOPS |
   |--------------+----------------+--------------+-----------------|

As can be seen in the numbers, the only exception to the rule is when
the cache is large enough to hold all L2 tables. This is also to be
expected because in this case no cache entry is ever evicted so
reducing its size doesn't bring any benefit.

This patch sets the default L2 cache entry size to 4KB except when the
cache is large enough for the whole disk.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoiotests: use iotests.VM in 238
Stefan Hajnoczi [Wed, 27 Feb 2019 14:44:13 +0000 (14:44 +0000)]
iotests: use iotests.VM in 238

Test 238 does not require the kvm accelerator.  Using the qtest
accelerator allows the test to run in both non-kvm and non-tcg
environments.

iotests.VM implicitly uses the qtest accelerator and is really the class
that this test should be using.  Switch to that instead of
qemu.QEMUMachine.

Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream-kconfig' into staging
Peter Maydell [Fri, 8 Mar 2019 10:38:39 +0000 (10:38 +0000)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream-kconfig' into staging

Initial Kconfig work, excluding ARM and MIPS

# gpg: Signature made Thu 07 Mar 2019 20:54:27 GMT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream-kconfig: (54 commits)
  kconfig: add documentation
  .travis.yml: test that no-default-device builds do not regress
  xtensa-softmmu.mak: express dependencies with Kconfig
  unicore32-softmmu.mak: express dependencies with Kconfig
  sparc64-softmmu.mak: express dependencies with Kconfig
  sparc-softmmu.mak: express dependencies with Kconfig
  sh4-softmmu.mak: express dependencies with Kconfig
  s390x: express dependencies with Kconfig
  riscv-softmmu.mak: replace CONFIG_* with Kconfig "select" directives
  or1k-softmmu.mak: express dependencies with Kconfig
  nios2-softmmu.mak: express dependencies with Kconfig
  moxie-softmmu.mak: express dependencies with Kconfig
  microblaze-softmmu.mak: express dependencies with Kconfig
  m68k-softmmu.mak: express dependencies with Kconfig
  lm32-softmmu.mak: express dependencies with Kconfig
  hppa-softmmu.mak: express dependencies with Kconfig
  cris-softmmu.mak: express dependencies with Kconfig
  alpha-softmmu.mak: express dependencies with Kconfig
  ppc: Express dependencies of the embedded machines with kconfig
  ppc: Express dependencies of the Sam460EX machines with kconfig
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoiothread: document about why we need explicit aio_poll()
Peter Xu [Wed, 6 Mar 2019 11:55:32 +0000 (19:55 +0800)]
iothread: document about why we need explicit aio_poll()

After consulting Paolo I know why we'd better keep the explicit
aio_poll() in iothread_run().  Document it directly into the code so
that future readers will know the answer from day one.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20190306115532.23025-6-peterx@redhat.com
Message-Id: <20190306115532.23025-6-peterx@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agoiothread: push gcontext earlier in the thread_fn
Peter Xu [Wed, 6 Mar 2019 11:55:31 +0000 (19:55 +0800)]
iothread: push gcontext earlier in the thread_fn

We were pushing the context until right before running the gmainloop.
Now since we have everything unconditionally, we can move this
earlier.

One benefit is that now it's done even before init_done_sem, so as
long as the iothread user calls iothread_create() and completes, we
know that the thread stack is ready.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-id: 20190306115532.23025-5-peterx@redhat.com
Message-Id: <20190306115532.23025-5-peterx@redhat.com>

[Tweaked comment wording as discussed with Peter Xu.
--Stefan]

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agoiothread: create main loop unconditionally
Peter Xu [Wed, 6 Mar 2019 11:55:30 +0000 (19:55 +0800)]
iothread: create main loop unconditionally

Since we've have the gcontext always there, create the main loop
altogether.  The iothread_run() is even cleaner.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-id: 20190306115532.23025-4-peterx@redhat.com
Message-Id: <20190306115532.23025-4-peterx@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agoiothread: create the gcontext unconditionally
Peter Xu [Wed, 6 Mar 2019 11:55:29 +0000 (19:55 +0800)]
iothread: create the gcontext unconditionally

In existing code we create the gcontext dynamically at the first
access of the gcontext from caller.  That can bring some complexity
and potential races during using iothread.  Since the context itself
is not that big a resource, and we won't have millions of iothread,
let's simply create the gcontext unconditionally.

This will also be a preparation work further to move the thread
context push operation earlier than before (now it's only pushed right
before we want to start running the gmainloop).

Removing the g_once since it's not necessary, while introducing a new
run_gcontext boolean to show whether we want to run the gcontext.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-id: 20190306115532.23025-3-peterx@redhat.com
Message-Id: <20190306115532.23025-3-peterx@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agoiothread: replace init_done_cond with a semaphore
Peter Xu [Wed, 6 Mar 2019 11:55:28 +0000 (19:55 +0800)]
iothread: replace init_done_cond with a semaphore

Only sending an init-done message using lock+cond seems an overkill to
me.  Replacing it with a simpler semaphore.

Meanwhile, init the semaphore unconditionally, then we can destroy it
unconditionally too in finalize which seems cleaner.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-id: 20190306115532.23025-2-peterx@redhat.com
Message-Id: <20190306115532.23025-2-peterx@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agotricore: fixed RCR_CADDN instruction
David Brenken [Thu, 7 Feb 2019 07:39:28 +0000 (08:39 +0100)]
tricore: fixed RCR_CADDN instruction

Signed-off-by: Christian Richter <christian.richter@efs-auto.de>
Signed-off-by: David Brenken <david.brenken@efs-auto.de>
Signed-off-by: Georg Hofstetter <georg.hofstetter@efs-auto.de>
Signed-off-by: Robert Rasche <robert.rasche@efs-auto.de>
Signed-off-by: Lars Biermanski <lars.biermanski@efs-auto.de>
Message-Id: <20190207073928.4048-3-david.brenken@efs-auto.org>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
5 years agotricore: fixed RCR_CADD instruction
David Brenken [Thu, 7 Feb 2019 07:39:27 +0000 (08:39 +0100)]
tricore: fixed RCR_CADD instruction

Signed-off-by: Christian Richter <christian.richter@efs-auto.de>
Signed-off-by: David Brenken <david.brenken@efs-auto.de>
Signed-off-by: Georg Hofstetter <georg.hofstetter@efs-auto.de>
Signed-off-by: Robert Rasche <robert.rasche@efs-auto.de>
Signed-off-by: Lars Biermanski <lars.biermanski@efs-auto.de>
Message-Id: <20190207073928.4048-2-david.brenken@efs-auto.org>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
5 years agocirrus.yml: Add macOS continuous integration task
Thomas Huth [Sun, 3 Mar 2019 14:42:59 +0000 (15:42 +0100)]
cirrus.yml: Add macOS continuous integration task

cirrus-ci.com also has the possibility to run CI tasks on macOS.
Since most of the QEMU developers do not have access to macOS yet,
let's add a CI pipeline for this operating system here, too.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Ed Maste <emaste@freebsd.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agotests/bios-tables: Improve portability by searching bash in the $PATH
Philippe Mathieu-Daudé [Thu, 7 Mar 2019 14:58:37 +0000 (15:58 +0100)]
tests/bios-tables: Improve portability by searching bash in the $PATH

Bash is not always installed as /bin/bash. In particular on OpenBSD,
the package installs it in /usr/local/bin.
Use the 'env' shebang to search bash in the $PATH.

Reviewed-by: Kamil Rytarowski <n54@gmx.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agovhost-user-test: fix leaks
Marc-André Lureau [Tue, 5 Mar 2019 22:51:35 +0000 (23:51 +0100)]
vhost-user-test: fix leaks

Spotted by ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Fixes: ae31fb54914 and 4d3f50eb489
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agotarget/hppa: Optimize blr r0,rn
Richard Henderson [Thu, 21 Feb 2019 23:29:39 +0000 (15:29 -0800)]
target/hppa: Optimize blr r0,rn

We can eliminate an extra TB in this case, which merely
loads a "return address" into rn.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/hppa: Do not return freed temporary
Richard Henderson [Thu, 21 Feb 2019 22:01:07 +0000 (14:01 -0800)]
target/hppa: Do not return freed temporary

For priv levels 1 & 2, we were doing so from do_ibranch_priv.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotests: Do not use "\n" in g_test_message() strings
Thomas Huth [Fri, 1 Mar 2019 15:10:18 +0000 (16:10 +0100)]
tests: Do not use "\n" in g_test_message() strings

g_test_message() takes care of the newline on its own, so we
should not use \n in the strings here.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agohw/devices: Remove unused TC6393XB_RAM definition
Philippe Mathieu-Daudé [Fri, 4 Jan 2019 17:58:34 +0000 (18:58 +0100)]
hw/devices: Remove unused TC6393XB_RAM definition

Introduced in 64b40bc54a9, this definition is no more used since
a0b753dfd39. Remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agohw: Remove unused 'hw/devices.h' include
Philippe Mathieu-Daudé [Fri, 4 Jan 2019 17:58:33 +0000 (18:58 +0100)]
hw: Remove unused 'hw/devices.h' include

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agotests: Move qdict-test-data.txt to tests/data/qobject/
Philippe Mathieu-Daudé [Tue, 18 Dec 2018 11:37:17 +0000 (12:37 +0100)]
tests: Move qdict-test-data.txt to tests/data/qobject/

Move qdict-test-data.txt to the tests/data/qobject/ subdirectory,
and remove the unnecessary symlinking.
(See 4b2ff65a1f3 for similar test-data cleanup).

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[thuth: Fix conflict in MAINTAINERS]
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agokconfig: add documentation
Paolo Bonzini [Tue, 12 Feb 2019 12:06:51 +0000 (13:06 +0100)]
kconfig: add documentation

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years ago.travis.yml: test that no-default-device builds do not regress
Paolo Bonzini [Thu, 31 Jan 2019 14:57:53 +0000 (15:57 +0100)]
.travis.yml: test that no-default-device builds do not regress

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agoxtensa-softmmu.mak: express dependencies with Kconfig
Paolo Bonzini [Tue, 29 Jan 2019 11:16:27 +0000 (12:16 +0100)]
xtensa-softmmu.mak: express dependencies with Kconfig

%-softmmu.mak only keep boards and optional device
definitions in Kconfig mode.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agounicore32-softmmu.mak: express dependencies with Kconfig
Paolo Bonzini [Tue, 29 Jan 2019 11:16:27 +0000 (12:16 +0100)]
unicore32-softmmu.mak: express dependencies with Kconfig

%-softmmu.mak only keep boards and optional device
definitions in Kconfig mode.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agosparc64-softmmu.mak: express dependencies with Kconfig
Paolo Bonzini [Tue, 29 Jan 2019 11:16:27 +0000 (12:16 +0100)]
sparc64-softmmu.mak: express dependencies with Kconfig

%-softmmu.mak only keep boards and optional device
definitions in Kconfig mode.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agosparc-softmmu.mak: express dependencies with Kconfig
Paolo Bonzini [Tue, 29 Jan 2019 11:16:27 +0000 (12:16 +0100)]
sparc-softmmu.mak: express dependencies with Kconfig

%-softmmu.mak only keep boards and optional device
definitions in Kconfig mode.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agosh4-softmmu.mak: express dependencies with Kconfig
Paolo Bonzini [Tue, 29 Jan 2019 11:16:27 +0000 (12:16 +0100)]
sh4-softmmu.mak: express dependencies with Kconfig

%-softmmu.mak only keep boards and optional device
definitions in Kconfig mode.

Note that USB_OHCI was missing (it was brought in via pci.mak,
but r2d needs the sysbus version) and SERIAL is not used.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agos390x: express dependencies with Kconfig
Thomas Huth [Tue, 29 Jan 2019 09:42:14 +0000 (10:42 +0100)]
s390x: express dependencies with Kconfig

Instead of hard-coding all config switches in the config file
default-configs/s390x-softmmu.mak, let's use the new Kconfig files
to express the necessary dependencies: The S390_CCW_VIRTIO config switch
for the "s390-ccw-virtio" machine now selects all non-optional devices.

And since we already have the VIRTIO_PCI and VIRTIO_MMIO config switches
for the other two virtio transports, this patch also introduces a new
config switch VIRTIO_CCW for the third, s390x-specific virtio transport,
so that all three virtio transports are now handled in the same way.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agoriscv-softmmu.mak: replace CONFIG_* with Kconfig "select" directives
Paolo Bonzini [Tue, 29 Jan 2019 11:16:27 +0000 (12:16 +0100)]
riscv-softmmu.mak: replace CONFIG_* with Kconfig "select" directives

%-softmmu.mak only keep boards and optional device
definitions in Kconfig mode.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>