OSDN Git Service

qmiga/qemu.git
3 years agotcg: Move some TCG_CT_* bits to TCGArgConstraint bitfields
Richard Henderson [Fri, 5 Apr 2019 02:34:19 +0000 (19:34 -0700)]
tcg: Move some TCG_CT_* bits to TCGArgConstraint bitfields

These are easier to set and test when they have their own fields.
Reduce the size of alias_index and sort_index to 4 bits, which is
sufficient for TCG_MAX_OP_ARGS.  This leaves only the bits indicating
constants within the ct field.

Move all initialization to allocation time, rather than init
individual fields in process_op_defs.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Remove TCG_CT_REG
Richard Henderson [Thu, 3 Sep 2020 22:56:24 +0000 (15:56 -0700)]
tcg: Remove TCG_CT_REG

This wasn't actually used for anything, really.  All variable
operands must accept registers, and which are indicated by the
set in TCGArgConstraint.regs.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Move sorted_args into TCGArgConstraint.sort_index
Richard Henderson [Thu, 4 Apr 2019 02:37:38 +0000 (09:37 +0700)]
tcg: Move sorted_args into TCGArgConstraint.sort_index

This uses an existing hole in the TCGArgConstraint structure
and will be convenient for keeping the data in one place.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Drop union from TCGArgConstraint
Richard Henderson [Thu, 3 Sep 2020 22:19:03 +0000 (15:19 -0700)]
tcg: Drop union from TCGArgConstraint

The union is unused; let "regs" appear in the main structure
without the "u.regs" wrapping.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Adjust simd_desc size encoding
Richard Henderson [Sun, 30 Aug 2020 15:57:20 +0000 (08:57 -0700)]
tcg: Adjust simd_desc size encoding

With larger vector sizes, it turns out oprsz == maxsz, and we only
need to represent mismatch for oprsz <= 32.  We do, however, need
to represent larger oprsz and do so without reducing SIMD_DATA_BITS.

Reduce the size of the oprsz field and increase the maxsz field.
Steal the oprsz value of 24 to indicate equality with maxsz.

Tested-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-10-06' into...
Peter Maydell [Tue, 6 Oct 2020 20:13:34 +0000 (21:13 +0100)]
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-10-06' into staging

* Don't stop at the first unbootable device, continue scanning
* Fix corner cases in booting from ECKD
* s390x-ccw bios cleanup part 2​

# gpg: Signature made Tue 06 Oct 2020 19:17:46 BST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2020-10-06:
  tests/qtest/cdrom: Add more s390x-related boot tests
  pc-bios/s390: Update the s390-ccw bios binaries
  pc-bios: s390x: Go into disabled wait when encountering a PGM exception
  pc-bios: s390x: Use reset PSW if avaliable
  pc-bios: s390x: Save PSW rework
  pc-bios: s390x: Fix bootmap.c zipl component entry data handling
  pc-bios/s390-ccw: break loop if a null block number is reached
  pc-bios/s390-ccw: fix off-by-one error
  pc-bios/s390-ccw/main: Remove superfluous call to enable_subchannel()
  pc-bios/s390-ccw: Allow booting in case the first virtio-blk disk is bad
  pc-bios/s390-ccw: Scan through all devices if no boot device specified
  pc-bios/s390-ccw: Do not bail out early if not finding a SCSI disk
  pc-bios/s390-ccw: Move the inner logic of find_subch() to a separate function
  pc-bios/s390-ccw: Introduce ENODEV define and remove guards of others
  pc-bios/s390-ccw: Move ipl-related code from main() into a separate function
  pc-bios/s390-ccw/Makefile: Compile with -std=gnu99, -fwrapv and -fno-common

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agotests/qtest/cdrom: Add more s390x-related boot tests
Thomas Huth [Thu, 6 Aug 2020 10:16:13 +0000 (12:16 +0200)]
tests/qtest/cdrom: Add more s390x-related boot tests

Let's add two new tests:

1) Booting with "bootindex" is the architected default behavior on the
s390x target, so we should have at least one test that is using the
"bootindex" property.

2) The s390-ccw bios used to fail when other unbootable devices have
been specified before the bootable device (without "bootindex"). Now
that the s390-ccw bios is a little bit smarter here, we should test
this scenario, too, to avoid regressions.

Message-Id: <20200806105349.632-10-thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390: Update the s390-ccw bios binaries
Thomas Huth [Tue, 6 Oct 2020 10:43:03 +0000 (12:43 +0200)]
pc-bios/s390: Update the s390-ccw bios binaries

Make sure that the binaries match the current state of the sources.

Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios: s390x: Go into disabled wait when encountering a PGM exception
Janosch Frank [Tue, 6 Oct 2020 09:42:49 +0000 (05:42 -0400)]
pc-bios: s390x: Go into disabled wait when encountering a PGM exception

Let's setup a PGM PSW, so we won't load 0s when a program exception
happens. Instead we'll load a disabled wait PSW.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201006094249.50640-5-frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios: s390x: Use reset PSW if avaliable
Janosch Frank [Tue, 6 Oct 2020 09:42:48 +0000 (05:42 -0400)]
pc-bios: s390x: Use reset PSW if avaliable

If a blob provides a reset PSW then we should use it instead of
branching to the PSW address and using our own mask.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201006094249.50640-4-frankja@linux.ibm.com>
[thuth: Use Elvis operator to shorten long line]
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios: s390x: Save PSW rework
Janosch Frank [Tue, 6 Oct 2020 09:42:47 +0000 (05:42 -0400)]
pc-bios: s390x: Save PSW rework

We don't need to save the ipl_continue variable in lowcore and have it
limited to 32 bits because of the lowcore layout. Let's move it to a
new 64 bit variable and get rid of the reset info struct.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201006094249.50640-3-frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios: s390x: Fix bootmap.c zipl component entry data handling
Janosch Frank [Tue, 6 Oct 2020 09:42:46 +0000 (05:42 -0400)]
pc-bios: s390x: Fix bootmap.c zipl component entry data handling

The two main types of zipl component entries are execute and
load/data. The last member of the component entry struct therefore
denotes either a PSW or an address. Let's make this a bit more clear
by introducing a union and cleaning up the code that uses that struct
member.

The execute type component entries written by zipl contain short PSWs,
not addresses. Let's mask them and only pass the address part to
jump_to_IPL_code(uint64_t address) because it expects an address as
visible by the name of the argument.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201006094249.50640-2-frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw: break loop if a null block number is reached
Marc Hartmayer [Thu, 24 Sep 2020 08:59:25 +0000 (10:59 +0200)]
pc-bios/s390-ccw: break loop if a null block number is reached

