]> Git Repo - qemu.git/log
qemu.git
7 years agoMove include qemu/option.h from qemu-common.h to actual users
Markus Armbruster [Thu, 1 Feb 2018 11:18:46 +0000 (12:18 +0100)]
Move include qemu/option.h from qemu-common.h to actual users

qemu-common.h includes qemu/option.h, but most places that include the
former don't actually need the latter.  Drop the include, and add it
to the places that actually need it.

While there, drop superfluous includes of both headers, and
separate #include from file comment with a blank line.

This cleanup makes the number of objects depending on qemu/option.h
drop from 4545 (out of 4743) to 284 in my "build everything" tree.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>
[Semantic conflict with commit bdd6a90a9e in block/nvme.c resolved]

7 years agoDrop superfluous includes of qapi/qmp/qjson.h
Markus Armbruster [Thu, 1 Feb 2018 11:18:45 +0000 (12:18 +0100)]
Drop superfluous includes of qapi/qmp/qjson.h

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoDrop superfluous includes of qapi/qmp/dispatch.h
Markus Armbruster [Thu, 1 Feb 2018 11:18:44 +0000 (12:18 +0100)]
Drop superfluous includes of qapi/qmp/dispatch.h

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoInclude qapi/qmp/qnull.h exactly where needed
Markus Armbruster [Thu, 1 Feb 2018 11:18:43 +0000 (12:18 +0100)]
Include qapi/qmp/qnull.h exactly where needed

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoInclude qapi/qmp/qnum.h exactly where needed
Markus Armbruster [Thu, 1 Feb 2018 11:18:42 +0000 (12:18 +0100)]
Include qapi/qmp/qnum.h exactly where needed

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoInclude qapi/qmp/qbool.h exactly where needed
Markus Armbruster [Thu, 1 Feb 2018 11:18:41 +0000 (12:18 +0100)]
Include qapi/qmp/qbool.h exactly where needed

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoInclude qapi/qmp/qstring.h exactly where needed
Markus Armbruster [Thu, 1 Feb 2018 11:18:40 +0000 (12:18 +0100)]
Include qapi/qmp/qstring.h exactly where needed

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoInclude qapi/qmp/qdict.h exactly where needed
Markus Armbruster [Thu, 1 Feb 2018 11:18:39 +0000 (12:18 +0100)]
Include qapi/qmp/qdict.h exactly where needed

This cleanup makes the number of objects depending on qapi/qmp/qdict.h
drop from 4550 (out of 4743) to 368 in my "build everything" tree.
For qapi/qmp/qobject.h, the number drops from 4552 to 390.

While there, separate #include from file comment with a blank line.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoInclude qapi/qmp/qlist.h exactly where needed
Markus Armbruster [Thu, 1 Feb 2018 11:18:38 +0000 (12:18 +0100)]
Include qapi/qmp/qlist.h exactly where needed

This cleanup makes the number of objects depending on qapi/qmp/qlist.h
drop from 4551 (out of 4743) to 16 in my "build everything" tree.

While there, separate #include from file comment with a blank line.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoInclude qapi/qmp/qobject.h exactly where needed
Markus Armbruster [Thu, 1 Feb 2018 11:18:37 +0000 (12:18 +0100)]
Include qapi/qmp/qobject.h exactly where needed

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoqdict qlist: Make most helper macros functions
Markus Armbruster [Thu, 1 Feb 2018 11:18:36 +0000 (12:18 +0100)]
qdict qlist: Make most helper macros functions

The macro expansions of qdict_put_TYPE() and qlist_append_TYPE() need
qbool.h, qnull.h, qnum.h and qstring.h to compile.  We include qnull.h
and qnum.h in the headers, but not qbool.h and qstring.h.  Works,
because we include those wherever the macros get used.

Open-coding these helpers is of dubious value.  Turn them into
functions and drop the includes from the headers.

This cleanup makes the number of objects depending on qapi/qmp/qnum.h
from 4551 (out of 4743) to 46 in my "build everything" tree.  For
qapi/qmp/qnull.h, the number drops from 4552 to 21.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoEliminate qapi/qmp/types.h
Markus Armbruster [Thu, 1 Feb 2018 11:18:35 +0000 (12:18 +0100)]
Eliminate qapi/qmp/types.h

qapi/qmp/types.h is a convenience header to include a number of
qapi/qmp/ headers.  Since we rarely need all of the headers
qapi/qmp/types.h includes, we bypass it most of the time.  Most of the
places that use it don't need all the headers, either.

Include the necessary headers directly, and drop qapi/qmp/types.h.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoTypedef the subtypes of QObject in qemu/typedefs.h, too
Markus Armbruster [Thu, 1 Feb 2018 11:18:34 +0000 (12:18 +0100)]
Typedef the subtypes of QObject in qemu/typedefs.h, too

This renders many inclusions of qapi/qmp/q*.h superfluous.  They'll be
dropped in the next few commits.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoInclude qmp-commands.h exactly where needed
Markus Armbruster [Thu, 1 Feb 2018 11:18:33 +0000 (12:18 +0100)]
Include qmp-commands.h exactly where needed

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>
[OSX breakage fixed]

7 years agoDrop superfluous includes of qapi/qmp/qerror.h
Markus Armbruster [Thu, 1 Feb 2018 11:18:32 +0000 (12:18 +0100)]
Drop superfluous includes of qapi/qmp/qerror.h

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoInclude qapi/error.h exactly where needed
Markus Armbruster [Thu, 1 Feb 2018 11:18:31 +0000 (12:18 +0100)]
Include qapi/error.h exactly where needed

This cleanup makes the number of objects depending on qapi/error.h
drop from 1910 (out of 4743) to 1612 in my "build everything" tree.

While there, separate #include from file comment with a blank line,
and drop a useless comment on why qemu/osdep.h is included first.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>
[Semantic conflict with commit 34e304e975 resolved, OSX breakage fixed]

