OSDN Git Service

qmiga/qemu.git
4 years agoMerge remote-tracking branch 'remotes/philmd-gitlab/tags/python-next-20200207' into...
Peter Maydell [Mon, 10 Feb 2020 12:07:26 +0000 (12:07 +0000)]
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/python-next-20200207' into staging

- Python 3 cleanups:
  . Remove text about Python 2 in qemu-deprecated (Thomas)
  . Remove shebang header (Paolo, Philippe)
  . scripts/checkpatch.pl now allows Python 3 interpreter (Philippe)
  . Explicit usage of Python 3 interpreter in scripts (Philippe)
  . Fix Python scripts permissions (Paolo, Philippe)
  . Drop 'from __future__ import print_function' (Paolo)
  . Specify minimum python requirements in ReadTheDocs configuration (Alex)
- Test UNIX/EXEC transports with migration (Oksana)
- Added extract_from_rpm helper, improved extract_from_deb (Liam)
- Allow to use other serial consoles than default one (Philippe)
- Various improvements in QEMUMonitorProtocol (Wainer)
- Fix kvm_available() on ppc64le (Wainer)

# gpg: Signature made Fri 07 Feb 2020 15:01:56 GMT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* remotes/philmd-gitlab/tags/python-next-20200207: (46 commits)
  .readthedocs.yml: specify some minimum python requirements
  drop "from __future__ import print_function"
  make all Python scripts executable
  scripts/signrom: remove Python 2 support, add shebang
  tests/qemu-iotests/check: Only check for Python 3 interpreter
  scripts: Explicit usage of Python 3 (scripts without __main__)
  tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__)
  tests/vm: Remove shebang header
  tests/acceptance: Remove shebang header
  scripts/tracetool: Remove shebang header
  scripts/minikconf: Explicit usage of Python 3
  scripts: Explicit usage of Python 3 (scripts with __main__)
  tests: Explicit usage of Python 3
  tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__)
  tests/qemu-iotests/check: Allow use of python3 interpreter
  scripts/checkpatch.pl: Only allow Python 3 interpreter
  tests/acceptance/migration: Default to -nodefaults
  tests/acceptance/migration: Add the 'migration' tag
  tests/acceptance/migration: Test EXEC transport when migrating
  tests/acceptance/migration: Test UNIX transport when migrating
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200207' into...
Peter Maydell [Fri, 7 Feb 2020 18:02:52 +0000 (18:02 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200207' into staging

target-arm queue:
 * monitor: fix query-cpu-model-expansion crash when using machine type none
 * Support emulation of the ARMv8.1-VHE architecture feature
 * bcm2835_dma: fix bugs in TD mode handling
 * docs/arm-cpu-features: Make kvm-no-adjvtime comment clearer
 * stellaris, stm32f2xx_timer, armv7m_systick: fix minor memory leaks

# gpg: Signature made Fri 07 Feb 2020 14:32:28 GMT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20200207: (48 commits)
  stellaris: delay timer_new to avoid memleaks
  stm32f2xx_timer: delay timer_new to avoid memleaks
  armv7m_systick: delay timer_new to avoid memleaks
  docs/arm-cpu-features: Make kvm-no-adjvtime comment clearer
  bcm2835_dma: Re-initialize xlen in TD mode
  bcm2835_dma: Fix the ylen loop in TD mode
  target/arm: Raise only one interrupt in arm_cpu_exec_interrupt
  target/arm: Use bool for unmasked in arm_excp_unmasked
  target/arm: Pass more cpu state to arm_excp_unmasked
  target/arm: Move arm_excp_unmasked to cpu.c
  target/arm: Enable ARMv8.1-VHE in -cpu max
  target/arm: Update arm_cpu_do_interrupt_aarch64 for VHE
  target/arm: Update get_a64_user_mem_index for VHE
  target/arm: check TGE and E2H flags for EL0 pauth traps
  target/arm: Update {fp,sve}_exception_el for VHE
  target/arm: Update arm_phys_excp_target_el for TGE
  target/arm: Flush tlbs for E2&0 translation regime
  target/arm: Flush tlb for ASID changes in EL2&0 translation regime
  target/arm: Add VHE timer register redirection and aliasing
  target/arm: Add VHE system register redirection and aliasing
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/berrange/tags/misc-fixes-pull-request' into...
Peter Maydell [Fri, 7 Feb 2020 15:01:23 +0000 (15:01 +0000)]
Merge remote-tracking branch 'remotes/berrange/tags/misc-fixes-pull-request' into staging

Misc fixes

* Use correct constants for 'bool' type
* Fix compatibility with noVNC in websocket impl
* Remove inaccurate docs aout default NIC model

# gpg: Signature made Fri 07 Feb 2020 12:23:53 GMT
# gpg:                using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/misc-fixes-pull-request:
  docs: stop documenting the e1000 NIC model as the default
  authz: fix usage of bool in listfile.c
  io/channel-websock: treat 'binary' and no sub-protocol as the same

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years ago.readthedocs.yml: specify some minimum python requirements
Alex Bennée [Thu, 6 Feb 2020 16:31:20 +0000 (16:31 +0000)]
.readthedocs.yml: specify some minimum python requirements

QEMU is all about the Python 3 now so lets also hint that to
ReadTheDocs in its config file.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200206163120.31899-1-alex.bennee@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agodrop "from __future__ import print_function"
Paolo Bonzini [Tue, 4 Feb 2020 16:06:04 +0000 (17:06 +0100)]
drop "from __future__ import print_function"

This is only needed for Python 2, which we do not support anymore.

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200204160604.19883-1-pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agomake all Python scripts executable
Paolo Bonzini [Tue, 4 Feb 2020 16:02:37 +0000 (17:02 +0100)]
make all Python scripts executable

Scripts that have a Python shebang are meant to be executed directly from the
shell; give them 755 permissions.

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200204160237.16889-1-pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoscripts/signrom: remove Python 2 support, add shebang
Paolo Bonzini [Tue, 4 Feb 2020 16:00:28 +0000 (17:00 +0100)]
scripts/signrom: remove Python 2 support, add shebang

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200204160028.16211-1-pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/qemu-iotests/check: Only check for Python 3 interpreter
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:32 +0000 (17:32 +0100)]
tests/qemu-iotests/check: Only check for Python 3 interpreter

All the iotests Python scripts have been converted to search for
the Python 3 interpreter. Update the ./check script accordingly.

Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-13-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoscripts: Explicit usage of Python 3 (scripts without __main__)
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:31 +0000 (17:32 +0100)]
scripts: Explicit usage of Python 3 (scripts without __main__)

