qemu.git
4 years agolinux-user: Validate mmap/mprotect prot value
Richard Henderson [Tue, 19 May 2020 18:56:44 +0000 (11:56 -0700)]
linux-user: Validate mmap/mprotect prot value

The kernel will return -EINVAL for bits set in the prot argument
that are unknown or invalid.  Previously we were simply cropping
out the bits that we care about.

Introduce validate_prot_to_pageflags to perform this check in a
single place between the two syscalls.  Differentiate between
the target and host versions of prot.  Compute the qemu internal
page_flags value at the same time.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200519185645.3915-2-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last value
Filip Bozuta [Thu, 2 Jul 2020 16:09:15 +0000 (18:09 +0200)]
linux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last value

Function "print_fdset()" in "strace.c" is used to print the file descriptor
values in "print__newselect()" which prints arguments of syscall _newselect().
Until changes from this patch, this function was printing "," even after the
last value of the fd_set argument. This was changed in this patch by removing
this unnecessary "," after the last fd value and thus improving the estetics of
the _newselect() "-strace" print.

Implementation notes:

   The printing fix was made possible by using an existing function "get_comma()"
   which returns a "," or an empty string "" based on its argument (0 for "," and
   other for "").

Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200702160915.9517-1-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agoMerge remote-tracking branch 'remotes/philmd-gitlab/tags/sd-next-20200821' into staging
Peter Maydell [Sat, 22 Aug 2020 22:53:08 +0000 (23:53 +0100)]
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/sd-next-20200821' into staging

SD/MMC patches

- Convert legacy SD host controller to the SDBus API
- Move legacy API to a separate "sdcard_legacy.h" header
- Introduce methods to access multiple bytes on SDBus data lines
- Fix 'switch function' group location
- Fix SDSC maximum card size (2GB)

CI jobs result:
  https://gitlab.com/philmd/qemu/-/pipelines/180605963

# gpg: Signature made Fri 21 Aug 2020 18:27:50 BST
# 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/sd-next-20200821: (23 commits)
  hw/sd: Correct the maximum size of a Standard Capacity SD Memory Card
  hw/sd: Fix incorrect populated function switch status data structure
  hw/sd: Use sdbus_read_data() instead of sdbus_read_byte() when possible
  hw/sd: Add sdbus_read_data() to read multiples bytes on the data line
  hw/sd: Use sdbus_write_data() instead of sdbus_write_byte when possible
  hw/sd: Add sdbus_write_data() to write multiples bytes on the data line
  hw/sd: Rename sdbus_read_data() as sdbus_read_byte()
  hw/sd: Rename sdbus_write_data() as sdbus_write_byte()
  hw/sd: Rename read/write_data() as read/write_byte()
  hw/sd: Move sdcard legacy API to 'hw/sd/sdcard_legacy.h'
  hw/sd/sdcard: Make sd_data_ready() static
  hw/sd/pl181: Replace disabled fprintf()s by trace events
  hw/sd/pl181: Do not create SD card within the SD host controller
  hw/sd/pl181: Expose a SDBus and connect the SDCard to it
  hw/sd/pl181: Use named GPIOs
  hw/sd/pl181: Add TODO to use Fifo32 API
  hw/sd/pl181: Rename pl181_send_command() as pl181_do_command()
  hw/sd/pl181: Replace fprintf(stderr, "*\n") with error_report()
  hw/sd/milkymist: Do not create SD card within the SD host controller
  hw/sd/milkymist: Create the SDBus at init()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
Peter Maydell [Sat, 22 Aug 2020 20:59:08 +0000 (21:59 +0100)]
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging

meson fixes:

* --disable-tools --enable-system build
* s390 no-TCG build
* fdmon-io_uring
* 'shift' error message in version_ge()