Break the loop if `cur_block_nr` is a null block number because this
means that the end of chunk is reached. In this case we will try to
boot the default entry.

Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu")
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Message-Id: <20200924085926.21709-3-mhartmay@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw: fix off-by-one error
Marc Hartmayer [Thu, 24 Sep 2020 08:59:24 +0000 (10:59 +0200)]
pc-bios/s390-ccw: fix off-by-one error

This error takes effect when the magic value "zIPL" is located at the
end of a block. For example if s2_cur_blk = 0x7fe18000 and the magic
value "zIPL" is located at 0x7fe18ffc - 0x7fe18fff.

Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu")
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Message-Id: <20200924085926.21709-2-mhartmay@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
[thuth: Use "<= ... - 4" instead of "< ... - 3"]
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw/main: Remove superfluous call to enable_subchannel()
Thomas Huth [Thu, 6 Aug 2020 09:41:51 +0000 (11:41 +0200)]
pc-bios/s390-ccw/main: Remove superfluous call to enable_subchannel()

enable_subchannel() is already done during is_dev_possibly_bootable()
(which is called from find_boot_device() -> find_subch()), so there
is no need to do this again in the main() function.

Message-Id: <20200806105349.632-9-thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw: Allow booting in case the first virtio-blk disk is bad
Thomas Huth [Tue, 28 Jul 2020 16:14:50 +0000 (18:14 +0200)]
pc-bios/s390-ccw: Allow booting in case the first virtio-blk disk is bad

If you try to boot with two virtio-blk disks (without bootindex), and
only the second one is bootable, the s390-ccw bios currently stops at
the first disk and does not continue booting from the second one. This
is annoying - and all other major QEMU firmwares succeed to boot from
the second disk in this case, so we should do the same in the s390-ccw
bios, too.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200806105349.632-8-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw: Scan through all devices if no boot device specified
Thomas Huth [Tue, 28 Jul 2020 14:29:03 +0000 (16:29 +0200)]
pc-bios/s390-ccw: Scan through all devices if no boot device specified

If no boot device has been specified (via "bootindex=..."), the s390-ccw
bios scans through all devices to find a bootable device. But so far, it
stops at the very first block device (including virtio-scsi controllers
without attached devices) that it finds, no matter whether it is bootable
or not. That leads to some weird situatation where it is e.g. possible
to boot via:

 qemu-system-s390x -hda /path/to/disk.qcow2

but not if there is e.g. a virtio-scsi controller specified before:

 qemu-system-s390x -device virtio-scsi -hda /path/to/disk.qcow2

While using "bootindex=..." is clearly the preferred way of booting
on s390x, we still can make the life for the users at least a little
bit easier if we look at all available devices to find a bootable one.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1846975
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200806105349.632-7-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw: Do not bail out early if not finding a SCSI disk
Thomas Huth [Tue, 28 Jul 2020 12:30:14 +0000 (14:30 +0200)]
pc-bios/s390-ccw: Do not bail out early if not finding a SCSI disk

In case the user did not specify a boot device, we want to continue
looking for other devices if there are no valid SCSI disks on a virtio-
scsi controller. As a first step, do not panic in this case and let
the control flow carry the error to the upper functions instead.

Message-Id: <20200806105349.632-6-thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw: Move the inner logic of find_subch() to a separate function
Thomas Huth [Tue, 28 Jul 2020 13:50:31 +0000 (15:50 +0200)]
pc-bios/s390-ccw: Move the inner logic of find_subch() to a separate function

Move the code to a separate function to be able to re-use it from a
different spot later.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-Id: <20200806105349.632-5-thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw: Introduce ENODEV define and remove guards of others
Thomas Huth [Wed, 5 Aug 2020 15:41:08 +0000 (17:41 +0200)]
pc-bios/s390-ccw: Introduce ENODEV define and remove guards of others

Remove the "#ifndef E..." guards from the defines here - the header
guard S390_CCW_H at the top of the file should avoid double definition,
and if the error code is defined in a different file already, we're in
trouble anyway, then it's better to see the error at compile time instead
of hunting weird behavior during runtime later.
Also define ENODEV - we will use this in a later patch.

Message-Id: <20200806105349.632-4-thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw: Move ipl-related code from main() into a separate function
Thomas Huth [Tue, 28 Jul 2020 08:35:53 +0000 (10:35 +0200)]
pc-bios/s390-ccw: Move ipl-related code from main() into a separate function

Let's move this part of the code into a separate function to be able
to use it from multiple spots later.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-Id: <20200806105349.632-3-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agopc-bios/s390-ccw/Makefile: Compile with -std=gnu99, -fwrapv and -fno-common
Thomas Huth [Tue, 28 Jul 2020 11:24:11 +0000 (13:24 +0200)]
pc-bios/s390-ccw/Makefile: Compile with -std=gnu99, -fwrapv and -fno-common

The main QEMU code is compiled with -std=gnu99, -fwrapv and -fno-common.
We should use the same flags for the s390-ccw bios, too, to avoid that
we get different behavior with different compiler versions that changed
their default settings in the course of time (it happened at least with
-std=... and -fno-common in the past already).

While we're at it, also group the other flags here in a little bit nicer
fashion: Move the two "-m" flags out of the "-f" area and specify them on
a separate line.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Message-Id: <20200806105349.632-2-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agoMerge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
Peter Maydell [Tue, 6 Oct 2020 14:04:10 +0000 (15:04 +0100)]
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging

* Reverse debugging (Pavel)
* CFLAGS cleanup (Paolo)
* ASLR fix (Mark)
* cpus.c refactoring (Claudio)

# gpg: Signature made Tue 06 Oct 2020 07:35:09 BST
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini-gitlab/tags/for-upstream: (37 commits)
  tests/acceptance: add reverse debugging test
  replay: create temporary snapshot at debugger connection
  replay: describe reverse debugging in docs/replay.txt
  gdbstub: add reverse continue support in replay mode
  gdbstub: add reverse step support in replay mode
  replay: flush rr queue before loading the vmstate
  replay: implement replay-seek command
  replay: introduce breakpoint at the specified step
  replay: introduce info hmp/qmp command
  qapi: introduce replay.json for record/replay-related stuff
  migration: introduce icount field for snapshots
  qcow2: introduce icount field for snapshots
  replay: provide an accessor for rr filename
  replay: don't record interrupt poll
  configure: don't enable ASLR for --enable-debug Windows builds
  configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson
  configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS
  dtc: Convert Makefile bits to meson bits
  slirp: Convert Makefile bits to meson bits
  accel/tcg: use current_machine as it is always set for softmmu
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into...
Peter Maydell [Tue, 6 Oct 2020 11:15:59 +0000 (12:15 +0100)]
Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into staging

