OSDN Git Service

qmiga/qemu.git
6 years agomigration: split ufd_version_check onto receive/request features part
Alexey Perevalov [Tue, 19 Sep 2017 16:47:58 +0000 (19:47 +0300)]
migration: split ufd_version_check onto receive/request features part

This modification is necessary for userfault fd features which are
required to be requested from userspace.
UFFD_FEATURE_THREAD_ID is a one of such "on demand" feature, which will
be introduced in the next patch.

QEMU have to use separate userfault file descriptor, due to
userfault context has internal state, and after first call of
ioctl UFFD_API it changes its state to UFFD_STATE_RUNNING (in case of
success), but kernel while handling ioctl UFFD_API expects UFFD_STATE_WAIT_API.
So only one ioctl with UFFD_API is possible per ufd.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
6 years agomigration: fix hardcoded function name in error report
Alexey Perevalov [Tue, 19 Sep 2017 16:47:57 +0000 (19:47 +0300)]
migration: fix hardcoded function name in error report

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
6 years agomigration: pass MigrationIncomingState* into migration check functions
Alexey Perevalov [Tue, 19 Sep 2017 16:47:56 +0000 (19:47 +0300)]
migration: pass MigrationIncomingState* into migration check functions

That tiny refactoring is necessary to be able to set
UFFD_FEATURE_THREAD_ID while requesting features, and then
to create downtime context in case when kernel supports it.

Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
6 years agomigration: split common postcopy out of ram postcopy
Vladimir Sementsov-Ogievskiy [Mon, 10 Jul 2017 16:30:16 +0000 (19:30 +0300)]
migration: split common postcopy out of ram postcopy

Split common postcopy staff from ram postcopy staff.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
6 years agomigration: fix ram_save_pending
Vladimir Sementsov-Ogievskiy [Mon, 10 Jul 2017 16:30:15 +0000 (19:30 +0300)]
migration: fix ram_save_pending

Fill postcopy-able pending only if ram postcopy is enabled.
It is necessary because of there will be other postcopy-able states and
when ram postcopy is disabled, it should not spoil common postcopy
related pending.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
6 years agomigration: add has_postcopy savevm handler
Vladimir Sementsov-Ogievskiy [Mon, 10 Jul 2017 16:30:14 +0000 (19:30 +0300)]
migration: add has_postcopy savevm handler

Now postcopy-able states are recognized by not NULL
save_live_complete_postcopy handler. But when we have several different
postcopy-able states, it is not convenient. Ram postcopy may be
disabled, while some other postcopy enabled, in this case Ram state
should behave as it is not postcopy-able.

This patch add separate has_postcopy handler to specify behaviour of
savevm state.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
6 years agobitmap: provide to_le/from_le helpers
Peter Xu [Wed, 30 Aug 2017 08:32:00 +0000 (16:32 +0800)]
bitmap: provide to_le/from_le helpers

Provide helpers to convert bitmaps to little endian format. It can be
used when we want to send one bitmap via network to some other hosts.

One thing to mention is that, these helpers only solve the problem of
endianess, but it does not solve the problem of different word size on
machines (the bitmaps managing same count of bits may contains different
size when malloced). So we need to take care of the size alignment issue
on the callers for now.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
6 years agobitmap: introduce bitmap_count_one()
Peter Xu [Wed, 30 Aug 2017 08:31:59 +0000 (16:31 +0800)]
bitmap: introduce bitmap_count_one()

Count how many bits set in the bitmap.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
6 years agobitmap: remove BITOP_WORD()
Peter Xu [Wed, 30 Aug 2017 08:31:58 +0000 (16:31 +0800)]
bitmap: remove BITOP_WORD()

We have BIT_WORD(). It's the same.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
6 years agomigration: Split migration_fd_process_incoming
Juan Quintela [Mon, 17 Jul 2017 10:30:25 +0000 (12:30 +0200)]
migration: Split migration_fd_process_incoming

We need that on later patches.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
6 years agomigration: Create multifd migration threads
Juan Quintela [Thu, 14 Jan 2016 15:52:55 +0000 (16:52 +0100)]
migration: Create multifd migration threads

Creation of the threads, nothing inside yet.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
--

Use pointers instead of long array names
Move to use semaphores instead of conditions as paolo suggestion

Put all the state inside one struct.
Use a counter for the number of threads created.  Needed during cancellation.

Add error return to thread creation

Add id field

Rename functions to multifd_save/load_setup/cleanup
Change recv parameters to a pointer to struct
Change back to a struct
Use Error * for _cleanup

6 years agomigration: Create x-multifd-page-count parameter
Juan Quintela [Thu, 27 Apr 2017 08:48:25 +0000 (10:48 +0200)]
migration: Create x-multifd-page-count parameter

Indicates how many pages we are going to send in each batch to a multifd
thread.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
--

Be consistent with defaults and documentation
Use new DEFINE_PROP_*
Rename x-multifd-group to x-multifd-page-count

6 years agomigration: Create x-multifd-channels parameter
Juan Quintela [Fri, 15 Jan 2016 07:56:17 +0000 (08:56 +0100)]
migration: Create x-multifd-channels parameter

Indicates the number of channels that we will create.  By default we
create 2 channels.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
--

Catch inconsistent defaults (eric).
Improve comment stating that number of threads is the same than number
of sockets
Use new DEFIN_PROP_*
Rename x-multifd-threads to x-multifd-threads

6 years agomigration: Add multifd capability
Juan Quintela [Thu, 14 Jan 2016 11:23:00 +0000 (12:23 +0100)]
migration: Add multifd capability

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
--