# gpg: Signature made Fri 21 Aug 2020 22:12: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:
  keymaps: update
  meson: Fix --disable-tools --enable-system builds
  meson: convert pc-bios/keymaps/Makefile
  configure: silence 'shift' error message in version_ge()
  util/meson.build: fix fdmon-io_uring build
  target/s390x: fix meson.build issue

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-21' into staging
Peter Maydell [Sat, 22 Aug 2020 18:57:23 +0000 (19:57 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-21' into staging

bitmaps patches for 2020-08-21

- Andrey Shinkevich: Enhance qcow2.py for iotest inspection of qcow2 images
- Max Reitz: Add block-bitmap-mapping migration parameter

# gpg: Signature made Fri 21 Aug 2020 15:05:07 BST
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-bitmaps-2020-08-21:
  iotests: Test node/bitmap aliases during migration
  iotests.py: Let wait_migration() return on failure
  migration: Add block-bitmap-mapping parameter
  iotests: dump QCOW2 header in JSON in #303
  qcow2_format.py: support dumping metadata in JSON format
  qcow2_format.py: collect fields to dump in JSON format
  qcow2.py: Introduce '-j' key to dump in JSON format
  qcow2_format.py: Dump bitmap table serialized entries
  qcow2_format.py: pass cluster size to substructures
  qcow2_format.py: Dump bitmap directory information
  qcow2_format.py: dump bitmap flags in human readable way.
  qcow2_format.py: change Qcow2BitmapExt initialization method
  qcow2_format.py: make printable data an extension class member
  iotests: add test for QCOW2 header dump

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into...
Peter Maydell [Sat, 22 Aug 2020 13:37:31 +0000 (14:37 +0100)]
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging

Machine queue 2020-08-19

Regular post-release changes:
* hw: add compat machines for 5.2 (Cornelia Huck)

Features:
* qmp: Expose MachineClass::default_ram_id
  (Michal Privoznik)

Cleanups:
* qdev: Document qdev_prop_set_drive_err() return value
  (Philippe Mathieu-Daudé)

# gpg: Signature made Wed 19 Aug 2020 16:21:55 BST
# gpg:                using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6
# gpg:                issuer "ehabkost@redhat.com"
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/machine-next-pull-request:
  hw: add compat machines for 5.2
  qmp: Expose MachineClass::default_ram_id
  qdev: Document qdev_prop_set_drive_err() return value

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/kraxel/tags/seabios-20200819-pull-request'...
Peter Maydell [Fri, 21 Aug 2020 21:45:15 +0000 (22:45 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/seabios-20200819-pull-request' into staging

seabios: update to 1.14-final

# gpg: Signature made Wed 19 Aug 2020 07:36:36 BST
# 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/seabios-20200819-pull-request:
  seabios: update to 1.14-final

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agokeymaps: update
Paolo Bonzini [Fri, 21 Aug 2020 16:09:29 +0000 (12:09 -0400)]
keymaps: update

Looks like update-keymaps has not been run in a while.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: Fix --disable-tools --enable-system builds
Philippe Mathieu-Daudé [Fri, 21 Aug 2020 15:05:56 +0000 (17:05 +0200)]
meson: Fix --disable-tools --enable-system builds

Fixes:

 $ ../configure --disable-tools --disable-user
 ../tests/qemu-iotests/meson.build:7:0: ERROR: Unknown variable "qemu_block_tools".

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200821150556.1235625-1-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert pc-bios/keymaps/Makefile
Marc-André Lureau [Thu, 19 Sep 2019 16:24:43 +0000 (20:24 +0400)]
meson: convert pc-bios/keymaps/Makefile

Note that sl and sv keymaps were not created by qemu-keymap.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoconfigure: silence 'shift' error message in version_ge()
Stefano Garzarella [Fri, 21 Aug 2020 20:35:58 +0000 (22:35 +0200)]
configure: silence 'shift' error message in version_ge()

If there are less than 2 arguments in version_ge(), the second
'shift' prints this error:
    ../configure: line 232: shift: shift count out of range

As Eric suggested, we can use 'shift ${2:+2}' which works out to
'shift 2' if $2 is set, or 'shift' (implicitly shift 1) if $2
is not set.

This patch replaces both 'shift; shift' occurrences in version_ge()
with 'shift ${2:+2}'.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200821203558.10338-1-sgarzare@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Fri, 21 Aug 2020 16:26:52 +0000 (17:26 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

# gpg: Signature made Mon 17 Aug 2020 15:34:34 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/tags/block-pull-request:
  aio-posix: keep aio_notify_me disabled during polling
  async: always set ctx->notified in aio_notify()
  async: rename event_notifier_dummy_cb/poll()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoutil/meson.build: fix fdmon-io_uring build
Stefano Garzarella [Fri, 21 Aug 2020 15:48:53 +0000 (17:48 +0200)]
util/meson.build: fix fdmon-io_uring build

libqemuutil.a build fails with this error:

  /usr/bin/ld: libqemuutil.a(util_fdmon-io_uring.c.o): in function `get_sqe':
  qemu/build/../util/fdmon-io_uring.c:83: undefined reference to `io_uring_get_sqe'
  /usr/bin/ld: qemu/build/../util/fdmon-io_uring.c:92: undefined reference to `io_uring_submit'
  /usr/bin/ld: qemu/build/../util/fdmon-io_uring.c:96: undefined reference to `io_uring_get_sqe'
  /usr/bin/ld: libqemuutil.a(util_fdmon-io_uring.c.o): in function `fdmon_io_uring_wait':
  qemu/build/../util/fdmon-io_uring.c:289: undefined reference to `io_uring_submit_and_wait'
  /usr/bin/ld: libqemuutil.a(util_fdmon-io_uring.c.o): in function `fdmon_io_uring_setup':
  qemu/build/../util/fdmon-io_uring.c:328: undefined reference to `io_uring_queue_init'
  /usr/bin/ld: libqemuutil.a(util_fdmon-io_uring.c.o): in function `fdmon_io_uring_destroy':
  qemu/build/../util/fdmon-io_uring.c:343: undefined reference to `io_uring_queue_exit'
  collect2: error: ld returned 1 exit status

This patch fix the issue adding 'linux_io_uring' dependency for
fdmon-io_uring.c

Fixes: a81df1b68b ("libqemuutil, qapi, trace: convert to meson")
Cc: pbonzini@redhat.com
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20200821154853.94379-1-sgarzare@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agotarget/s390x: fix meson.build issue
Paolo Bonzini [Fri, 21 Aug 2020 15:52:37 +0000 (11:52 -0400)]
target/s390x: fix meson.build issue

files() is needed to avoid

../meson.build:977:2: ERROR: File tcg-stub.c does not exist.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/sd: Correct the maximum size of a Standard Capacity SD Memory Card
Bin Meng [Fri, 21 Aug 2020 14:45:36 +0000 (22:45 +0800)]
hw/sd: Correct the maximum size of a Standard Capacity SD Memory Card

Per the SD spec, Standard Capacity SD Memory Card (SDSC) supports
capacity up to and including 2 GiB.

Fixes: 2d7adea4fe ("hw/sd: Support SDHC size cards")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Message-Id: <1598021136-49525-2-git-send-email-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4 years agohw/sd: Fix incorrect populated function switch status data structure
Bin Meng [Fri, 21 Aug 2020 14:45:35 +0000 (22:45 +0800)]
hw/sd: Fix incorrect populated function switch status data structure

At present the function switch status data structure bit [399:376]
are wrongly pupulated. These 3 bytes encode function switch status
for the 6 function groups, with 4 bits per group, starting from
function group 6 at bit 399, then followed by function group 5 at
bit 395, and so on.

However the codes mistakenly fills in the function group 1 status
at bit 399. This fixes the code logic.

Fixes: a1bb27b1e9 ("SD card emulation (initial implementation)")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Message-Id: <1598021136-49525-1-git-send-email-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4 years agohw/sd: Use sdbus_read_data() instead of sdbus_read_byte() when possible
Philippe Mathieu-Daudé [Fri, 14 Aug 2020 09:23:46 +0000 (11:23 +0200)]
hw/sd: Use sdbus_read_data() instead of sdbus_read_byte() when possible

Use the recently added sdbus_read_data() to read multiple
bytes at once, instead of looping calling sdbus_read_byte().

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200814092346.21825-8-f4bug@amsat.org>

4 years agohw/sd: Add sdbus_read_data() to read multiples bytes on the data line
Philippe Mathieu-Daudé [Fri, 14 Aug 2020 09:23:45 +0000 (11:23 +0200)]
hw/sd: Add sdbus_read_data() to read multiples bytes on the data line

Add a sdbus_read_data() method to read multiple bytes on the
data line of a SD bus.
We might improve the tracing later, for now keep logging each
byte individually.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200814092346.21825-7-f4bug@amsat.org>

4 years agohw/sd: Use sdbus_write_data() instead of sdbus_write_byte when possible
Philippe Mathieu-Daudé [Fri, 14 Aug 2020 09:23:44 +0000 (11:23 +0200)]
hw/sd: Use sdbus_write_data() instead of sdbus_write_byte when possible

Use the recently added sdbus_write_data() to write multiple
bytes at once, instead of looping calling sdbus_write_byte().

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200814092346.21825-6-f4bug@amsat.org>

4 years agohw/sd: Add sdbus_write_data() to write multiples bytes on the data line
Philippe Mathieu-Daudé [Fri, 14 Aug 2020 09:23:43 +0000 (11:23 +0200)]
hw/sd: Add sdbus_write_data() to write multiples bytes on the data line

Add a sdbus_write_data() method to write multiple bytes on the
data line of a SD bus.
We might improve the tracing later, for now keep logging each
byte individually.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200814092346.21825-5-f4bug@amsat.org>

4 years agohw/sd: Rename sdbus_read_data() as sdbus_read_byte()
Philippe Mathieu-Daudé [Fri, 14 Aug 2020 09:23:42 +0000 (11:23 +0200)]
hw/sd: Rename sdbus_read_data() as sdbus_read_byte()

The sdbus_read_data() method do a single byte access on the data
line of a SD bus. Rename it as sdbus_read_byte() and document it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200814092346.21825-4-f4bug@amsat.org>

4 years agohw/sd: Rename sdbus_write_data() as sdbus_write_byte()
Philippe Mathieu-Daudé [Fri, 14 Aug 2020 09:23:41 +0000 (11:23 +0200)]
hw/sd: Rename sdbus_write_data() as sdbus_write_byte()

The sdbus_write_data() method do a single byte access on the data
line of a SD bus. Rename it as sdbus_write_byte() and document it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200814092346.21825-3-f4bug@amsat.org>

4 years agohw/sd: Rename read/write_data() as read/write_byte()
Philippe Mathieu-Daudé [Fri, 14 Aug 2020 09:23:40 +0000 (11:23 +0200)]
hw/sd: Rename read/write_data() as read/write_byte()

The read/write_data() methods write do a single byte access
on the data line of a SD card. Rename them as read/write_byte().
Add some documentation (not in "hw/sd/sdcard_legacy.h" which we
are going to remove soon).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200814092346.21825-2-f4bug@amsat.org>

4 years agohw/sd: Move sdcard legacy API to 'hw/sd/sdcard_legacy.h'
Philippe Mathieu-Daudé [Sat, 23 Dec 2017 20:29:33 +0000 (17:29 -0300)]
hw/sd: Move sdcard legacy API to 'hw/sd/sdcard_legacy.h'

omap_mmc.c is the last device left using the legacy sdcard API.
Move the prototype declarations into a separate header, to
make it clear this is a legacy API.

Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-Id: <20180216022933.10945-8-f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/sd/sdcard: Make sd_data_ready() static
Philippe Mathieu-Daudé [Fri, 16 Feb 2018 02:01:26 +0000 (23:01 -0300)]
hw/sd/sdcard: Make sd_data_ready() static

sd_data_ready() belongs to the legacy API. As its last user has
been converted to the SDBus API, make it static.

Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-Id: <20180216022933.10945-7-f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/sd/pl181: Replace disabled fprintf()s by trace events
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 17:57:50 +0000 (19:57 +0200)]
hw/sd/pl181: Replace disabled fprintf()s by trace events

Convert disabled DPRINTF() to trace events and remove ifdef'ry.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200705204630.4133-9-f4bug@amsat.org>

4 years agohw/sd/pl181: Do not create SD card within the SD host controller
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 12:24:24 +0000 (14:24 +0200)]
hw/sd/pl181: Do not create SD card within the SD host controller

SD/MMC host controllers provide a SD Bus to plug SD cards,
but don't come with SD card plugged in :) Let the machine/board
model create and plug the SD cards when required.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200705204630.4133-8-f4bug@amsat.org>

4 years agohw/sd/pl181: Expose a SDBus and connect the SDCard to it
Philippe Mathieu-Daudé [Tue, 23 Jan 2018 03:58:35 +0000 (04:58 +0100)]
hw/sd/pl181: Expose a SDBus and connect the SDCard to it

Convert the controller to the SDBus API:
- add the a TYPE_PL181_BUS object of type TYPE_SD_BUS,
- adapt the SDBusClass set_inserted/set_readonly handlers
- create the bus in the PL181 controller
- switch legacy sd_*() API to the sdbus_*() API.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200705204630.4133-7-f4bug@amsat.org>

4 years agohw/sd/pl181: Use named GPIOs
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 11:39:53 +0000 (13:39 +0200)]
hw/sd/pl181: Use named GPIOs

To make the code easier to manage/review/use, rename the
cardstatus[0] variable as 'card_readonly' and name the GPIO
"card-read-only".
Similarly with cardstatus[1], renamed as 'card_inserted' and
name its GPIO "card-inserted".

Adapt the users accordingly by using the qdev_init_gpio_out_named()
function.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200705204630.4133-6-f4bug@amsat.org>

4 years agohw/sd/pl181: Add TODO to use Fifo32 API
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 17:54:31 +0000 (19:54 +0200)]
hw/sd/pl181: Add TODO to use Fifo32 API

Add TODO to use Fifo32 API from "qemu/fifo32.h".

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200705204630.4133-4-f4bug@amsat.org>

4 years agohw/sd/pl181: Rename pl181_send_command() as pl181_do_command()
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 17:42:05 +0000 (19:42 +0200)]
hw/sd/pl181: Rename pl181_send_command() as pl181_do_command()