Pull request

v2:
 * Removed clang-format call from scripts/block-coroutine-wrapper.py. This
   avoids the issue with clang version incompatibility. It could be added back
   in the future but the code is readable without reformatting and it also
   makes the build less dependent on the environment.

# gpg: Signature made Mon 05 Oct 2020 16:42:28 BST
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha-gitlab/tags/block-pull-request:
  util/vfio-helpers: Rework the IOVA allocator to avoid IOVA reserved regions
  util/vfio-helpers: Collect IOVA reserved regions
  docs: add 'io_uring' option to 'aio' param in qemu-options.hx
  include/block/block.h: drop non-ascii quotation mark
  block/io: refactor save/load vmstate
  block: drop bdrv_prwv
  block: generate coroutine-wrapper code
  scripts: add block-coroutine-wrapper.py
  block: declare some coroutine functions in block/coroutines.h
  block/io: refactor coroutine wrappers
  block: return error-code from bdrv_invalidate_cache
  block/nvme: Replace magic value by SCALE_MS definition
  block/nvme: Use register definitions from 'block/nvme.h'
  block/nvme: Drop NVMeRegs structure, directly use NvmeBar
  block/nvme: Reduce I/O registers scope
  block/nvme: Map doorbells pages write-only
  util/vfio-helpers: Pass page protections to qemu_vfio_pci_map_bar()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agotests/acceptance: add reverse debugging test
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:14:06 +0000 (20:14 +0300)]
tests/acceptance: add reverse debugging test

This is a test for GDB reverse debugging commands: reverse step and reverse continue.
Every test in this suite consists of two phases: record and replay.
Recording saves the execution of some instructions and makes an initial
VM snapshot to allow reverse execution.
Replay saves the order of the first instructions and then checks that they
are executed backwards in the correct order.
After that the execution is replayed to the end, and reverse continue
command is checked by setting several breakpoints, and asserting
that the execution is stopped at the last of them.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
--

v5:
 - disabled (as some other tests) when running on gitlab
   due to the unidentified timeout problem
Message-Id: <160174524678.12451.13258942849173670277.stgit@pasha-ThinkPad-X280>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoreplay: create temporary snapshot at debugger connection
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:14:01 +0000 (20:14 +0300)]
replay: create temporary snapshot at debugger connection

When record/replay does not uses overlays for storing the snapshots,
user is not capable of issuing reverse debugging commands.
This patch adds creation of the VM snapshot on the temporary
overlay image, when the debugger connects to QEMU.
Therefore the execution can be rewind to the moment
of the debugger connection while debugging the virtual machine.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
--

v6:
 - dropped unused error processing (suggested by Philippe Mathieu-Daudé)
Message-Id: <160174524096.12451.11651270339216758643.stgit@pasha-ThinkPad-X280>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoreplay: describe reverse debugging in docs/replay.txt
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:55 +0000 (20:13 +0300)]
replay: describe reverse debugging in docs/replay.txt

This patch updates the documentation and describes usage of the reverse
debugging in QEMU+GDB.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--

v4 changes:
 - added an example of the command line for reverse debugging of
   the diskless machine
Message-Id: <160174523509.12451.1409905901920738979.stgit@pasha-ThinkPad-X280>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agogdbstub: add reverse continue support in replay mode
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:49 +0000 (20:13 +0300)]
gdbstub: add reverse continue support in replay mode

This patch adds support of the reverse continue operation for gdbstub.
Reverse continue finds the last breakpoint that would happen in normal
execution from the beginning to the current moment.
Implementation of the reverse continue replays the execution twice:
to find the breakpoints that were hit and to seek to the last breakpoint.
Reverse continue loads the previous snapshot and tries to find the breakpoint
since that moment. If there are no such breakpoints, it proceeds to
the earlier snapshot, and so on. When no breakpoints or watchpoints were
hit at all, execution stops at the beginning of the replay log.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Message-Id: <160174522930.12451.6994758004725016836.stgit@pasha-ThinkPad-X280>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agogdbstub: add reverse step support in replay mode
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:43 +0000 (20:13 +0300)]
gdbstub: add reverse step support in replay mode

GDB remote protocol supports two reverse debugging commands:
reverse step and reverse continue.
This patch adds support of the first one to the gdbstub.
Reverse step is intended to step one instruction in the backwards
direction. This is not possible in regular execution.
But replayed execution is deterministic, therefore we can load one of
the prior snapshots and proceed to the desired step. It is equivalent
to stepping one instruction back.
There should be at least one snapshot preceding the debugged part of
the replay log.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--

v4 changes:
 - inverted condition in cpu_handle_guest_debug (suggested by Alex Bennée)
Message-Id: <160174522341.12451.1498758422543765253.stgit@pasha-ThinkPad-X280>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoreplay: flush rr queue before loading the vmstate
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:37 +0000 (20:13 +0300)]
replay: flush rr queue before loading the vmstate

Non-empty record/replay queue prevents saving and loading the VM state,
because it includes pending bottom halves and block coroutines.
But when the new VM state is loaded, we don't have to preserve the consistency
of the current state anymore. Therefore this patch just flushes the queue
allowing the coroutines to finish and removes checking for empty rr queue
for load_snapshot function.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <160174521762.12451.15752448887893855757.stgit@pasha-ThinkPad-X280>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoreplay: implement replay-seek command
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:31 +0000 (20:13 +0300)]
replay: implement replay-seek command

This patch adds hmp/qmp commands replay_seek/replay-seek that proceed
the execution to the specified instruction count.
The command automatically loads nearest snapshot and replays the execution
to find the desired instruction count.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Acked-by: Markus Armbruster <armbru@redhat.com>
--

v4 changes:
 - fixed HMP command description indent
 - removed useless error_free call
Message-Id: <160174521180.12451.14033112911009278753.stgit@pasha-ThinkPad-X280>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoreplay: introduce breakpoint at the specified step
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:26 +0000 (20:13 +0300)]
replay: introduce breakpoint at the specified step

This patch introduces replay_break, replay_delete_break
qmp and hmp commands.
These commands allow stopping at the specified instruction.
It may be useful for debugging when there are some known
events that should be investigated.
replay_break command has one argument - number of instructions
executed since the start of the replay.
replay_delete_break removes previously set breakpoint.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Acked-by: Markus Armbruster <armbru@redhat.com>
--

v4 changes:
 - removed useless error_free call
