]> Git Repo - qemu.git/log
qemu.git
7 years ago.shippable.yml: new CI provider
Alex Bennée [Mon, 20 Feb 2017 10:51:38 +0000 (10:51 +0000)]
.shippable.yml: new CI provider

Ostensibly Shippable offers a similar set of services as Travis.
However they are focused on Docker container based work-flows so we
can use our existing containers to run a few extra builds - in this
case a bunch of cross-compiled targets on a Debian multiarch system.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Message-Id: <20170220105139[email protected]>
Signed-off-by: Fam Zheng <[email protected]>
7 years agonew: debian docker targets for cross-compiling
Alex Bennée [Mon, 20 Feb 2017 10:51:37 +0000 (10:51 +0000)]
new: debian docker targets for cross-compiling

This provides a basic Debian install with access to the emdebian cross
compilers. The debian-armhf-cross and debian-arm64-cross targets build
on the basic Debian image to allow cross compiling to those targets.

A new environment variable (QEMU_CONFIGURE_OPTS) is set as part of the
docker container and passed to the build to specify the
--cross-prefix. The user still calls the build in the usual way, for
example:

  make docker-test-build@debian-arm64-cross \
    TARGET_LIST="aarch64-softmmu,aarch64-linux-user"

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20170220105139[email protected]>
Signed-off-by: Fam Zheng <[email protected]>
7 years agotests/docker: add basic user mapping support
Alex Bennée [Mon, 20 Feb 2017 10:51:36 +0000 (10:51 +0000)]
tests/docker: add basic user mapping support

Currently all docker builds are done by exporting a tarball to the
docker container and running the build as the containers root user.
Other use cases are possible however and it is possible to map a part
of users file-system to the container. This is useful for example for
doing cross-builds of arbitrary source trees. For this to work
smoothly the container needs to have a user created that maps cleanly
to the host system.

This adds a -u option to the docker script so that:

  DEB_ARCH=armhf DEB_TYPE=stable ./tests/docker/docker.py build \
    -u --include-executable=arm-linux-user/qemu-arm \
    debian:armhf ./tests/docker/dockerfiles/debian-bootstrap.docker

Will build a container that can then be run like:

  docker run --rm -it -v /home/alex/lsrc/qemu/risu.git/:/src \
    --user=alex:alex -w /src/ debian:armhf \
    sh -c "make clean && ./configure -s && make"

All docker containers built will add the current user unless
explicitly disabled by specifying NOUSER when invoking the Makefile:

  make docker-image-debian-armhf-cross NOUSER=1

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20170220105139[email protected]>
Signed-off-by: Fam Zheng <[email protected]>
7 years agooption: Fix checking of sizes for overflow and trailing crap
Markus Armbruster [Tue, 21 Feb 2017 20:14:08 +0000 (21:14 +0100)]
option: Fix checking of sizes for overflow and trailing crap

parse_option_size()'s checking for overflow and trailing crap is
wrong.  Has always been that way.  qemu_strtosz() gets it right, so
use that.

This adds support for size suffixes 'P', 'E', and ignores case for all
suffixes, not just 'k'.

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

7 years agoutil/cutils: Change qemu_strtosz*() from int64_t to uint64_t
Markus Armbruster [Tue, 21 Feb 2017 20:14:07 +0000 (21:14 +0100)]
util/cutils: Change qemu_strtosz*() from int64_t to uint64_t

This will permit its use in parse_option_size().

Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Eduardo Habkost <[email protected]> (maintainer:X86)
Cc: Kevin Wolf <[email protected]> (supporter:Block layer core)
Cc: Max Reitz <[email protected]> (supporter:Block layer core)
Cc: [email protected] (open list:Block layer core)
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <1487708048[email protected]>

7 years agoutil/cutils: Return qemu_strtosz*() error and value separately
Markus Armbruster [Tue, 21 Feb 2017 20:14:06 +0000 (21:14 +0100)]
util/cutils: Return qemu_strtosz*() error and value separately

This makes qemu_strtosz(), qemu_strtosz_mebi() and
qemu_strtosz_metric() similar to qemu_strtoi64(), except negative
values are rejected.

Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Eduardo Habkost <[email protected]> (maintainer:X86)
Cc: Kevin Wolf <[email protected]> (supporter:Block layer core)
Cc: Max Reitz <[email protected]> (supporter:Block layer core)
Cc: [email protected] (open list:Block layer core)
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <1487708048[email protected]>

7 years agoutil/cutils: Let qemu_strtosz*() optionally reject trailing crap
Markus Armbruster [Tue, 21 Feb 2017 20:14:05 +0000 (21:14 +0100)]
util/cutils: Let qemu_strtosz*() optionally reject trailing crap

Change the qemu_strtosz() & friends to return -EINVAL when @endptr is
null and the conversion doesn't consume the string completely.
Matches how qemu_strtol() & friends work.

Only test_qemu_strtosz_simple() passes a null @endptr.  No functional
change there, because its conversion consumes the string.

Simplify callers that use @endptr only to fail when it doesn't point
to '\0' to pass a null @endptr instead.

Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Eduardo Habkost <[email protected]> (maintainer:X86)
Cc: Kevin Wolf <[email protected]> (supporter:Block layer core)
Cc: Max Reitz <[email protected]> (supporter:Block layer core)
Cc: [email protected] (open list:Block layer core)
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <1487708048[email protected]>

7 years agoqemu-img: Wrap cvtnum() around qemu_strtosz()
Markus Armbruster [Tue, 21 Feb 2017 20:14:04 +0000 (21:14 +0100)]
qemu-img: Wrap cvtnum() around qemu_strtosz()

Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: [email protected]
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <1487708048[email protected]>

7 years agotest-cutils: Drop suffix from test_qemu_strtosz_simple()
Markus Armbruster [Tue, 21 Feb 2017 20:14:03 +0000 (21:14 +0100)]
test-cutils: Drop suffix from test_qemu_strtosz_simple()

Leave testing unit suffixes to test_qemu_strtosz_units().

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

7 years agotest-cutils: Use qemu_strtosz() more often
Markus Armbruster [Tue, 21 Feb 2017 20:14:02 +0000 (21:14 +0100)]
test-cutils: Use qemu_strtosz() more often

Use qemu_strtosz() instead of qemu_strtosz_MiB() where it doesn't
really make a difference.

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

7 years agoutil/cutils: Drop QEMU_STRTOSZ_DEFSUFFIX_* macros
Markus Armbruster [Tue, 21 Feb 2017 20:14:01 +0000 (21:14 +0100)]
util/cutils: Drop QEMU_STRTOSZ_DEFSUFFIX_* macros

Writing QEMU_STRTOSZ_DEFSUFFIX_* instead of '*' gains nothing.  Get
rid of these eyesores.

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