Use the program search path to find the Python 3 interpreter.

Patch created mechanically by running:

  $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
      $(git grep -lF '#!/usr/bin/env python' \
      | xargs grep -L 'if __name__.*__main__')

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-12-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/qemu-iotests: Explicit usage of Python3 (scripts without __main__)
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:30 +0000 (17:32 +0100)]
tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__)

Use the program search path to find the Python 3 interpreter.

Patch created mechanically by running:

  $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
      $(git grep -lF '#!/usr/bin/env python' \
      | xargs grep -L 'if __name__.*__main__')

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-11-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/vm: Remove shebang header
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:29 +0000 (17:32 +0100)]
tests/vm: Remove shebang header

Patch created mechanically by running:

  $ chmod 644 $(git grep -lF '#!/usr/bin/env python' \
      | xargs grep -L 'if __name__.*__main__')
  $ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \
      $(git grep -lF '#!/usr/bin/env python' \
      | xargs grep -L 'if __name__.*__main__')

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-10-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance: Remove shebang header
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:27 +0000 (17:32 +0100)]
tests/acceptance: Remove shebang header

Patch created mechanically by running:

  $ chmod 644 $(git grep -lF '#!/usr/bin/env python' \
      | xargs grep -L 'if __name__.*__main__')
  $ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \
      $(git grep -lF '#!/usr/bin/env python' \
      | xargs grep -L 'if __name__.*__main__')

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-8-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoscripts/tracetool: Remove shebang header
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:28 +0000 (17:32 +0100)]
scripts/tracetool: Remove shebang header

Patch created mechanically by running:

  $ chmod 644 $(git grep -lF '#!/usr/bin/env python' \
      | xargs grep -L 'if __name__.*__main__')
  $ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \
      $(git grep -lF '#!/usr/bin/env python' \
      | xargs grep -L 'if __name__.*__main__')

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-9-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoscripts/minikconf: Explicit usage of Python 3
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:26 +0000 (17:32 +0100)]
scripts/minikconf: Explicit usage of Python 3

Use the program search path to find the Python 3 interpreter.

Patch created manually after running:

  $ git grep -l 'if __name__.*__main__' \
      | xargs grep -LF '#!/usr/bin/env python3'

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-7-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoscripts: Explicit usage of Python 3 (scripts with __main__)
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:25 +0000 (17:32 +0100)]
scripts: Explicit usage of Python 3 (scripts with __main__)

Use the program search path to find the Python 3 interpreter.

Patch created mechanically by running:

  $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
       $(git grep -l 'if __name__.*__main__')

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-6-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests: Explicit usage of Python 3
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:24 +0000 (17:32 +0100)]
tests: Explicit usage of Python 3

Use the program search path to find the Python 3 interpreter.

Patch created mechanically by running:

  $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
       $(git grep -l 'if __name__.*__main__')

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-5-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__)
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:23 +0000 (17:32 +0100)]
tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__)

Use the program search path to find the Python 3 interpreter.

Patch created mechanically by running:

  $ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
       $(git grep -l 'if __name__.*__main__')

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-4-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/qemu-iotests/check: Allow use of python3 interpreter
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:22 +0000 (17:32 +0100)]
tests/qemu-iotests/check: Allow use of python3 interpreter

As we want to enforce a unique and explicit Python 3 interpreter,
we need let this script handle 'python3' too.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-3-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoscripts/checkpatch.pl: Only allow Python 3 interpreter
Philippe Mathieu-Daudé [Thu, 30 Jan 2020 16:32:21 +0000 (17:32 +0100)]
scripts/checkpatch.pl: Only allow Python 3 interpreter

Since commit ddf9069963 QEMU requires Python >= 3.5.

PEP 0394 [*] states that 'python3' should be available and
that 'python' is optional.

To avoid problem with unsupported versions, enforce the
shebang interpreter to Python 3.

[*] https://www.python.org/dev/peps/pep-0394/

Reported-by: John Snow <jsnow@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200130163232.10446-2-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/migration: Default to -nodefaults
Philippe Mathieu-Daudé [Wed, 29 Jan 2020 21:23:43 +0000 (22:23 +0100)]
tests/acceptance/migration: Default to -nodefaults

We don't need the default options to run this test.

This fixes errors when running a binary built with
--without-default-devices such:

  ERROR: qemu-system-arm: Unsupported NIC model: virtio-net-pci

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200129212345.20547-28-philmd@redhat.com>
[PMD: Rebased]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/migration: Add the 'migration' tag
Philippe Mathieu-Daudé [Tue, 4 Feb 2020 16:33:04 +0000 (17:33 +0100)]
tests/acceptance/migration: Add the 'migration' tag

By using an Avocado tag, we can run all tests described by that
tag as once:

  $ avocado --show=app run -t migration tests/acceptance/
  JOB ID     : 165477737509503fcfa6d7108057a0a18f2a6559
  JOB LOG    : avocado/job-results/job-2020-02-04T17.29-1654777/job.log
   (1/3) tests/acceptance/migration.py:Migration.test_migration_with_tcp_localhost: PASS (0.38 s)
   (2/3) tests/acceptance/migration.py:Migration.test_migration_with_unix: PASS (0.33 s)
   (3/3) tests/acceptance/migration.py:Migration.test_migration_with_exec: PASS (0.07 s)
  RESULTS    : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0

Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200204163304.14616-1-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/migration: Test EXEC transport when migrating
Oksana Vohchana [Mon, 3 Feb 2020 11:16:31 +0000 (13:16 +0200)]
tests/acceptance/migration: Test EXEC transport when migrating