7 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20180209' into staging
Peter Maydell [Fri, 9 Feb 2018 11:46:32 +0000 (11:46 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180209' into staging

s390x updates:
- rework interrupt handling for tcg, smp is now considered non-experimental
- some general improvements in the flic
- improvements in the pci code, and wiring it up in tcg
- add PTFF subfunctions for multiple-epoch to the cpu model
- maintainership updates
- various other fixes and improvements

# gpg: Signature made Fri 09 Feb 2018 09:04:34 GMT
# gpg:                using RSA key DECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20180209: (29 commits)
  MAINTAINERS: add David as additional tcg/s390 maintainer
  MAINTAINERS: reorganize s390-ccw bios maintainership
  MAINTAINERS: add myself as overall s390x maintainer
  s390x/pci: use the right pal and pba in reg_ioat()
  s390x/pci: fixup global refresh
  s390x/pci: fixup the code walking IOMMU tables
  s390x/cpumodel: model PTFF subfunctions for Multiple-epoch facility
  s390x/cpumodel: allow zpci features in qemu model
  s390x/tcg: wire up pci instructions
  s390x/sclp: fix event mask handling
  s390x/flic: cache the common flic class in a central function
  s390x/kvm: cache the kvm flic in a central function
  s390x/tcg: cache the qemu flic in a central function
  configure: s390x supports mttcg now
  s390x/tcg: remove SMP warning
  s390x/tcg: STSI overhaul
  s390x: fix size + content of STSI blocks
  s390x/flic: optimize CPU wakeup for TCG
  s390x/flic: implement qemu_s390_clear_io_flic()
  s390x/tcg: implement TEST PENDING INTERRUPTION
  ...

Signed-off-by: Peter Maydell <[email protected]>
7 years agohw/core/generic-loader: Allow PC to be set on command line
Peter Maydell [Mon, 5 Feb 2018 15:04:26 +0000 (15:04 +0000)]
hw/core/generic-loader: Allow PC to be set on command line

The documentation for the generic loader claims that you can
set the PC for a CPU with an option of the form
  -device loader,cpu-num=0,addr=0x10000004

However if you try this QEMU complains:
  cpu_num must be specified when setting a program counter

This is because we were testing against 0 rather than CPU_NONE.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20180205150426[email protected]

7 years agotarget/arm/translate.c: Fix missing 'break' for TT insns
Peter Maydell [Tue, 6 Feb 2018 10:39:41 +0000 (10:39 +0000)]
target/arm/translate.c: Fix missing 'break' for TT insns

The code where we added the TT instruction was accidentally
missing a 'break', which meant that after generating the code
to execute the TT we would fall through to 'goto illegal_op'
and generate code to take an UNDEF insn.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20180206103941[email protected]

7 years agotarget/arm/kvm: gic: Prevent creating userspace GICv3 with KVM
Christoffer Dall [Thu, 1 Feb 2018 20:53:07 +0000 (21:53 +0100)]
target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM

KVM doesn't support emulating a GICv3 in userspace, only GICv2.  We
currently attempt this anyway, and as a result a KVM guest doesn't
receive interrupts and the user is left wondering why.  Report an error
to the user if this particular combination is requested.

Signed-off-by: Christoffer Dall <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20180201205307[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: Add SVE state to TB->FLAGS
Richard Henderson [Tue, 23 Jan 2018 03:53:49 +0000 (19:53 -0800)]
target/arm: Add SVE state to TB->FLAGS

Add both SVE exception state and vector length.

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20180123035349[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: Add ZCR_ELx
Richard Henderson [Tue, 23 Jan 2018 03:53:48 +0000 (19:53 -0800)]
target/arm: Add ZCR_ELx

Define ZCR_EL[1-3].

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20180123035349[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: Add SVE to migration state
Richard Henderson [Tue, 23 Jan 2018 03:53:47 +0000 (19:53 -0800)]
target/arm: Add SVE to migration state

Save the high parts of the Zregs and all of the Pregs.
The ZCR_ELx registers are migrated via the CP mechanism.

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20180123035349[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: Add predicate registers for SVE
Richard Henderson [Tue, 23 Jan 2018 03:53:46 +0000 (19:53 -0800)]
target/arm: Add predicate registers for SVE

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20180123035349[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: Expand vector registers for SVE
Richard Henderson [Fri, 9 Feb 2018 10:40:31 +0000 (10:40 +0000)]
target/arm: Expand vector registers for SVE

Change vfp.regs as a uint64_t to vfp.zregs as an ARMVectorReg.
The previous patches have made the change in representation
relatively painless.

Reviewed-by: Alex Bennée <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20180123035349[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agohw/arm: Move virt's PSCI DT fixup code to arm/boot.c
Andrey Smirnov [Fri, 9 Feb 2018 10:40:30 +0000 (10:40 +0000)]
hw/arm: Move virt's PSCI DT fixup code to arm/boot.c

Move virt's PSCI DT fixup code to arm/boot.c and set this fixup to
happen automatically for every board that doesn't mark "psci-conduit"
as disabled. This way emulated boards other than "virt" that rely on
PSIC for SMP could benefit from that code.

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agousb: Add basic code to emulate Chipidea USB IP
Andrey Smirnov [Fri, 9 Feb 2018 10:40:30 +0000 (10:40 +0000)]
usb: Add basic code to emulate Chipidea USB IP

Add code to emulate Chipidea USB IP (used in i.MX SoCs). Tested to
work against:

-usb -drive if=none,id=stick,file=usb.img,format=raw -device \
 usb-storage,bus=usb-bus.0,drive=stick

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoi.MX: Add implementation of i.MX7 GPR IP block
Andrey Smirnov [Fri, 9 Feb 2018 10:40:30 +0000 (10:40 +0000)]
i.MX: Add implementation of i.MX7 GPR IP block

Add minimal code needed to allow upstream Linux guest to boot.

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoi.MX: Add i.MX7 GPT variant
Andrey Smirnov [Fri, 9 Feb 2018 10:40:30 +0000 (10:40 +0000)]
i.MX: Add i.MX7 GPT variant

Add minimal code needed to allow upstream Linux guest to boot.

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoi.MX: Add code to emulate GPCv2 IP block
Andrey Smirnov [Fri, 9 Feb 2018 10:40:30 +0000 (10:40 +0000)]
i.MX: Add code to emulate GPCv2 IP block

Add minimal code needed to allow upstream Linux guest to boot.

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoi.MX: Add code to emulate i.MX7 SNVS IP-block
Andrey Smirnov [Fri, 9 Feb 2018 10:40:30 +0000 (10:40 +0000)]
i.MX: Add code to emulate i.MX7 SNVS IP-block

Add code to emulate SNVS IP-block. Currently only the bits needed to
be able to emulate machine shutdown are implemented.

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoi.MX: Add code to emulate i.MX2 watchdog IP block
Andrey Smirnov [Fri, 9 Feb 2018 10:40:29 +0000 (10:40 +0000)]
i.MX: Add code to emulate i.MX2 watchdog IP block

Add enough code to emulate i.MX2 watchdog IP block so it would be
possible to reboot the machine running Linux Guest.

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoi.MX: Add code to emulate i.MX7 CCM, PMU and ANALOG IP blocks
Andrey Smirnov [Fri, 9 Feb 2018 10:40:29 +0000 (10:40 +0000)]
i.MX: Add code to emulate i.MX7 CCM, PMU and ANALOG IP blocks

Add minimal code needed to allow upstream Linux guest to boot.

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agohw: i.MX: Convert i.MX6 to use TYPE_IMX_USDHC
Andrey Smirnov [Fri, 9 Feb 2018 10:40:29 +0000 (10:40 +0000)]
hw: i.MX: Convert i.MX6 to use TYPE_IMX_USDHC

Convert i.MX6 to use TYPE_IMX_USDHC since that's what real HW comes
with.

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agosdhci: Add i.MX specific subtype of SDHCI
Andrey Smirnov [Fri, 9 Feb 2018 10:40:29 +0000 (10:40 +0000)]
sdhci: Add i.MX specific subtype of SDHCI

IP block found on several generations of i.MX family does not use
vanilla SDHCI implementation and it comes with a number of quirks.

Introduce i.MX SDHCI subtype of SDHCI block to add code necessary to
support unmodified Linux guest driver.

Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
[PMM: define and use ESDHC_UNDOCUMENTED_REG27]
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: enable user-mode SHA-3, SM3, SM4 and SHA-512 instruction support
Ard Biesheuvel [Fri, 9 Feb 2018 10:40:29 +0000 (10:40 +0000)]
target/arm: enable user-mode SHA-3, SM3, SM4 and SHA-512 instruction support

Add support for the new ARMv8.2 SHA-3, SM3, SM4 and SHA-512 instructions to
AArch64 user mode emulation.

Signed-off-by: Ard Biesheuvel <[email protected]>
Message-id: 20180207111729[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: implement SM4 instructions
Ard Biesheuvel [Fri, 9 Feb 2018 10:40:28 +0000 (10:40 +0000)]
target/arm: implement SM4 instructions

This implements emulation of the new SM4 instructions that have
been added as an optional extension to the ARMv8 Crypto Extensions
in ARM v8.2.

Signed-off-by: Ard Biesheuvel <[email protected]>
Message-id: 20180207111729[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: implement SM3 instructions
Ard Biesheuvel [Fri, 9 Feb 2018 10:40:28 +0000 (10:40 +0000)]
target/arm: implement SM3 instructions

This implements emulation of the new SM3 instructions that have
been added as an optional extension to the ARMv8 Crypto Extensions
in ARM v8.2.

Signed-off-by: Ard Biesheuvel <[email protected]>
Message-id: 20180207111729[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: implement SHA-3 instructions
Ard Biesheuvel [Fri, 9 Feb 2018 10:40:28 +0000 (10:40 +0000)]
target/arm: implement SHA-3 instructions

This implements emulation of the new SHA-3 instructions that have
been added as an optional extensions to the ARMv8 Crypto Extensions
in ARM v8.2.

Signed-off-by: Ard Biesheuvel <[email protected]>
Message-id: 20180207111729[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: implement SHA-512 instructions
Ard Biesheuvel [Fri, 9 Feb 2018 10:40:28 +0000 (10:40 +0000)]
target/arm: implement SHA-512 instructions

This implements emulation of the new SHA-512 instructions that have
been added as an optional extensions to the ARMv8 Crypto Extensions
in ARM v8.2.

Signed-off-by: Ard Biesheuvel <[email protected]>
Message-id: 20180207111729[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: Handle exceptions during exception stack pop
Peter Maydell [Fri, 9 Feb 2018 10:40:28 +0000 (10:40 +0000)]
target/arm: Handle exceptions during exception stack pop

Handle possible MPU faults, SAU faults or bus errors when
popping register state off the stack during exception return.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1517324542[email protected]

7 years agotarget/arm: Make exception vector loads honour the SAU
Peter Maydell [Fri, 9 Feb 2018 10:40:28 +0000 (10:40 +0000)]
target/arm: Make exception vector loads honour the SAU

Make the load of the exception vector from the vector table honour
the SAU and any bus error on the load (possibly provoking a derived
exception), rather than simply aborting if the load fails.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1517324542[email protected]

7 years agotarget/arm: Make v7m_push_callee_stack() honour MPU
Peter Maydell [Fri, 9 Feb 2018 10:40:27 +0000 (10:40 +0000)]
target/arm: Make v7m_push_callee_stack() honour MPU

Make v7m_push_callee_stack() honour the MPU by using the
new v7m_stack_write() function. We return a flag to indicate
whether the pushes failed, which we can then use in
v7m_exception_taken() to cause us to handle the derived
exception correctly.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 1517324542[email protected]

7 years agotarget/arm: Make v7M exception entry stack push check MPU
Peter Maydell [Fri, 9 Feb 2018 10:40:27 +0000 (10:40 +0000)]
target/arm: Make v7M exception entry stack push check MPU

The memory writes done to push registers on the stack
on exception entry in M profile CPUs are supposed to
go via MPU permissions checks, which may cause us to
take a derived exception instead of the original one of
the MPU lookup fails. We were implementing these as
always-succeeds direct writes to physical memory.
Rewrite v7m_push_stack() to do the necessary checks.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1517324542[email protected]

7 years agotarget/arm: Add ignore_stackfaults argument to v7m_exception_taken()
Peter Maydell [Fri, 9 Feb 2018 10:40:27 +0000 (10:40 +0000)]
target/arm: Add ignore_stackfaults argument to v7m_exception_taken()

In the v8M architecture, if the process of taking an exception
results in a further exception this is called a derived exception
(for example, an MPU exception when writing the exception frame to
memory). If the derived exception happens while pushing the initial
stack frame, we must ignore any subsequent possible exception
pushing the callee-saves registers.

In preparation for making the stack writes check for exceptions,
add a return value from v7m_push_stack() and a new parameter to
v7m_exception_taken(), so that the former can tell the latter that
it needs to ignore failures to write to the stack. We also plumb
the argument through to v7m_push_callee_stack(), which is where
the code to ignore the failures will be.

(Note that the v8M ARM pseudocode structures this slightly differently:
derived exceptions cause the attempt to process the original
exception to be abandoned; then at the top level it calls
DerivedLateArrival to prioritize the derived exception and call
TakeException from there. We choose to let the NVIC do the prioritization
and continue forward with a call to TakeException which will then
take either the original or the derived exception. The effect is
the same, but this structure works better for QEMU because we don't
have a convenient top level place to do the abandon-and-retry logic.)

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1517324542[email protected]

7 years agotarget/arm: Split "get pending exception info" from "acknowledge it"
Peter Maydell [Fri, 9 Feb 2018 10:40:27 +0000 (10:40 +0000)]
target/arm: Split "get pending exception info" from "acknowledge it"

Currently armv7m_nvic_acknowledge_irq() does three things:
 * make the current highest priority pending interrupt active
 * return a bool indicating whether that interrupt is targeting
   Secure or NonSecure state
 * implicitly tell the caller which is the highest priority
   pending interrupt by setting env->v7m.exception

We need to split these jobs, because v7m_exception_taken()
needs to know whether the pending interrupt targets Secure so
it can choose to stack callee-saves registers or not, but it
must not make the interrupt active until after it has done
that stacking, in case the stacking causes a derived exception.
Similarly, it needs to know the number of the pending interrupt
so it can read the correct vector table entry before the
interrupt is made active, because vector table reads might
also cause a derived exception.

Create a new armv7m_nvic_get_pending_irq_info() function which simply
returns information about the highest priority pending interrupt, and
use it to rearrange the v7m_exception_taken() code so we don't
acknowledge the exception until we've done all the things which could
possibly cause a derived exception.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 1517324542[email protected]

7 years agotarget/arm: Add armv7m_nvic_set_pending_derived()
Peter Maydell [Fri, 9 Feb 2018 10:40:27 +0000 (10:40 +0000)]
target/arm: Add armv7m_nvic_set_pending_derived()

In order to support derived exceptions (exceptions generated in
the course of trying to take an exception), we need to be able
to handle prioritizing whether to take the original exception
or the derived exception.

We do this by introducing a new function
armv7m_nvic_set_pending_derived() which the exception-taking code in
helper.c will call when a derived exception occurs.  Derived
exceptions are dealt with mostly like normal pending exceptions, so
we share the implementation with the armv7m_nvic_set_pending()
function.

Note that the way we structure this is significantly different
from the v8M Arm ARM pseudocode: that does all the prioritization
logic in the DerivedLateArrival() function, whereas we choose to
let the existing "identify highest priority exception" logic
do the prioritization for us. The effect is the same, though.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1517324542[email protected]

7 years agoMAINTAINERS: add David as additional tcg/s390 maintainer
Cornelia Huck [Mon, 15 Jan 2018 15:18:20 +0000 (16:18 +0100)]
MAINTAINERS: add David as additional tcg/s390 maintainer

Acked-by: David Hildenbrand <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agoMAINTAINERS: reorganize s390-ccw bios maintainership
Cornelia Huck [Mon, 15 Jan 2018 15:14:45 +0000 (16:14 +0100)]
MAINTAINERS: reorganize s390-ccw bios maintainership

Split it out from the s390-ccw-virtio machine, add Thomas as a
maintainer in addition to Christian.

Acked-by: Christian Borntraeger <[email protected]>
Acked-by: Thomas Huth <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agoMAINTAINERS: add myself as overall s390x maintainer
Cornelia Huck [Mon, 15 Jan 2018 14:43:11 +0000 (15:43 +0100)]
MAINTAINERS: add myself as overall s390x maintainer

All your mainframes are belong to me.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Christian Borntraeger <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: use the right pal and pba in reg_ioat()
Yi Min Zhao [Mon, 5 Feb 2018 07:22:58 +0000 (15:22 +0800)]
s390x/pci: use the right pal and pba in reg_ioat()

When registering ioat, pba should be comprised of leftmost 52 bits and
rightmost 12 binary zeros, and pal should be comprised of leftmost 52
bits and right most 12 binary ones. The lower 12 bits of words 5 and 7
of the FIB are ignored by the facility. Let's fixup this.

Reviewed-by: Pierre Morel <[email protected]>
Signed-off-by: Yi Min Zhao <[email protected]>
Message-Id: <20180205072258[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: fixup global refresh
Yi Min Zhao [Mon, 5 Feb 2018 07:22:57 +0000 (15:22 +0800)]
s390x/pci: fixup global refresh

The VFIO common code doesn't provide the possibility to modify a
previous mapping entry in another way than unmapping and mapping again
with new properties.

To avoid -EEXIST DMA mapping error, we introduce a GHashTable to store
S390IOTLBEntry instances in order to cache the mapped entries. When
intercepting rpcit instruction, ignore the identical mapped entries to
avoid doing map operations multiple times and do unmap and re-map
operations for the case of updating the valid entries.

Acked-by: Pierre Morel <[email protected]>
Signed-off-by: Yi Min Zhao <[email protected]>
Message-Id: <20180205072258[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: fixup the code walking IOMMU tables
Yi Min Zhao [Mon, 5 Feb 2018 07:22:56 +0000 (15:22 +0800)]
s390x/pci: fixup the code walking IOMMU tables

Current s390x PCI IOMMU code is lack of flags' checking, including:
1) protection bit
2) table length
3) table offset
4) intermediate tables' invalid bit
5) format control bit

This patch introduces a new struct named S390IOTLBEntry, and makes up
these missed checkings. At the same time, inform the guest with the
corresponding error number when the check fails. Finally, in order to
get the error number, we export s390_guest_io_table_walk().

Reviewed-by: Pierre Morel <[email protected]>
Signed-off-by: Yi Min Zhao <[email protected]>
Message-Id: <20180205072258[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/cpumodel: model PTFF subfunctions for Multiple-epoch facility
David Hildenbrand [Mon, 5 Feb 2018 10:29:35 +0000 (11:29 +0100)]
s390x/cpumodel: model PTFF subfunctions for Multiple-epoch facility

For now, the kernel does not properly indicate configured CPU subfunctions
to the guest, but simply uses the host values (as support in KVM is still
missing). That's why we missed to model the PTFF subfunctions that come
with Multiple-epoch facility.

Let's properly add these, along with a new feature group.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180205102935[email protected]>
Tested-by: Christian Borntraeger <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/cpumodel: allow zpci features in qemu model
Cornelia Huck [Thu, 23 Nov 2017 15:59:11 +0000 (16:59 +0100)]
s390x/cpumodel: allow zpci features in qemu model

AEN and AIS can be provided unconditionally, ZPCI should be turned on
manually.

With -cpu qemu,zpci=on, the guest kernel can now successfully detect
virtio-pci devices under tcg.

Also fixup the order of the MSA_EXT_{3,4} flags while at it.

Reviewed-by: David Hildenbrand <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: wire up pci instructions
Cornelia Huck [Thu, 16 Nov 2017 09:09:53 +0000 (10:09 +0100)]
s390x/tcg: wire up pci instructions

On s390x, pci support is implemented via a set of instructions
(no mmio). Unfortunately, none of them are documented in the
PoP; the code is based upon the existing implementation for KVM
and the Linux zpci driver.

Reviewed-by: David Hildenbrand <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/sclp: fix event mask handling
Christian Borntraeger [Fri, 2 Feb 2018 09:43:18 +0000 (10:43 +0100)]
s390x/sclp: fix event mask handling

commit 67915de9f038 ("s390x/event-facility: variable-length event
masks") switched the sclp receive/send mask. This broke the sclp
lm console.

Signed-off-by: Christian Borntraeger <[email protected]>
Fixes: commit 67915de9f038 ("s390x/event-facility: variable-length event masks")
Cc: Cornelia Huck <[email protected]>
Cc: Jason J. Herne <[email protected]>
Cc: [email protected]
Message-Id: <20180202094241[email protected]>
Reviewed-by: Claudio Imbrenda <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/flic: cache the common flic class in a central function
David Hildenbrand [Mon, 29 Jan 2018 12:56:23 +0000 (13:56 +0100)]
s390x/flic: cache the common flic class in a central function

This avoids tons of conversions when handling interrupts.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/kvm: cache the kvm flic in a central function
David Hildenbrand [Mon, 29 Jan 2018 12:56:22 +0000 (13:56 +0100)]
s390x/kvm: cache the kvm flic in a central function

This avoids tons of conversions when handling interrupts.

Acked-by: Christian Borntraeger <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: cache the qemu flic in a central function
David Hildenbrand [Mon, 29 Jan 2018 12:56:21 +0000 (13:56 +0100)]
s390x/tcg: cache the qemu flic in a central function

This avoids tons of conversions when handling interrupts.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agoconfigure: s390x supports mttcg now
David Hildenbrand [Mon, 29 Jan 2018 12:56:20 +0000 (13:56 +0100)]
configure: s390x supports mttcg now

s390x is ready. Most likely we are missing some pieces, but it should
already be in pretty good shape now.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: remove SMP warning
David Hildenbrand [Mon, 29 Jan 2018 12:56:19 +0000 (13:56 +0100)]
s390x/tcg: remove SMP warning

We should be pretty good in shape now. Floating interrupts are working
and atomic instructions should be atomic.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: STSI overhaul
David Hildenbrand [Mon, 29 Jan 2018 12:56:18 +0000 (13:56 +0100)]
s390x/tcg: STSI overhaul

Current STSI implementation is a mess, so let's rewrite it.

Problems fixed by this patch:
1) The order of exceptions/when recognized is wrong.
2) We have to store to virtual address space, not absolute.
3) Alignment check of the block is missing.
3) The SMP information is not indicated.

While at it:
a) Make the code look nicer
    - get rid of nesting levels
    - use struct initialization instead of initializing to zero
    - rename a misspelled field and rename function code defines
    - use a union and have only one write statement
    - use cpu_to_beX()
b) Indicate the VM name/extended name + UUID just like KVM does
c) Indicate that all LPAR CPUs we fake are dedicated
d) Add a comment why we fake being a KVM guest
e) Give our guest as default the name "TCGguest"
f) Fake the same CPU information we have in our Guest for all layers

While at it, get rid of "potential_page_fault()" by forwarding the
retaddr properly.

The result is best verified by looking at "/proc/sysinfo" in the guest
when specifying on the qemu command line
    -uuid "74738ff5-5367-5958-9aee-98fffdcd1876" \
    -name "extra long guest name"

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x: fix size + content of STSI blocks
David Hildenbrand [Mon, 29 Jan 2018 12:56:17 +0000 (13:56 +0100)]
s390x: fix size + content of STSI blocks

All blocks are 4k in size, which is only true for two of them right now.
Also some reserved fields were wrong, fix it and convert all reserved
fields to u8.

This also fixes the LPAR part output in /proc/sysinfo under TCG. (for
now, everything was indicated as 0)

While at it, introduce typedefs for these structs and use them in TCG/KVM
code.

Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/flic: optimize CPU wakeup for TCG
David Hildenbrand [Mon, 29 Jan 2018 12:56:16 +0000 (13:56 +0100)]
s390x/flic: optimize CPU wakeup for TCG

Kicking all CPUs on every floating interrupt is far from efficient.
Let's optimize it at least a little bit.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/flic: implement qemu_s390_clear_io_flic()
David Hildenbrand [Mon, 29 Jan 2018 12:56:15 +0000 (13:56 +0100)]
s390x/flic: implement qemu_s390_clear_io_flic()

Now that we have access to the io interrupts, we can implement
clear_io_irq() for TCG.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: implement TEST PENDING INTERRUPTION
David Hildenbrand [Mon, 29 Jan 2018 12:56:14 +0000 (13:56 +0100)]
s390x/tcg: implement TEST PENDING INTERRUPTION

Use s390_cpu_virt_mem_write() so we can actually revert what we did
(re-inject the dequeued IO interrupt).

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/flic: make floating interrupts on TCG actually floating
David Hildenbrand [Mon, 29 Jan 2018 12:56:13 +0000 (13:56 +0100)]
s390x/flic: make floating interrupts on TCG actually floating

Move floating interrupt handling into the flic. Floating interrupts
will now be considered by all CPUs, not just CPU #0. While at it, convert
I/O interrupts to use a list and make sure we properly consider I/O
sub-classes in s390_cpu_has_io_int().

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: tolerate wrong wakeups due to floating interrupts
David Hildenbrand [Mon, 29 Jan 2018 12:56:12 +0000 (13:56 +0100)]
s390x/tcg: tolerate wrong wakeups due to floating interrupts

This is a preparation for floating interrupt support and only applies to
MTTCG, single threaded TCG works just fine. If a floating interrupt wakes
up a VCPU and the CPU thinks it can run (clearing cs->halted), at
the point where the interrupt would be delivered, already another VCPU
might have picked up the interrupt, resulting in a wakeup without an
interrupt (executing wrong code).

It is wrong to let the VCPU continue to execute (the WAIT PSW). Instead,
we have to put the VCPU back to sleep.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/flic: no need to call s390_io_interrupt() from flic
David Hildenbrand [Mon, 29 Jan 2018 12:56:11 +0000 (13:56 +0100)]
s390x/flic: no need to call s390_io_interrupt() from flic

We can directly call the right function.

Suggested-by: Cornelia Huck <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/flic: factor out injection of floating interrupts
David Hildenbrand [Mon, 29 Jan 2018 12:56:10 +0000 (13:56 +0100)]
s390x/flic: factor out injection of floating interrupts

Let the flic device handle it internally. This will allow us to later
on store floating interrupts in the flic for the TCG case.

This now also simplifies kvm.c. All that's left is the fallback
interface for floating interrupts, which is now triggered directly via
the flic in case anything goes wrong.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: simplify machine check handling
David Hildenbrand [Mon, 29 Jan 2018 12:56:09 +0000 (13:56 +0100)]
s390x/tcg: simplify machine check handling

We currently only support CRW machine checks. This is a preparation for
real floating interrupt support.

Get rid of the queue and handle it via the bit INTERRUPT_MCHK. We don't
rename it for now, as it will be soon gone (when moving crw machine checks
into the flic).

Please note that this is the same way also KVM handles it: only one
instance of a machine check can be pending at a time. So no need for a
queue.

While at it, make sure we try to deliver only if env->cregs[14]
actually indicates that CRWs are accepted.

Drop two unused defines on the way (we already have PSW_MASK_...).

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: simplify lookup of flic
David Hildenbrand [Mon, 29 Jan 2018 12:56:08 +0000 (13:56 +0100)]
s390x/tcg: simplify lookup of flic

We can simply search for an object of our common type.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/flic: simplify flic initialization
David Hildenbrand [Mon, 29 Jan 2018 12:56:07 +0000 (13:56 +0100)]
s390x/flic: simplify flic initialization

This makes it clearer, which device is used for which accelerator.

Reviewed-by: Christian Borntraeger <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: deliver multiple interrupts in a row
David Hildenbrand [Mon, 29 Jan 2018 12:56:06 +0000 (13:56 +0100)]
s390x/tcg: deliver multiple interrupts in a row

We have to consider all deliverable interrupts.

We now have to take care of the special scenario, where we first
inject an interrupt with a WAIT PSW, followed by a !WAIT PSW. (very
unlikely but possible)

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20180129125623[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agoFix configure for s390 qemu on alpine and other busybox environments
Alice Frosi [Tue, 30 Jan 2018 13:38:28 +0000 (14:38 +0100)]
Fix configure for s390 qemu on alpine and other busybox environments

In alpine docker image the qemu-system-s390x build is broken and
it throws this error:
qemu-system-s390x: Initialization of device s390-ipl failed: could not
load bootloader 's390-ccw.img'

The grep command of busybox uses regex. This fails on binary data
(e.g. stops on every \0), so it does not identify the string
BiGeNdIaN in the test case big/little. Therefore, it assumes
that the architecture is little endian.

This fix solves the grep problem by printing the content of
TMPO with strings

Signed-off-by: Alice Frosi <[email protected]>
Signed-off-by: Christian Borntraeger <[email protected]>
[some changes to patch description, add -a option to strings]
Message-Id: <20180130133828[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agoDrop superfluous includes of qapi-types.h and test-qapi-types.h
Markus Armbruster [Thu, 1 Feb 2018 11:18:30 +0000 (12:18 +0100)]
Drop superfluous includes of qapi-types.h and test-qapi-types.h

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoClean up includes
Markus Armbruster [Thu, 1 Feb 2018 11:18:29 +0000 (12:18 +0100)]
Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes, with the change
to target/s390x/gen-features.c manually reverted, and blank lines
around deletions collapsed.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agoUse #include "..." for our own headers, <...> for others
Markus Armbruster [Thu, 1 Feb 2018 11:18:28 +0000 (12:18 +0100)]
Use #include "..." for our own headers, <...> for others

System headers should be included with <...>, our own headers with
"...".  Offenders tracked down with an ugly, brittle and probably
buggy Perl script.  Previous iteration was commit a9c94277f0.

Delete inclusions of "string.h" and "strings.h" instead of fixing them
to <string.h> and <strings.h>, because we always include these via
osdep.h.

Put the cleaned up system header includes first.

While there, separate #include from file comment with exactly one
blank line.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20180201111846[email protected]>

7 years agovnc: use stubs for CONFIG_VNC=n dummy functions
Gerd Hoffmann [Fri, 2 Feb 2018 06:45:46 +0000 (07:45 +0100)]
vnc: use stubs for CONFIG_VNC=n dummy functions

Cc: Paolo Bonzini <[email protected]>
Cc: Markus Armbruster <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
Message-Id: <20180202064546[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
7 years agopci: removed the is_express field since a uniform interface was inserted
Yoni Bettan [Tue, 16 Jan 2018 12:34:56 +0000 (14:34 +0200)]
pci: removed the is_express field since a uniform interface was inserted

according to Eduardo Habkost's commit fd3b02c889 all PCIEs now implement
INTERFACE_PCIE_DEVICE so we don't need is_express field anymore.

Devices that implements only INTERFACE_PCIE_DEVICE (is_express == 1)
or
devices that implements only INTERFACE_CONVENTIONAL_PCI_DEVICE (is_express == 0)
where not affected by the change.

The only devices that were affected are those that are hybrid and also
had (is_express == 1) - therefor only:
  - hw/vfio/pci.c
  - hw/usb/hcd-xhci.c
  - hw/xen/xen_pt.c

For those 3 I made sure that QEMU_PCI_CAP_EXPRESS is on in instance_init()

Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Yoni Bettan <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovirtio-blk: enable multiple vectors when using multiple I/O queues
Changpeng Liu [Tue, 6 Feb 2018 01:35:34 +0000 (09:35 +0800)]
virtio-blk: enable multiple vectors when using multiple I/O queues

Currently virtio-pci driver hardcoded 2 vectors for virtio-blk device,
for multiple I/O queues scenario, all the I/O queues will share one
interrupt vector, while here, enable multiple vectors according to
the number of I/O queues.

Signed-off-by: Changpeng Liu <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci/bus: let it has higher migration priority
Peter Xu [Tue, 6 Feb 2018 07:39:33 +0000 (15:39 +0800)]
pci/bus: let it has higher migration priority

In the past, we prioritized IOMMU migration so that we have such a
priority order:

    IOMMU > PCI Devices

When migrating a guest with both vIOMMU and a pcie-root-port, we'll
always migrate vIOMMU first, since pci buses will be seen to have the
same priority of general PCI devices.

That's problematic.

The thing is that PCI bus number information is stored in the root port,
and that is needed by vIOMMU during post_load(), e.g., to figure out
context entry for a device.  If we don't have correct bus numbers for
devices, we won't be able to recover device state of the DMAR memory
regions, and things will be messed up.

So let's boost the PCIe root ports to be even with higher priority:

   PCIe Root Port > IOMMU > PCI Devices

A smoke test shows that this patch fixes bug 1538953.

Also, apply this rule to all the PCI bus/bridge devices: ioh3420,
xio3130_downstream, xio3130_upstream, pcie_pci_bridge, pci-pci bridge,
i82801b11.

I noted that we set pcie_pci_bridge_dev_vmstate twice.  Clean that up
together.

CC: Alex Williamson <[email protected]>
CC: Marcel Apfelbaum <[email protected]>
CC: Michael S. Tsirkin <[email protected]>
CC: Dr. David Alan Gilbert <[email protected]>
CC: Juan Quintela <[email protected]>
CC: Laurent Vivier <[email protected]>
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1538953
Reported-by: Maxime Coquelin <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci-bridge/i82801b11: clear bridge registers on platform reset
Laszlo Ersek [Wed, 7 Feb 2018 12:10:27 +0000 (13:10 +0100)]
pci-bridge/i82801b11: clear bridge registers on platform reset

The "i82801b11-bridge" device model is a descendant of "base-pci-bridge"
(TYPE_PCI_BRIDGE). However, unlike other similar devices, such as

- pci-bridge,
- pcie-pci-bridge,
- PCIE Root Port,
- xio3130 switch upstream and downstream ports,
- dec-21154-p2p-bridge,
- pbm-bridge,
- xilinx-pcie-root,

"i82801b11-bridge" does not clear the bridge specific registers at
platform reset.

This is a problem because devices on "i82801b11-bridge" continue to
respond to config space cycles after platform reset, when addressed with
the bus number that was previously programmed into the secondary bus
number register of "i82801b11-bridge". This error breaks OVMF's search for
extra (PXB) root buses, for example.

The device class reset method for "i82801b11-bridge" is currently NULL;
set it directly to pci_bridge_reset(), like the last three bridge models
in the above listing do.

Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: [email protected]
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1541839
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovhost: Move log_dirty check
Dr. David Alan Gilbert [Fri, 19 Jan 2018 10:39:24 +0000 (10:39 +0000)]
vhost: Move log_dirty check

Move the log_dirty check into vhost_section.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovhost: Merge and delete unused callbacks
Dr. David Alan Gilbert [Fri, 19 Jan 2018 10:39:23 +0000 (10:39 +0000)]
vhost: Merge and delete unused callbacks

Now that the olf vhost_set_memory code is gone, the _nop and _add
callbacks are identical and can be merged.  The _del callback is
no longer needed.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovhost: Clean out old vhost_set_memory and friends
Dr. David Alan Gilbert [Fri, 19 Jan 2018 10:39:22 +0000 (10:39 +0000)]
vhost: Clean out old vhost_set_memory and friends

Remove the old update mechanism, vhost_set_memory, and the functions
and flags it used.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovhost: Regenerate region list from changed sections list
Dr. David Alan Gilbert [Fri, 19 Jan 2018 10:39:21 +0000 (10:39 +0000)]
vhost: Regenerate region list from changed sections list

Compare the sections list that's just been generated, and if it's
different from the old one regenerate the region list.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
7 years agovhost: Merge sections added to temporary list
Dr. David Alan Gilbert [Fri, 19 Jan 2018 10:39:20 +0000 (10:39 +0000)]
vhost: Merge sections added to temporary list

As sections are reported by the listener to the _nop and _add
methods, add them to the temporary section list but now merge them
with the previous section if the new one abuts and the backend allows.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovhost: Simplify ring verification checks
Dr. David Alan Gilbert [Fri, 19 Jan 2018 10:39:19 +0000 (10:39 +0000)]
vhost: Simplify ring verification checks

vhost_verify_ring_mappings() were used to verify that
rings are still accessible and related memory hasn't
been moved after flatview is updated.

It was doing checks by mapping ring's GPA+len and
checking that HVA hadn't changed with new memory map.
To avoid maybe expensive mapping call, we were
identifying address range that changed and were doing
mapping only if ring was in changed range.

However it's not neccessary to perform ring's GPA
mapping as we already have its current HVA and all
we need is to verify that ring's GPA translates to
the same HVA in updated flatview.

This will allow the following patches to simplify the range
comparison that was previously needed to avoid expensive
verify_ring_mapping calls.

Signed-off-by: Igor Mammedov <[email protected]>
with modifications by:
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovhost: Build temporary section list and deref after commit
Dr. David Alan Gilbert [Fri, 19 Jan 2018 10:39:18 +0000 (10:39 +0000)]
vhost: Build temporary section list and deref after commit

Igor spotted that there's a race, where a region that's unref'd
in a _del callback might be free'd before the set_mem_table call in
the _commit callback, and thus the vhost might end up using free memory.

Fix this by building a complete temporary sections list, ref'ing every
section (during add and nop) and then unref'ing the whole list right
at the end of commit.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovirtio: improve virtio devices initialization time
Gal Hammer [Mon, 29 Jan 2018 14:20:57 +0000 (16:20 +0200)]
virtio: improve virtio devices initialization time

The loading time of a VM is quite significant when its virtio
devices use a large amount of virt-queues (e.g. a virtio-serial
device with max_ports=511). Most of the time is spend in the
creation of all the required event notifiers (ioeventfd and memory
regions).

This patch pack all the changes to the memory regions in a
single memory transaction.

Reported-by: Sitong Liu
Reported-by: Xiaoling Gao
Signed-off-by: Gal Hammer <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Tested-by: Greg Kurz <[email protected]>
7 years agovirtio: remove event notifier cleanup call on de-assign
Gal Hammer [Mon, 29 Jan 2018 14:20:56 +0000 (16:20 +0200)]
virtio: remove event notifier cleanup call on de-assign

The virtio_bus_set_host_notifier function no longer calls
event_notifier_cleanup when a event notifier is removed.

The commit updates the code to match the new behavior and calls
virtio_bus_cleanup_host_notifier after the notifier was de-assign
and no longer in use.

This change is a preparation to allow executing the
virtio_bus_set_host_notifier function in a memory region
transaction.

Signed-off-by: Gal Hammer <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Tested-by: Greg Kurz <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180208' into staging
Peter Maydell [Thu, 8 Feb 2018 17:41:15 +0000 (17:41 +0000)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180208' into staging

tcg generic vectors

# gpg: Signature made Thu 08 Feb 2018 16:47:16 GMT
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <[email protected]>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20180208:
  tcg/aarch64: Add vector operations
  tcg/i386: Add vector operations
  target/arm: Use vector infrastructure for aa64 orr/bic immediate
  target/arm: Use vector infrastructure for aa64 multiplies
  target/arm: Use vector infrastructure for aa64 compares
  target/arm: Use vector infrastructure for aa64 constant shifts
  target/arm: Use vector infrastructure for aa64 dup/movi
  target/arm: Use vector infrastructure for aa64 mov/not/neg
  target/arm: Use vector infrastructure for aa64 add/sub/logic
  target/arm: Align vector registers
  tcg/optimize: Handle vector opcodes during optimize
  tcg: Add generic vector helpers with a scalar operand
  tcg: Add generic helpers for saturating arithmetic
  tcg: Add generic vector ops for multiplication
  tcg: Add generic vector ops for comparisons
  tcg: Add generic vector ops for constant shifts
  tcg: Add generic vector expanders
  tcg: Standardize integral arguments to expanders
  tcg: Add types and basic operations for host vectors
  tcg: Allow multiple word entries into the constant pool

Signed-off-by: Peter Maydell <[email protected]>
7 years agoRevert "vhost: add traces for memory listeners"
Michael S. Tsirkin [Thu, 8 Feb 2018 17:26:51 +0000 (19:26 +0200)]
Revert "vhost: add traces for memory listeners"

This reverts commit 0750b060216de69ed1f14bc08181bf4ad27fc622.

Follow up patches are reworking the memory listeners, the new mechanism
will add its own set of traces.

Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agotcg/aarch64: Add vector operations
Richard Henderson [Tue, 12 Sep 2017 05:09:28 +0000 (22:09 -0700)]
tcg/aarch64: Add vector operations

Reviewed-by: Alex Bennée <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotcg/i386: Add vector operations
Richard Henderson [Thu, 17 Aug 2017 21:47:43 +0000 (14:47 -0700)]
tcg/i386: Add vector operations

The x86 vector instruction set is extremely irregular.  With newer
editions, Intel has filled in some of the blanks.  However, we don't
get many 64-bit operations until SSE4.2, introduced in 2009.

The subsequent edition was for AVX1, introduced in 2011, which added
three-operand addressing, and adjusts how all instructions should be
encoded.

Given the relatively narrow 2 year window between possible to support
and desirable to support, and to vastly simplify code maintainence,
I am only planning to support AVX1 and later cpus.

Reviewed-by: Alex Bennée <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/arm: Use vector infrastructure for aa64 orr/bic immediate
Richard Henderson [Fri, 12 Jan 2018 22:09:25 +0000 (14:09 -0800)]
target/arm: Use vector infrastructure for aa64 orr/bic immediate

Reviewed-by: Alex Bennée <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/arm: Use vector infrastructure for aa64 multiplies
Richard Henderson [Tue, 21 Nov 2017 10:21:28 +0000 (11:21 +0100)]
target/arm: Use vector infrastructure for aa64 multiplies

Reviewed-by: Alex Bennée <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/arm: Use vector infrastructure for aa64 compares
Richard Henderson [Fri, 17 Nov 2017 20:05:16 +0000 (21:05 +0100)]
target/arm: Use vector infrastructure for aa64 compares

Reviewed-by: Alex Bennée <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
This page took 0.095592 seconds and 4 git commands to generate.