7 years agoutil/cutils: New qemu_strtosz()
Markus Armbruster [Tue, 21 Feb 2017 20:14:00 +0000 (21:14 +0100)]
util/cutils: New qemu_strtosz()

Most callers of qemu_strtosz_suffix() pass QEMU_STRTOSZ_DEFSUFFIX_B.
Capture the pattern in new qemu_strtosz().

Inline qemu_strtosz_suffix() into its only remaining caller.

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

7 years agoutil/cutils: Rename qemu_strtosz() to qemu_strtosz_MiB()
Markus Armbruster [Tue, 21 Feb 2017 20:13:59 +0000 (21:13 +0100)]
util/cutils: Rename qemu_strtosz() to qemu_strtosz_MiB()

With qemu_strtosz(), no suffix means mebibytes.  It's used rarely.
I'm going to add a similar function where no suffix means bytes.
Rename qemu_strtosz() to qemu_strtosz_MiB() to make the name
qemu_strtosz() available for the new function.

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

7 years agoutil/cutils: New qemu_strtosz_metric()
Markus Armbruster [Tue, 21 Feb 2017 20:13:58 +0000 (21:13 +0100)]
util/cutils: New qemu_strtosz_metric()

To parse numbers with metric suffixes, we use

    qemu_strtosz_suffix_unit(nptr, &eptr, QEMU_STRTOSZ_DEFSUFFIX_B, 1000)

Capture this in a new function for legibility:

    qemu_strtosz_metric(nptr, &eptr)

Replace test_qemu_strtosz_suffix_unit() by test_qemu_strtosz_metric().

Rename qemu_strtosz_suffix_unit() to do_strtosz() and give it internal
linkage.

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

7 years agotest-cutils: Cover qemu_strtosz() around range limits
Markus Armbruster [Tue, 21 Feb 2017 20:13:57 +0000 (21:13 +0100)]
test-cutils: Cover qemu_strtosz() around range limits

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

7 years agotest-cutils: Cover qemu_strtosz() with trailing crap
Markus Armbruster [Tue, 21 Feb 2017 20:13:56 +0000 (21:13 +0100)]
test-cutils: Cover qemu_strtosz() with trailing crap

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

7 years agotest-cutils: Cover qemu_strtosz() invalid input
Markus Armbruster [Tue, 21 Feb 2017 20:13:55 +0000 (21:13 +0100)]
test-cutils: Cover qemu_strtosz() invalid input

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

7 years agotest-cutils: Add missing qemu_strtosz()... endptr checks
Markus Armbruster [Tue, 21 Feb 2017 20:13:54 +0000 (21:13 +0100)]
test-cutils: Add missing qemu_strtosz()... endptr checks

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

7 years agooption: Fix to reject invalid and overflowing numbers
Markus Armbruster [Tue, 21 Feb 2017 20:13:53 +0000 (21:13 +0100)]
option: Fix to reject invalid and overflowing numbers

parse_option_number() fails to check for these errors after
strtoull().  Has always been broken.  Fix that.

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

7 years agoutil/cutils: Clean up control flow around qemu_strtol() a bit
Markus Armbruster [Tue, 21 Feb 2017 20:13:52 +0000 (21:13 +0100)]
util/cutils: Clean up control flow around qemu_strtol() a bit

Reorder check_strtox_error() to make it obvious that we always store
through a non-null @endptr.

Transform

    if (some error) {
        error case ...
        err = value for error case;
    } else {
        normal case ...
        err = value for normal case;
    }
    return err;

to

    if (some error) {
        error case ...
        return value for error case;
    }
    normal case ...
    return value for normal case;

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

7 years agoutil/cutils: Clean up variable names around qemu_strtol()
Markus Armbruster [Tue, 21 Feb 2017 20:13:51 +0000 (21:13 +0100)]
util/cutils: Clean up variable names around qemu_strtol()

Name same things the same, different things differently.

* qemu_strtol()'s parameter @nptr is called @p in
  check_strtox_error().  Rename the latter.

* qemu_strtol()'s parameter @endptr is called @next in
  check_strtox_error().  Rename the latter.

* qemu_strtol()'s variable @p is called @endptr in
  check_strtox_error().  Rename both to @ep.

* qemu_strtol()'s variable @err is *negative* errno,
  check_strtox_error()'s parameter @err is *positive*.  Rename the
  latter to @libc_errno.

Same for qemu_strtoul(), qemu_strtoi64(), qemu_strtou64(), of course.

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

7 years agoutil/cutils: Rename qemu_strtoll(), qemu_strtoull()
Markus Armbruster [Tue, 21 Feb 2017 20:13:50 +0000 (21:13 +0100)]
util/cutils: Rename qemu_strtoll(), qemu_strtoull()

The name qemu_strtoll() suggests conversion to long long, but it
actually converts to int64_t.  Rename to qemu_strtoi64().

The name qemu_strtoull() suggests conversion to unsigned long long,
but it actually converts to uint64_t.  Rename to qemu_strtou64().

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

7 years agoutil/cutils: Rewrite documentation of qemu_strtol() & friends
Markus Armbruster [Tue, 21 Feb 2017 20:13:49 +0000 (21:13 +0100)]
util/cutils: Rewrite documentation of qemu_strtol() & friends

Fixes the following documentation bugs:

* Fails to document that null @nptr is safe.

* Fails to document that we return -EINVAL when no conversion could be
  performed (commit 47d4be1).

* Confuses long long with int64_t, and unsigned long long with
  uint64_t.

* Claims the unsigned conversions can underflow.  They can't.

While there, mark problematic assumptions that int64_t is long long,
and uint64_t is unsigned long long with FIXME comments.

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

7 years agotest-cutils: Clean up qemu_strtoul() result checks
Markus Armbruster [Tue, 21 Feb 2017 20:13:48 +0000 (21:13 +0100)]
test-cutils: Clean up qemu_strtoul() result checks

Use unsigned comparisons to check the result of qemu_strtoul() and
strtoull().

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

7 years agotest-cutils: Add missing qemu_strtol()... endptr checks
Markus Armbruster [Tue, 21 Feb 2017 20:13:47 +0000 (21:13 +0100)]
test-cutils: Add missing qemu_strtol()... endptr checks

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

7 years agooption: Assert value string isn't null
Markus Armbruster [Tue, 21 Feb 2017 20:13:46 +0000 (21:13 +0100)]
option: Assert value string isn't null

Plenty of code relies on QemuOpt member @str not being null, including
qemu_opts_print(), qemu_opts_to_qdict(), and callbacks passed to
qemu_opt_foreach().

Begs the question whether it can be null.  Only opt_set() creates
QemuOpt.  It sets member @str to its argument @value.  Passing null
for @value would plant a time bomb.  Callers:

* opts_do_parse() can't pass null.

