]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
5 years agotarget/arm: Convert VADD to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:48 +0000 (16:39 +0100)]
target/arm: Convert VADD to decodetree

Convert the VADD instruction to decodetree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VNMUL to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:47 +0000 (16:39 +0100)]
target/arm: Convert VNMUL to decodetree

Convert the VNMUL instruction to decodetree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VMUL to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:47 +0000 (16:39 +0100)]
target/arm: Convert VMUL to decodetree

Convert the VMUL instruction to decodetree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VFP VNMLA to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:47 +0000 (16:39 +0100)]
target/arm: Convert VFP VNMLA to decodetree

Convert the VFP VNMLA instruction to decodetree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VFP VNMLS to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:46 +0000 (16:39 +0100)]
target/arm: Convert VFP VNMLS to decodetree

Convert the VFP VNMLS instruction to decodetree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VFP VMLS to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:46 +0000 (16:39 +0100)]
target/arm: Convert VFP VMLS to decodetree

Convert the VFP VMLS instruction to decodetree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VFP VMLA to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:46 +0000 (16:39 +0100)]
target/arm: Convert VFP VMLA to decodetree

Convert the VFP VMLA instruction to decodetree.

This is the first of the VFP 3-operand data processing instructions,
so we include in this patch the code which loops over the elements
for an old-style VFP vector operation. The existing code to do this
looping uses the deprecated cpu_F0s/F0d/F1s/F1d TCG globals; since
we are going to be converting instructions one at a time anyway
we can take the opportunity to make the new loop use TCG temporaries,
which means we can do that conversion one operation at a time
rather than needing to do it all in one go.

We include an UNDEF check which was missing in the old code:
short-vector operations (with stride or length non-zero) were
deprecated in v7A and must UNDEF in v8A, so if the MVFR0 FPShVec
field does not indicate that support for short vectors is present
we UNDEF the operations that would use them. (This is a change
of behaviour for Cortex-A7, Cortex-A15 and the v8 CPUs, which
previously were all incorrectly allowing short-vector operations.)

Note that the conversion fixes a bug in the old code for the
case of VFP short-vector "mixed scalar/vector operations". These
happen where the destination register is in a vector bank but
but the second operand is in a scalar bank. For example
  vmla.f64 d10, d1, d16   with length 2 stride 2
is equivalent to the pair of scalar operations
  vmla.f64 d10, d1, d16
  vmla.f64 d8, d3, d16
where the destination and first input register cycle through
their vector but the second input is scalar (d16). In the
old decoder the gen_vfp_F1_mul() operation uses cpu_F1{s,d}
as a temporary output for the multiply, which trashes the
second input operand. For the fully-scalar case (where we
never do a second iteration) and the fully-vector case
(where the loop loads the new second input operand) this
doesn't matter, but for the mixed scalar/vector case we
will end up using the wrong value for later loop iterations.
In the new code we use TCG temporaries and so avoid the bug.
This bug is present for all the multiply-accumulate insns
that operate on short vectors: VMLA, VMLS, VNMLA, VNMLS.

Note 2: the expression used to calculate the next register
number in the vector bank is not in fact correct; we leave
this behaviour unchanged from the old decoder and will
fix this bug later in the series.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Remove VLDR/VSTR/VLDM/VSTM use of cpu_F0s and cpu_F0d
Peter Maydell [Tue, 11 Jun 2019 15:39:46 +0000 (16:39 +0100)]
target/arm: Remove VLDR/VSTR/VLDM/VSTM use of cpu_F0s and cpu_F0d

Expand out the sequences in the new decoder VLDR/VSTR/VLDM/VSTM trans
functions which perform the memory accesses by going via the TCG
globals cpu_F0s and cpu_F0d, to use local TCG temps instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert the VFP load/store multiple insns to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:45 +0000 (16:39 +0100)]
target/arm: Convert the VFP load/store multiple insns to decodetree

Convert the VFP load/store multiple insns to decodetree.
This includes tightening up the UNDEF checking for pre-VFPv3
CPUs which only have D0-D15 : they now UNDEF for any access
to D16-D31, not merely when the smallest register in the
transfer list is in D16-D31.

This conversion does not try to share code between the single
precision and the double precision versions; this looks a bit
duplicative of code, but it leaves the door open for a future
refactoring which gets rid of the use of the "F0" registers
by inlining the various functions like gen_vfp_ld() and
gen_mov_F0_reg() which are hiding "if (dp) { ... } else { ... }"
conditionalisation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VFP VLDR and VSTR to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:45 +0000 (16:39 +0100)]
target/arm: Convert VFP VLDR and VSTR to decodetree

Convert the VFP single load/store insns VLDR and VSTR to decodetree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VFP two-register transfer insns to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:45 +0000 (16:39 +0100)]
target/arm: Convert VFP two-register transfer insns to decodetree

Convert the VFP two-register transfer instructions to decodetree
(in the v8 Arm ARM these are the "Advanced SIMD and floating-point
64-bit move" encoding group).

Again, we expand out the sequences involving gen_vfp_msr() and
gen_msr_vfp().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert "single-precision" register moves to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:44 +0000 (16:39 +0100)]
target/arm: Convert "single-precision" register moves to decodetree

Convert the "single-precision" register moves to decodetree:
 * VMSR
 * VMRS
 * VMOV between general purpose register and single precision

Note that the VMSR/VMRS conversions make our handling of
the "should this UNDEF?" checks consistent between the two
instructions:
 * VMSR to MVFR0, MVFR1, MVFR2 now UNDEF from EL0
   (previously was a nop)
 * VMSR to FPSID now UNDEFs from EL0 or if VFPv3 or better
   (previously was a nop)
 * VMSR to FPINST and FPINST2 now UNDEF if VFPv3 or better
   (previously would write to the register, which had no
   guest-visible effect because we always UNDEF reads)

We also tighten up the decode: we were previously underdecoding
some SBZ or SBO bits.