Message-Id: <160174520606.12451.7056879546045599378.stgit@pasha-ThinkPad-X280>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoreplay: introduce info hmp/qmp command
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:20 +0000 (20:13 +0300)]
replay: introduce info hmp/qmp command

This patch introduces 'info replay' monitor command and
corresponding qmp request.
These commands request the current record/replay mode, replay log file
name, and the instruction count (number of recorded/replayed
instructions).  The instruction count can be used with the
replay_seek/replay_break commands added in the next two patches.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <160174520026.12451.13112161947433306561.stgit@pasha-ThinkPad-X280>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoqapi: introduce replay.json for record/replay-related stuff
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:14 +0000 (20:13 +0300)]
qapi: introduce replay.json for record/replay-related stuff

This patch adds replay.json file. It will be
used for adding record/replay-related data structures and commands.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <160174519444.12451.3472949430004845434.stgit@pasha-ThinkPad-X280>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agomigration: introduce icount field for snapshots
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:08 +0000 (20:13 +0300)]
migration: introduce icount field for snapshots

Saving icount as a parameters of the snapshot allows navigation between
them in the execution replay scenario.
This information can be used for finding a specific snapshot for proceeding
the recorded execution to the specific moment of the time.
E.g., 'reverse step' action (introduced in one of the following patches)
needs to load the nearest snapshot which is prior to the current moment
of time.
This patch also updates snapshot test which verifies qemu monitor output.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Acked-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
--

v4 changes:
 - squashed format update with test output update
v7 changes:
 - introduced the spaces between the fields in snapshot info output
 - updated the test to match new field widths
Message-Id: <160174518865.12451.14327573383978752463.stgit@pasha-ThinkPad-X280>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoqcow2: introduce icount field for snapshots
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:13:02 +0000 (20:13 +0300)]
qcow2: introduce icount field for snapshots

This patch introduces the icount field for saving within the snapshot.
It is required for navigation between the snapshots in record/replay mode.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Acked-by: Kevin Wolf <kwolf@redhat.com>
--

v7 changes:
 - also fix the test which checks qcow2 snapshot extra data
Message-Id: <160174518284.12451.2301137308458777398.stgit@pasha-ThinkPad-X280>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoreplay: provide an accessor for rr filename
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:12:57 +0000 (20:12 +0300)]
replay: provide an accessor for rr filename

This patch adds an accessor function for the name of the record/replay
log file. Adding an accessor instead of making variable global,
prevents accidental modification of this variable by other modules.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <160174517710.12451.17645787545733927488.stgit@pasha-ThinkPad-X280>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoreplay: don't record interrupt poll
Pavel Dovgalyuk [Sat, 3 Oct 2020 17:12:51 +0000 (20:12 +0300)]
replay: don't record interrupt poll

Interrupt poll is not a real interrupt event. It is needed only for
thread safety. This interrupt is used for i386 and converted
to hardware interrupt by cpu_handle_interrupt function.
Therefore it is not needed to be recorded, because hardware
interrupt will be recorded after converting.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
--

v4 changes:
 - Condition check refactoring (suggested by Alex Bennée)
Message-Id: <160174517124.12451.12983410242461131737.stgit@pasha-ThinkPad-X280>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: don't enable ASLR for --enable-debug Windows builds
Mark Cave-Ayland [Mon, 5 Oct 2020 13:34:34 +0000 (14:34 +0100)]
configure: don't enable ASLR for --enable-debug Windows builds

Unlike other OSs it is not possible for gdb to temporarily disable ASLR when
debugging executables on Windows which causes gdb to fail with memory access
errors when trying to debug QEMU.

Keep ASLR enabled by default on Windows via the --dynamicbase compiler flag
except for --enable-debug builds when there is a clear expectation that a
functioning gdb is expected at the cost of slightly less security.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20201005133434.12614-1-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson
Paolo Bonzini [Wed, 23 Sep 2020 09:26:17 +0000 (05:26 -0400)]
configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson

Environment variables like CFLAGS are easy to accidentally change.  Meson
warns if that happens, but in a project with a lot of configuration that
is easy to lose.  It is also surprising behavior since meson caches -D
options and remembers those on reconfiguration (which we rely on,
since configure options become -D options).

By placing the user-provided CFLAGS, CXXFLAGS and LDFLAGS in the
cross file, we at least get consistent behavior.  These environment
variables are still ugly and not really recommended, but there are
distros that rely on them.  For the gory details, refer to
https://github.com/mesonbuild/meson/issues/4664.

Tested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200923092617.1593722-5-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS
Paolo Bonzini [Wed, 23 Sep 2020 09:26:15 +0000 (05:26 -0400)]
configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS

If the CFLAGS, CXXFLAGS or LDFLAGS variables are present in the environment,
any modification made within the configure script is passed down to Meson.
This is particularly undesirable for the "-pie" option, since it overrides
"-shared" and thus messes up the linker flags for shared modules.

Using a separate variable therefore fixes the bug, while clarifying that
the scope of these CFLAGS is just the configure script.

We also do not need to pass those variables in config-host.mak; they
were only used for printing the summary now that all submodules are
built with handwritten Meson rules).  For now synthesize CFLAGS in the
configuration summary, the next patch will also pass them in a cleaner
way using the cross file.

Reported-by: Frederic Bezies
Analyzed-by: Toolybird
Tested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200923092617.1593722-4-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodtc: Convert Makefile bits to meson bits
Paolo Bonzini [Mon, 5 Oct 2020 09:31:15 +0000 (11:31 +0200)]
dtc: Convert Makefile bits to meson bits

Build the library via the main meson.build just like for capstone.
This improves the current state of affairs in that we will re-link
the qemu executables against a changed libfdt.a, which we wouldn't
do before-hand, and lets us remove the whole recursive make machinery.

Tested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoslirp: Convert Makefile bits to meson bits
Paolo Bonzini [Mon, 5 Oct 2020 09:31:15 +0000 (11:31 +0200)]
slirp: Convert Makefile bits to meson bits