Use new DEFINE_PROP

6 years agomigration: Create migration_has_all_channels
Juan Quintela [Mon, 24 Jul 2017 11:06:25 +0000 (13:06 +0200)]
migration: Create migration_has_all_channels

This function allows us to decide when to close the listener socket.
For now, we only need one connection.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
6 years agomigration: Add comments to channel functions
Juan Quintela [Mon, 24 Jul 2017 10:55:26 +0000 (12:55 +0200)]
migration: Add comments to channel functions

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
6 years agomigration: Teach it about G_SOURCE_REMOVE
Juan Quintela [Mon, 24 Jul 2017 10:51:59 +0000 (12:51 +0200)]
migration: Teach it about G_SOURCE_REMOVE

As this is defined on glib 2.32, add compatibility macros for older glibs.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
6 years agomigration: Create migration_ioc_process_incoming()
Juan Quintela [Mon, 24 Jul 2017 10:42:02 +0000 (12:42 +0200)]
migration: Create migration_ioc_process_incoming()

We pass the ioc instead of the fd.  This will allow us to have more
than one channel open.  We also make sure that we set the
from_src_file sooner, so we don't need to pass it as a parameter.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
--

Do not assing mis->from_src_file (peterxu)

6 years agoMerge remote-tracking branch 'remotes/famz/tags/build-and-test-automation-pull-reques...
Peter Maydell [Fri, 22 Sep 2017 11:14:27 +0000 (12:14 +0100)]
Merge remote-tracking branch 'remotes/famz/tags/build-and-test-automation-pull-request' into staging

# gpg: Signature made Fri 22 Sep 2017 08:28:38 BST
# gpg:                using RSA key 0xCA35624C6A9171C6
# gpg: Good signature from "Fam Zheng <famz@redhat.com>"
# 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: 5003 7CB7 9706 0F76 F021  AD56 CA35 624C 6A91 71C6