* qemu_opt_set() passes its argument @value.  Callers:

  - qemu_opts_from_qdict_1() can't pass null

  - qemu_opts_set() passes its argument @value, but none of its
    callers pass null.

  - Many more outside qemu-option.c, but they shouldn't pass null,
    either.

Assert member @str isn't null, so that misuse is caught right away.

Simplify parse_option_bool(), parse_option_number() and
parse_option_size() accordingly.  Best viewed with whitespace changes
ignored.

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

7 years agotest-qemu-opts: Cover qemu_opts_parse()
Markus Armbruster [Tue, 21 Feb 2017 20:13:45 +0000 (21:13 +0100)]
test-qemu-opts: Cover qemu_opts_parse()

The new tests demonstrate a few bugs, all clearly marked.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <1487708048[email protected]>
[A few additional test cases squashed in, see
Message-ID: <[email protected]>]

7 years agoRevert "hw/mips: MIPS Boston board support"
Peter Maydell [Thu, 23 Feb 2017 18:04:45 +0000 (18:04 +0000)]
Revert "hw/mips: MIPS Boston board support"

This reverts commit d3473e147a754e999718bf6fcb015d9978c6a1ee.

This commit creates a board which defaults to having 2GB of RAM.
Unfortunately on 32-bit hosts we can't create boards with 2GB of RAM,
and so 'make check' fails. I missed this during testing of the
merge, unfortunately. Luckily the offending commit is the last
one in the merge request, so we can just revert it for now.

Signed-off-by: Peter Maydell <[email protected]>
7 years agoxhci: properties cleanup
Gerd Hoffmann [Tue, 21 Feb 2017 07:50:31 +0000 (08:50 +0100)]
xhci: properties cleanup

Split xhci properties into common and nec specific.

Move the backward compat flags to nec, so the new qemu-xhci
devices doesn't carry on the compatibiity stuff.

Move the msi/msix switches too and just enable msix for qemu-xhci.

Also move the intrs and slots properties.  Wasn't a great idea to
make them configurable in the first place, nobody needs this.

Signed-off-by: Gerd Hoffmann <[email protected]>
Message-id: 1487663432[email protected]

7 years agousb: ohci: fix error return code in servicing td
Li Qiang [Wed, 22 Feb 2017 10:56:30 +0000 (02:56 -0800)]
usb: ohci: fix error return code in servicing td

It should return 1 if an error occurs when reading td.
This will avoid an infinite loop issue in ohci_service_ed_list.