SLIRP uses Meson so it could become a subproject in the future,
but our choice of configure options is not yet supported in Meson
(https://github.com/mesonbuild/meson/pull/7740).

For now, build the library via the main meson.build just like for
capstone.

This improves the current state of affairs in that we will re-link
the qemu executables against a changed libslirp.a, which we wouldn't
do before-hand.

Tested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoreadthedocs: build with Python 3.6
Paolo Bonzini [Mon, 5 Oct 2020 15:01:22 +0000 (17:01 +0200)]
readthedocs: build with Python 3.6

The readthedocs build is failing because we do not support Python 3.5 anymore.
Bump the Python version in the configuration.

Fixes: 1b11f28d05 ("configure: Bump the minimum required Python version to 3.6", 2020-10-02)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20201005150122.446472-1-pbonzini@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoaccel/tcg: use current_machine as it is always set for softmmu
Claudio Fontana [Tue, 8 Sep 2020 08:59:07 +0000 (10:59 +0200)]
accel/tcg: use current_machine as it is always set for softmmu

current_machine is always set before accelerators are initialized,
so use that instead of MACHINE(qdev_get_machine()).

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agokvm: kvm_init_vcpu take Error pointer
Dr. David Alan Gilbert [Thu, 23 Jul 2020 16:09:15 +0000 (17:09 +0100)]
kvm: kvm_init_vcpu take Error pointer

Clean up the error handling in kvm_init_vcpu so we can see what went
wrong more easily.

Make it take an Error ** and fill it out with what failed, including
the cpu id, so you can tell if it only fails at a given ID.

Replace the remaining DPRINTF by a trace.

This turns a:
kvm_init_vcpu failed: Invalid argument

into:
kvm_init_vcpu: kvm_get_vcpu failed (256): Invalid argument

and with the trace you then get to see:

19049@1595520414.310107:kvm_init_vcpu index: 169 id: 212
19050@1595520414.310635:kvm_init_vcpu index: 170 id: 256
qemu-system-x86_64: kvm_init_vcpu: kvm_get_vcpu failed (256): Invalid argument

which makes stuff a lot more obvious.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200723160915.129069-1-dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agokvm: remove kvm specific functions from global includes
Claudio Fontana [Tue, 11 Aug 2020 17:08:23 +0000 (19:08 +0200)]
kvm: remove kvm specific functions from global includes

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohax: remove hax specific functions from global includes
Claudio Fontana [Tue, 11 Aug 2020 16:47:21 +0000 (18:47 +0200)]
hax: remove hax specific functions from global includes

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agowhpx: remove whpx specific functions from global includes
Claudio Fontana [Tue, 11 Aug 2020 16:32:18 +0000 (18:32 +0200)]
whpx: remove whpx specific functions from global includes

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohvf: remove hvf specific functions from global includes
Claudio Fontana [Tue, 11 Aug 2020 13:58:14 +0000 (15:58 +0200)]
hvf: remove hvf specific functions from global includes

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: add handle_interrupt to the CpusAccel interface
Claudio Fontana [Tue, 11 Aug 2020 13:16:33 +0000 (15:16 +0200)]
cpus: add handle_interrupt to the CpusAccel interface

kvm: uses the generic handler
qtest: uses the generic handler
whpx: changed to use the generic handler (identical implementation)
hax: changed to use the generic handler (identical implementation)
hvf: changed to use the generic handler (identical implementation)
tcg: adapt tcg-cpus to point to the tcg-specific handler

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: remove checks for non-NULL cpus_accel
Claudio Fontana [Wed, 19 Aug 2020 14:01:03 +0000 (16:01 +0200)]
cpus: remove checks for non-NULL cpus_accel

now that all accelerators support the CpusAccel interface,
we can remove most checks for non-NULL cpus_accel,
we just add a sanity check/assert at vcpu creation.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: cleanup now unneeded includes
Claudio Fontana [Wed, 5 Aug 2020 08:54:25 +0000 (10:54 +0200)]
cpus: cleanup now unneeded includes

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: extract out hvf-specific code to target/i386/hvf/
Claudio Fontana [Tue, 7 Jul 2020 09:50:13 +0000 (11:50 +0200)]
cpus: extract out hvf-specific code to target/i386/hvf/

register a "CpusAccel" interface for HVF as well.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
[added const]
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: extract out whpx-specific code to target/i386/
Claudio Fontana [Tue, 7 Jul 2020 09:39:12 +0000 (11:39 +0200)]
cpus: extract out whpx-specific code to target/i386/

register a "CpusAccel" interface for WHPX as well.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: extract out hax-specific code to target/i386/
Claudio Fontana [Tue, 7 Jul 2020 09:18:49 +0000 (11:18 +0200)]
cpus: extract out hax-specific code to target/i386/

register a "CpusAccel" interface for HAX as well.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: extract out kvm-specific code to accel/kvm
Claudio Fontana [Tue, 7 Jul 2020 08:54:37 +0000 (10:54 +0200)]
cpus: extract out kvm-specific code to accel/kvm

register a "CpusAccel" interface for KVM as well.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[added const]
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: extract out qtest-specific code to accel/qtest
Claudio Fontana [Tue, 7 Jul 2020 08:21:10 +0000 (10:21 +0200)]
cpus: extract out qtest-specific code to accel/qtest

register a "CpusAccel" interface for qtest as well.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: extract out TCG-specific code to accel/tcg
Claudio Fontana [Mon, 6 Jul 2020 17:39:45 +0000 (19:39 +0200)]
cpus: extract out TCG-specific code to accel/tcg

TCG is the first accelerator to register a "CpusAccel" interface
on initialization, providing functions for starting a vcpu,
kicking a vcpu, sychronizing state and getting virtual clock
and ticks.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[added const]
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpus: prepare new CpusAccel cpu accelerator interface
Claudio Fontana [Fri, 31 Jul 2020 10:23:42 +0000 (12:23 +0200)]
cpus: prepare new CpusAccel cpu accelerator interface

The new interface starts unused, will start being used by the
next patches.

It provides methods for each accelerator to start a vcpu, kick a vcpu,
synchronize state, get cpu virtual clock and elapsed ticks.

In qemu_wait_io_event, make it clear that APC is used only for HAX
on Windows.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoicount: rename functions to be consistent with the module name
Claudio Fontana [Mon, 31 Aug 2020 14:18:34 +0000 (16:18 +0200)]
icount: rename functions to be consistent with the module name

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocpu-timers, icount: new modules
Claudio Fontana [Wed, 19 Aug 2020 11:17:19 +0000 (13:17 +0200)]
cpu-timers, icount: new modules

refactoring of cpus.c continues with cpu timer state extraction.

cpu-timers: responsible for the softmmu cpu timers state,
            including cpu clocks and ticks.

icount: counts the TCG instructions executed. As such it is specific to
the TCG accelerator. Therefore, it is built only under CONFIG_TCG.

One complication is due to qtest, which uses an icount field to warp time
as part of qtest (qtest_clock_warp).

In order to solve this problem, provide a separate counter for qtest.

This requires fixing assumptions scattered in the code that
qtest_enabled() implies icount_enabled(), checking each specific case.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[remove redundant initialization with qemu_spice_init]
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
[fix lingering calls to icount_get]
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoMerge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
Peter Maydell [Mon, 5 Oct 2020 12:12:55 +0000 (13:12 +0100)]
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging

* move target configuration to default-configs/targets (myself)
* Memory failure event (Zhenwei)

# gpg: Signature made Mon 05 Oct 2020 08:14:29 BST
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini-gitlab/tags/for-upstream:
  dockerfiles: add diffutils to Fedora
  tests: tcg: do not use implicit rules
  target-i386: post memory failure event to QMP
  qapi/run-state.json: introduce memory failure event
  target-i386: seperate MCIP & MCE_MASK error reason
  meson: move sparse detection to Meson and rewrite check_sparse.py
  default-configs: remove redundant keys
  default-configs: use TARGET_ARCH key
  configure: move OpenBSD W^X test to meson
  default-configs: remove default-configs/devices for user-mode targets
  configure: remove target configuration
  configure: remove useless config-target.mak symbols
  configure: compute derivatives of target name in meson
  configure: remove dead variable
  configure: move accelerator logic to meson
  configure: rewrite accelerator defaults as tests
  configure: convert accelerator variables to meson options
  default-configs: move files to default-configs/devices/
  travis: remove TCI test

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

3 years agoMerge remote-tracking branch 'remotes/rth-gitlab/tags/pull-cap-20201003' into staging
Peter Maydell [Mon, 5 Oct 2020 10:25:55 +0000 (11:25 +0100)]
Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-cap-20201003' into staging

Update capstone submodule from v3.0.5 to v5 ("next").
Convert submodule build to meson.
Enable capstone disassembly for s390x.
Code cleanups in disas.c

# gpg: Signature made Sat 03 Oct 2020 10:33:44 BST
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth-gitlab/tags/pull-cap-20201003:
  disas/capstone: Add skipdata hook for s390x
  disas: Enable capstone disassembly for s390x
  disas: Split out capstone code to disas/capstone.c
  disas: Configure capstone for aarch64 host without libvixl
  disas: Cleanup plugin_disas
  disas: Use qemu/bswap.h for bfd endian loads
  disas: Clean up CPUDebug initialization
  disas: Move host asm annotations to tb_gen_code
  capstone: Require version 4.0 from a system library
  capstone: Update to upstream "next" branch
  capstone: Convert Makefile bits to meson bits

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoutil/vfio-helpers: Rework the IOVA allocator to avoid IOVA reserved regions
Eric Auger [Tue, 29 Sep 2020 08:55:50 +0000 (10:55 +0200)]
util/vfio-helpers: Rework the IOVA allocator to avoid IOVA reserved regions

Introduce the qemu_vfio_find_fixed/temp_iova helpers which
respectively allocate IOVAs from the bottom/top parts of the
usable IOVA range, without picking within host IOVA reserved
windows. The allocation remains basic: if the size is too big
for the remaining of the current usable IOVA range, we jump
to the next one, leaving a hole in the address map.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Message-id: 20200929085550.30926-3-eric.auger@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agoutil/vfio-helpers: Collect IOVA reserved regions
Eric Auger [Tue, 29 Sep 2020 08:55:49 +0000 (10:55 +0200)]
util/vfio-helpers: Collect IOVA reserved regions

The IOVA allocator currently ignores host reserved regions.
As a result some chosen IOVAs may collide with some of them,
resulting in VFIO MAP_DMA errors later on. This happens on ARM
where the MSI reserved window quickly is encountered:
[0x8000000, 0x8100000]. since 5.4 kernel, VFIO returns the usable
IOVA regions. So let's enumerate them in the prospect to avoid
them, later on.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Message-id: 20200929085550.30926-2-eric.auger@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agodocs: add 'io_uring' option to 'aio' param in qemu-options.hx
Stefano Garzarella [Thu, 24 Sep 2020 15:15:11 +0000 (17:15 +0200)]
docs: add 'io_uring' option to 'aio' param in qemu-options.hx

When we added io_uring AIO engine, we forgot to update qemu-options.hx,
so qemu(1) man page and qemu help were outdated.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Julia Suvorova <jusual@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Message-Id: <20200924151511.131471-1-sgarzare@redhat.com>

3 years agoinclude/block/block.h: drop non-ascii quotation mark
Vladimir Sementsov-Ogievskiy [Fri, 25 Sep 2020 08:32:29 +0000 (11:32 +0300)]
include/block/block.h: drop non-ascii quotation mark

This is the only non-ascii character in the file and it doesn't really
needed here. Let's use normal "'" symbol for consistency with the rest
11 occurrences of "'" in the file.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agoblock/io: refactor save/load vmstate
Vladimir Sementsov-Ogievskiy [Thu, 24 Sep 2020 18:54:14 +0000 (21:54 +0300)]
block/io: refactor save/load vmstate

Like for read/write in a previous commit, drop extra indirection layer,
generate directly bdrv_readv_vmstate() and bdrv_writev_vmstate().

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200924185414.28642-8-vsementsov@virtuozzo.com>

3 years agoblock: drop bdrv_prwv
Vladimir Sementsov-Ogievskiy [Thu, 24 Sep 2020 18:54:13 +0000 (21:54 +0300)]
block: drop bdrv_prwv

Now that we are not maintaining boilerplate code for coroutine
wrappers, there is no more sense in keeping the extra indirection layer
of bdrv_prwv().  Let's drop it and instead generate pure bdrv_preadv()
and bdrv_pwritev().

Currently, bdrv_pwritev() and bdrv_preadv() are returning bytes on
success, auto generated functions will instead return zero, as their
_co_ prototype. Still, it's simple to make the conversion safe: the
only external user of bdrv_pwritev() is test-bdrv-drain, and it is
comfortable enough with bdrv_co_pwritev() instead. So prototypes are
moved to local block/coroutines.h. Next, the only internal use is
bdrv_pread() and bdrv_pwrite(), which are modified to return bytes on
success.

Of course, it would be great to convert bdrv_pread() and bdrv_pwrite()
to return 0 on success. But this requires audit (and probably
conversion) of all their users, let's leave it for another day
refactoring.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200924185414.28642-7-vsementsov@virtuozzo.com>

3 years agoblock: generate coroutine-wrapper code
Vladimir Sementsov-Ogievskiy [Thu, 24 Sep 2020 18:54:12 +0000 (21:54 +0300)]
block: generate coroutine-wrapper code

Use code generation implemented in previous commit to generated
coroutine wrappers in block.c and block/io.c

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200924185414.28642-6-vsementsov@virtuozzo.com>

3 years agoscripts: add block-coroutine-wrapper.py
Vladimir Sementsov-Ogievskiy [Thu, 24 Sep 2020 18:54:11 +0000 (21:54 +0300)]
scripts: add block-coroutine-wrapper.py

We have a very frequent pattern of creating a coroutine from a function
with several arguments:

  - create a structure to pack parameters
  - create _entry function to call original function taking parameters
    from struct
  - do different magic to handle completion: set ret to NOT_DONE or
    EINPROGRESS or use separate bool field
  - fill the struct and create coroutine from _entry function with this
    struct as a parameter
  - do coroutine enter and BDRV_POLL_WHILE loop

Let's reduce code duplication by generating coroutine wrappers.

This patch adds scripts/block-coroutine-wrapper.py together with some
friends, which will generate functions with declared prototypes marked
by the 'generated_co_wrapper' specifier.

The usage of new code generation is as follows:

    1. define the coroutine function somewhere

        int coroutine_fn bdrv_co_NAME(...) {...}

    2. declare in some header file

        int generated_co_wrapper bdrv_NAME(...);

       with same list of parameters (generated_co_wrapper is
       defined in "include/block/block.h").

    3. Make sure the block_gen_c declaration in block/meson.build
       mentions the file with your marker function.

Still, no function is now marked, this work is for the following
commit.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200924185414.28642-5-vsementsov@virtuozzo.com>
[Added encoding='utf-8' to open() calls as requested by Vladimir. Fixed
typo and grammar issues pointed out by Eric Blake. Removed clang-format
dependency that caused build test issues.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agoblock: declare some coroutine functions in block/coroutines.h
Vladimir Sementsov-Ogievskiy [Thu, 24 Sep 2020 18:54:10 +0000 (21:54 +0300)]
block: declare some coroutine functions in block/coroutines.h

We are going to keep coroutine-wrappers code (structure-packing
parameters, BDRV_POLL wrapper functions) in separate auto-generated
files. So, we'll need a header with declaration of original _co_
functions, for those which are static now. As well, we'll need
declarations for wrapper functions. Do these declarations now, as a
preparation step.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200924185414.28642-4-vsementsov@virtuozzo.com>

3 years agoblock/io: refactor coroutine wrappers
Vladimir Sementsov-Ogievskiy [Thu, 24 Sep 2020 18:54:09 +0000 (21:54 +0300)]
block/io: refactor coroutine wrappers

Most of our coroutine wrappers already follow this convention:

We have 'coroutine_fn bdrv_co_<something>(<normal argument list>)' as
the core function, and a wrapper 'bdrv_<something>(<same argument
list>)' which does parameter packing and calls bdrv_run_co().

The only outsiders are the bdrv_prwv_co and
bdrv_common_block_status_above wrappers. Let's refactor them to behave
as the others, it simplifies further conversion of coroutine wrappers.

This patch adds an indirection layer, but it will be compensated by
a further commit, which will drop bdrv_co_prwv together with the
is_write logic, to keep the read and write paths separate.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200924185414.28642-3-vsementsov@virtuozzo.com>

3 years agoblock: return error-code from bdrv_invalidate_cache
Vladimir Sementsov-Ogievskiy [Thu, 24 Sep 2020 18:54:08 +0000 (21:54 +0300)]
block: return error-code from bdrv_invalidate_cache

This is the only coroutine wrapper from block.c and block/io.c which
doesn't return a value, so let's convert it to the common behavior, to
simplify moving to generated coroutine wrappers in a further commit.

Also, bdrv_invalidate_cache is a void function, returning error only
through **errp parameter, which is considered to be bad practice, as
it forces callers to define and propagate local_err variable, so
conversion is good anyway.

This patch leaves the conversion of .bdrv_co_invalidate_cache() driver
callbacks and bdrv_invalidate_cache_all() for another day.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200924185414.28642-2-vsementsov@virtuozzo.com>

3 years agoblock/nvme: Replace magic value by SCALE_MS definition
Philippe Mathieu-Daudé [Tue, 22 Sep 2020 08:38:21 +0000 (10:38 +0200)]
block/nvme: Replace magic value by SCALE_MS definition

Use self-explicit SCALE_MS definition instead of magic value
(missed in similar commit e4f310fe7f5).

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200922083821.578519-7-philmd@redhat.com>

3 years agoblock/nvme: Use register definitions from 'block/nvme.h'
Philippe Mathieu-Daudé [Tue, 22 Sep 2020 08:38:20 +0000 (10:38 +0200)]
block/nvme: Use register definitions from 'block/nvme.h'

Use the NVMe register definitions from "block/nvme.h" which
ease a bit reviewing the code while matching the datasheet.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200922083821.578519-6-philmd@redhat.com>

3 years agoblock/nvme: Drop NVMeRegs structure, directly use NvmeBar
Philippe Mathieu-Daudé [Tue, 22 Sep 2020 08:38:19 +0000 (10:38 +0200)]
block/nvme: Drop NVMeRegs structure, directly use NvmeBar

NVMeRegs only contains NvmeBar. Simplify the code by using NvmeBar
directly.

This triggers a checkpatch.pl error:

  ERROR: Use of volatile is usually wrong, please add a comment
  #30: FILE: block/nvme.c:691:
  +    volatile NvmeBar *regs;

This is a false positive as in our case we are using I/O registers,
so the 'volatile' use is justified.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200922083821.578519-5-philmd@redhat.com>

3 years agoblock/nvme: Reduce I/O registers scope
Philippe Mathieu-Daudé [Tue, 22 Sep 2020 08:38:18 +0000 (10:38 +0200)]
block/nvme: Reduce I/O registers scope

We only access the I/O register in nvme_init().
Remove the reference in BDRVNVMeState and reduce its scope.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200922083821.578519-4-philmd@redhat.com>

3 years agoblock/nvme: Map doorbells pages write-only
Philippe Mathieu-Daudé [Tue, 22 Sep 2020 08:38:17 +0000 (10:38 +0200)]
block/nvme: Map doorbells pages write-only

Per the datasheet sections 3.1.13/3.1.14:
  "The host should not read the doorbell registers."

As we don't need read access, map the doorbells with write-only
permission. We keep a reference to this mapped address in the
BDRVNVMeState structure.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200922083821.578519-3-philmd@redhat.com>

3 years agoutil/vfio-helpers: Pass page protections to qemu_vfio_pci_map_bar()
Philippe Mathieu-Daudé [Tue, 22 Sep 2020 08:38:16 +0000 (10:38 +0200)]
util/vfio-helpers: Pass page protections to qemu_vfio_pci_map_bar()

Pages are currently mapped READ/WRITE. To be able to use different
protections, add a new argument to qemu_vfio_pci_map_bar().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200922083821.578519-2-philmd@redhat.com>

3 years agodockerfiles: add diffutils to Fedora
Paolo Bonzini [Sat, 3 Oct 2020 08:50:54 +0000 (10:50 +0200)]
dockerfiles: add diffutils to Fedora

For some reason diffutils is not included in the Fedora containers anymore,
causing the build to fail.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201003085054.332992-2-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agotests: tcg: do not use implicit rules
Paolo Bonzini [Sat, 3 Oct 2020 07:00:46 +0000 (03:00 -0400)]
tests: tcg: do not use implicit rules

Use pattern rules to clarify which targets are going to match the
rule and to provide clearer error messages.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agotarget-i386: post memory failure event to QMP
zhenwei pi [Wed, 30 Sep 2020 10:04:40 +0000 (18:04 +0800)]
target-i386: post memory failure event to QMP

Post memory failure event through QMP to handle hardware memory corrupted
event. Rather than simply printing to the log, QEMU could report more
effective message to the client. For example, if a guest receives an MCE,
evacuating the host could be a good idea.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20200930100440.1060708-4-pizhenwei@bytedance.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoqapi/run-state.json: introduce memory failure event
zhenwei pi [Wed, 30 Sep 2020 10:04:39 +0000 (18:04 +0800)]
qapi/run-state.json: introduce memory failure event

Introduce memory failure events for hypervisor and guest. This lets
mft: Need exactly one file argument.  Try `mft --help' for more
information.

Suggested by Peter Maydell, rename events name&description to make
them architecture-neutral; and suggested by Paolo, add more info to
distinguish a mce is AR/AO, and if a previous MCE was still being
processed in the guest.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20200930100440.1060708-3-pizhenwei@bytedance.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agotarget-i386: seperate MCIP & MCE_MASK error reason
zhenwei pi [Wed, 30 Sep 2020 10:04:38 +0000 (18:04 +0800)]
target-i386: seperate MCIP & MCE_MASK error reason

Previously we would only get a simple string "Triple fault" in qemu
log. Add detailed message for the two reasons to describe why qemu
has to reset the guest.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20200930100440.1060708-2-pizhenwei@bytedance.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agomeson: move sparse detection to Meson and rewrite check_sparse.py
Paolo Bonzini [Tue, 1 Sep 2020 11:51:16 +0000 (07:51 -0400)]
meson: move sparse detection to Meson and rewrite check_sparse.py

Pass the path to the program to scripts/check_sparse.py, which
previously was not included in config-host.mak.  Change
scripts/check_sparse.py to work with cgcc, which seems to
work better with sparse 0.6.x.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodefault-configs: remove redundant keys
Paolo Bonzini [Mon, 21 Sep 2020 09:19:07 +0000 (05:19 -0400)]
default-configs: remove redundant keys

TARGET_BASE_ARCH and TARGET_ABI_DIR are 99% of the time the same
as TARGET_ARCH, remove them if so.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodefault-configs: use TARGET_ARCH key
Paolo Bonzini [Mon, 21 Sep 2020 09:11:01 +0000 (05:11 -0400)]
default-configs: use TARGET_ARCH key

Replace the individual TARGET_*=y lines with TARGET_ARCH,
similar to how TARGET_BASE_ARCH is handled already.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: move OpenBSD W^X test to meson
Paolo Bonzini [Mon, 21 Sep 2020 08:49:50 +0000 (04:49 -0400)]
configure: move OpenBSD W^X test to meson

The TCG option is now passed through to Meson.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodefault-configs: remove default-configs/devices for user-mode targets
Paolo Bonzini [Fri, 18 Sep 2020 10:44:16 +0000 (06:44 -0400)]
default-configs: remove default-configs/devices for user-mode targets

We no longer need dummy files to detect targets, since
default-configs/targets/ exists.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: remove target configuration
Paolo Bonzini [Mon, 21 Sep 2020 08:37:49 +0000 (04:37 -0400)]
configure: remove target configuration

The config-target.mak files are small constant, we can therefore just
write them down explicitly.

This removes a pretty large part of the configure script, including the
whole logic to detect which accelerators are supported by each target.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: remove useless config-target.mak symbols
Paolo Bonzini [Mon, 21 Sep 2020 08:58:27 +0000 (04:58 -0400)]
configure: remove useless config-target.mak symbols

Omit symbols that are not needed by softmmu or bsd-user targets,
in preparation for moving the generated config-target.mak files
into the source tree.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: compute derivatives of target name in meson
Paolo Bonzini [Fri, 18 Sep 2020 10:37:21 +0000 (06:37 -0400)]
configure: compute derivatives of target name in meson

Several CONFIG_* symbols in config-target.mak are easily computed from just
the target name.  We do not need them in config-target.mak, and can instead
place them in the config_target dictionary only.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: remove dead variable
Paolo Bonzini [Fri, 18 Sep 2020 10:52:12 +0000 (06:52 -0400)]
configure: remove dead variable

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: move accelerator logic to meson
Paolo Bonzini [Fri, 18 Sep 2020 09:37:01 +0000 (05:37 -0400)]
configure: move accelerator logic to meson

Move to meson the code to detect the presence of accelerators, and
to define accelerator-specific config-target.h symbols.

The logic for now is duplicated in configure because it is still
in use to build the list of targets (which is in turn used to
create the config-target.mak files).  The next patches remove it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: rewrite accelerator defaults as tests
Paolo Bonzini [Fri, 18 Sep 2020 09:22:37 +0000 (05:22 -0400)]
configure: rewrite accelerator defaults as tests

Prepare to process "auto" in meson rather than configure: standardize the
shape of the code that changes "auto" to enabled/disabled, to ease the review
when it will be moved to meson.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfigure: convert accelerator variables to meson options
Paolo Bonzini [Fri, 18 Sep 2020 08:57:25 +0000 (04:57 -0400)]
configure: convert accelerator variables to meson options

Prepare for moving the tests to meson.  For now they only have
enabled/disabled as the possible values when meson is invoked,
but "auto" will be a possibility later, when configure will only
parse the command line options.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodefault-configs: move files to default-configs/devices/
Paolo Bonzini [Fri, 18 Sep 2020 10:06:09 +0000 (06:06 -0400)]
default-configs: move files to default-configs/devices/

Make room for target files in default-configs/targets/

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agotravis: remove TCI test
Paolo Bonzini [Wed, 23 Sep 2020 15:10:25 +0000 (11:10 -0400)]
travis: remove TCI test

TCI is already covered on gitlab CI, so we can remove it.

Cc: Thomas Huth <thuth@redhat.com>
Cc: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>