* remotes/famz/tags/build-and-test-automation-pull-request: (36 commits)
  docker: Drop 'set -e' from run script
  docker: Use archive-source.py
  tests: Add README for vm tests
  MAINTAINERS: Add tests/vm entry
  Makefile: Add rules to run vm tests
  tests: Add OpenBSD image
  tests: Add NetBSD image
  tests: Add FreeBSD image
  tests: Add ubuntu.i386 image
  tests: Add vm test lib
  tests: Add a test key pair
  scripts: Add archive-source.sh
  qemu.py: Add "wait()" method
  gitignore: Ignore vm test images
  MAINTAINERS: Fix subsystem name for "Build and test automation"
  buildsys: Move rdma libs to per object
  buildsys: Move brlapi libs to per object
  buildsys: Move usb redir cflags/libs to per object
  buildsys: Move libusb cflags/libs to per object
  buildsys: Move libcacard cflags/libs to per object
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20170922' into staging
Peter Maydell [Fri, 22 Sep 2017 09:55:55 +0000 (10:55 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20170922' into staging

Fix an s390x migration breakage up for 2.10 stable.
This will be fixed properly for 2.11.

# gpg: Signature made Fri 22 Sep 2017 08:28:22 BST
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20170922:
  s390x/ais: for 2.10 stable: disable ais facility

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoseccomp: Don't include libseccomp from QEMU header
Fam Zheng [Wed, 20 Sep 2017 08:36:47 +0000 (16:36 +0800)]
seccomp: Don't include libseccomp from QEMU header

The only prototype doesn't need anything from the lib header, and not
including it here allows files that include this header, for example
vl.c, to compile without the libseccomp cflags.

The breakage is since c3883e1f93 for environments where `pkg-config
--cflags libseccomp" is non-empty.

Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Acked-by: Eduardo Otubo <otubo@redhat.com>
Message-id: 20170920083647.14599-1-famz@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agos390x/ais: for 2.10 stable: disable ais facility
Christian Borntraeger [Thu, 21 Sep 2017 14:08:34 +0000 (16:08 +0200)]
s390x/ais: for 2.10 stable: disable ais facility

The migration interface for ais was introduced with kernel 4.13
but the capability itself had been active since 4.12. As migration
support is considered necessary lets disable ais in the 2.10
stable version. A proper fix and re-enablement will be done
for qemu 2.11.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20170921140834.14233-2-borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agodocker: Drop 'set -e' from run script
Fam Zheng [Tue, 5 Sep 2017 02:56:14 +0000 (10:56 +0800)]
docker: Drop 'set -e' from run script

Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agodocker: Use archive-source.py
Fam Zheng [Tue, 5 Sep 2017 02:12:01 +0000 (10:12 +0800)]
docker: Use archive-source.py

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6 years agotests: Add README for vm tests
Fam Zheng [Tue, 5 Sep 2017 02:12:00 +0000 (10:12 +0800)]
tests: Add README for vm tests

Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agoMAINTAINERS: Add tests/vm entry
Fam Zheng [Tue, 5 Sep 2017 02:11:59 +0000 (10:11 +0800)]
MAINTAINERS: Add tests/vm entry

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agoMakefile: Add rules to run vm tests
Fam Zheng [Tue, 5 Sep 2017 02:11:58 +0000 (10:11 +0800)]
Makefile: Add rules to run vm tests

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agotests: Add OpenBSD image
Fam Zheng [Tue, 5 Sep 2017 02:11:57 +0000 (10:11 +0800)]
tests: Add OpenBSD image

The image is prepared following instructions as in:

https://wiki.qemu.org/Hosts/BSD

Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agotests: Add NetBSD image
Fam Zheng [Tue, 5 Sep 2017 02:11:56 +0000 (10:11 +0800)]
tests: Add NetBSD image

The image is prepared following instructions as in:

https://wiki.qemu.org/Hosts/BSD

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Kamil Rytarowski <n54@gmx.com>
6 years agotests: Add FreeBSD image
Fam Zheng [Tue, 5 Sep 2017 02:11:55 +0000 (10:11 +0800)]
tests: Add FreeBSD image

The image is prepared following instructions as in:

https://wiki.qemu.org/Hosts/BSD

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6 years agotests: Add ubuntu.i386 image
Fam Zheng [Tue, 5 Sep 2017 02:11:54 +0000 (10:11 +0800)]
tests: Add ubuntu.i386 image

This adds a 32bit guest.

The official LTS cloud image is downloaded and initialized with
cloud-init.

Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agotests: Add vm test lib
Fam Zheng [Tue, 5 Sep 2017 02:11:53 +0000 (10:11 +0800)]
tests: Add vm test lib

This is the common code to implement a "VM test" to

  1) Download and initialize a pre-defined VM that has necessary
  dependencies to build QEMU and SSH access.

  2) Archive $SRC_PATH to a .tar file.

  3) Boot the VM, and pass the source tar file to the guest.

  4) SSH into the VM, untar the source tarball, build from the source.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6 years agotests: Add a test key pair
Fam Zheng [Wed, 13 Sep 2017 01:07:25 +0000 (09:07 +0800)]
tests: Add a test key pair

This will be used by setup test user ssh.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
6 years agoscripts: Add archive-source.sh
Fam Zheng [Tue, 5 Sep 2017 02:11:52 +0000 (10:11 +0800)]
scripts: Add archive-source.sh

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
6 years agoqemu.py: Add "wait()" method
Fam Zheng [Tue, 5 Sep 2017 02:11:51 +0000 (10:11 +0800)]
qemu.py: Add "wait()" method

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6 years agogitignore: Ignore vm test images
Fam Zheng [Tue, 5 Sep 2017 02:11:50 +0000 (10:11 +0800)]
gitignore: Ignore vm test images

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
6 years agoMAINTAINERS: Fix subsystem name for "Build and test automation"
Eduardo Habkost [Thu, 21 Sep 2017 17:02:09 +0000 (14:02 -0300)]
MAINTAINERS: Fix subsystem name for "Build and test automation"

The subsystem name for the "Build test automation" section is
"-------------------------", because an actual subsystem name
line is missing:

  $ ./scripts/get_maintainer.pl -f tests/docker/docker.py
  "Alex Bennée" <alex.bennee@linaro.org> (maintainer:-----------------...)
  Fam Zheng <famz@redhat.com> (maintainer:-----------------...)
  "Philippe Mathieu-Daudé" <f4bug@amsat.org> (reviewer:-----------------...)
  qemu-devel@nongnu.org (open list:-----------------...)

Fix the issue by inserting a subsystem name line where
get_maintainer.pl expects it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170921170209.9101-1-ehabkost@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agobuildsys: Move rdma libs to per object
Fam Zheng [Thu, 7 Sep 2017 08:42:30 +0000 (16:42 +0800)]
buildsys: Move rdma libs to per object

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907084230.26493-1-famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agobuildsys: Move brlapi libs to per object
Fam Zheng [Thu, 7 Sep 2017 08:47:00 +0000 (16:47 +0800)]
buildsys: Move brlapi libs to per object

baum.o already receives the sdl cflags in its per object variable, do
the same for brlapi libs to avoid cluttering libs_softmmu.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907084700.952-1-famz@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agobuildsys: Move usb redir cflags/libs to per object
Fam Zheng [Thu, 7 Sep 2017 08:29:18 +0000 (16:29 +0800)]
buildsys: Move usb redir cflags/libs to per object

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907082918.7299-10-famz@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agobuildsys: Move libusb cflags/libs to per object
Fam Zheng [Thu, 7 Sep 2017 08:29:17 +0000 (16:29 +0800)]
buildsys: Move libusb cflags/libs to per object

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907082918.7299-9-famz@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agobuildsys: Move libcacard cflags/libs to per object
Fam Zheng [Thu, 7 Sep 2017 08:29:16 +0000 (16:29 +0800)]
buildsys: Move libcacard cflags/libs to per object

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907082918.7299-8-famz@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agobuildsys: Move audio libs to per object
Fam Zheng [Thu, 7 Sep 2017 08:29:13 +0000 (16:29 +0800)]
buildsys: Move audio libs to per object

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907082918.7299-5-famz@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agobuildsys: Move sdl cflags/libs to per object
Fam Zheng [Thu, 7 Sep 2017 08:29:11 +0000 (16:29 +0800)]
buildsys: Move sdl cflags/libs to per object

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907082918.7299-3-famz@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agobuildsys: Move vde libs to per object
Fam Zheng [Thu, 7 Sep 2017 08:35:52 +0000 (16:35 +0800)]
buildsys: Move vde libs to per object

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907083552.17725-3-famz@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agovl: Don't include vde header
Fam Zheng [Thu, 7 Sep 2017 08:35:51 +0000 (16:35 +0800)]
vl: Don't include vde header

Nothing in vl.c uses anything from the vde package, do remove the
unnecessary include.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907083552.17725-2-famz@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agodocker: Add test-block
Fam Zheng [Tue, 5 Sep 2017 02:56:13 +0000 (10:56 +0800)]
docker: Add test-block

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170905025614.579-6-famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Based-on: 20170905021201.25684-1-famz@redhat.com

6 years agodocker: Add nettle-devel to fedora image
Fam Zheng [Tue, 5 Sep 2017 02:56:12 +0000 (10:56 +0800)]
docker: Add nettle-devel to fedora image

The LUKS cases in qemu-iotests requires this.

Reviewed-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170905025614.579-5-famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Based-on: 20170905021201.25684-1-famz@redhat.com

6 years agodocker: Use unconfined security profile
Fam Zheng [Tue, 5 Sep 2017 02:56:11 +0000 (10:56 +0800)]
docker: Use unconfined security profile

Some by default blocked syscalls are required to run tests for example
userfaultfd.

Reviewed-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170905025614.579-4-famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Based-on: 20170905021201.25684-1-famz@redhat.com

6 years agodocker: Add test_fail and prep_fail
Fam Zheng [Tue, 5 Sep 2017 02:56:10 +0000 (10:56 +0800)]
docker: Add test_fail and prep_fail

They both print a message and exit, but with different status code so
distinguish real test errors from env preparation failures.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170905025614.579-3-famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Based-on: 20170905021201.25684-1-famz@redhat.com

6 years agodocker: Fix return code of build_qemu()
Fam Zheng [Tue, 5 Sep 2017 02:56:09 +0000 (10:56 +0800)]
docker: Fix return code of build_qemu()

Without "set -e", the "&&" makes sure that the return code reflects the
result status, and that make only runs if configure succeeds.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170905025614.579-2-famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Based-on: 20170905021201.25684-1-famz@redhat.com

6 years agotests/docker: Clean up paths
Fam Zheng [Thu, 17 Aug 2017 03:57:21 +0000 (11:57 +0800)]
tests/docker: Clean up paths

The 'run' script already creats src, build and install directories under
$TEST_DIR, use it in common.rc.

Also the tests always run from $QEMU_SRC/tests/docker, so use a relative
$CMD string.

Message-Id: <20170817035721.11064-1-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agodocker: Enable features explicitly in test-full
Fam Zheng [Thu, 7 Sep 2017 14:12:45 +0000 (22:12 +0800)]
docker: Enable features explicitly in test-full

Also avoid "set -e".

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907141245.31946-3-famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
6 years agodocker: Update ubuntu image
Fam Zheng [Thu, 7 Sep 2017 14:12:44 +0000 (22:12 +0800)]
docker: Update ubuntu image

Base on the newer ubuntu-lts (16.06) and include more packages for
better build coverage.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170907141245.31946-2-famz@redhat.com>

6 years agodocker: reduce noise when building travis.docker
Alex Bennée [Tue, 25 Jul 2017 13:34:25 +0000 (14:34 +0100)]
docker: reduce noise when building travis.docker

Set the DEBIAN_FRONTEND and locale env vars to stop apt complaining so
much as we build the image.

Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20170725133425.436-7-alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agodocker: don't install device-tree-compiler build-deps in travis.docker
Alex Bennée [Tue, 25 Jul 2017 13:34:24 +0000 (14:34 +0100)]
docker: don't install device-tree-compiler build-deps in travis.docker

Installing the device-tree-compiler build-deps is a little extreme. We
only actually need the binary so include it with the other packages.

Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20170725133425.436-6-alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agodocker: docker.py make --no-cache skip checksum test
Alex Bennée [Tue, 25 Jul 2017 13:34:23 +0000 (14:34 +0100)]
docker: docker.py make --no-cache skip checksum test

If you invoke with NOCACHE=1 we pass --no-cache in the argv to
docker.py but may still not force a rebuild if the dockerfile checksum
hasn't changed. By testing for its presence we can force builds
without having to manually remove the docker image.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20170725133425.436-5-alex.bennee@linaro.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agodocker: ensure NOUSER for travis images
Alex Bennée [Tue, 25 Jul 2017 13:34:20 +0000 (14:34 +0100)]
docker: ensure NOUSER for travis images

While adding the current user is a useful default behaviour for
creating new images it is not appropriate for Travis which already has
a default user.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170725133425.436-2-alex.bennee@linaro.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170921' into...
Peter Maydell [Thu, 21 Sep 2017 16:42:27 +0000 (17:42 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170921' into staging

target-arm queue:
 * more preparatory work for v8M support
 * convert some omap devices away from old_mmio
 * remove out of date ARM ARM section references in comments
 * add the Smartfusion2 board

# gpg: Signature made Thu 21 Sep 2017 17:40:40 BST
# gpg:                using RSA key 0x3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20170921: (31 commits)
  msf2: Add Emcraft's Smartfusion2 SOM kit
  msf2: Add Smartfusion2 SoC
  msf2: Add Smartfusion2 SPI controller
  msf2: Microsemi Smartfusion2 System Register block
  msf2: Add Smartfusion2 System timer
  hw/arm/omap2.c: Don't use old_mmio
  hw/i2c/omap_i2c.c: Don't use old_mmio
  hw/timer/omap_gptimer: Don't use old_mmio
  hw/timer/omap_synctimer.c: Don't use old_mmio
  hw/gpio/omap_gpio.c: Don't use old_mmio
  hw/arm/palm.c: Don't use old_mmio for static_ops
  target/arm: Remove out of date ARM ARM section references in A64 decoder
  nvic: Support banked exceptions in acknowledge and complete
  nvic: Make SHCSR banked for v8M
  nvic: Make ICSR banked for v8M
  target/arm: Handle banking in negative-execution-priority check in cpu_mmu_index()
  nvic: Handle v8M changes in nvic_exec_prio()
  nvic: Disable the non-secure HardFault if AIRCR.BFHFNMINS is clear
  nvic: Implement v8M changes to fixed priority exceptions
  nvic: In escalation to HardFault, support HF not being priority -1
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agomsf2: Add Emcraft's Smartfusion2 SOM kit
Subbaraya Sundeep [Wed, 20 Sep 2017 20:17:37 +0000 (17:17 -0300)]
msf2: Add Emcraft's Smartfusion2 SOM kit

Emulated Emcraft's Smartfusion2 System On Module starter
kit.

Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170920201737.25723-6-f4bug@amsat.org
[PMD: drop cpu_model to directly use cpu type]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agomsf2: Add Smartfusion2 SoC
Subbaraya Sundeep [Wed, 20 Sep 2017 20:17:36 +0000 (17:17 -0300)]
msf2: Add Smartfusion2 SoC

Smartfusion2 SoC has hardened Microcontroller subsystem
and flash based FPGA fabric. This patch adds support for
Microcontroller subsystem in the SoC.

Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170920201737.25723-5-f4bug@amsat.org
[PMD: drop cpu_model to directly use cpu type, check m3clk non null]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agomsf2: Add Smartfusion2 SPI controller
Subbaraya Sundeep [Wed, 20 Sep 2017 20:17:35 +0000 (17:17 -0300)]
msf2: Add Smartfusion2 SPI controller

Modelled Microsemi's Smartfusion2 SPI controller.

Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170920201737.25723-4-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agomsf2: Microsemi Smartfusion2 System Register block
Subbaraya Sundeep [Wed, 20 Sep 2017 20:17:34 +0000 (17:17 -0300)]
msf2: Microsemi Smartfusion2 System Register block

Added Sytem register block of Smartfusion2.
This block has PLL registers which are accessed by guest.

Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170920201737.25723-3-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agomsf2: Add Smartfusion2 System timer
Subbaraya Sundeep [Wed, 20 Sep 2017 20:17:33 +0000 (17:17 -0300)]
msf2: Add Smartfusion2 System timer

Modelled System Timer in Microsemi's Smartfusion2 Soc.
Timer has two 32bit down counters and two interrupts.

Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170920201737.25723-2-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agohw/arm/omap2.c: Don't use old_mmio
Peter Maydell [Sat, 16 Sep 2017 16:46:18 +0000 (17:46 +0100)]
hw/arm/omap2.c: Don't use old_mmio

Don't use old_mmio in the memory region ops struct.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505580378-9044-7-git-send-email-peter.maydell@linaro.org

6 years agohw/i2c/omap_i2c.c: Don't use old_mmio
Peter Maydell [Sat, 16 Sep 2017 16:46:17 +0000 (17:46 +0100)]
hw/i2c/omap_i2c.c: Don't use old_mmio

Don't use old_mmio in the memory region ops struct.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505580378-9044-6-git-send-email-peter.maydell@linaro.org

6 years agohw/timer/omap_gptimer: Don't use old_mmio
Peter Maydell [Sat, 16 Sep 2017 16:46:16 +0000 (17:46 +0100)]
hw/timer/omap_gptimer: Don't use old_mmio

Don't use the old_mmio struct in memory region ops.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505580378-9044-5-git-send-email-peter.maydell@linaro.org

6 years agohw/timer/omap_synctimer.c: Don't use old_mmio
Peter Maydell [Sat, 16 Sep 2017 16:46:15 +0000 (17:46 +0100)]
hw/timer/omap_synctimer.c: Don't use old_mmio

Don't use the old_mmio in the memory region ops struct.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505580378-9044-4-git-send-email-peter.maydell@linaro.org

6 years agohw/gpio/omap_gpio.c: Don't use old_mmio
Peter Maydell [Sat, 16 Sep 2017 16:46:14 +0000 (17:46 +0100)]
hw/gpio/omap_gpio.c: Don't use old_mmio

Drop the use of old_mmio in the omap2_gpio memory ops.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505580378-9044-3-git-send-email-peter.maydell@linaro.org

6 years agohw/arm/palm.c: Don't use old_mmio for static_ops
Peter Maydell [Sat, 16 Sep 2017 16:46:13 +0000 (17:46 +0100)]
hw/arm/palm.c: Don't use old_mmio for static_ops

Update the static_ops functions to use new-style mmio
rather than the legacy old_mmio functions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505580378-9044-2-git-send-email-peter.maydell@linaro.org

6 years agotarget/arm: Remove out of date ARM ARM section references in A64 decoder
Peter Maydell [Fri, 15 Sep 2017 15:08:49 +0000 (16:08 +0100)]
target/arm: Remove out of date ARM ARM section references in A64 decoder

In the A64 decoder, we have a lot of references to section numbers
from version A.a of the v8A ARM ARM (DDI0487). This version of the
document is now long obsolete (we are currently on revision B.a),
and various intervening versions renumbered all the sections.

The most recent B.a version of the document doesn't assign
section numbers at all to the individual instruction classes
in the way that the various A.x versions did. The simplest thing
to do is just to delete all the out of date C.x.x references.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20170915150849.23557-1-peter.maydell@linaro.org

6 years agonvic: Support banked exceptions in acknowledge and complete
Peter Maydell [Tue, 12 Sep 2017 18:14:06 +0000 (19:14 +0100)]
nvic: Support banked exceptions in acknowledge and complete

Update armv7m_nvic_acknowledge_irq() and armv7m_nvic_complete_irq()
to handle banked exceptions:
 * acknowledge needs to use the correct vector, which may be
   in sec_vectors[]
 * acknowledge needs to return to its caller whether the
   exception should be taken to secure or non-secure state
 * complete needs its caller to tell it whether the exception
   being completed is a secure one or not

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-20-git-send-email-peter.maydell@linaro.org

6 years agonvic: Make SHCSR banked for v8M
Peter Maydell [Tue, 12 Sep 2017 18:14:05 +0000 (19:14 +0100)]
nvic: Make SHCSR banked for v8M

Handle banking of SHCSR: some register bits are banked between
Secure and Non-Secure, and some are only accessible to Secure.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-19-git-send-email-peter.maydell@linaro.org

6 years agonvic: Make ICSR banked for v8M
Peter Maydell [Tue, 12 Sep 2017 18:14:04 +0000 (19:14 +0100)]
nvic: Make ICSR banked for v8M

The ICSR NVIC register is banked for v8M. This doesn't
require any new state, but it does mean that some bits
are controlled by BFHNFNMINS and some bits must work
with the correct banked exception. There is also a new
in v8M PENDNMICLR bit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-18-git-send-email-peter.maydell@linaro.org

6 years agotarget/arm: Handle banking in negative-execution-priority check in cpu_mmu_index()
Peter Maydell [Tue, 12 Sep 2017 18:14:03 +0000 (19:14 +0100)]
target/arm: Handle banking in negative-execution-priority check in cpu_mmu_index()

Now that we have a banked FAULTMASK register and banked exceptions,
we can implement the correct check in cpu_mmu_index() for whether
the MPU_CTRL.HFNMIENA bit's effect should apply. This bit causes
handlers which have requested a negative execution priority to run
with the MPU disabled. In v8M the test has to check this for the
current security state and so takes account of banking.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-17-git-send-email-peter.maydell@linaro.org

6 years agonvic: Handle v8M changes in nvic_exec_prio()
Peter Maydell [Tue, 12 Sep 2017 18:14:02 +0000 (19:14 +0100)]
nvic: Handle v8M changes in nvic_exec_prio()

Update nvic_exec_prio() to support the v8M changes:
 * BASEPRI, FAULTMASK and PRIMASK are all banked
 * AIRCR.PRIS can affect NS priorities
 * AIRCR.BFHFNMINS affects FAULTMASK behaviour

These changes mean that it's no longer possible to
definitely say that if FAULTMASK is set it overrides
PRIMASK, and if PRIMASK is set it overrides BASEPRI
(since if PRIMASK_NS is set and AIRCR.PRIS is set then
whether that 0x80 priority should take effect or the
priority in BASEPRI_S depends on the value of BASEPRI_S,
for instance). So we switch to the same approach used
by the pseudocode of working through BASEPRI, PRIMASK
and FAULTMASK and overriding the previous values if
needed.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-16-git-send-email-peter.maydell@linaro.org

6 years agonvic: Disable the non-secure HardFault if AIRCR.BFHFNMINS is clear
Peter Maydell [Tue, 12 Sep 2017 18:14:01 +0000 (19:14 +0100)]
nvic: Disable the non-secure HardFault if AIRCR.BFHFNMINS is clear

If AIRCR.BFHFNMINS is clear, then although NonSecure HardFault
can still be pended via SHCSR.HARDFAULTPENDED it mustn't actually
preempt execution. The simple way to achieve this is to clear the
enable bit for it, since the enable bit isn't guest visible.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-15-git-send-email-peter.maydell@linaro.org

6 years agonvic: Implement v8M changes to fixed priority exceptions
Peter Maydell [Tue, 12 Sep 2017 18:14:00 +0000 (19:14 +0100)]
nvic: Implement v8M changes to fixed priority exceptions

In v7M, the fixed-priority exceptions are:
 Reset: -3
 NMI: -2
 HardFault: -1

In v8M, this changes because Secure HardFault may need
to be prioritised above NMI:
 Reset: -4
 Secure HardFault if AIRCR.BFHFNMINS == 1: -3
 NMI: -2
 Secure HardFault if AIRCR.BFHFNMINS == 0: -1
 NonSecure HardFault: -1

Make these changes, including support for changing the
priority of Secure HardFault as AIRCR.BFHFNMINS changes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-14-git-send-email-peter.maydell@linaro.org

6 years agonvic: In escalation to HardFault, support HF not being priority -1
Peter Maydell [Tue, 12 Sep 2017 18:13:59 +0000 (19:13 +0100)]
nvic: In escalation to HardFault, support HF not being priority -1

When escalating to HardFault, we must go into Lockup if we
can't take the synchronous HardFault because the current
execution priority is already at or below the priority of
HardFault. In v7M HF is always priority -1 so a simple < 0
comparison sufficed; in v8M the priority of HardFault can
vary depending on whether it is a Secure or NonSecure
HardFault, so we must check against the priority of the
HardFault exception vector we're about to use.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-13-git-send-email-peter.maydell@linaro.org

6 years agonvic: Compare group priority for escalation to HF
Peter Maydell [Tue, 12 Sep 2017 18:13:58 +0000 (19:13 +0100)]
nvic: Compare group priority for escalation to HF

In armv7m_nvic_set_pending() we have to compare the
priority of an exception against the execution priority
to decide whether it needs to be escalated to HardFault.
In the specification this is a comparison against the
exception's group priority; for v7M we implemented it
as a comparison against the raw exception priority
because the two comparisons will always give the
same answer. For v8M the existence of AIRCR.PRIS and
the possibility of different PRIGROUP values for secure
and nonsecure exceptions means we need to explicitly
calculate the vector's group priority for this check.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-12-git-send-email-peter.maydell@linaro.org

6 years agonvic: Make SHPR registers banked
Peter Maydell [Tue, 12 Sep 2017 18:13:57 +0000 (19:13 +0100)]
nvic: Make SHPR registers banked

Make the set_prio() function take a bool indicating
whether to pend the secure or non-secure version of a banked
interrupt, and use this to implement the correct banking
semantics for the SHPR registers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-11-git-send-email-peter.maydell@linaro.org

6 years agonvic: Make set_pending and clear_pending take a secure parameter
Peter Maydell [Tue, 12 Sep 2017 18:13:56 +0000 (19:13 +0100)]
nvic: Make set_pending and clear_pending take a secure parameter

Make the armv7m_nvic_set_pending() and armv7m_nvic_clear_pending()
functions take a bool indicating whether to pend the secure
or non-secure version of a banked interrupt, and update the
callsites accordingly.

In most callsites we can simply pass the correct security
state in; in a couple of cases we use TODO comments to indicate
that we will return the code in a subsequent commit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-10-git-send-email-peter.maydell@linaro.org

6 years agonvic: Handle banked exceptions in nvic_recompute_state()
Peter Maydell [Tue, 12 Sep 2017 18:13:55 +0000 (19:13 +0100)]
nvic: Handle banked exceptions in nvic_recompute_state()

Update the nvic_recompute_state() code to handle the security
extension and its associated banked registers.

Code that uses the resulting cached state (ie the irq
acknowledge and complete code) will be updated in a later
commit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-9-git-send-email-peter.maydell@linaro.org

6 years agonvic: Implement NVIC_ITNS<n> registers
Peter Maydell [Tue, 12 Sep 2017 18:13:54 +0000 (19:13 +0100)]
nvic: Implement NVIC_ITNS<n> registers

For v8M, the NVIC has a new set of registers per interrupt,
NVIC_ITNS<n>. These determine whether the interrupt targets Secure
or Non-secure state. Implement the register read/write code for
these, and make them cause NVIC_IABR, NVIC_ICER, NVIC_ISER,
NVIC_ICPR, NVIC_IPR and NVIC_ISPR to RAZ/WI for non-secure
accesses to fields corresponding to interrupts which are
configured to target secure state.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-8-git-send-email-peter.maydell@linaro.org

6 years agonvic: Make ICSR.RETTOBASE handle banked exceptions
Peter Maydell [Tue, 12 Sep 2017 18:13:53 +0000 (19:13 +0100)]
nvic: Make ICSR.RETTOBASE handle banked exceptions

Update the code in nvic_rettobase() so that it checks the
sec_vectors[] array as well as the vectors[] array if needed.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-7-git-send-email-peter.maydell@linaro.org

6 years agonvic: Implement AIRCR changes for v8M
Peter Maydell [Tue, 12 Sep 2017 18:13:52 +0000 (19:13 +0100)]
nvic: Implement AIRCR changes for v8M

The Application Interrupt and Reset Control Register has some changes
for v8M:
 * new bits SYSRESETREQS, BFHFNMINS and PRIS: these all have
   real state if the security extension is implemented and otherwise
   are constant
 * the PRIGROUP field is banked between security states
 * non-secure code can be blocked from using the SYSRESET bit
   to reset the system if SYSRESETREQS is set

Implement the new state and the changes to register read and write.
For the moment we ignore the effects of the secure PRIGROUP.
We will implement the effects of PRIS and BFHFNMIS later.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-6-git-send-email-peter.maydell@linaro.org

6 years agonvic: Add cached vectpending_prio state
Peter Maydell [Tue, 12 Sep 2017 18:13:51 +0000 (19:13 +0100)]
nvic: Add cached vectpending_prio state

Instead of looking up the pending priority
in nvic_pending_prio(), cache it in a new state struct
field. The calculation of the pending priority given
the interrupt number is more complicated in v8M with
the security extension, so the caching will be worthwhile.

This changes nvic_pending_prio() from returning a full
(group + subpriority) priority value to returning a group
priority. This doesn't require changes to its callsites
because we use it only in comparisons of the form
  execution_prio > nvic_pending_prio()
and execution priority is always a group priority, so
a test (exec prio > full prio) is true if and only if
(execprio > group_prio).

(Architecturally the expected comparison is with the
group priority for this sort of "would we preempt" test;
we were only doing a test with a full priority as an
optimisation to avoid the mask, which is possible
precisely because the two comparisons always give the
same answer.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-5-git-send-email-peter.maydell@linaro.org

6 years agonvic: Add cached vectpending_is_s_banked state
Peter Maydell [Tue, 12 Sep 2017 18:13:50 +0000 (19:13 +0100)]
nvic: Add cached vectpending_is_s_banked state

With banked exceptions, just the exception number in
s->vectpending is no longer sufficient to uniquely identify
the pending exception. Add a vectpending_is_s_banked bool
which is true if the exception is using the sec_vectors[]
array.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1505240046-11454-4-git-send-email-peter.maydell@linaro.org

6 years agonvic: Add banked exception states
Peter Maydell [Thu, 21 Sep 2017 15:28:59 +0000 (16:28 +0100)]
nvic: Add banked exception states

For the v8M security extension, some exceptions must be banked
between security states. Add the new vecinfo array which holds
the state for the banked exceptions and migrate it if the
CPU the NVIC is attached to implements the security extension.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agotarget/arm: Implement MSR/MRS access to NS banked registers
Peter Maydell [Tue, 12 Sep 2017 18:13:48 +0000 (19:13 +0100)]
target/arm: Implement MSR/MRS access to NS banked registers

In v8M the MSR and MRS instructions have extra register value
encodings to allow secure code to access the non-secure banked
version of various special registers.

(We don't implement the MSPLIM_NS or PSPLIM_NS aliases, because
we don't currently implement the stack limit registers at all.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1505240046-11454-2-git-send-email-peter.maydell@linaro.org

6 years agoMerge remote-tracking branch 'remotes/yongbok/tags/mips-20170921' into staging
Peter Maydell [Thu, 21 Sep 2017 13:40:30 +0000 (14:40 +0100)]
Merge remote-tracking branch 'remotes/yongbok/tags/mips-20170921' into staging

MIPS patches 2017-09-21

Changes:
QOMify MIPS cpu
Improve macro parenthesization

# gpg: Signature made Thu 21 Sep 2017 13:50:37 BST
# gpg:                using RSA key 0x2238EB86D5F797C2
# gpg: Good signature from "Yongbok Kim <yongbok.kim@imgtec.com>"
# 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-20170921:
  mips: Improve macro parenthesization
  mips: replace cpu_mips_init() with cpu_generic_init()
  mips: MIPSCPU model subclasses
  mips: call cpu_mips_realize_env() from mips_cpu_realizefn()
  mips: split cpu_mips_realize_env() out of cpu_mips_init()
  mips: introduce internal.h and cleanup cpu.h
  mips: move hw/mips/cputimer.c to target/mips/

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agomips: Improve macro parenthesization
Eric Blake [Tue, 19 Sep 2017 14:13:07 +0000 (09:13 -0500)]
mips: Improve macro parenthesization

Although none of the existing macro call-sites were broken,
it's always better to write macros that properly parenthesize
arguments that can be complex expressions, so that the intended
order of operations is not broken.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Yongbok Kim <yongbok.kim@imgtec.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
6 years agomips: replace cpu_mips_init() with cpu_generic_init()
Igor Mammedov [Wed, 20 Sep 2017 19:49:34 +0000 (16:49 -0300)]
mips: replace cpu_mips_init() with cpu_generic_init()

now cpu_mips_init() reimplements subset of cpu_generic_init()
tasks, so just drop it and use cpu_generic_init() directly.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
[PMD: use internal.h instead of cpu.h]
Tested-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
6 years agomips: MIPSCPU model subclasses
Igor Mammedov [Wed, 20 Sep 2017 19:49:33 +0000 (16:49 -0300)]
mips: MIPSCPU model subclasses

Register separate QOM types for each mips cpu model,
so it would be possible to reuse generic CPU creation
routines.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
[PMD: use internal.h, use void* to hold cpu_def in MIPSCPUClass,
 mark MIPSCPU abstract, address Eduardo Habkost review]
Tested-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
6 years agomips: call cpu_mips_realize_env() from mips_cpu_realizefn()
Philippe Mathieu-Daudé [Wed, 20 Sep 2017 19:49:32 +0000 (16:49 -0300)]
mips: call cpu_mips_realize_env() from mips_cpu_realizefn()

This changes the order between cpu_mips_realize_env() and
cpu_exec_initfn(), but cpu_exec_initfn() don't have anything that
depends on cpu_mips_realize_env() being called first.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
6 years agomips: split cpu_mips_realize_env() out of cpu_mips_init()
Philippe Mathieu-Daudé [Wed, 20 Sep 2017 19:49:31 +0000 (16:49 -0300)]
mips: split cpu_mips_realize_env() out of cpu_mips_init()

so it can be used in mips_cpu_realizefn() in the next commit

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
6 years agomips: introduce internal.h and cleanup cpu.h
Philippe Mathieu-Daudé [Wed, 20 Sep 2017 19:49:30 +0000 (16:49 -0300)]
mips: introduce internal.h and cleanup cpu.h

no logical change, only code movement (and fix a comment typo).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
6 years agomips: move hw/mips/cputimer.c to target/mips/
Philippe Mathieu-Daudé [Wed, 20 Sep 2017 19:49:29 +0000 (16:49 -0300)]
mips: move hw/mips/cputimer.c to target/mips/

This timer is a required part of the MIPS32/MIPS64 System Control coprocessor
(CP0). Moving it with the other architecture related files will allow an opaque
use of CPUMIPSState* in the next commit (introduce "internal.h").

also remove it from 'user' targets, remove an unnecessary include.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
6 years agoMerge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging
Peter Maydell [Thu, 21 Sep 2017 09:56:09 +0000 (10:56 +0100)]
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging

qemu-sparc update

# gpg: Signature made Thu 21 Sep 2017 08:42:30 BST
# gpg:                using RSA key 0x5BC2C56FAE0F321F
# gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>"
# Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F

* remotes/mcayland/tags/qemu-sparc-signed:
  sun4u: use sunhme as default on-board NIC
  net: add Sun HME (Happy Meal Ethernet) on-board NIC

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/sstabellini/tags/xen-20170920-tag' into staging
Peter Maydell [Thu, 21 Sep 2017 09:18:02 +0000 (10:18 +0100)]
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20170920-tag' into staging

Xen 2017/09/20

# gpg: Signature made Thu 21 Sep 2017 03:20:02 BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# gpg:                 aka "Stefano Stabellini <sstabellini@kernel.org>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* remotes/sstabellini/tags/xen-20170920-tag:
  xen/pt: allow QEMU to request MSI unmasking at bind time
  xen-disk: use g_new0 to fix build

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>