Signed-off-by: Li Qiang <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 1487760990[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agousb: replace handle_destroy with unrealize
Marc-André Lureau [Tue, 21 Feb 2017 14:14:45 +0000 (18:14 +0400)]
usb: replace handle_destroy with unrealize

Curiously, unrealize() is not being used, but it seems more
appropriate than handle_destroy() together with realize(). It is more
ubiquitous destroy name in qemu code base and may throw errors.

Cc: Gerd Hoffmann <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
Message-id: 20170221141451[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/yongbok/tags/mips-20170222' into staging
Peter Maydell [Thu, 23 Feb 2017 09:59:40 +0000 (09:59 +0000)]
Merge remote-tracking branch 'remotes/yongbok/tags/mips-20170222' into staging

MIPS patches 2017-02-22

Changes:
* Add MIPS Boston board support

# gpg: Signature made Wed 22 Feb 2017 00:08:00 GMT
# gpg:                using RSA key 0x2238EB86D5F797C2
# gpg: Good signature from "Yongbok Kim <[email protected]>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 8600 4CF5 3415 A5D9 4CFA  2B5C 2238 EB86 D5F7 97C2

* remotes/yongbok/tags/mips-20170222:
  hw/mips: MIPS Boston board support
  hw: xilinx-pcie: Add support for Xilinx AXI PCIe Controller
  loader: Support Flattened Image Trees (FIT images)
  dtc: Update requirement to v1.4.2
  target-mips: Provide function to test if a CPU supports an ISA
  hw/mips_gic: Update pin state on mask changes
  hw/mips_gictimer: provide API for retrieving frequency
  hw/mips_cmgcr: allow GCR base to be moved

Signed-off-by: Peter Maydell <[email protected]>
7 years agovfio/pci-quirks.c: Disable stolen memory for igd VFIO
XiongZhang [Wed, 22 Feb 2017 20:19:59 +0000 (13:19 -0700)]
vfio/pci-quirks.c: Disable stolen memory for igd VFIO

Regardless of running in UPT or legacy mode, the guest igd
drivers may attempt to use stolen memory, however only legacy
mode has BIOS support for reserving stolen memmory in the
guest VM. We zero out the stolen memory size in all cases,
then guest igd driver won't use stolen memory.
In legacy mode, user could use x-igd-gms option to specify the
amount of stolen memory which will be pre-allocated and reserved
by bios for igd use.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99028
          https://bugs.freedesktop.org/show_bug.cgi?id=99025

Signed-off-by: Xiong Zhang <[email protected]>
Tested-by: Terrence Xu <[email protected]>
Signed-off-by: Alex Williamson <[email protected]>
7 years agovfio/pci: Improve extended capability comments, skip masked caps
Alex Williamson [Wed, 22 Feb 2017 20:19:58 +0000 (13:19 -0700)]
vfio/pci: Improve extended capability comments, skip masked caps

Since commit 4bb571d857d9 ("pci/pcie: don't assume cap id 0 is
reserved") removes the internal use of extended capability ID 0, the
comment here becomes invalid.  However, peeling back the onion, the
code is still correct and we still can't seed the capability chain
with ID 0, unless we want to muck with using the version number to
force the header to be non-zero, which is much uglier to deal with.
The comment also now covers some of the subtleties of using cap ID 0,
such as transparently indicating absence of capabilities if none are
added.  This doesn't detract from the correctness of the referenced
commit as vfio in the kernel also uses capability ID zero to mask
capabilties.  In fact, we should skip zero capabilities precisely
because the kernel might also expose such a capability at the head
position and re-introduce the problem.

Signed-off-by: Alex Williamson <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Tested-by: Peter Xu <[email protected]>
Reported-by: Jintack Lim <[email protected]>
Tested-by: Jintack Lim <[email protected]>
7 years agovfio/pci: Report errors from qdev_unplug() via device request
Alex Williamson [Wed, 22 Feb 2017 20:19:58 +0000 (13:19 -0700)]
vfio/pci: Report errors from qdev_unplug() via device request

Currently we ignore this error, report it with error_reportf_err()

Signed-off-by: Alex Williamson <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
7 years agoblock: Don't bother asserting type of output visitor's output
Markus Armbruster [Fri, 17 Feb 2017 20:38:25 +0000 (21:38 +0100)]
block: Don't bother asserting type of output visitor's output

After a visit of a complex QAPI type FOO

    ov = qobject_output_visitor_new(&foo);
    visit_type_FOO(ov, NULL, expr, &error_abort);
    visit_complete(ov, &foo);

we can safely assume qobject_type(foo) is QTYPE_QDICT.  We do in many
places, but occasionally assert qobject_type(obj) == QTYPE_QDICT.
Don't.  The appropriate place to check such fundamental properties of
QAPI visitors is the test suite.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agomonitor: Clean up handle_hmp_command() a bit
Markus Armbruster [Fri, 17 Feb 2017 20:38:24 +0000 (21:38 +0100)]
monitor: Clean up handle_hmp_command() a bit

Leave checking qobject_type(req) to qmp_check_input_obj().  Rework
handling of json_parser_parse_err() failing without setting an error.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agotests: Don't check qobject_type() before qobject_to_qbool()
Markus Armbruster [Fri, 17 Feb 2017 20:38:23 +0000 (21:38 +0100)]
tests: Don't check qobject_type() before qobject_to_qbool()

qobject_to_qbool(obj) returns NULL when obj isn't a QBool.  Check
that instead of qobject_type(obj) == QTYPE_QBOOL.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agotests: Don't check qobject_type() before qobject_to_qfloat()
Markus Armbruster [Fri, 17 Feb 2017 20:38:22 +0000 (21:38 +0100)]
tests: Don't check qobject_type() before qobject_to_qfloat()

qobject_to_qfloat(obj) returns NULL when obj isn't a QFloat.  Check
that instead of qobject_type(obj) == QTYPE_QFLOAT.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agotests: Don't check qobject_type() before qobject_to_qint()
Markus Armbruster [Fri, 17 Feb 2017 20:38:21 +0000 (21:38 +0100)]
tests: Don't check qobject_type() before qobject_to_qint()

qobject_to_qint(obj) returns NULL when obj isn't a QInt.  Check
that instead of qobject_type(obj) == QTYPE_QINT.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agotests: Don't check qobject_type() before qobject_to_qstring()
Markus Armbruster [Fri, 17 Feb 2017 20:38:20 +0000 (21:38 +0100)]
tests: Don't check qobject_type() before qobject_to_qstring()

qobject_to_qstring(obj) returns NULL when obj isn't a QString.  Check
that instead of qobject_type(obj) == QTYPE_QSTRING.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agotests: Don't check qobject_type() before qobject_to_qlist()
Markus Armbruster [Fri, 17 Feb 2017 20:38:19 +0000 (21:38 +0100)]
tests: Don't check qobject_type() before qobject_to_qlist()

qobject_to_qlist(obj) returns NULL when obj isn't a QList.  Check
that instead of qobject_type(obj) == QTYPE_QLIST.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agoDon't check qobject_type() before qobject_to_qdict()
Markus Armbruster [Fri, 17 Feb 2017 20:38:18 +0000 (21:38 +0100)]
Don't check qobject_type() before qobject_to_qdict()

qobject_to_qdict(obj) returns NULL when obj isn't a QDict.  Check
that instead of qobject_type(obj) == QTYPE_QDICT.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agotest-qmp-event: Simplify and tighten event_test_emit()
Markus Armbruster [Fri, 17 Feb 2017 20:38:17 +0000 (21:38 +0100)]
test-qmp-event: Simplify and tighten event_test_emit()

Use qdict_get_qdict() and qdict_get_try_int() to simplify.

While there, add a sanity check for seconds.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agolibqtest: Clean up qmp_response() a bit
Markus Armbruster [Fri, 17 Feb 2017 20:38:16 +0000 (21:38 +0100)]
libqtest: Clean up qmp_response() a bit

Use qobject_to_qdict() instead of a type cast.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agocheck-qjson: Simplify around compare_litqobj_to_qobj()
Markus Armbruster [Fri, 17 Feb 2017 20:38:15 +0000 (21:38 +0100)]
check-qjson: Simplify around compare_litqobj_to_qobj()

Make compare_litqobj_to_qobj() cope with null, and drop non-null
assertions from callers.

compare_litqobj_to_qobj() already checks the QType matches; drop the
redundant assertions from callers.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agocheck-qdict: Tighten qdict_crumple_test_recursive() some
Markus Armbruster [Fri, 17 Feb 2017 20:38:14 +0000 (21:38 +0100)]
check-qdict: Tighten qdict_crumple_test_recursive() some

Consistently check for unexpected QDict entries, and qdict_get_qdict()
success.  The latter doesn't tighten the test, it only makes it fail
more nicely.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agocheck-qdict: Simplify qdict_crumple_test_recursive()
Markus Armbruster [Fri, 17 Feb 2017 20:38:13 +0000 (21:38 +0100)]
check-qdict: Simplify qdict_crumple_test_recursive()

Use qdict_get_qdict(), qdict_get_qlist() instead of qdict_get()
followed by qobject_to_qdict(), qobject_to_qlist().

While there, drop some redundant code.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agoqdict: Make qdict_get_qlist() safe like qdict_get_qdict()
Markus Armbruster [Fri, 17 Feb 2017 20:38:12 +0000 (21:38 +0100)]
qdict: Make qdict_get_qlist() safe like qdict_get_qdict()

Commit 89cad9f changed qdict_get_qdict() to return NULL instead of
crash when the key doesn't exist or its value isn't a QDict.
Commit 2d6421a neglected to do the same for qdict_get_qlist().
Correct that, and update the function comments.

qdict_get_obj() is now unused, remove.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <1487363905[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agonet: Flatten simple union NetLegacyOptions
Markus Armbruster [Tue, 21 Feb 2017 20:46:27 +0000 (21:46 +0100)]
net: Flatten simple union NetLegacyOptions

Simple unions are simpler than flat unions in the schema, but more
complicated in C and on the QMP wire: there's extra indirection in C
and extra nesting on the wire, both pointless.  They're best avoided
in new code.

NetLegacyOptions isn't new, but it's only used internally, not in QMP.
Convert it to a flat union.

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

7 years agonuma: Flatten simple union NumaOptions
Markus Armbruster [Tue, 21 Feb 2017 20:46:26 +0000 (21:46 +0100)]
numa: Flatten simple union NumaOptions

Simple unions are simpler than flat unions in the schema, but more
complicated in C and on the QMP wire: there's extra indirection in C
and extra nesting on the wire, both pointless.  They're best avoided
in new code.

NumaOptions isn't new, but it's only used internally, not in QMP.
Convert it to a flat union.

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

7 years agohw/ppc/ppc405_uc.c: Avoid integer overflows
Peter Maydell [Tue, 21 Feb 2017 13:33:41 +0000 (13:33 +0000)]
hw/ppc/ppc405_uc.c: Avoid integer overflows

When performing clock calculations, the ppc405_uc code
has several places where it multiplies together two
32-bit variables and assigns the result to a 64-bit
variable. This doesn't quite do what is intended because
C will compute a 32-bit multiply result. Add casts to
ensure we don't truncate the result.

(Spotted by Coverity, CID 10055041005505.)

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agohw/ppc/spapr: Check for valid page size when hot plugging memory
Thomas Huth [Wed, 15 Feb 2017 09:21:44 +0000 (10:21 +0100)]
hw/ppc/spapr: Check for valid page size when hot plugging memory

On POWER, the valid page sizes that the guest can use are bound
to the CPU and not to the memory region. QEMU already has some
fancy logic to find out the right maximum memory size to tell
it to the guest during boot (see getrampagesize() in the file
target/ppc/kvm.c for more information).
However, once we're booted and the guest is using huge pages
already, it is currently still possible to hot-plug memory regions
that does not support huge pages - which of course does not work
on POWER, since the guest thinks that it is possible to use huge
pages everywhere. The KVM_RUN ioctl will then abort with -EFAULT,
QEMU spills out a not very helpful error message together with
a register dump and the user is annoyed that the VM unexpectedly
died.
To avoid this situation, we should check the page size of hot-plugged
DIMMs to see whether it is possible to use it in the current VM.
If it does not fit, we can print out a better error message and
refuse to add it, so that the VM does not die unexpectely and the
user has a second chance to plug a DIMM with a matching memory
backend instead.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1419466
Signed-off-by: Thomas Huth <[email protected]>
[dwg: Fix a build error on 32-bit builds with KVM]
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: fix Book-E TLB matching
Alex Zuepke [Tue, 14 Feb 2017 11:54:29 +0000 (12:54 +0100)]
target-ppc: fix Book-E TLB matching

The Book-E TLB matching process should bail out early when a TLB
entry matches, but the access permissions are wrong. The CPU
will then raise a DSI error instead of a Data TLB error, as
described for TLB matching in Freescale and IBM documents.

Signed-off-by: Alex Zuepke <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agohw/net/spapr_llan: 6 byte mac address device tree entry
Sam Bobroff [Mon, 21 Nov 2016 23:19:38 +0000 (10:19 +1100)]
hw/net/spapr_llan: 6 byte mac address device tree entry

The spapr-vlan device in QEMU has always presented it's MAC address in
the device tree as an 8 byte value, even though PAPR requires it to be
6 bytes.  This is because, at the time, AIX required the value to be 8
bytes.  However, modern versions of AIX support the (correct) 6
byte value so they no longer require the workaround.

It would be neatest to always provide a 6 byte value but that would
cause a problem with old Linux kernel ibmveth drivers, so the old 8
byte value is still presented when necessary.

Since commit 13f85203e (3.10, May 2013) the driver has been able to
handle 6 or 8 byte addresses so versions after that don't need to be
considered specially.

Drivers from kernels before that can also handle either type of
address, but not always:
* If the first byte's lowest bits are 10, the address must be 6 bytes.
* Otherwise, the address must be 8 bytes.
(The two bits in question are significant in a MAC address: they
indicate a locally-administered unicast address.)

So to maintain compatibility the old 8 byte value is presented when
the lowest two bits of the first byte are not 10.

Signed-off-by: Sam Bobroff <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agomachine: replace query_hotpluggable_cpus() callback with has_hotpluggable_cpus flag
Igor Mammedov [Fri, 10 Feb 2017 10:20:57 +0000 (11:20 +0100)]
machine: replace query_hotpluggable_cpus() callback with has_hotpluggable_cpus flag

Generic helper machine_query_hotpluggable_cpus() replaced
target specific query_hotpluggable_cpus() callbacks so
there is no need in it anymore. However inon NULL callback
value is used to detect/report hotpluggable cpus support,
therefore it can be removed completely.
Replace it with MachineClass.has_hotpluggable_cpus boolean
which is sufficient for the task.

Suggested-by: David Gibson <[email protected]>
Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agomachine: unify [pc_|spapr_]query_hotpluggable_cpus() callbacks
Igor Mammedov [Thu, 9 Feb 2017 11:08:38 +0000 (12:08 +0100)]
machine: unify [pc_|spapr_]query_hotpluggable_cpus() callbacks

All callbacks FOO_query_hotpluggable_cpus() are practically
the same except of setting vcpus_count to different values.
Convert them to a generic machine_query_hotpluggable_cpus()
callback by moving vcpus_count initialization to per machine
specific callback possible_cpu_arch_ids().

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: reuse machine->possible_cpus instead of cores[]
Igor Mammedov [Fri, 10 Feb 2017 10:18:49 +0000 (11:18 +0100)]
spapr: reuse machine->possible_cpus instead of cores[]

Replace SPAPR specific cores[] array with generic
machine->possible_cpus and store core objects there.
It makes cores bookkeeping similar to x86 cpus and
will allow to unify similar code.
It would allow to replace cpu_index based NUMA node
mapping with iproperty based one (for -device created
cores) since possible_cpus carries board defined
topology/layout.

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agochange CPUArchId.cpu type to Object*
Igor Mammedov [Thu, 9 Feb 2017 11:08:36 +0000 (12:08 +0100)]
change CPUArchId.cpu type to Object*

so it could be reused for SPAPR cores as well

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agopc: pass apic_id to pc_find_cpu_slot() directly so lookup could be done without CPU...
Igor Mammedov [Thu, 9 Feb 2017 11:08:35 +0000 (12:08 +0100)]
pc: pass apic_id to pc_find_cpu_slot() directly so lookup could be done without CPU object

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agopc: calculate topology only once when possible_cpus is initialised
Igor Mammedov [Thu, 9 Feb 2017 11:08:34 +0000 (12:08 +0100)]
pc: calculate topology only once when possible_cpus is initialised

Fill in CpuInstanceProperties once at board init time and
just copy them whenever query_hotpluggable_cpus() is called.
It will keep topology info always available without need
to recalculate it every time it's needed.
Considering it has NUMA node id, it will be used to keep
NUMA node to cpu mapping instead of numa_info[i].node_cpu
bitmasks.

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agopc: move pcms->possible_cpus init out of pc_cpus_init()
Igor Mammedov [Thu, 9 Feb 2017 11:08:33 +0000 (12:08 +0100)]
pc: move pcms->possible_cpus init out of pc_cpus_init()

possible_cpus could be initialized earlier then cpu objects,
i.e. when -smp is parsed so move init code to possible_cpu_arch_ids()
interface func and do initialization on the first call.

it should help later with making -numa cpu/-smp parsing a machine state
properties.

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agomachine: move possible_cpus to MachineState
Igor Mammedov [Thu, 9 Feb 2017 11:08:32 +0000 (12:08 +0100)]
machine: move possible_cpus to MachineState

so that it would be possible to reuse it with
spapr/virt-aarch64 targets.

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agohw/pci-host/prep: Do not use hw_error() in realize function
Thomas Huth [Thu, 9 Feb 2017 11:14:41 +0000 (12:14 +0100)]
hw/pci-host/prep: Do not use hw_error() in realize function

hw_error() is for CPU related errors only (it prints out a
register dump and calls abort()), so we should not use it
if we just failed to load the bios image. Apart from that,
realize() functions should not exit directly but always set
the errp with error_setg() in case of errors instead.
Additionally, move some code around and delete the bios memory
subregion again in case of such an error, so that we leave a
clean state when returning to the caller.

Signed-off-by: Thomas Huth <[email protected]>
Reviewed-by: Hervé Poussineau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget/ppc/POWER9: Direct all instr and data storage interrupts to the hypv
Suraj Jitindar Singh [Fri, 10 Feb 2017 05:25:54 +0000 (16:25 +1100)]
target/ppc/POWER9: Direct all instr and data storage interrupts to the hypv

The vpm0 bit was removed from the LPCR in POWER9, this bit controlled
whether ISI and DSI interrupts were directed to the hypervisor or the
partition. These interrupts now go to the hypervisor irrespective, thus
it is no longer necessary to check the vmp0 bit in the LPCR.

Signed-off-by: Suraj Jitindar Singh <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget/ppc/POWER9: Adapt LPCR handling for POWER9
Suraj Jitindar Singh [Fri, 10 Feb 2017 05:25:53 +0000 (16:25 +1100)]
target/ppc/POWER9: Adapt LPCR handling for POWER9

The logical partitioning control register controls a threads operation
based on the partition it is currently executing. Add new definitions and
update the mask used when writing to the LPCR based on the POWER9 spec.

Signed-off-by: Suraj Jitindar Singh <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget/ppc/POWER9: Add ISAv3.00 MMU definition
Suraj Jitindar Singh [Fri, 10 Feb 2017 05:25:51 +0000 (16:25 +1100)]
target/ppc/POWER9: Add ISAv3.00 MMU definition

POWER9 processors implement the mmu as defined in version 3.00 of the ISA.

Add a definition for this mmu model and set the POWER9 cpu model to use
this mmu model.

Signed-off-by: Suraj Jitindar Singh <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget/ppc: Fix LPCR DPFD mask define
Suraj Jitindar Singh [Fri, 10 Feb 2017 05:25:52 +0000 (16:25 +1100)]
target/ppc: Fix LPCR DPFD mask define

The DPFD field in the LPCR is 3 bits wide. This has always been defined
as 0x3 << shift which indicates a 2 bit field, which is incorrect.
Correct this.

Signed-off-by: Suraj Jitindar Singh <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: Add xscvqpudz and xscvqpuwz instructions
Bharata B Rao [Fri, 10 Feb 2017 07:23:09 +0000 (12:53 +0530)]
target-ppc: Add xscvqpudz and xscvqpuwz instructions

xscvqpudz: VSX Scalar truncate & Convert Quad-Precision format to
           Unsigned Doubleword format
xscvqpuwz: VSX Scalar truncate & Convert Quad-Precision format to
           Unsigned Word format

Signed-off-by: Bharata B Rao <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: Implement round to odd variants of quad FP instructions
Bharata B Rao [Fri, 10 Feb 2017 07:23:08 +0000 (12:53 +0530)]
target-ppc: Implement round to odd variants of quad FP instructions

xsaddqpo:  VSX Scalar Add Quad-Precision using round to Odd
xsmulqo:   VSX Scalar Multiply Quad-Precision using round to Odd
xsdivqpo:  VSX Scalar Divide Quad-Precision using round to Odd
xscvqpdpo: VSX Scalar round & Convert Quad-Precision format to
           Double-Precision format using round to Odd
xssqrtqpo: VSX Scalar Square Root Quad-Precision using round to Odd
xssubqpo:  VSX Scalar Subtract Quad-Precision using round to Odd

In addition, fix the invalid bitmask in the instruction encoding
of xssqrtqp[o].

Signed-off-by: Bharata B Rao <[email protected]>
CC: Jose Ricardo Ziviani <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agosoftfloat: Add float128_to_uint32_round_to_zero()
Bharata B Rao [Fri, 10 Feb 2017 07:23:07 +0000 (12:53 +0530)]
softfloat: Add float128_to_uint32_round_to_zero()

float128_to_uint32_round_to_zero() is needed by xscvqpuwz instruction
of PowerPC ISA 3.0.

Signed-off-by: Bharata B Rao <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agosoftfloat: Add float128_to_uint64_round_to_zero()
Bharata B Rao [Fri, 10 Feb 2017 07:23:06 +0000 (12:53 +0530)]
softfloat: Add float128_to_uint64_round_to_zero()

Implement float128_to_uint64() and use that to implement
float128_to_uint64_round_to_zero()

This is required by xscvqpudz instruction of PowerPC ISA 3.0.

Signed-off-by: Bharata B Rao <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agosoftfloat: Add round-to-odd rounding mode
Bharata B Rao [Fri, 10 Feb 2017 07:23:05 +0000 (12:53 +0530)]
softfloat: Add round-to-odd rounding mode

Power ISA 3.0 introduces a few quadruple precision floating point
instructions that support round-to-odd rounding mode. The
round-to-odd mode is explained as under:

Let Z be the intermediate arithmetic result or the operand of a convert
operation. If Z can be represented exactly in the target format, the
result is Z. Otherwise the result is either Z1 or Z2 whichever is odd.
Here Z1 and Z2 are the next larger and smaller numbers representable
in the target format respectively.

Signed-off-by: Bharata B Rao <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: replace debug printf with trace points
Laurent Vivier [Fri, 10 Feb 2017 09:27:24 +0000 (10:27 +0100)]
spapr: replace debug printf with trace points

Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc4xx: replace debug printf with trace points
Laurent Vivier [Fri, 10 Feb 2017 09:27:23 +0000 (10:27 +0100)]
ppc4xx: replace debug printf with trace points

Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agomac99: replace debug printf with trace points
Laurent Vivier [Fri, 10 Feb 2017 09:27:22 +0000 (10:27 +0100)]
mac99: replace debug printf with trace points

Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc, tcg: fix usermode segfault with pthread_create()
Sam Bobroff [Tue, 7 Feb 2017 03:21:39 +0000 (14:21 +1100)]
target-ppc, tcg: fix usermode segfault with pthread_create()

Programs run under qemu-ppc64 on an x86_64 host currently segfault
if they use pthread_create() due to the adjustment made to the NIP in
commit bd6fefe71cec5a0c7d2be4ac96307f25db56abf9.

This patch changes cpu_loop() to set the NIP back to the
pre-incremented value before calling do_syscall(), which causes the
correct address to be used for the new thread and corrects the fault.

Signed-off-by: Sam Bobroff <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: add wait instruction
Nikunj A Dadhania [Thu, 9 Feb 2017 10:34:03 +0000 (16:04 +0530)]
target-ppc: add wait instruction

Use the available wait instruction implementation.

Signed-off-by: Nikunj A Dadhania <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: add slbsync implementation
Nikunj A Dadhania [Thu, 9 Feb 2017 10:34:02 +0000 (16:04 +0530)]
target-ppc: add slbsync implementation

slbsync: SLB Synchoronize

The instruction provides an ordering function for the effects of all
slbieg instructions executed by the thread executing the slbsync
instruction.

Signed-off-by: Nikunj A Dadhania <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: add slbieg instruction
Nikunj A Dadhania [Thu, 9 Feb 2017 10:34:01 +0000 (16:04 +0530)]
target-ppc: add slbieg instruction

slbieg: SLB Invalidate Entry Global

Signed-off-by: Nikunj A Dadhania <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: generate exception for copy/paste
Nikunj A Dadhania [Thu, 9 Feb 2017 10:34:00 +0000 (16:04 +0530)]
target-ppc: generate exception for copy/paste

Signed-off-by: Nikunj A Dadhania <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: implement store atomic instruction
Balamuruhan S [Thu, 9 Feb 2017 05:33:31 +0000 (11:03 +0530)]
target-ppc: implement store atomic instruction

stwat: Store Word Atomic
stdat: Store Doubleword Atomic

The instruction includes as function code (5 bits) which gives a detail
on the operation to be performed. The patch implements five such
functions.

Signed-off-by: Balamuruhan S <[email protected]>
Signed-off-by: Harish S <[email protected]>
Signed-off-by: Athira Rajeev <[email protected]>
[ implement stdat, use macro and combine both implementation ]
Signed-off-by: Nikunj A Dadhania <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: implement load atomic instruction
Balamuruhan S [Thu, 9 Feb 2017 05:33:30 +0000 (11:03 +0530)]
target-ppc: implement load atomic instruction

lwat: Load Word Atomic
ldat: Load Doubleword Atomic

The instruction includes as function code (5 bits) which gives a detail
on the operation to be performed. The patch implements five such
functions.

Signed-off-by: Balamuruhan S <[email protected]>
Signed-off-by: Harish S <[email protected]>
Signed-off-by: Athira Rajeev <[email protected]>
[ combine both lwat/ldat implementation using macro ]
Signed-off-by: Nikunj A Dadhania <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: fix off-by-one error in spapr_ovec_populate_dt()
Sam Bobroff [Tue, 7 Feb 2017 02:56:44 +0000 (13:56 +1100)]
spapr: fix off-by-one error in spapr_ovec_populate_dt()

The last byte of the option vector was missing due to an off-by-one
error. Without this fix, client architecture support negotiation will
fail because the last byte of option vector 5, which contains the MMU
support, will be missed.

Signed-off-by: Sam Bobroff <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Michael Roth <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: Add xsmaxjdp and xsminjdp instructions
Bharata B Rao [Mon, 6 Feb 2017 10:30:00 +0000 (16:00 +0530)]
target-ppc: Add xsmaxjdp and xsminjdp instructions

xsmaxjdp: VSX Scalar Maximum Type-J Double-Precision
xsminjdp: VSX Scalar Minimum Type-J Double-Precision

Signed-off-by: Bharata B Rao <[email protected]>
Signed-off-by: Nikunj A Dadhania <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget-ppc: Add xsmaxcdp and xsmincdp instructions
Bharata B Rao [Mon, 6 Feb 2017 10:29:59 +0000 (15:59 +0530)]
target-ppc: Add xsmaxcdp and xsmincdp instructions

xsmaxcdp: VSX Scalar Maximum Type-C Double-Precision
xsmincdp: VSX Scalar Minimum Type-C Double-Precision

Signed-off-by: Bharata B Rao <[email protected]>
Signed-off-by: Nikunj A Dadhania <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agohw/ppc/pnv: Remove superfluous "qemu" prefix from error strings
Thomas Huth [Wed, 8 Feb 2017 18:31:57 +0000 (19:31 +0100)]
hw/ppc/pnv: Remove superfluous "qemu" prefix from error strings

error_report() already puts a prefix with the program name in front
of the error strings, so the "qemu:" prefix is not necessary here
anymore.

Reported-by: Markus Armbruster <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: implement xssubqp instruction
Jose Ricardo Ziviani [Fri, 3 Feb 2017 22:01:17 +0000 (20:01 -0200)]
ppc: implement xssubqp instruction

xssubqp: VSX Scalar Subtract Quad-Precision.

Signed-off-by: Jose Ricardo Ziviani <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: implement xssqrtqp instruction
Jose Ricardo Ziviani [Fri, 3 Feb 2017 22:01:16 +0000 (20:01 -0200)]
ppc: implement xssqrtqp instruction

xssqrtqp: VSX Scalar Square Root Quad-Precision.

Signed-off-by: Jose Ricardo Ziviani <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: implement xsrqpxp instruction
Jose Ricardo Ziviani [Fri, 3 Feb 2017 22:01:15 +0000 (20:01 -0200)]
ppc: implement xsrqpxp instruction

xsrqpxp: VSX Scalar Round Quad-Precision to Double-Extended Precision.

Signed-off-by: Jose Ricardo Ziviani <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: implement xsrqpi[x] instruction
Jose Ricardo Ziviani [Fri, 3 Feb 2017 22:01:14 +0000 (20:01 -0200)]
ppc: implement xsrqpi[x] instruction

xsrqpi[x]: VSX Scalar Round to Quad-Precision Integer
[with Inexact].

Signed-off-by: Jose Ricardo Ziviani <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: make cpu core unplug follow expected hotunplug call flow
Igor Mammedov [Thu, 2 Feb 2017 15:02:35 +0000 (16:02 +0100)]
spapr: make cpu core unplug follow expected hotunplug call flow

spapr_core_unplug() were essentially spapr_core_unplug_request()
handler that requested CPU removal and registered callback
which did actual cpu core removali but it was called from
spapr_machine_device_unplug() which is intended for actual object
removal. Commit (cf632463 spapr: Memory hot-unplug support)
sort of fixed it introducing spapr_machine_device_unplug_request()
and calling spapr_core_unplug() but it hasn't renamed callback and
by mistake calls it from spapr_machine_device_unplug().

However spapr_machine_device_unplug() isn't ever called for
cpu core since spapr_core_release() doesn't follow expected
hotunplug call flow which is:
 1: device_del() ->
        hotplug_handler_unplug_request() ->
            set destroy_cb()
 2: destroy_cb() ->
        hotplug_handler_unplug() ->
            object_unparent // actual device removal

Fix it by renaming spapr_core_unplug() to spapr_core_unplug_request()
which is called from spapr_machine_device_unplug_request() and
making spapr_core_release() call hotplug_handler_unplug() which
will call spapr_machine_device_unplug() -> spapr_core_unplug()
to remove cpu core.

Signed-off-by: Igor Mammedov <[email protected]>
Reveiwed-by: Bharata B Rao <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: move spapr_core_[foo]plug() callbacks close to machine code in spapr.c
Igor Mammedov [Thu, 2 Feb 2017 15:02:34 +0000 (16:02 +0100)]
spapr: move spapr_core_[foo]plug() callbacks close to machine code in spapr.c

spapr_core_pre_plug/spapr_core_plug/spapr_core_unplug() are managing
wiring CPU core into spapr machine state and not internal CPU core state.
So move them from spapr_cpu_core.c to spapr.c where other similar
(spapr_memory_[foo]plug()) callbacks are located, which also matches
x86 target practice.

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: cpu core: separate child threads destruction from machine state operations
Igor Mammedov [Fri, 3 Feb 2017 10:51:57 +0000 (11:51 +0100)]
spapr: cpu core: separate child threads destruction from machine state operations

Split off destroying VCPU threads from drc callback
spapr_core_release() into new spapr_cpu_core_unrealizefn()
which takes care of internal cpu core state cleanup (i.e.
VCPU threads) and is called when object_unparent(core)
is called.

That leaves spapr_core_release() only with board mgmt
code, which will be moved to board related file in
follow up patch along with the rest on hotplug callbacks.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Bharata B Rao <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agohw/mips: MIPS Boston board support
Paul Burton [Thu, 8 Sep 2016 14:51:58 +0000 (15:51 +0100)]
hw/mips: MIPS Boston board support

Introduce support for emulating the MIPS Boston development board. The
Boston board is built around an FPGA & 3 PCIe controllers, one of which
is connected to an Intel EG20T Platform Controller Hub. It is used
during the development & debug of new CPUs and the software intended to
run on them, and is essentially the successor to the older MIPS Malta
board.

This patch does not implement the EG20T, instead connecting an already
supported ICH-9 AHCI controller. Whilst this isn't accurate it's enough
for typical stock Boston software (eg. Linux kernels) to work with hard
disks given that both the ICH-9 & EG20T implement the AHCI
specification.

Boston boards typically boot kernels in the FIT image format, and this
patch will treat kernels provided to QEMU as such. When loading a kernel
directly, the board code will generate minimal firmware much as the
Malta board code does. This firmware will set up the CM, CPC & GIC
register base addresses then set argument registers & jump to the kernel
entry point. Alternatively, bootloader code may be loaded using the bios
argument in which case no firmware will be generated & execution will
proceed from the start of the boot code at the default MIPS boot
exception vector (offset 0x1fc00000 into (c)kseg1).

Currently real Boston boards are always used with FPGA bitfiles that
include a Global Interrupt Controller (GIC), so the interrupt
configuration is only defined for such cases. Therefore the board will
only allow use of CPUs which implement the CPS components, including the
GIC, and will otherwise exit with a message.

Signed-off-by: Paul Burton <[email protected]>
Reviewed-by: Yongbok Kim <[email protected]>
[[email protected]:
  isolated boston machine support for mips64el.
  updated for recent Chardev changes.
  ignore missing bios/kernel for qtest.
  added default -drive to if=ide explicitly]
Signed-off-by: Yongbok Kim <[email protected]>
7 years agohw: xilinx-pcie: Add support for Xilinx AXI PCIe Controller
Paul Burton [Thu, 8 Sep 2016 14:51:57 +0000 (15:51 +0100)]
hw: xilinx-pcie: Add support for Xilinx AXI PCIe Controller

Add support for emulating the Xilinx AXI Root Port Bridge for PCI
Express as described by Xilinx' PG055 document. This is a PCIe
controller that can be used with certain series of Xilinx FPGAs, and is
used on the MIPS Boston board which will make use of this code.

Signed-off-by: Paul Burton <[email protected]>
[[email protected]:
  removed returning on !level,
  updated IRQ connection with GPIO logic,
  moved xilinx_pcie_init() to boston.c
  replaced stw_le_p() with pci_set_word()
  and other cosmetic changes]
Signed-off-by: Yongbok Kim <[email protected]>
7 years agoloader: Support Flattened Image Trees (FIT images)
Paul Burton [Thu, 8 Sep 2016 14:51:56 +0000 (15:51 +0100)]
loader: Support Flattened Image Trees (FIT images)

Introduce support for loading Flattened Image Trees, as used by modern
U-Boot. FIT images are essentially flattened device tree files which
contain binary images such as kernels, FDTs or ramdisks along with one
or more configuration nodes describing boot configurations.

The MIPS Boston board typically boots kernels in the form of FIT images,
and will make use of this code.

Signed-off-by: Paul Burton <[email protected]>
[[email protected]:
  fixed potential memory leaks,
  isolated building option]
Signed-off-by: Yongbok Kim <[email protected]>
7 years agodtc: Update requirement to v1.4.2
Paul Burton [Thu, 8 Sep 2016 14:51:55 +0000 (15:51 +0100)]
dtc: Update requirement to v1.4.2

In order to obtain fdt_first_subnode & fdt_next_subnode symbols from
libfdt for use by a later patch, bump the requirement for dtc to v1.4.2
& the submodule to that same version.

Signed-off-by: Paul Burton <[email protected]>
Reviewed-by: Yongbok Kim <[email protected]>
Signed-off-by: Yongbok Kim <[email protected]>
7 years agotarget-mips: Provide function to test if a CPU supports an ISA
Paul Burton [Thu, 8 Sep 2016 14:51:54 +0000 (15:51 +0100)]
target-mips: Provide function to test if a CPU supports an ISA

Provide a new cpu_supports_isa function which allows callers to
determine whether a CPU supports one of the ISA_ flags, by testing
whether the associated struct mips_def_t sets the ISA flags in its
insn_flags field.

An example use of this is to allow boards which generate bootloader code
to determine the properties of the CPU that will be used, for example
whether the CPU is 64 bit or which architecture revision it implements.

Signed-off-by: Paul Burton <[email protected]>
Reviewed-by: Leon Alrae <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Yongbok Kim <[email protected]>
7 years agohw/mips_gic: Update pin state on mask changes
Paul Burton [Thu, 8 Sep 2016 14:51:53 +0000 (15:51 +0100)]
hw/mips_gic: Update pin state on mask changes

If the GIC interrupt mask is changed by a write to the smask (set mask)
or rmask (reset mask) registers, we need to re-evaluate the state of the
pins/IRQs fed to the CPU. Without doing so we risk leaving a pin high
despite the interrupt that led to that state being masked, or losing
interrupts if an already pending interrupt is unmasked.

Signed-off-by: Paul Burton <[email protected]>
Reviewed-by: Leon Alrae <[email protected]>
Signed-off-by: Yongbok Kim <[email protected]>
This page took 0.091336 seconds and 4 git commands to generate.