pl181_send_command() do a bus transaction (send or receive),
rename it as pl181_do_command().

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200705204630.4133-3-f4bug@amsat.org>

4 years agohw/sd/pl181: Replace fprintf(stderr, "*\n") with error_report()
Alistair Francis [Wed, 20 Dec 2017 17:24:47 +0000 (09:24 -0800)]
hw/sd/pl181: Replace fprintf(stderr, "*\n") with error_report()

Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.

find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +

Some lines where then manually tweaked to pass checkpatch.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Message-Id: <488ba8d4c562ea44119de8ea0f385a898bd8fa1e.1513790495.git.alistair.francis@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/sd/milkymist: Do not create SD card within the SD host controller
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 21:03:34 +0000 (23:03 +0200)]
hw/sd/milkymist: Do not create SD card within the SD host controller

SD/MMC host controllers provide a SD Bus to plug SD cards,
but don't come with SD card plugged in :) Let the machine/board
model create and plug the SD cards when required.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200705211016.15241-5-f4bug@amsat.org>

4 years agohw/sd/milkymist: Create the SDBus at init()
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 20:56:07 +0000 (22:56 +0200)]
hw/sd/milkymist: Create the SDBus at init()

We don't need to wait until realize() to create the SDBus,
create it in init() directly.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200705211016.15241-4-f4bug@amsat.org>