The conversion of VMOV_single includes the expansion out of the
gen_mov_F0_vreg()/gen_vfp_mrs() and gen_mov_vreg_F0()/gen_vfp_msr()
sequences into the simpler direct load/store of the TCG temp via
neon_{load,store}_reg32(): we know in the new function that we're
always single-precision, we don't need to use the old-and-deprecated
cpu_F0* TCG globals, and we don't happen to have the declaration of
gen_vfp_msr() and gen_vfp_mrs() at the point in the file where the
new function is.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert "double-precision" register moves to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:44 +0000 (16:39 +0100)]
target/arm: Convert "double-precision" register moves to decodetree

Convert the "double-precision" register moves to decodetree:
this covers VMOV scalar-to-gpreg, VMOV gpreg-to-scalar and VDUP.

Note that the conversion process has tightened up a few of the
UNDEF encoding checks: we now correctly forbid:
 * VMOV-to-gpr with U:opc1:opc2 == 10x00 or x0x10
 * VMOV-from-gpr with opc1:opc2 == 0x10
 * VDUP with B:E == 11
 * VDUP with Q == 1 and Vn<0> == 1

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
The accesses of elements < 32 bits could be improved by doing
direct ld/st of the right size rather than 32-bit read-and-shift
or read-modify-write, but we leave this for later cleanup,
since this series is generally trying to stick to fixing
the decode.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Add helpers for VFP register loads and stores
Peter Maydell [Tue, 11 Jun 2019 15:39:44 +0000 (16:39 +0100)]
target/arm: Add helpers for VFP register loads and stores

The current VFP code has two different idioms for
loading and storing from the VFP register file:
 1 using the gen_mov_F0_vreg() and similar functions,
   which load and store to a fixed set of TCG globals
   cpu_F0s, CPU_F0d, etc
 2 by direct calls to tcg_gen_ld_f64() and friends

We want to phase out idiom 1 (because the use of the
fixed globals is a relic of a much older version of TCG),
but idiom 2 is quite longwinded:
 tcg_gen_ld_f64(tmp, cpu_env, vfp_reg_offset(true, reg))
requires us to specify the 64-bitness twice, once in
the function name and once by passing 'true' to
vfp_reg_offset(). There's no guard against accidentally
passing the wrong flag.

Instead, let's move to a convention of accessing 64-bit
registers via the existing neon_load_reg64() and
neon_store_reg64(), and provide new neon_load_reg32()
and neon_store_reg32() for the 32-bit equivalents.

Implement the new functions and use them in the code in
translate-vfp.inc.c. We will convert the rest of the VFP
code as we do the decodetree conversion in subsequent
commits.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Move the VFP trans_* functions to translate-vfp.inc.c
Peter Maydell [Tue, 11 Jun 2019 15:39:43 +0000 (16:39 +0100)]
target/arm: Move the VFP trans_* functions to translate-vfp.inc.c

Move the trans_*() functions we've just created from translate.c
to translate-vfp.inc.c. This is pure code motion with no textual
changes (this can be checked with 'git show --color-moved').

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VCVTA/VCVTN/VCVTP/VCVTM to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:43 +0000 (16:39 +0100)]
target/arm: Convert VCVTA/VCVTN/VCVTP/VCVTM to decodetree

Convert the VCVTA/VCVTN/VCVTP/VCVTM instructions to decodetree.
trans_VCVT() is temporarily left in translate.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VRINTA/VRINTN/VRINTP/VRINTM to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:43 +0000 (16:39 +0100)]
target/arm: Convert VRINTA/VRINTN/VRINTP/VRINTM to decodetree

Convert the VRINTA/VRINTN/VRINTP/VRINTM instructions to decodetree.
Again, trans_VRINT() is temporarily left in translate.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert VMINNM, VMAXNM to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:43 +0000 (16:39 +0100)]
target/arm: Convert VMINNM, VMAXNM to decodetree

Convert the VMINNM and VMAXNM instructions to decodetree.
As with VSEL, we leave the trans_VMINMAXNM() function
in translate.c for the moment.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Convert the VSEL instructions to decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:42 +0000 (16:39 +0100)]
target/arm: Convert the VSEL instructions to decodetree

Convert the VSEL instructions to decodetree.
We leave trans_VSEL() in translate.c for now as this allows
the patch to show just the changes from the old handle_vsel().

In the old code the check for "do D16-D31 exist" was hidden in
the VFP_DREG macro, and assumed that VFPv3 always implied that
D16-D31 exist. In the new code we do the correct ID register test.
This gives identical behaviour for most of our CPUs, and fixes
previously incorrect handling for  Cortex-R5F, Cortex-M4 and
Cortex-M33, which all implement VFPv3 or better with only 16
double-precision registers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Explicitly enable VFP short-vectors for aarch32 -cpu max
Peter Maydell [Tue, 11 Jun 2019 15:39:42 +0000 (16:39 +0100)]
target/arm: Explicitly enable VFP short-vectors for aarch32 -cpu max

At the moment our -cpu max for AArch32 supports VFP short-vectors
because we always implement them, even for CPUs which should
not have them. The following commits are going to switch to
using the correct ID-register-check to enable or disable short
vector support, so we need to turn it on explicitly for -cpu max,
because Cortex-A15 doesn't implement it.

We don't enable this for the AArch64 -cpu max, because the v8A
architecture never supports short-vectors.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Fix Cortex-R5F MVFR values
Peter Maydell [Tue, 11 Jun 2019 15:39:42 +0000 (16:39 +0100)]
target/arm: Fix Cortex-R5F MVFR values

The Cortex-R5F initfn was not correctly setting up the MVFR
ID register values. Fill these in, since some subsequent patches
will use ID register checks rather than CPU feature bit checks.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Factor out VFP access checking code
Peter Maydell [Tue, 11 Jun 2019 15:39:41 +0000 (16:39 +0100)]
target/arm: Factor out VFP access checking code

Factor out the VFP access checking code so that we can use it in the
leaf functions of the decodetree decoder.