Along with VM migration via TCP, we can use migration through
the EXEC transport protocol

Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200203111631.18796-3-ovoshcha@redhat.com>
[PMD: Split patch in 2, reworded subject and description]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/migration: Test UNIX transport when migrating
Oksana Vohchana [Mon, 3 Feb 2020 11:16:31 +0000 (13:16 +0200)]
tests/acceptance/migration: Test UNIX transport when migrating

Along with VM migration via TCP, we can use migration through
the UNIX transport protocol

Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200203111631.18796-3-ovoshcha@redhat.com>
[PMD: Split patch in 2, reworded subject and description]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/migration: Factor out do_migrate()
Oksana Vohchana [Mon, 3 Feb 2020 11:16:30 +0000 (13:16 +0200)]
tests/acceptance/migration: Factor out do_migrate()

We are going to reuse this code when testing different transport
methods, so factor it out first.

Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200203111631.18796-2-ovoshcha@redhat.com>
[PMD: Split patch in 2, reworded subject and description]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/migration: Factor out assert_migration()
Oksana Vohchana [Mon, 3 Feb 2020 11:16:30 +0000 (13:16 +0200)]
tests/acceptance/migration: Factor out assert_migration()

We are going to reuse this code when testing different transport
methods, so factor it out first

Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200203111631.18796-2-ovoshcha@redhat.com>
[PMD: Split patch in 2, reworded subject and description]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/version: Default to -nodefaults
Philippe Mathieu-Daudé [Wed, 29 Jan 2020 21:23:44 +0000 (22:23 +0100)]
tests/acceptance/version: Default to -nodefaults

We don't need the default options to run this test.

This fixes errors when running a binary built with
--without-default-devices such:

  ERROR: qemu-system-arm: Unsupported NIC model: virtio-net-pci

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200129212345.20547-29-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/boot_linux_console: Do not use VGA on Clipper machine
Philippe Mathieu-Daudé [Wed, 29 Jan 2020 21:23:42 +0000 (22:23 +0100)]
tests/acceptance/boot_linux_console: Do not use VGA on Clipper machine

As we only read the serial console, we don't need to force a
VGA display. This fixes when running a binary built with
--without-default-devices:

  ERROR: qemu-system-alpha: standard VGA not available

We also need the '-nodefaults' argument to avoid:

  ERROR: qemu-system-alpha: Unsupported NIC model: e1000

Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200129212345.20547-27-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/virtio_check_params: Disable the test
Philippe Mathieu-Daudé [Thu, 6 Feb 2020 17:17:15 +0000 (18:17 +0100)]
tests/acceptance/virtio_check_params: Disable the test

This test fails on various CI:

- Using QEMU 4.0:
  tests/acceptance/x86_cpu_model_versions.py:X86CPUModelAliases.test_none_alias:  ERROR: 'alias-of' (0.45 s)

- On OSX
  Unexpected error in object_property_find() at qom/object.c:1201:
  qemu-system-x86_64: -device virtio-blk-pci,id=scsi0,drive=drive0: can't apply global virtio-blk-device.scsi=true: Property '.scsi' not found

- When removing unavailable machine:
  VirtioMaxSegSettingsCheck.test_machine_types: ERROR: list.remove(x): x not in list (0.12 s)

- Using Xen:
  xencall: error: Could not obtain handle on privileged command interface: No such file or directory
  xen be core: xen be core: can't open xen interface

- On PPC:
  TestFail: machine type pseries-2.8: No Transactional Memory support in TCG, try appending -machine cap-htm=off

- On S390X configured with --without-default-devices:
  ERROR: qemu-system-s390x: -device virtio-scsi-pci,id=scsi0: 'virtio-scsi-pci' is not a valid device model name

Disable it for now.

Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200206171715.25041-1-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/virtio_check_params: Default to -nodefaults
Philippe Mathieu-Daudé [Wed, 29 Jan 2020 21:23:40 +0000 (22:23 +0100)]
tests/acceptance/virtio_check_params: Default to -nodefaults

We don't need the default options to run this test.

This fixes errors when running a binary built with
--without-default-devices such:

  ERROR: qemu-system-s390x: Unknown device 'virtio-net-ccw' for bus 'virtual-css-bus'

Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200129212345.20547-25-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/virtio_check_params: List machine being tested
Philippe Mathieu-Daudé [Wed, 29 Jan 2020 21:23:34 +0000 (22:23 +0100)]
tests/acceptance/virtio_check_params: List machine being tested