4 years agohw/lm32/milkymist: Un-inline milkymist_memcard_create()
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 20:50:52 +0000 (22:50 +0200)]
hw/lm32/milkymist: Un-inline milkymist_memcard_create()

As we will modify milkymist_memcard_create(), move it first
to the source file where it is used.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200705211016.15241-2-f4bug@amsat.org>

4 years agohw/sd/pxa2xx_mmci: Trivial simplification
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 21:22:57 +0000 (23:22 +0200)]
hw/sd/pxa2xx_mmci: Trivial simplification

Avoid declaring PXA2xxMMCIState local variable, return it directly.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200705213350.24725-3-f4bug@amsat.org>

4 years agohw/sd/pxa2xx_mmci: Do not create SD card within the SD host controller
Philippe Mathieu-Daudé [Sun, 5 Jul 2020 21:22:10 +0000 (23:22 +0200)]
hw/sd/pxa2xx_mmci: Do not create SD card within the SD host controller

SD/MMC host controllers provide a SD Bus to plug SD cards,
but don't come with SD card plugged in :)

The machine/board object is where the SD cards are created.
Since the PXA2xx is not qdevified, for now create the cards
in pxa270_init() which is the SoC model.
In the future we will move this to the board model.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200705213350.24725-2-f4bug@amsat.org>