We call the function full_vfp_access_check() so we can keep
the more natural vfp_access_check() for a version which doesn't
have the 'ignore_vfp_enabled' flag -- that way almost all VFP
insns will be able to use vfp_access_check(s) and only the
special-register access function will have to use
full_vfp_access_check(s, ignore_vfp_enabled).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotarget/arm: Add stubs for AArch32 VFP decodetree
Peter Maydell [Tue, 11 Jun 2019 15:39:41 +0000 (16:39 +0100)]
target/arm: Add stubs for AArch32 VFP decodetree

Add the infrastructure for building and invoking a decodetree decoder
for the AArch32 VFP encodings.  At the moment the new decoder covers
nothing, so we always fall back to the existing hand-written decode.

We need to have one decoder for the unconditional insns and one for
the conditional insns, as otherwise the patterns for conditional
insns would incorrectly match against the unconditional ones too.

Since translate.c is over 14,000 lines long and we're going to be
touching pretty much every line of the VFP code as part of the
decodetree conversion, we create a new translate-vfp.inc.c to hold
the code which deals with VFP in the new scheme.  It should be
possible to convert this into a standalone translation unit
eventually, but the conversion process will be much simpler if we
simply #include it midway through translate.c to start with.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Fix comparison of Field
Richard Henderson [Tue, 11 Jun 2019 15:39:41 +0000 (16:39 +0100)]
decodetree: Fix comparison of Field

Typo comparing the sign of the field, twice, instead of also comparing
the mask of the field (which itself encodes both position and length).

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190604154225.26992-1-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Fix output of PAuth Auth
Richard Henderson [Sun, 9 Jun 2019 22:22:49 +0000 (15:22 -0700)]
target/arm: Fix output of PAuth Auth

The ARM pseudocode installs the error_code into the original
pointer, not the encrypted pointer.  The difference applies
within the 7 bits of pac data; the result should be the sign
extension of bit 55.

Add a testcase to that effect.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/core/bus.c: Only the main system bus can have no parent
Peter Maydell [Thu, 23 May 2019 15:05:43 +0000 (16:05 +0100)]
hw/core/bus.c: Only the main system bus can have no parent

In commit 80376c3fc2c38fdd453 in 2010 we added a workaround for
some qbus buses not being connected to qdev devices -- if the
bus has no parent object then we register a reset function which
resets the bus on system reset (and unregister it when the
bus is unparented).

Nearly a decade later, we have now no buses in the tree which
are created with non-NULL parents, so we can remove the
workaround and instead just assert that if the bus has a NULL
parent then it is the main system bus.