Add logging for easier debugging of failures:

  $ avocado --show=machine run tests/acceptance/virtio_check_params.py
   (1/1) tests/acceptance/virtio_check_params.py:VirtioMaxSegSettingsCheck.test_machine_types:
  machine: {'name': 'pc-i440fx-2.12', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
  machine: {'name': 'pc-i440fx-2.0', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
  machine: {'name': 'pc-q35-4.2', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
  machine: {'name': 'pc-i440fx-2.5', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
  machine: {'name': 'pc-i440fx-4.2', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
  ...

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200129212345.20547-19-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance/virtio_check_params: Improve exception logging
Philippe Mathieu-Daudé [Wed, 29 Jan 2020 21:23:33 +0000 (22:23 +0100)]
tests/acceptance/virtio_check_params: Improve exception logging

Message-Id: <20200129212345.20547-18-philmd@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests: rename virtio_seg_max_adjust to virtio_check_params
Denis Plotnikov [Wed, 29 Jan 2020 21:23:31 +0000 (22:23 +0100)]
tests: rename virtio_seg_max_adjust to virtio_check_params

Since, virtio_seg_max_adjust checks not only seg_max, but also
virtqueue_size parameter, let's make the test more general and
add new parameters to be checked there in the future.

Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
Message-Id: <20200129140702.5411-5-dplotnikov@virtuozzo.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/acceptance: Add boot tests for some of the QEMU advent calendar images
Thomas Huth [Fri, 24 Jan 2020 17:03:25 +0000 (18:03 +0100)]
tests/acceptance: Add boot tests for some of the QEMU advent calendar images

The 2018 edition of the QEMU advent calendar 2018 featured Linux images
for various non-x86 machines. We can use them for a boot tests in our
acceptance test suite.

Let's also make sure that we build the corresponding machines in Travis.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200124170325.30072-1-thuth@redhat.com>
[PMD: Rebased, --python=python3 parameter dropped in commit 5311cb12e]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/boot_linux_console: Tag Emcraft Smartfusion2 as running 'u-boot'
Philippe Mathieu-Daudé [Mon, 20 Jan 2020 23:51:59 +0000 (00:51 +0100)]
tests/boot_linux_console: Tag Emcraft Smartfusion2 as running 'u-boot'

Avocado tags are handy to automatically select tests matching
the tags. Since this test also runs U-Boot, tag it.

We can run all the tests using U-Boot as once with:

  $ avocado --show=app run -t u-boot tests/acceptance/
  JOB LOG    : avocado/job-results/job-2020-01-21T00.16-ee9344e/job.log
   (1/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_emcraft_sf2: PASS (16.59 s)
   (2/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uboot: PASS (0.47 s)
   (3/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_aarch64_raspi3_uboot: PASS (2.43 s)
  RESULTS    : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
  JOB TIME   : 19.78 s

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200120235159.18510-8-f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/boot_linux_console: fix extract_from_deb() comment
Liam Merwick [Mon, 27 Jan 2020 16:36:31 +0000 (16:36 +0000)]
tests/boot_linux_console: fix extract_from_deb() comment

The second param in extract_from_deb() is 'path' not 'file'

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1580142994-1836-4-git-send-email-liam.merwick@oracle.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/boot_linux_console: use os.path for filesystem paths
Liam Merwick [Wed, 5 Feb 2020 14:56:05 +0000 (14:56 +0000)]
tests/boot_linux_console: use os.path for filesystem paths

Change extract_from_deb() to use os.path routines to manipulate the
filesystem path returned when extracting a file.

Suggested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1580914565-19675-7-git-send-email-liam.merwick@oracle.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/boot_linux_console: add extract_from_rpm method
Liam Merwick [Wed, 5 Feb 2020 14:56:03 +0000 (14:56 +0000)]
tests/boot_linux_console: add extract_from_rpm method

Add a method to extract a specified file from an RPM to the test's
working directory and return the path to the extracted file.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1580914565-19675-5-git-send-email-liam.merwick@oracle.com>
[PMD: Rebased]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotravis.yml: install rpm2cpio for acceptance tests
Liam Merwick [Wed, 5 Feb 2020 14:56:02 +0000 (14:56 +0000)]
travis.yml: install rpm2cpio for acceptance tests

The extract_from_rpm() method added for the PVH acceptance tests needs
rpm2cpio to extract a vmlinux binary from an RPM.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1580914565-19675-4-git-send-email-liam.merwick@oracle.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoAcceptance tests: Add interrupt_interactive_console_until_pattern()
Philippe Mathieu-Daudé [Mon, 20 Jan 2020 23:51:55 +0000 (00:51 +0100)]
Acceptance tests: Add interrupt_interactive_console_until_pattern()

We need a function to interrupt interactive consoles.

Example: Interrupt U-Boot to set different environment values.

Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Tested-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200120235159.18510-4-f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoAcceptance tests: Extract _console_interaction()
Philippe Mathieu-Daudé [Mon, 20 Jan 2020 23:51:54 +0000 (00:51 +0100)]
Acceptance tests: Extract _console_interaction()

Since we are going to re-use the code shared between
wait_for_console_pattern() and exec_command_and_wait_for_pattern(),
extract the common part into a local function.

Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Tested-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200120235159.18510-3-f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agopython/qemu/machine: Allow to use other serial consoles than default
Philippe Mathieu-Daudé [Mon, 20 Jan 2020 23:51:56 +0000 (00:51 +0100)]
python/qemu/machine: Allow to use other serial consoles than default

Currently the QEMU Python module limits the QEMUMachine class to
use the first serial console.

Some machines/guest might use another console than the first one as
the 'boot console'. For example the Raspberry Pi uses the second
(AUX) console.

To be able to use the Nth console as default, we simply need to
connect all the N - 1 consoles to the null chardev.

Add an index argument, so we can use a specific serial console as
default.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Tested-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200120235159.18510-5-f4bug@amsat.org>
[PMD: zero-initialize _console_index in __init__()]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agopython: Treat None-return of greeting cmd
Lukáš Doktor [Mon, 20 Jan 2020 07:12:02 +0000 (08:12 +0100)]
python: Treat None-return of greeting cmd

In case qemu process dies the "monitor.cmd" returns None which gets
passed to the "__negotiate_capabilities" and leads to unhandled
exception. Let's only check the resp in case it has a value.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200120071202.30646-1-ldoktor@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoqemu-deprecated: Remove text about Python 2
Thomas Huth [Thu, 9 Jan 2020 09:51:16 +0000 (10:51 +0100)]
qemu-deprecated: Remove text about Python 2

Python 2 support has been removed, so we should now also remove
the announcement text for the deprecation.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20200109095116.18201-1-thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agopython/qemu: accel: Fix kvm_available() on ppc64le
Wainer dos Santos Moschetta [Wed, 5 Feb 2020 20:32:46 +0000 (15:32 -0500)]
python/qemu: accel: Fix kvm_available() on ppc64le

On ppc64le, the accel.kvm_available() check may wrongly
return False because the host arch (as returned by os.uname[4])
and the target arch (ppc64) mismatch. In order to solve this
it is added an ppc64le -> ppc64 mapping which is used as an
fallback verification.

Fixes: 53a049d7d78e5ccf6d4c0d7
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200205203250.30526-5-wainersm@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agopython/qemu: qmp: Remove unnused attributes
Wainer dos Santos Moschetta [Fri, 27 Dec 2019 13:41:01 +0000 (10:41 -0300)]
python/qemu: qmp: Remove unnused attributes

The `error` and `timeout` attributes in QEMUMonitorProtocol are
not used, so this delete them.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191227134101.244496-6-wainersm@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agopython/qemu: qmp: Make QEMUMonitorProtocol a context manager
Wainer dos Santos Moschetta [Tue, 4 Feb 2020 14:11:10 +0000 (11:11 -0300)]
python/qemu: qmp: Make QEMUMonitorProtocol a context manager

This implement the __enter__ and __exit__ functions on
QEMUMonitorProtocol class so that it can be used on 'with'
statement and the resources will be free up on block end:

with QEMUMonitorProtocol(socket_path) as qmp:
    qmp.connect()
    qmp.command('query-status')

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20200204141111.3207-5-wainersm@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agopython/qemu: qmp: Make accept()'s timeout configurable
Wainer dos Santos Moschetta [Tue, 4 Feb 2020 14:11:09 +0000 (11:11 -0300)]
python/qemu: qmp: Make accept()'s timeout configurable

Currently the timeout of QEMUMonitorProtocol.accept() is
hard-coded to 15.0 seconds. This added the parameter `timeout`
so the value can be configured by the user.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20200204141111.3207-4-wainersm@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agopython/qemu: Delint the qmp module
Wainer dos Santos Moschetta [Fri, 27 Dec 2019 13:40:58 +0000 (10:40 -0300)]
python/qemu: Delint the qmp module

This clean up the pylint-3 report on qmp:

************* Module qemu.qmp
python/qemu/qmp.py:1:0: C0111: Missing module docstring (missing-docstring)
python/qemu/qmp.py:17:0: C0111: Missing class docstring (missing-docstring)
python/qemu/qmp.py:21:0: C0111: Missing class docstring (missing-docstring)
python/qemu/qmp.py:25:0: C0111: Missing class docstring (missing-docstring)
python/qemu/qmp.py:29:0: C0111: Missing class docstring (missing-docstring)
python/qemu/qmp.py:33:0: C0111: Missing class docstring (missing-docstring)
python/qemu/qmp.py:33:0: R0205: Class 'QEMUMonitorProtocol' inherits from object, can be safely removed from bases in python3 (useless-object-inheritance)
python/qemu/qmp.py:80:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
python/qemu/qmp.py:131:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
python/qemu/qmp.py:159:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
python/qemu/qmp.py:245:4: C0111: Missing method docstring (missing-docstring)
python/qemu/qmp.py:249:4: C0111: Missing method docstring (missing-docstring)
python/qemu/qmp.py:252:4: C0111: Missing method docstring (missing-docstring)
python/qemu/qmp.py:255:4: C0111: Missing method docstring (missing-docstring)

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191227134101.244496-3-wainersm@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agopython/qemu: qmp: Replace socket.error with OSError
Wainer dos Santos Moschetta [Fri, 27 Dec 2019 13:40:57 +0000 (10:40 -0300)]
python/qemu: qmp: Replace socket.error with OSError

The socket.error is deprecated from Python 3.3, instead it is
made a link to OSError. This change replaces the occurences
of socket.error with OSError.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20191227134101.244496-2-wainersm@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agostellaris: delay timer_new to avoid memleaks
Pan Nengyuan [Fri, 7 Feb 2020 14:04:28 +0000 (14:04 +0000)]
stellaris: delay timer_new to avoid memleaks

There is a memory leak when we call 'device_list_properties' with typename = stellaris-gptm. It's easy to reproduce as follow:

  virsh qemu-monitor-command vm1 --pretty '{"execute": "device-list-properties", "arguments": {"typename": "stellaris-gptm"}}'

This patch delay timer_new in realize to fix it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200205070659.22488-4-pannengyuan@huawei.com
Cc: qemu-arm@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agostm32f2xx_timer: delay timer_new to avoid memleaks
Pan Nengyuan [Fri, 7 Feb 2020 14:04:28 +0000 (14:04 +0000)]
stm32f2xx_timer: delay timer_new to avoid memleaks

There is a memory leak when we call 'device_list_properties' with typename = stm32f2xx_timer. It's easy to reproduce as follow:

    virsh qemu-monitor-command vm1 --pretty '{"execute": "device-list-properties", "arguments": {"typename": "stm32f2xx_timer"}}'

This patch delay timer_new to fix this memleaks.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200205070659.22488-3-pannengyuan@huawei.com
Cc: Alistair Francis <alistair@alistair23.me>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoarmv7m_systick: delay timer_new to avoid memleaks
Pan Nengyuan [Fri, 7 Feb 2020 14:04:28 +0000 (14:04 +0000)]
armv7m_systick: delay timer_new to avoid memleaks

There is a memory leak when we call 'device_list_properties' with typename = armv7m_systick. It's easy to reproduce as follow:

  virsh qemu-monitor-command vm1 --pretty '{"execute": "device-list-properties", "arguments": {"typename": "armv7m_systick"}}'

This patch delay timer_new to fix this memleaks.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Message-id: 20200205070659.22488-2-pannengyuan@huawei.com
Cc: qemu-arm@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agodocs/arm-cpu-features: Make kvm-no-adjvtime comment clearer
Philippe Mathieu-Daudé [Fri, 7 Feb 2020 14:04:28 +0000 (14:04 +0000)]
docs/arm-cpu-features: Make kvm-no-adjvtime comment clearer

The bold text sounds like 'knock knock'. Only bolding the
second 'not' makes it easier to read.

Fixes: dea101a1ae
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Message-id: 20200206225148.23923-1-philmd@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agobcm2835_dma: Re-initialize xlen in TD mode
Rene Stange [Fri, 7 Feb 2020 14:04:28 +0000 (14:04 +0000)]
bcm2835_dma: Re-initialize xlen in TD mode

TD (two dimensions) DMA mode did not work, because the xlen variable
has not been re-initialized before each additional ylen run through
in bcm2835_dma_update(). Fix it.

Signed-off-by: Rene Stange <rsta2@o2online.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agobcm2835_dma: Fix the ylen loop in TD mode
Rene Stange [Fri, 7 Feb 2020 14:04:27 +0000 (14:04 +0000)]
bcm2835_dma: Fix the ylen loop in TD mode

In TD (two dimensions) DMA mode ylen has to be increased by one after
reading it from the TXFR_LEN register, because a value of zero has to
result in one run through of the ylen loop. This has been tested on a
real Raspberry Pi 3 Model B+. In the previous implementation the ylen
loop was not passed at all for a value of zero.

Signed-off-by: Rene Stange <rsta2@o2online.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Raise only one interrupt in arm_cpu_exec_interrupt
Richard Henderson [Fri, 7 Feb 2020 14:04:27 +0000 (14:04 +0000)]
target/arm: Raise only one interrupt in arm_cpu_exec_interrupt

The fall through organization of this function meant that we
would raise an interrupt, then might overwrite that with another.
Since interrupt prioritization is IMPLEMENTATION DEFINED, we
can recognize these in any order we choose.

Unify the code to raise the interrupt in a block at the end.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-42-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Use bool for unmasked in arm_excp_unmasked
Richard Henderson [Fri, 7 Feb 2020 14:04:27 +0000 (14:04 +0000)]
target/arm: Use bool for unmasked in arm_excp_unmasked

The value computed is fully boolean; using int8_t is odd.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-41-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Pass more cpu state to arm_excp_unmasked
Richard Henderson [Fri, 7 Feb 2020 14:04:27 +0000 (14:04 +0000)]
target/arm: Pass more cpu state to arm_excp_unmasked

Avoid redundant computation of cpu state by passing it in
from the caller, which has already computed it for itself.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-40-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Move arm_excp_unmasked to cpu.c
Richard Henderson [Fri, 7 Feb 2020 14:04:27 +0000 (14:04 +0000)]
target/arm: Move arm_excp_unmasked to cpu.c

This inline function has one user in cpu.c, and need not be exposed
otherwise.  Code movement only, with fixups for checkpatch.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-39-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Enable ARMv8.1-VHE in -cpu max
Richard Henderson [Fri, 7 Feb 2020 14:04:27 +0000 (14:04 +0000)]
target/arm: Enable ARMv8.1-VHE in -cpu max

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-38-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update arm_cpu_do_interrupt_aarch64 for VHE
Richard Henderson [Fri, 7 Feb 2020 14:04:27 +0000 (14:04 +0000)]
target/arm: Update arm_cpu_do_interrupt_aarch64 for VHE

When VHE is enabled, the exception level below EL2 is not EL1,
but EL0, and so to identify the entry vector offset for exceptions
targeting EL2 we need to look at the width of EL0, not of EL1.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-37-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update get_a64_user_mem_index for VHE
Richard Henderson [Fri, 7 Feb 2020 14:04:26 +0000 (14:04 +0000)]
target/arm: Update get_a64_user_mem_index for VHE

The EL2&0 translation regime is affected by Load Register (unpriv).

The code structure used here will facilitate later changes in this
area for implementing UAO and NV.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-36-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: check TGE and E2H flags for EL0 pauth traps
Alex Bennée [Fri, 7 Feb 2020 14:04:26 +0000 (14:04 +0000)]
target/arm: check TGE and E2H flags for EL0 pauth traps

According to ARM ARM we should only trap from the EL1&0 regime.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-35-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update {fp,sve}_exception_el for VHE
Richard Henderson [Fri, 7 Feb 2020 14:04:26 +0000 (14:04 +0000)]
target/arm: Update {fp,sve}_exception_el for VHE

When TGE+E2H are both set, CPACR_EL1 is ignored.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-34-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update arm_phys_excp_target_el for TGE
Richard Henderson [Fri, 7 Feb 2020 14:04:26 +0000 (14:04 +0000)]
target/arm: Update arm_phys_excp_target_el for TGE

The TGE bit routes all asynchronous exceptions to EL2.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-33-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Flush tlbs for E2&0 translation regime
Richard Henderson [Fri, 7 Feb 2020 14:04:26 +0000 (14:04 +0000)]
target/arm: Flush tlbs for E2&0 translation regime

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-32-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Flush tlb for ASID changes in EL2&0 translation regime
Richard Henderson [Fri, 7 Feb 2020 14:04:26 +0000 (14:04 +0000)]
target/arm: Flush tlb for ASID changes in EL2&0 translation regime

Since we only support a single ASID, flush the tlb when it changes.

Note that TCR_EL2, like TCR_EL1, has the A1 bit that chooses between
the two TTBR* registers for the location of the ASID.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-31-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Add VHE timer register redirection and aliasing
Richard Henderson [Fri, 7 Feb 2020 14:04:25 +0000 (14:04 +0000)]
target/arm: Add VHE timer register redirection and aliasing

Apart from the wholesale redirection that HCR_EL2.E2H performs
for EL2, there's a separate redirection specific to the timers
that happens for EL0 when running in the EL2&0 regime.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-30-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Add VHE system register redirection and aliasing
Richard Henderson [Fri, 7 Feb 2020 14:04:25 +0000 (14:04 +0000)]
target/arm: Add VHE system register redirection and aliasing

Several of the EL1/0 registers are redirected to the EL2 version when in
EL2 and HCR_EL2.E2H is set.  Many of these registers have side effects.
Link together the two ARMCPRegInfo structures after they have been
properly instantiated.  Install common dispatch routines to all of the
relevant registers.

The same set of registers that are redirected also have additional
EL12/EL02 aliases created to access the original register that was
redirected.

Omit the generic timer registers from redirection here, because we'll
need multiple kinds of redirection from both EL0 and EL2.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-29-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update define_one_arm_cp_reg_with_opaque for VHE
Richard Henderson [Fri, 7 Feb 2020 14:04:25 +0000 (14:04 +0000)]
target/arm: Update define_one_arm_cp_reg_with_opaque for VHE

For ARMv8.1, op1 == 5 is reserved for EL2 aliases of
EL1 and EL0 registers.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-28-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update timer access for VHE
Richard Henderson [Fri, 7 Feb 2020 14:04:25 +0000 (14:04 +0000)]
target/arm: Update timer access for VHE

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-27-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Add the hypervisor virtual counter
Richard Henderson [Fri, 7 Feb 2020 14:04:25 +0000 (14:04 +0000)]
target/arm: Add the hypervisor virtual counter

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-26-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update ctr_el0_access for EL2
Richard Henderson [Fri, 7 Feb 2020 14:04:25 +0000 (14:04 +0000)]
target/arm: Update ctr_el0_access for EL2

Update to include checks against HCR_EL2.TID2.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-25-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update aa64_zva_access for EL2
Richard Henderson [Fri, 7 Feb 2020 14:04:24 +0000 (14:04 +0000)]
target/arm: Update aa64_zva_access for EL2

The comment that we don't support EL2 is somewhat out of date.
Update to include checks against HCR_EL2.TDZ.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-24-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update arm_sctlr for VHE
Richard Henderson [Fri, 7 Feb 2020 14:04:24 +0000 (14:04 +0000)]
target/arm: Update arm_sctlr for VHE

Use the correct sctlr for EL2&0 regime.  Due to header ordering,
and where arm_mmu_idx_el is declared, we need to move the function
out of line.  Use the function in many more places in order to
select the correct control.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-23-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update arm_mmu_idx for VHE
Richard Henderson [Fri, 7 Feb 2020 14:04:24 +0000 (14:04 +0000)]
target/arm: Update arm_mmu_idx for VHE

Return the indexes for the EL2&0 regime when the appropriate bits
are set within HCR_EL2.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-22-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Add regime_has_2_ranges
Richard Henderson [Fri, 7 Feb 2020 14:04:24 +0000 (14:04 +0000)]
target/arm: Add regime_has_2_ranges

Create a predicate to indicate whether the regime has
both positive and negative addresses.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-21-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Reorganize ARMMMUIdx
Richard Henderson [Fri, 7 Feb 2020 14:04:24 +0000 (14:04 +0000)]
target/arm: Reorganize ARMMMUIdx

Prepare for, but do not yet implement, the EL2&0 regime.
This involves adding the new MMUIdx enumerators and adjusting
some of the MMUIdx related predicates to match.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-20-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Tidy ARMMMUIdx m-profile definitions
Richard Henderson [Fri, 7 Feb 2020 14:04:24 +0000 (14:04 +0000)]
target/arm: Tidy ARMMMUIdx m-profile definitions

Replace the magic numbers with the relevant ARM_MMU_IDX_M_* constants.
Keep the definitions short by referencing previous symbols.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-19-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Rearrange ARMMMUIdxBit
Richard Henderson [Fri, 7 Feb 2020 14:04:23 +0000 (14:04 +0000)]
target/arm: Rearrange ARMMMUIdxBit

Define via macro expansion, so that renumbering of the base ARMMMUIdx
symbols is automatically reflected in the bit definitions.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-18-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Expand TBFLAG_ANY.MMUIDX to 4 bits
Richard Henderson [Fri, 7 Feb 2020 14:04:23 +0000 (14:04 +0000)]
target/arm: Expand TBFLAG_ANY.MMUIDX to 4 bits

We are about to expand the number of mmuidx to 10, and so need 4 bits.
For the benefit of reading the number out of -d exec, align it to the
penultimate nibble.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-17-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Recover 4 bits from TBFLAGs
Richard Henderson [Fri, 7 Feb 2020 14:04:23 +0000 (14:04 +0000)]
target/arm: Recover 4 bits from TBFLAGs

We had completely run out of TBFLAG bits.
Split A- and M-profile bits into two overlapping buckets.
This results in 4 free bits.

We used to initialize all of the a32 and m32 fields in DisasContext
by assignment, in arm_tr_init_disas_context.  Now we only initialize
either the a32 or m32 by assignment, because the bits overlap in
tbflags.  So zero the entire structure in gen_intermediate_code.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-16-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Rename ARMMMUIdx_S1E2 to ARMMMUIdx_E2
Richard Henderson [Fri, 7 Feb 2020 14:04:23 +0000 (14:04 +0000)]
target/arm: Rename ARMMMUIdx_S1E2 to ARMMMUIdx_E2

This is part of a reorganization to the set of mmu_idx.
The non-secure EL2 regime only has a single stage translation;
there is no point in pointing out that the idx is for stage1.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-15-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Rename ARMMMUIdx*_S1E3 to ARMMMUIdx*_SE3
Richard Henderson [Fri, 7 Feb 2020 14:04:23 +0000 (14:04 +0000)]
target/arm: Rename ARMMMUIdx*_S1E3 to ARMMMUIdx*_SE3

This is part of a reorganization to the set of mmu_idx.
The EL3 regime only has a single stage translation, and
is always secure.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-14-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Rename ARMMMUIdx_S1SE[01] to ARMMMUIdx_SE10_[01]
Richard Henderson [Fri, 7 Feb 2020 14:04:23 +0000 (14:04 +0000)]
target/arm: Rename ARMMMUIdx_S1SE[01] to ARMMMUIdx_SE10_[01]

This is part of a reorganization to the set of mmu_idx.
This emphasizes that they apply to the Secure EL1&0 regime.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-13-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Rename ARMMMUIdx_S1NSE* to ARMMMUIdx_Stage1_E*
Richard Henderson [Fri, 7 Feb 2020 14:04:22 +0000 (14:04 +0000)]
target/arm: Rename ARMMMUIdx_S1NSE* to ARMMMUIdx_Stage1_E*

This is part of a reorganization to the set of mmu_idx.
The EL1&0 regime is the only one that uses 2-stage translation.
Spelling out Stage avoids confusion with Secure.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-12-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Rename ARMMMUIdx_S2NS to ARMMMUIdx_Stage2
Richard Henderson [Fri, 7 Feb 2020 14:04:22 +0000 (14:04 +0000)]
target/arm: Rename ARMMMUIdx_S2NS to ARMMMUIdx_Stage2

The EL1&0 regime is the only one that uses 2-stage translation.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Rename ARMMMUIdx*_S12NSE* to ARMMMUIdx*_E10_*
Richard Henderson [Fri, 7 Feb 2020 14:04:22 +0000 (14:04 +0000)]
target/arm: Rename ARMMMUIdx*_S12NSE* to ARMMMUIdx*_E10_*

This is part of a reorganization to the set of mmu_idx.
This emphasizes that they apply to the EL1&0 regime.

The ultimate goal is

 -- Non-secure regimes:
    ARMMMUIdx_E10_0,
    ARMMMUIdx_E20_0,
    ARMMMUIdx_E10_1,
    ARMMMUIdx_E2,
    ARMMMUIdx_E20_2,

 -- Secure regimes:
    ARMMMUIdx_SE10_0,
    ARMMMUIdx_SE10_1,
    ARMMMUIdx_SE3,

 -- Helper mmu_idx for non-secure EL1&0 stage1 and stage2
    ARMMMUIdx_Stage2,
    ARMMMUIdx_Stage1_E0,
    ARMMMUIdx_Stage1_E1,

The 'S' prefix is reserved for "Secure".  Unless otherwise specified,
each mmu_idx represents all stages of translation.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-10-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Simplify tlb_force_broadcast alternatives
Richard Henderson [Fri, 7 Feb 2020 14:04:22 +0000 (14:04 +0000)]
target/arm: Simplify tlb_force_broadcast alternatives

Rather than call to a separate function and re-compute any
parameters for the flush, simply use the correct flush
function directly.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-9-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Split out alle1_tlbmask
Richard Henderson [Fri, 7 Feb 2020 14:04:22 +0000 (14:04 +0000)]
target/arm: Split out alle1_tlbmask

No functional change, but unify code sequences.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-8-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Split out vae1_tlbmask
Richard Henderson [Fri, 7 Feb 2020 14:04:22 +0000 (14:04 +0000)]
target/arm: Split out vae1_tlbmask

No functional change, but unify code sequences.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-7-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Update CNTVCT_EL0 for VHE
Richard Henderson [Fri, 7 Feb 2020 14:04:21 +0000 (14:04 +0000)]
target/arm: Update CNTVCT_EL0 for VHE

The virtual offset may be 0 depending on EL, E2H and TGE.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-6-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Add TTBR1_EL2
Richard Henderson [Fri, 7 Feb 2020 14:04:21 +0000 (14:04 +0000)]
target/arm: Add TTBR1_EL2

At the same time, add writefn to TTBR0_EL2 and TCR_EL2.
A later patch will update any ASID therein.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Add CONTEXTIDR_EL2
Richard Henderson [Fri, 7 Feb 2020 14:04:21 +0000 (14:04 +0000)]
target/arm: Add CONTEXTIDR_EL2

Not all of the breakpoint types are supported, but those that
only examine contextidr are extended to support the new register.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Enable HCR_E2H for VHE
Richard Henderson [Fri, 7 Feb 2020 14:04:21 +0000 (14:04 +0000)]
target/arm: Enable HCR_E2H for VHE

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Define isar_feature_aa64_vh
Richard Henderson [Fri, 7 Feb 2020 14:04:21 +0000 (14:04 +0000)]
target/arm: Define isar_feature_aa64_vh

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm/monitor: query-cpu-model-expansion crashed qemu when using machine type...
Liang Yan [Fri, 7 Feb 2020 14:04:21 +0000 (14:04 +0000)]
target/arm/monitor: query-cpu-model-expansion crashed qemu when using machine type none

Commit e19afd566781 mentioned that target-arm only supports queryable
cpu models 'max', 'host', and the current type when KVM is in use.
The logic works well until using machine type none.

For machine type none, cpu_type will be null if cpu option is not
set by command line, strlen(cpu_type) will terminate process.
So We add a check above it.

This won't affect i386 and s390x since they do not use current_cpu.

Signed-off-by: Liang Yan <lyan@suse.com>
Message-id: 20200203134251.12986-1-lyan@suse.com
Reviewed-by: Andrew Jones <drjones@redhat.com>
Tested-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/kraxel/tags/audio-20200207-pull-request' into...
Peter Maydell [Fri, 7 Feb 2020 13:42:09 +0000 (13:42 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20200207-pull-request' into staging

audio: bugfixes, mostly audio backend rewrite fallout

# gpg: Signature made Fri 07 Feb 2020 07:45:44 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/audio-20200207-pull-request:
  audio: proper support for float samples in mixeng
  coreaudio: fix coreaudio playback
  audio/dsound: fix invalid parameters error
  audio: audio_generic_get_buffer_in should honor *size
  ossaudio: disable poll mode can't be reached
  ossaudio: prevent SIGSEGV in oss_enable_out
  audio: fix bug 1858488
  audio: prevent SIGSEGV in AUD_get_buffer_size_out
  paaudio: remove unused variables
  audio: fix audio_generic_read
  audio: fix audio_generic_write
  audio/oss: fix buffer pos calculation

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agodocs: stop documenting the e1000 NIC model as the default
Daniel P. Berrangé [Thu, 9 Jan 2020 12:24:05 +0000 (12:24 +0000)]
docs: stop documenting the e1000 NIC model as the default

The default NIC model for QEMU varies per machine type, and is liable to
change across machine type versions. Documenting e1000 NIC as the
default for PC/i386 is thus misleading to users at best. In particular
the PC q35 machine type switched to use e1000e, but only in machine
type versions after 2.11.

Rather than try to explain which NIC model is used for each machine
type version, remove mention of e1000 as the default, and steer users
towards always specifying their desired model.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoauthz: fix usage of bool in listfile.c
Jafar Abdi [Sat, 23 Mar 2019 14:26:34 +0000 (17:26 +0300)]
authz: fix usage of bool in listfile.c

Clean up wrong usage of FALSE and TRUE in places that use "bool" from stdbool.h.

FALSE and TRUE (with capital letters) are the constants defined by glib for
being used with the "gboolean" type of glib. But some parts of the code also use
TRUE and FALSE for variables that are declared as "bool" (the type from <stdbool.h>).

Signed-off-by: Jafar Abdi <cafer.abdi@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>