4 years agoiotests: Test node/bitmap aliases during migration
Max Reitz [Thu, 20 Aug 2020 15:07:25 +0000 (17:07 +0200)]
iotests: Test node/bitmap aliases during migration

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200820150725.68687-4-mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Eric Blake <eblake@redhat.com>
[eblake: fold in python cleanups recommended by Vladimir]
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoiotests.py: Let wait_migration() return on failure
Max Reitz [Thu, 20 Aug 2020 15:07:24 +0000 (17:07 +0200)]
iotests.py: Let wait_migration() return on failure

Let wait_migration() return on failure (with the return value indicating
whether the migration was completed or has failed), so we can use it for
migrations that are expected to fail, too.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200820150725.68687-3-mreitz@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agomigration: Add block-bitmap-mapping parameter
Max Reitz [Thu, 20 Aug 2020 15:07:23 +0000 (17:07 +0200)]
migration: Add block-bitmap-mapping parameter

This migration parameter allows mapping block node names and bitmap
names to aliases for the purpose of block dirty bitmap migration.

This way, management tools can use different node and bitmap names on
the source and destination and pass the mapping of how bitmaps are to be
transferred to qemu (on the source, the destination, or even both with
arbitrary aliases in the migration stream).

While touching this code, fix a bug where bitmap names longer than 255
bytes would fail an assertion in qemu_put_counted_string().

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200820150725.68687-2-mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoiotests: dump QCOW2 header in JSON in #303
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:57 +0000 (22:35 +0300)]
iotests: dump QCOW2 header in JSON in #303

Extend the test case #303 by dumping QCOW2 image metadata in JSON
format.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-12-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoqcow2_format.py: support dumping metadata in JSON format
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:56 +0000 (22:35 +0300)]
qcow2_format.py: support dumping metadata in JSON format