(The absence of other parentless buses was confirmed by
code inspection of all the callsites of qbus_create() and
qbus_create_inplace() and cross-checked by 'make check'.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190523150543.22676-1-peter.maydell@linaro.org

5 years agohw/arm/smmuv3: Fix decoding of ID register range
Peter Maydell [Fri, 24 May 2019 12:48:29 +0000 (13:48 +0100)]
hw/arm/smmuv3: Fix decoding of ID register range

The SMMUv3 ID registers cover an area 0x30 bytes in size
(12 registers, 4 bytes each). We were incorrectly decoding
only the first 0x20 bytes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-id: 20190524124829.2589-1-peter.maydell@linaro.org

5 years agotarget/arm: Implement NSACR gating of floating point
Peter Maydell [Fri, 10 May 2019 11:03:57 +0000 (12:03 +0100)]
target/arm: Implement NSACR gating of floating point

The NSACR register allows secure code to configure the FPU
to be inaccessible to non-secure code. If the NSACR.CP10
bit is set then:
 * NS accesses to the FPU trap as UNDEF (ie to NS EL1 or EL2)
 * CPACR.{CP10,CP11} behave as if RAZ/WI
 * HCPTR.{TCP11,TCP10} behave as if RAO/WI

Note that we do not implement the NSACR.NSASEDIS bit which
gates only access to Advanced SIMD, in the same way that
we don't implement the equivalent CPACR.ASEDIS and HCPTR.TASE.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20190510110357.18825-1-peter.maydell@linaro.org

5 years agotarget/arm: Use tcg_gen_gvec_bitsel
Richard Henderson [Sat, 18 May 2019 19:19:34 +0000 (12:19 -0700)]
target/arm: Use tcg_gen_gvec_bitsel

This replaces 3 target-specific implementations for BIT, BIF, and BSL.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20190518191934.21887-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/kraxel/tags/vga-20190613-pull-request' into...
Peter Maydell [Thu, 13 Jun 2019 12:25:25 +0000 (13:25 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20190613-pull-request' into staging

edid: add xmax + ymax properties, enable by default.

# gpg: Signature made Thu 13 Jun 2019 08:38:18 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/vga-20190613-pull-request:
  edid: flip the default to enabled
  edid: add xmax + ymax properties

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190612' into staging
Peter Maydell [Thu, 13 Jun 2019 11:57:04 +0000 (12:57 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190612' into staging

Fix vector arithmetic right shift helpers.

# gpg: Signature made Thu 13 Jun 2019 05:10:11 BST
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# 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-tcg-20190612:
  tcg: Fix typos in helper_gvec_sar{8,32,64}v

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-06-12' into staging
Peter Maydell [Thu, 13 Jun 2019 10:58:00 +0000 (11:58 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-06-12' into staging

QAPI patches for 2019-06-12

# gpg: Signature made Wed 12 Jun 2019 17:44:50 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2019-06-12:
  qapi: Simplify how QAPIDoc implements its state machine
  file-posix: Add dynamic-auto-read-only QAPI feature
  qapi: Allow documentation for features
  qapi: Disentangle QAPIDoc code
  tests/qapi-schema: Error case tests for features in structs
  tests/qapi-schema: Test for good feature lists in structs
  qapi: Add feature flags to struct types
  block/gluster: update .help of BLOCK_OPT_PREALLOC option
  block/file-posix: update .help of BLOCK_OPT_PREALLOC option
  qapi/block-core: update documentation of preallocation parameter
  qdev: Delete unused LostTickPolicy "merge"

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device
Chen Zhang [Tue, 4 Jun 2019 09:36:48 +0000 (17:36 +0800)]
ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device

In fullscreen mode, the window property of cocoaView may not be the key
window, and the current implementation would not re-grab cursor by left click
in fullscreen mode after ungrabbed in fullscreen mode with hot-key ctrl-opt-g.

This patch used value of isFullscreen as a short-cirtuit condition for
relative input device grabbing.

Signed-off-by: Chen Zhang <tgfbeta@me.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 2D2F1191-E82F-4B54-A6E7-73FFB953DE93@me.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoui/cocoa: Fix absolute input device grabbing issue on Mojave
Chen Zhang [Tue, 4 Jun 2019 09:36:00 +0000 (17:36 +0800)]
ui/cocoa: Fix absolute input device grabbing issue on Mojave

On Mojave, absolute input device, i.e. tablet, had trouble re-grabbing
the cursor in re-entry into the virtual screen area. In some cases,
the `window` property of NSEvent object was nil after cursor exiting from
window, hinting that the `-locationInWindow` method would return value in
screen coordinates. The current implementation used raw locations from
NSEvent without considering whether the value was for the window coordinates
or the macOS screen coordinates, nor the zooming factor for Zoom-to-Fit in
fullscreen mode.

In fullscreen mode, the fullscreen cocoa window might not be the key
window, therefore the location of event in virtual coordinates should
suffice.

This patches fixed boundary check methods for cursor in normal
and fullscreen with/without Zoom-to-Fit in Mojave.

Note: CGRect, -convertRectToScreen: and -convertRectFromScreen: were
used in coordinates conversion for compatibility reason.

Signed-off-by: Chen Zhang <tgfbeta@me.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: FA3FBC4F-5379-4118-B997-58FE05CC58F9@me.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-testing-gdbstub-cputlb-120619...
Peter Maydell [Thu, 13 Jun 2019 09:00:18 +0000 (10:00 +0100)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-gdbstub-cputlb-120619-3' into staging

Various fixes and updates:

  - editor config tweak for shell scripts
  - iotest updates (still not default for make check)
  - various docker updates
  - gcc/ubsan updates for travis
  - some clean-ups for tests/vm (no serial autoinstall)
  - semihosting fix for Coverity
  - fixes for cputlb in 64-on-32 cases
  - gdbstub re-factor + maintainership update

# gpg: Signature made Wed 12 Jun 2019 17:55:04 BST
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-testing-gdbstub-cputlb-120619-3: (40 commits)
  gdbstub: Implement qemu physical memory mode
  gdbstub: Clear unused variables in gdb_handle_packet
  gdbstub: Implement target halted (? pkt) with new infra
  gdbstub: Implement generic set/query (Q/q pkt) with new infra
  gdbstub: Implement v commands with new infra
  gdbstub: Implement step (s pkt) with new infra
  gdbstub: Implement file io (F pkt) with new infra
  gdbstub: Implement read all registers (g pkt) with new infra
  gdbstub: Implement write all registers (G pkt) with new infra
  gdbstub: Implement read memory (m pkt) with new infra
  gdbstub: Implement write memory (M pkt) with new infra
  gdbstub: Implement get register (p pkt) with new infra
  gdbstub: Implement set register (P pkt) with new infra
  gdbstub: Implement breakpoint commands (Z/z pkt) with new infra
  gdbstub: Implement set_thread (H pkt) with new infra
  gdbstub: Implement continue with signal (C pkt) with new infra
  gdbstub: Implement continue (c pkt) with new infra
  gdbstub: Implement thread_alive (T pkt) with new infra
  gdbstub: Implement deatch (D pkt) with new infra
  gdbstub: Add infrastructure to parse cmd packets
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoedid: flip the default to enabled
Gerd Hoffmann [Fri, 7 Jun 2019 08:34:44 +0000 (10:34 +0200)]
edid: flip the default to enabled

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20190607083444.32175-1-kraxel@redhat.com

5 years agoedid: add xmax + ymax properties
Gerd Hoffmann [Fri, 7 Jun 2019 08:34:29 +0000 (10:34 +0200)]
edid: add xmax + ymax properties

Add new properties to allow setting the maximum display resolution.
Resolutions larger than that will not be included in the mode list.
In linux guests xrandr can be used to list modes.

Note: The existing xres and yres properties set the preferred display
resolution, i.e. the mode should be first in the mode list and guests
should use it by default.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20190607083429.31943-1-kraxel@redhat.com

5 years agotcg: Fix typos in helper_gvec_sar{8,32,64}v
Richard Henderson [Fri, 7 Jun 2019 14:40:19 +0000 (09:40 -0500)]
tcg: Fix typos in helper_gvec_sar{8,32,64}v

The loop is written with scalars, not vectors.
Use the correct type when incrementing.

Fixes: 5ee5c14cacd
Reported-by: Laurent Vivier <lvivier@redhat.com>
Tested-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agogdbstub: Implement qemu physical memory mode
Jon Doron [Wed, 29 May 2019 06:41:48 +0000 (09:41 +0300)]
gdbstub: Implement qemu physical memory mode

Add a new query/set which changes the memory GDB sees to physical memory
only.

gdb> maint packet qqemu.PhyMemMode
will reply the current phy_mem_mode state (1 for enabled, 0 for disabled)
gdb> maint packet Qqemu.PhyMemMode:1
Will make GDB read/write only to physical memory, set to 0 to disable

Signed-off-by: Jon Doron <arilou@gmail.com>
Message-Id: <20190529064148.19856-21-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Clear unused variables in gdb_handle_packet
Jon Doron [Wed, 29 May 2019 06:41:47 +0000 (09:41 +0300)]
gdbstub: Clear unused variables in gdb_handle_packet

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-20-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement target halted (? pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:46 +0000 (09:41 +0300)]
gdbstub: Implement target halted (? pkt) with new infra

Note: The user-mode thread-id has been correctly reported since bd88c780e6

Signed-off-by: Jon Doron <arilou@gmail.com>
Message-Id: <20190529064148.19856-19-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement generic set/query (Q/q pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:45 +0000 (09:41 +0300)]
gdbstub: Implement generic set/query (Q/q pkt) with new infra

The generic set/query packets contains implementation for varioius
sub-commands which are required for GDB and also additional commands
which are QEMU specific.

To see which QEMU specific commands are available use the command
gdb> maintenance packet qqemu.Supported

Currently the only implemented QEMU specific command is the command
that sets the single step behavior.

gdb> maintenance packet qqemu.sstepbits
Will display the MASK bits used to control the single stepping.

gdb> maintenance packet qqemu.sstep
Will display the current value of the mask used when single stepping.

gdb> maintenance packet Qqemu.sstep:HEX_VALUE
Will change the single step mask.

Signed-off-by: Jon Doron <arilou@gmail.com>
Message-Id: <20190529064148.19856-18-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement v commands with new infra
Jon Doron [Wed, 29 May 2019 06:41:44 +0000 (09:41 +0300)]
gdbstub: Implement v commands with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Message-Id: <20190529064148.19856-17-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement step (s pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:43 +0000 (09:41 +0300)]
gdbstub: Implement step (s pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-16-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement file io (F pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:42 +0000 (09:41 +0300)]
gdbstub: Implement file io (F pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Message-Id: <20190529064148.19856-15-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement read all registers (g pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:41 +0000 (09:41 +0300)]
gdbstub: Implement read all registers (g pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-14-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement write all registers (G pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:40 +0000 (09:41 +0300)]
gdbstub: Implement write all registers (G pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-13-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement read memory (m pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:39 +0000 (09:41 +0300)]
gdbstub: Implement read memory (m pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-12-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement write memory (M pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:38 +0000 (09:41 +0300)]
gdbstub: Implement write memory (M pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-11-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement get register (p pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:37 +0000 (09:41 +0300)]
gdbstub: Implement get register (p pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Message-Id: <20190529064148.19856-10-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement set register (P pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:36 +0000 (09:41 +0300)]
gdbstub: Implement set register (P pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Message-Id: <20190529064148.19856-9-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement breakpoint commands (Z/z pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:35 +0000 (09:41 +0300)]
gdbstub: Implement breakpoint commands (Z/z pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Message-Id: <20190529064148.19856-8-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement set_thread (H pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:34 +0000 (09:41 +0300)]
gdbstub: Implement set_thread (H pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-7-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement continue with signal (C pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:33 +0000 (09:41 +0300)]
gdbstub: Implement continue with signal (C pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-6-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement continue (c pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:32 +0000 (09:41 +0300)]
gdbstub: Implement continue (c pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-5-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement thread_alive (T pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:31 +0000 (09:41 +0300)]
gdbstub: Implement thread_alive (T pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-4-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Implement deatch (D pkt) with new infra
Jon Doron [Wed, 29 May 2019 06:41:30 +0000 (09:41 +0300)]
gdbstub: Implement deatch (D pkt) with new infra

Signed-off-by: Jon Doron <arilou@gmail.com>
Message-Id: <20190529064148.19856-3-arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agogdbstub: Add infrastructure to parse cmd packets
Jon Doron [Wed, 29 May 2019 06:41:29 +0000 (09:41 +0300)]
gdbstub: Add infrastructure to parse cmd packets

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190529064148.19856-2-arilou@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agocputlb: cast size_t to target_ulong before using for address masks
Alex Bennée [Thu, 6 Jun 2019 15:38:19 +0000 (16:38 +0100)]
cputlb: cast size_t to target_ulong before using for address masks

While size_t is defined to happily access the biggest host object this
isn't the case when generating masks for 64 bit guests on 32 bit
hosts. Otherwise we end up truncating the address when we fall back to
our unaligned helper.

Fixes: https://bugs.launchpad.net/qemu/+bug/1831545
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Andrew Randrianasulu <randrianasulu@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agoMAINTAINERS: put myself forward for gdbstub
Alex Bennée [Thu, 6 Jun 2019 08:27:53 +0000 (09:27 +0100)]
MAINTAINERS: put myself forward for gdbstub

As I've been reviewing a lot of this recently and I'm going to put
together a pull request I'd better keep an eye on it. Philippe has
also volunteered to be a reviewer.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotests/tcg/x86_64: add a PVH crt.o for x86_64 system tests
Alex Bennée [Wed, 6 Mar 2019 16:44:47 +0000 (16:44 +0000)]
tests/tcg/x86_64: add a PVH crt.o for x86_64 system tests

Instead of doing the full real to 64 bit dance we are attempting to
leverage Xen's PVH boot spec to go from 32 bit to 64 bit.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg: clean-up VPATH/TESTS for i386
Alex Bennée [Tue, 4 Jun 2019 15:30:05 +0000 (16:30 +0100)]
tests/tcg: clean-up VPATH/TESTS for i386

Since we only run build the multiarch tests and we use a fully
resolved path for the crt object we don't need the wildcard or VPATH
messing about.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/tcg: better detect truncated reads
Alex Bennée [Mon, 3 Jun 2019 15:14:24 +0000 (16:14 +0100)]
tests/tcg: better detect truncated reads

If we've truncated a wider read we can detect the condition earlier by
looking at the number of zeros we've read. So we don't trip up on
cases where we have written zeros to the start of the buffer we also
ensure we only start each offset read from the right address.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agocputlb: use uint64_t for interim values for unaligned load
Alex Bennée [Mon, 3 Jun 2019 14:56:32 +0000 (15:56 +0100)]
cputlb: use uint64_t for interim values for unaligned load

When running on 32 bit TCG backends a wide unaligned load ends up
truncating data before returning to the guest. We specifically have
the return type as uint64_t to avoid any premature truncation so we
should use the same for the interim types.

Fixes: https://bugs.launchpad.net/qemu/+bug/1830872
Fixes: eed5664238e
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
5 years agosemihosting: split console_out into string and char versions
Alex Bennée [Thu, 30 May 2019 14:35:14 +0000 (15:35 +0100)]
semihosting: split console_out into string and char versions

This is ostensibly to avoid the weirdness of len looking like it might
come from a guest and sometimes being used. While we are at it fix up
the error checking for the arm-linux-user implementation of the API
which got flagged up by Coverity (CID 1401700).

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/vm: python3 fixes
Gerd Hoffmann [Mon, 20 May 2019 12:47:04 +0000 (14:47 +0200)]
tests/vm: python3 fixes

Add proper unicode handling when processing strings.
Also need to explicitly say we want int not float.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-3-kraxel@redhat.com>
[AJB: fix conflicts with tests/vm: Port basevm to Python 3]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agoscripts: use git archive in archive-source
Gerd Hoffmann [Mon, 20 May 2019 12:47:03 +0000 (14:47 +0200)]
scripts: use git archive in archive-source

Use git archive to create tarballs of qemu and submodules instead of
cloning the repository and the submodules.  This is a order of magnitude
faster because it doesn't fetch the submodules from the internet each
time the script runs.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-2-kraxel@redhat.com>
[AJB: fixed up tabs]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/vm: Add missing variables on help
Wainer dos Santos Moschetta [Fri, 29 Mar 2019 21:08:04 +0000 (17:08 -0400)]
tests/vm: Add missing variables on help

Added description of variables missing on vm-test help.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20190329210804.22121-6-wainersm@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotests/vm: Fix build-centos docker-based tests run
Wainer dos Santos Moschetta [Fri, 29 Mar 2019 21:08:03 +0000 (17:08 -0400)]
tests/vm: Fix build-centos docker-based tests run

`make vm-build-centos` run docker-based tests on CentOS. The
created containers should have network otherwise some tests
fail. Also fixed the BUILD_SCRIPT template to correctly
evaluate "V=1" for verbose output.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20190329210804.22121-5-wainersm@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/vm: Port basevm to Python 3
Wainer dos Santos Moschetta [Fri, 29 Mar 2019 21:08:01 +0000 (17:08 -0400)]
tests/vm: Port basevm to Python 3

Fixed tests/vm/basevm.py to run with Python 3:
 - hashlib.sha1() requires an binary encoded object.
 - uses floor division ("//") (PEP 238).
 - decode bytes to unicode when needed.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190329210804.22121-3-wainersm@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotests/vm: Use python configured on build
Wainer dos Santos Moschetta [Fri, 29 Mar 2019 21:08:00 +0000 (17:08 -0400)]
tests/vm: Use python configured on build

Changed the vm-test makefile to execute python scripts
with the interpreter configured on build. This allows to
run vm-test targets properly in Linux distros with Python 3
only support.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20190329210804.22121-2-wainersm@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years ago.travis.yml: add clang ubsan job
Alex Bennée [Tue, 28 May 2019 18:21:19 +0000 (19:21 +0100)]
.travis.yml: add clang ubsan job

We document this on our wiki and we might as well catch it in our CI
rather than waiting for it to be picked up on merge:

  https://wiki.qemu.org/Testing#clang_UBSan

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years ago.travis.yml: bump gcc sanitiser job to gcc-9
Alex Bennée [Tue, 28 May 2019 18:13:08 +0000 (19:13 +0100)]
.travis.yml: bump gcc sanitiser job to gcc-9

The toolchain PPA has it so we might as well use it. We currently have
to add:

  -Wno-error=stringop-truncation

as there are still strncpy operations in the tree operating on things
that haven't been annotated with QEMU_NONSTRING.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agotests/docker: Update the Ubuntu image to 19.04
Alex Bennée [Wed, 29 May 2019 20:03:01 +0000 (21:03 +0100)]
tests/docker: Update the Ubuntu image to 19.04

This has aged a little and we have a separate LTS image for testing on
the older distros. Update it to a more recent release like its Fedora
cousin.

Besides it is useful to have something with gcc-9 on it for squashing
those stringop truncation errors.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotests/docker: Update the Fedora cross compile images to 30
Alex Bennée [Thu, 30 May 2019 09:52:53 +0000 (10:52 +0100)]
tests/docker: Update the Fedora cross compile images to 30

While at it remove the bogus :latest tag for cris cross compiler. It
tends to break caching and cause confusion.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotests/docker: Update the Fedora image to Fedora 30
Philippe Mathieu-Daudé [Tue, 28 May 2019 15:33:04 +0000 (17:33 +0200)]
tests/docker: Update the Fedora image to Fedora 30

Fedora 30 got released:

  https://fedoramagazine.org/announcing-fedora-30/

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20190528153304.27157-1-philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agoqemu-io-cmds: use clock_gettime for benchmarking
Alex Bennée [Wed, 29 May 2019 16:16:32 +0000 (17:16 +0100)]
qemu-io-cmds: use clock_gettime for benchmarking

The previous use of gettimeofday() ran into undefined behaviour when
we ended up doing a div 0 for a very short operation. This is because
gettimeofday only works at the microsecond level as well as being
prone to discontinuous jumps in system time. Using clock_gettime with
CLOCK_MONOTONIC gives greater precision and alleviates some of the
potential problems with time jumping around.

We could use CLOCK_MONOTONIC_RAW to avoid being tripped up by NTP and
adjtime but that is Linux specific so I decided it would do for now.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
5 years agoeditorconfig: add setting for shell scripts
Alex Bennée [Thu, 30 May 2019 09:40:28 +0000 (10:40 +0100)]
editorconfig: add setting for shell scripts

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5 years agoqapi: Simplify how QAPIDoc implements its state machine
Markus Armbruster [Thu, 6 Jun 2019 15:38:03 +0000 (17:38 +0200)]
qapi: Simplify how QAPIDoc implements its state machine

QAPIDoc uses a state machine to for processing of documentation lines.
Its state is encoded as an enum QAPIDoc._state (well, as enum-like
class actually, thanks to our infatuation with Python 2).

All we ever do with the state is calling the state's function to
process a line of documentation.  The enum values effectively serve as
handles for the functions.

Eliminate the rather wordy indirection: store the function to call in
QAPIDoc._append_line.  Update and improve comments.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190606153803.5278-8-armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
[Commit message typo fixed]

5 years agofile-posix: Add dynamic-auto-read-only QAPI feature
Kevin Wolf [Thu, 6 Jun 2019 15:38:02 +0000 (17:38 +0200)]
file-posix: Add dynamic-auto-read-only QAPI feature

In commit 23dece19da4 ('file-posix: Make auto-read-only dynamic') ,
auto-read-only=on changed its behaviour in file-posix for the 4.0
release. This change cannot be detected through the usual mechanisms
like schema introspection. Add a new feature flag to the schema to
allow libvirt to detect the presence of the new behaviour.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190606153803.5278-7-armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Comment tweaked on Eric Blake's advice]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: Allow documentation for features
Kevin Wolf [Thu, 6 Jun 2019 15:38:01 +0000 (17:38 +0200)]
qapi: Allow documentation for features

Features will be documented in a new part introduced by a "Features:"
line, after arguments and before named sections.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190606153803.5278-6-armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: Disentangle QAPIDoc code
Kevin Wolf [Thu, 6 Jun 2019 15:38:00 +0000 (17:38 +0200)]
qapi: Disentangle QAPIDoc code

Documentation comments follow a certain structure: First, we have a text
with a general description (called QAPIDoc.body). After this,
descriptions of the arguments follow. Finally, we have a part that
contains various named sections.

The code doesn't show this structure, but just checks various attributes
that indicate indirectly which part is being processed, so it happens to
do the right set of things in the right phase. This is hard to follow,
and adding support for documentation of features would be even harder.

This patch restructures the code so that the three parts are clearly
separated. The code becomes a bit longer, but easier to follow. The
resulting output remains unchanged.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190606153803.5278-5-armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agotests/qapi-schema: Error case tests for features in structs
Kevin Wolf [Thu, 6 Jun 2019 15:37:59 +0000 (17:37 +0200)]
tests/qapi-schema: Error case tests for features in structs

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190606153803.5278-4-armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agotests/qapi-schema: Test for good feature lists in structs
Kevin Wolf [Thu, 6 Jun 2019 15:37:58 +0000 (17:37 +0200)]
tests/qapi-schema: Test for good feature lists in structs

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190606153803.5278-3-armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: Add feature flags to struct types
Kevin Wolf [Thu, 6 Jun 2019 15:37:57 +0000 (17:37 +0200)]
qapi: Add feature flags to struct types

Sometimes, the behaviour of QEMU changes without a change in the QMP
syntax (usually by allowing values or operations that previously
resulted in an error). QMP clients may still need to know whether
they can rely on the changed behavior.

Let's add feature flags to the QAPI schema language, so that we can make
such changes visible with schema introspection.

An example for a schema definition using feature flags looks like this:

    { 'struct': 'TestType',
      'data': { 'number': 'int' },
      'features': [ 'allow-negative-numbers' ] }

Introspection information then looks like this:

    { "name": "TestType", "meta-type": "object",
      "members": [
          { "name": "number", "type": "int" } ],
      "features": [ "allow-negative-numbers" ] }

This patch implements feature flags only for struct types. We'll
implement them more widely as needed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190606153803.5278-2-armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoblock/gluster: update .help of BLOCK_OPT_PREALLOC option
Stefano Garzarella [Fri, 24 May 2019 07:58:48 +0000 (09:58 +0200)]
block/gluster: update .help of BLOCK_OPT_PREALLOC option

Add missing 'falloc' among the allowed values of 'preallocation'
option; show it and 'full' only when they are supported.
('falloc' is supported if defined CONFIG_GLUSTERFS_FALLOCATE,
'full' is supported if defined CONFIG_GLUSTERFS_ZEROFILL)

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190524075848.23781-4-sgarzare@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoblock/file-posix: update .help of BLOCK_OPT_PREALLOC option
Stefano Garzarella [Fri, 24 May 2019 07:58:47 +0000 (09:58 +0200)]
block/file-posix: update .help of BLOCK_OPT_PREALLOC option

Show 'falloc' among the allowed values of 'preallocation'
option, only when it is supported (if defined CONFIG_POSIX_FALLOCATE)

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190524075848.23781-3-sgarzare@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi/block-core: update documentation of preallocation parameter
Stefano Garzarella [Fri, 24 May 2019 07:58:46 +0000 (09:58 +0200)]
qapi/block-core: update documentation of preallocation parameter

Add default and available values in the documentation block of
each block device or protocol that supports the 'preallocation'
parameter during the image creation.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190524075848.23781-2-sgarzare@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqdev: Delete unused LostTickPolicy "merge"
Markus Armbruster [Mon, 1 Apr 2019 15:01:40 +0000 (17:01 +0200)]
qdev: Delete unused LostTickPolicy "merge"

Commit 4e4fa398db6 "qdev: Introduce lost tick policy property"
(v1.1.0) created PropertyType PROP_TYPE_LOSTTICKPOLICY with values
"discard", "delay", "merge", and "slew".  Value "merge" has never been
used.  Delete it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190401150140.29151-1-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.1-20190612' into staging
Peter Maydell [Wed, 12 Jun 2019 13:43:47 +0000 (14:43 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.1-20190612' into staging

ppc patch queue 2019-06-12

Next pull request against qemu-4.1.  The big thing here is adding
support for hot plug of P2P bridges, and PCI devices under P2P bridges
on the "pseries" machine (which doesn't use SHPC).  Other than that
there's just a handful of fixes and small enhancements.

# gpg: Signature made Wed 12 Jun 2019 06:47:56 BST
# gpg:                using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" [full]
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>" [full]
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" [full]
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>" [unknown]
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-4.1-20190612:
  ppc/xive: Make XIVE generate the proper interrupt types
  ppc/pnv: activate the "dumpdtb" option on the powernv machine
  target/ppc: Use tcg_gen_gvec_bitsel
  spapr: Allow hot plug/unplug of PCI bridges and devices under PCI bridges
  spapr: Direct all PCI hotplug to host bridge, rather than P2P bridge
  spapr: Don't use bus number for building DRC ids
  spapr: Clean up DRC index construction
  spapr: Clean up spapr_drc_populate_dt()
  spapr: Clean up dt creation for PCI buses
  spapr: Clean up device tree construction for PCI devices
  spapr: Clean up device node name generation for PCI devices
  target/ppc: Fix lxvw4x, lxvh8x and lxvb16x
  spapr_pci: Improve error message

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-misc-2019-06-11-v3' into staging
Peter Maydell [Wed, 12 Jun 2019 12:50:01 +0000 (13:50 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2019-06-11-v3' into staging

Miscellaneous patches for 2019-06-11

# gpg: Signature made Wed 12 Jun 2019 12:20:41 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-misc-2019-06-11-v3:
  MAINTAINERS: Polish headline decorations
  MAINTAINERS: Improve section headlines
  MAINTAINERS: Remove duplicate entries of qemu-devel@nongnu.org
  Clean up a header guard symbols (again)
  Supply missing header guards
  Clean up a few header guard symbols
  scripts/clean-header-guards: Fix handling of trailing comments
  Normalize position of header guard
  Include qemu-common.h exactly where needed
  Include qemu/module.h where needed, drop it from qemu-common.h
  qemu-common: Move qemu_isalnum() etc. to qemu/ctype.h
  qemu-common: Move tcg_enabled() etc. to sysemu/tcg.h

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMAINTAINERS: Polish headline decorations
Markus Armbruster [Thu, 6 Jun 2019 17:24:08 +0000 (19:24 +0200)]
MAINTAINERS: Polish headline decorations

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190606172408.18399-4-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agoMAINTAINERS: Improve section headlines
Markus Armbruster [Thu, 6 Jun 2019 17:24:07 +0000 (19:24 +0200)]
MAINTAINERS: Improve section headlines

When scripts/get_maintainer.pl reports something like

    John Doe <jdoe@example.org> (maintainer:Overall)

the user is left to wonder *which* of our three "Overall" sections
applies: the one under "Guest CPU cores (TCG)", or the one under
"Guest CPU Cores (KVM)", or the one under "Usermode emulation".

Rename sections under

* "Guest CPU cores (TCG)" from "FOO" to "FOO TCG CPUs"

* "Guest CPU Cores (KVM)" from "FOO" to "FOO KVM CPUs"

* "Guest CPU Cores (Xen)" from "FOO" to "FOO Xen CPUs"

* "Architecture support" from "FOO" to "FOO general architecture
  support"

* "Usermode Emulation" from "Overall" to "Overall usermode emulation"

* "Tiny Code Generator (TCG)" from "FOO target" to "FOO TCG target",
  and from "Common code" to "Common TCG code"

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190606172408.18399-3-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agoMAINTAINERS: Remove duplicate entries of qemu-devel@nongnu.org
Philippe Mathieu-Daudé [Fri, 7 Jun 2019 14:27:20 +0000 (16:27 +0200)]
MAINTAINERS: Remove duplicate entries of qemu-devel@nongnu.org

The list is always selected by the 'All patches CC here' section.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[Conflicts resolved by redoing the patch]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoClean up a header guard symbols (again)
Markus Armbruster [Fri, 7 Jun 2019 14:13:21 +0000 (16:13 +0200)]
Clean up a header guard symbols (again)

Commit d52c454aad "contrib: add vhost-user-gpu" and "c68082c43a
virtio-gpu: split virtio-gpu-pci & virtio-vga" created headers with
unusual header guard symbols.  Clean them up

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190607141321.9726-1-armbru@redhat.com>

5 years agoSupply missing header guards
Markus Armbruster [Tue, 4 Jun 2019 18:16:18 +0000 (20:16 +0200)]
Supply missing header guards

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190604181618.19980-5-armbru@redhat.com>

5 years agoClean up a few header guard symbols
Markus Armbruster [Tue, 4 Jun 2019 18:16:17 +0000 (20:16 +0200)]
Clean up a few header guard symbols

Commit 58ea30f5145 "Clean up header guards that don't match their file
name" messed up contrib/elf2dmp/qemu_elf.h and
tests/migration/migration-test.h.

It missed target/cris/opcode-cris.h and
tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
due to the scripts/clean-header-guards.pl bug fixed in the previous
commit.

Commit a8b991b52dc "Clean up ill-advised or unusual header guards"
missed include/hw/xen/io/ring.h for the same reason.

Commit 3979fca4b69 "disas: Rename include/disas/bfd.h back to
include/disas/dis-asm.h" neglected to update the guard symbol for the
rename.

Commit a331c6d7741 "semihosting: implement a semihosting console"
created include/hw/semihosting/console.h with an ill-advised guard
symbol.

Clean them up.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190604181618.19980-4-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agoscripts/clean-header-guards: Fix handling of trailing comments
Markus Armbruster [Tue, 4 Jun 2019 18:16:16 +0000 (20:16 +0200)]
scripts/clean-header-guards: Fix handling of trailing comments

clean-header-guards.pl fails to recognize a header guard #endif when
it's followed by a // comment, or multiple comments.  Fix that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190604181618.19980-3-armbru@redhat.com>

5 years agoNormalize position of header guard
Markus Armbruster [Tue, 4 Jun 2019 18:16:15 +0000 (20:16 +0200)]
Normalize position of header guard

This is the common header guard idiom:

    /*
     * File comment
     */

    #ifndef GUARD_SYMBOL_H
    #define GUARD_SYMBOL_H

    ... actual contents ...

    #endif

A few of our headers have some #include before the guard.
target/tilegx/spr_def_64.h has #ifndef __DOXYGEN__ outside the guard.
A few more have the #define elsewhere.

Change them to match the common idiom.  For spr_def_64.h, that means
dropping #ifndef __DOXYGEN__.  While there, rename guard symbols to
make scripts/clean-header-guards.pl happy.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190604181618.19980-2-armbru@redhat.com>
[Rebased with conflicts resolved automatically]

5 years agoInclude qemu-common.h exactly where needed
Markus Armbruster [Thu, 23 May 2019 14:35:08 +0000 (16:35 +0200)]
Include qemu-common.h exactly where needed

No header includes qemu-common.h after this commit, as prescribed by
qemu-common.h's file comment.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190523143508.25387-5-armbru@redhat.com>
[Rebased with conflicts resolved automatically, except for
include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c
block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c
target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h
target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h
target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h
target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and
net/tap-bsd.c fixed up]