Implementation of dumping QCOW2 image metadata.
The sample output:
{
    "Header_extensions": [
        {
            "name": "Feature table",
            "magic": 1745090647,
            "length": 192,
            "data_str": "<binary>"
        },
        {
            "name": "Bitmaps",
            "magic": 595929205,
            "length": 24,
            "data": {
                "nb_bitmaps": 2,
                "reserved32": 0,
                "bitmap_directory_size": 64,
                "bitmap_directory_offset": 1048576,
                "bitmap_directory": [
                    {
                        "name": "bitmap-1",
                        "bitmap_table_offset": 589824,
                        "bitmap_table_size": 1,
                        "flags": 2,
                        "type": 1,
                        "granularity_bits": 15,
                        "name_size": 8,
                        "extra_data_size": 0,
                        "bitmap_table": [
                            {
                                "type": "serialized",
                                "offset": 655360
                            },
                            ...

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-11-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoqcow2_format.py: collect fields to dump in JSON format
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:55 +0000 (22:35 +0300)]
qcow2_format.py: collect fields to dump in JSON format

As __dict__ is being extended with class members we do not want to
print, add the to_json() method to classes that returns a json-dumpable
object with desired fields and their values. Extend it in subclass when
necessary to print the final dictionary in the JSON output which
follows.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Message-Id: <1596742557-320265-10-git-send-email-andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoqcow2.py: Introduce '-j' key to dump in JSON format
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:54 +0000 (22:35 +0300)]
qcow2.py: Introduce '-j' key to dump in JSON format

Add the command key to the qcow2.py arguments list to dump QCOW2
metadata in JSON format. Here is the suggested way to do that. The
implementation of the dump in JSON format is in the patch that follows.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-9-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoqcow2_format.py: Dump bitmap table serialized entries
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:53 +0000 (22:35 +0300)]
qcow2_format.py: Dump bitmap table serialized entries

Add bitmap table information to the QCOW2 metadata dump.

Bitmap name               bitmap-1
...
Bitmap table   type            size         offset
0              serialized      65536        10092544
1              all-zeroes      0            0
2              all-zeroes      0            0

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-8-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoqcow2_format.py: pass cluster size to substructures
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:52 +0000 (22:35 +0300)]
qcow2_format.py: pass cluster size to substructures

The cluster size of an image is the QcowHeader class member and may be
obtained by dependent extension structures such as Qcow2BitmapExt for
further bitmap table details print.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-7-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoqcow2_format.py: Dump bitmap directory information
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:51 +0000 (22:35 +0300)]
qcow2_format.py: Dump bitmap directory information

Read and dump entries from the bitmap directory of QCOW2 image.

Header extension:
magic                     0x23852875 (Bitmaps)
...
Bitmap name               bitmap-1
bitmap_table_offset       0xf0000
bitmap_table_size         1
flags                     0x2 (['auto'])
type                      1
granularity_bits          16
name_size                 8
extra_data_size           0

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-6-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoqcow2_format.py: dump bitmap flags in human readable way.
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:50 +0000 (22:35 +0300)]
qcow2_format.py: dump bitmap flags in human readable way.

Introduce the class BitmapFlags that parses a bitmap flags mask.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-5-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoqcow2_format.py: change Qcow2BitmapExt initialization method
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:49 +0000 (22:35 +0300)]
qcow2_format.py: change Qcow2BitmapExt initialization method

There are two ways to initialize a class derived from Qcow2Struct:
1. Pass a block of binary data to the constructor.
2. Pass the file descriptor to allow reading the file from constructor.
Let's change the Qcow2BitmapExt initialization method from 1 to 2 to
support a scattered reading in the initialization chain.
The implementation comes with the patch that follows.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-4-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoqcow2_format.py: make printable data an extension class member
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:48 +0000 (22:35 +0300)]
qcow2_format.py: make printable data an extension class member

Let us differ binary data type from string one for the extension data
variable and keep the string as the QcowHeaderExtension class member.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-3-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoiotests: add test for QCOW2 header dump
Andrey Shinkevich [Thu, 6 Aug 2020 19:35:47 +0000 (22:35 +0300)]
iotests: add test for QCOW2 header dump

The simple script creates a QCOW2 image and fills it with some data.
Two bitmaps are created as well. Then the script reads the image header
with extensions from the disk by running the script qcow2.py and dumps
the information to the output. Other entities, such as snapshots, may
be added to the test later.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-2-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
4 years agoMerge remote-tracking branch 'remotes/philmd-gitlab/tags/acceptance-testing-20200812...
Peter Maydell [Fri, 21 Aug 2020 13:51:43 +0000 (14:51 +0100)]
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/acceptance-testing-20200812' into staging

Acceptance tests patches

- Use stable URLs for the Debian and Ubuntu installer
  (Ubuntu has been updated last Wednesday, August 5, 2020).

CI jobs results:
. https://cirrus-ci.com/build/6385815351721984
. https://gitlab.com/philmd/qemu/-/pipelines/177054604

# gpg: Signature made Wed 12 Aug 2020 14:17:09 BST
# 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/acceptance-testing-20200812:
  acceptance: use stable URLs for the Debian and Ubuntu installer
  tests/acceptance/boot_linux: Extract common URL from xlnx-versal test

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
Peter Maydell [Fri, 21 Aug 2020 11:42:49 +0000 (12:42 +0100)]
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging

New build system, with "fake in-tree builds" support.

Missing:
* converting configure tests
* converting unit tests
* converting some remaining parts of the installation

# gpg: Signature made Fri 21 Aug 2020 11:33:35 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: (152 commits)
  docs: convert build system documentation to rST
  meson: update build-system documentation
  meson: avoid unstable module warning with Meson 0.56.0 or newer
  meson: convert po/
  meson: convert VNC and dependent libraries to meson
  meson: move SDL and SDL-image detection to meson
  meson: convert sample plugins
  meson: replace create-config with meson configure_file
  rules.mak: drop unneeded macros
  meson: convert check-block
  meson: build texi doc
  docs: automatically track manual dependencies
  meson: sphinx-build
  remove Makefile.target
  rules.mak: remove version.o
  meson: convert systemtap files
  configure: place compatibility symlinks in target directories
  meson: link emulators without Makefile.target
  meson: plugins
  meson: cpu-emu
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agodocs: convert build system documentation to rST
Paolo Bonzini [Tue, 11 Aug 2020 16:34:40 +0000 (18:34 +0200)]
docs: convert build system documentation to rST

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: update build-system documentation
Paolo Bonzini [Tue, 4 Feb 2020 10:43:54 +0000 (11:43 +0100)]
meson: update build-system documentation

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: avoid unstable module warning with Meson 0.56.0 or newer
Paolo Bonzini [Mon, 10 Aug 2020 16:04:43 +0000 (18:04 +0200)]
meson: avoid unstable module warning with Meson 0.56.0 or newer

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert po/
Marc-André Lureau [Thu, 19 Sep 2019 17:02:09 +0000 (21:02 +0400)]
meson: convert po/

Meson warns if xgettext is not found.  In the future we may want to add
a required argument to i18n.gettext(); in the meanwhile, I am adding a
--enable-gettext/--disable-gettext option and feature detection in
configure.  This preserves QEMU's default behavior of detecting system
features, without any warning, if neither --enable-* nor --disable-*
is requested.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert VNC and dependent libraries to meson
Paolo Bonzini [Thu, 6 Feb 2020 14:48:52 +0000 (15:48 +0100)]
meson: convert VNC and dependent libraries to meson

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: move SDL and SDL-image detection to meson
Paolo Bonzini [Thu, 6 Feb 2020 13:17:15 +0000 (14:17 +0100)]
meson: move SDL and SDL-image detection to meson

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert sample plugins
Paolo Bonzini [Tue, 4 Feb 2020 15:09:05 +0000 (16:09 +0100)]
meson: convert sample plugins

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: replace create-config with meson configure_file
Paolo Bonzini [Tue, 4 Aug 2020 16:14:26 +0000 (18:14 +0200)]
meson: replace create-config with meson configure_file

Move the create-config logic to meson.build; create a
configuration_data object and let meson handle the
quoting and output.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agorules.mak: drop unneeded macros
Paolo Bonzini [Thu, 12 Dec 2019 12:30:36 +0000 (13:30 +0100)]
rules.mak: drop unneeded macros

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert check-block
Paolo Bonzini [Tue, 28 Jan 2020 13:49:18 +0000 (14:49 +0100)]
meson: convert check-block

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: build texi doc
Paolo Bonzini [Wed, 5 Aug 2020 11:07:48 +0000 (13:07 +0200)]
meson: build texi doc

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agodocs: automatically track manual dependencies
Paolo Bonzini [Tue, 11 Aug 2020 07:07:04 +0000 (09:07 +0200)]
docs: automatically track manual dependencies

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: sphinx-build
Paolo Bonzini [Wed, 5 Aug 2020 13:49:10 +0000 (15:49 +0200)]
meson: sphinx-build

For now, sphinx is run on every invocation of make.  The previous mechanism
using $(wildcard) is not reproducible in Meson and was also brittle; for
example some .rst.inc files were left out.  The next patch will introduce
a Sphinx extension to emit a depfile.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoremove Makefile.target
Paolo Bonzini [Wed, 5 Aug 2020 11:05:13 +0000 (13:05 +0200)]
remove Makefile.target

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agorules.mak: remove version.o
Marc-André Lureau [Wed, 4 Sep 2019 12:51:52 +0000 (16:51 +0400)]
rules.mak: remove version.o

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert systemtap files
Marc-André Lureau [Tue, 20 Aug 2019 08:29:52 +0000 (12:29 +0400)]
meson: convert systemtap files

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoconfigure: place compatibility symlinks in target directories
Paolo Bonzini [Wed, 19 Aug 2020 19:36:59 +0000 (15:36 -0400)]
configure: place compatibility symlinks in target directories

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: link emulators without Makefile.target
Paolo Bonzini [Mon, 3 Aug 2020 15:04:25 +0000 (17:04 +0200)]
meson: link emulators without Makefile.target

The binaries move to the root directory, e.g. qemu-system-i386 or
qemu-arm.  This requires changes to qtests, CI, etc.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: plugins
Paolo Bonzini [Fri, 24 Jan 2020 12:08:01 +0000 (13:08 +0100)]
meson: plugins

For now link arguments end up in Makefile.target, they will move to the
right place soon.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: cpu-emu
Marc-André Lureau [Sun, 18 Aug 2019 15:51:17 +0000 (19:51 +0400)]
meson: cpu-emu

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: bsd-user
Marc-André Lureau [Sun, 18 Aug 2019 15:20:37 +0000 (19:20 +0400)]
meson: bsd-user

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: linux-user
Marc-André Lureau [Sun, 18 Aug 2019 12:13:08 +0000 (16:13 +0400)]
meson: linux-user

The most interesting or most complicated part here is the syscall_nr.h
generators.  In order to keep the generation logic all in meson.build,
I am adding to config_target the name of the .tbl file, and making the
generated file syscall<SUFFIX>_nr.h for input file syscall<SUFFIX>.tbl.

For architectures where the input file is not named syscall_nr.tbl,
syscall_nr.h has to be a source file; it's just a forwarder for x86
(i386/x86_64), while for MIPS64 it chooses between N32 and N64 ABIs.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: accel
Marc-André Lureau [Sun, 18 Aug 2019 12:13:08 +0000 (16:13 +0400)]
meson: accel

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: target
Paolo Bonzini [Fri, 7 Aug 2020 10:10:23 +0000 (12:10 +0200)]
meson: target

Similar to hw_arch, each architecture defines two sourceset which are placed in
dictionaries target_arch and target_softmmu_arch.  These are then picked up
from there when building the per-emulator static_library.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/arch*
Marc-André Lureau [Sat, 17 Aug 2019 09:55:58 +0000 (13:55 +0400)]
meson: convert hw/arch*

Each architecture's sourceset is placed in an hw_arch dictionary, and picked up
from there when building the per-emulator static_library.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/9pfs, cleanup
Marc-André Lureau [Sat, 17 Aug 2019 08:04:43 +0000 (12:04 +0400)]
meson: convert hw/9pfs, cleanup

hw/Makefile.objs is gone so there is more code that can be removed.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/acpi
Marc-André Lureau [Sat, 17 Aug 2019 07:40:51 +0000 (11:40 +0400)]
meson: convert hw/acpi

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/adc
Marc-André Lureau [Sat, 17 Aug 2019 07:34:47 +0000 (11:34 +0400)]
meson: convert hw/adc

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/audio
Marc-André Lureau [Sat, 17 Aug 2019 07:33:44 +0000 (11:33 +0400)]
meson: convert hw/audio

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/block
Marc-André Lureau [Sat, 17 Aug 2019 07:30:59 +0000 (11:30 +0400)]
meson: convert hw/block

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/char
Marc-André Lureau [Sat, 17 Aug 2019 07:25:08 +0000 (11:25 +0400)]
meson: convert hw/char

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/cpu
Marc-André Lureau [Sat, 17 Aug 2019 07:21:13 +0000 (11:21 +0400)]
meson: convert hw/cpu

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/display
Marc-André Lureau [Sat, 17 Aug 2019 07:03:19 +0000 (11:03 +0400)]
meson: convert hw/display

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/dma
Marc-André Lureau [Fri, 16 Aug 2019 15:06:19 +0000 (19:06 +0400)]
meson: convert hw/dma

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/gpio
Marc-André Lureau [Fri, 16 Aug 2019 15:03:55 +0000 (19:03 +0400)]
meson: convert hw/gpio

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/hyperv
Marc-André Lureau [Fri, 16 Aug 2019 15:02:41 +0000 (19:02 +0400)]
meson: convert hw/hyperv

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/i2c
Marc-André Lureau [Fri, 16 Aug 2019 15:00:37 +0000 (19:00 +0400)]
meson: convert hw/i2c

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/ide
Marc-André Lureau [Fri, 16 Aug 2019 14:56:47 +0000 (18:56 +0400)]
meson: convert hw/ide

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/input
Marc-André Lureau [Fri, 16 Aug 2019 14:39:54 +0000 (18:39 +0400)]
meson: convert hw/input

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/intc
Marc-André Lureau [Fri, 16 Aug 2019 14:36:51 +0000 (18:36 +0400)]
meson: convert hw/intc

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/ipack
Marc-André Lureau [Fri, 16 Aug 2019 14:23:55 +0000 (18:23 +0400)]
meson: convert hw/ipack

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/ipmi
Marc-André Lureau [Fri, 16 Aug 2019 14:22:36 +0000 (18:22 +0400)]
meson: convert hw/ipmi

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/isa
Marc-André Lureau [Fri, 16 Aug 2019 14:20:39 +0000 (18:20 +0400)]
meson: convert hw/isa

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/misc
Marc-André Lureau [Fri, 16 Aug 2019 14:15:00 +0000 (18:15 +0400)]
meson: convert hw/misc

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/net
Marc-André Lureau [Fri, 16 Aug 2019 13:48:00 +0000 (17:48 +0400)]
meson: convert hw/net

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/rdma
Marc-André Lureau [Fri, 16 Aug 2019 13:47:43 +0000 (17:47 +0400)]
meson: convert hw/rdma

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomeson: convert hw/nvram
Marc-André Lureau [Fri, 16 Aug 2019 13:35:29 +0000 (17:35 +0400)]
meson: convert hw/nvram

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>