Re: QEMU latest release riscv32-softmmu not working

2020-08-14 Thread Philippe Mathieu-Daudé
Hi Arman,

On 8/13/20 10:20 PM, arman avetisyan wrote:
> Hi QEMU Team, having issue running riscv32-softmmu

Cc'ing this to the QEMU RISCV mailing list.

> 
> After running riscv32-softmmu supplying custom linux build it crashes
> and complains about rom segments overlaping
> 
> $ qemu-system-riscv32 -nographic -machine virt -kernel bbl   -append
> "root=/dev/vda ro console=ttyS0"   -drive
> file=busybear.bin,format=raw,id=hd0   -device virtio-blk-device,drive=hd0
> 
> Log:
> rom: requested regions overlap (rom phdr #0: bbl.
> free=0x8000c160, addr=0x8000)
> qemu-system-riscv32: rom check and register reset failed
> 
> qemu version = 5.1.0
> Pulled from github.com  (latest commit in master =
> also tagged v5.1.0)
> 
> Same files are used in 4.2.0 and are working fine.
> Tried different kernel files, all had same issue.
> 
> How can I help to debug it? I really want to modify QEMU to support new
> board/machine but having hard time building latest version from github
> (which happens to be release v5.1.0)
> 
> Thanks, Arman




Re: [PULL 3/3] configure: Allow to build tools without pixman

2020-08-14 Thread Philippe Mathieu-Daudé
On 8/13/20 9:07 PM, Thomas Huth wrote:
> On 12/08/2020 18.26, Philippe Mathieu-Daudé wrote:
>> Hi,
>>
>> On 7/24/20 6:42 PM, Gerd Hoffmann wrote:
>>> From: Thomas Huth 
>>>
>>> If pixman is not installed, it is currently not possible to run:
>>>
>>>  .../configure  --disable-system --enable-tools
>>>
>>> Seems like there was a dependency from one of the required source
>>> files to pixman in the past, but since commit 1ac0206b2ae1ffaeec56
>>> ("qemu-timer.c: Trim list of included headers"), this dependency
>>> should be gone. Thus allow to compile the tools without pixman now.
>>>
>>> Signed-off-by: Thomas Huth 
>>> Message-id: 20200723141123.14765-1-th...@redhat.com
>>> Signed-off-by: Gerd Hoffmann 
>>> ---
>>>  configure | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/configure b/configure
>>> index 4bd80ed507aa..2acc4d1465f8 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -4065,7 +4065,7 @@ fi
>>>  ##
>>>  # pixman support probe
>>>  
>>> -if test "$want_tools" = "no" && test "$softmmu" = "no"; then
>>> +if test "$softmmu" = "no"; then
>>>pixman_cflags=
>>>pixman_libs=
>>>  elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
>>>
>>
>> This commit broke my '--disable-system --disable-user --enable-tools' build:
>>
>> $ make vhost-user-gpu
> 
> Yes, there is already a patch on the list to fix this. Look for:
> "configure: Require pixman for vhost-user-gpu". I hope Gerd can pick it
> up for his next pull request.

Thanks! I'll test it. Too bad it misses the release :(

> 
>  Thomas
> 




Re: [PATCH] configure: Require pixman for vhost-user-gpu.

2020-08-14 Thread Philippe Mathieu-Daudé
On 8/3/20 8:09 AM, Thomas Huth wrote:
> On 02/08/2020 00.44, Rafael Kitover wrote:
>> Use the test from Makefile to check if vhost-user-gpu is being built,
>> and if so require pixman.
> 
> Fixes: 9b52b17ba5 ("configure: Allow to build tools without pixman")
> 
> ... sorry, I missed that there is indeed a tool that requires pixman.
> 
>> Signed-off-by: Rafael Kitover 
>> ---
>>  configure | 28 ++--
>>  1 file changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 2acc4d1465..181b465861 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4062,20 +4062,6 @@ if test "$modules" = yes; then
>>  fi
>>  fi
>>  
>> -##
>> -# pixman support probe
>> -
>> -if test "$softmmu" = "no"; then
>> -  pixman_cflags=
>> -  pixman_libs=
>> -elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
>> -  pixman_cflags=$($pkg_config --cflags pixman-1)
>> -  pixman_libs=$($pkg_config --libs pixman-1)
>> -else
>> -  error_exit "pixman >= 0.21.8 not present." \
>> -  "Please install the pixman devel package."
>> -fi
>> -
>>  ##
>>  # libmpathpersist probe
>>  
>> @@ -4491,6 +4477,20 @@ if test "$opengl" = "yes" && test "$have_x11" = 
>> "yes"; then
>>done
>>  fi
>>  
>> +##
>> +# pixman support probe
>> +
>> +if test "$softmmu" = "no" && ! ( test "${linux} ${virglrenderer} ${gbm} 
>> ${want_tools}" = "yes yes yes yes" );  then
> 
> Do you need the round brackets here?
> 
>> +  pixman_cflags=
>> +  pixman_libs=
>> +elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
>> +  pixman_cflags=$($pkg_config --cflags pixman-1)
>> +  pixman_libs=$($pkg_config --libs pixman-1)
>> +else
>> +  error_exit "pixman >= 0.21.8 not present." \
>> +  "Please install the pixman devel package."
>> +fi
>> +
>>  ##
>>  # libxml2 probe
>>  if test "$libxml2" != "no" ; then
>>
> 
> With the round brackets removed:
> 
> Reviewed-by: Thomas Huth 
> 
> 

Hmm this doesn't work for me:

$ ../configure --disable-system --disable-user --enable-tools
QEMU_CFLAGS -Werror  -pthread -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include  -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes
-Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes
-fno-strict-aliasing -fno-common -fwrapv -std=gnu99
-Wold-style-declaration -Wold-style-definition -Wtype-limits
-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers
-Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined
-Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi
-fstack-protector-strong   -I/usr/include/p11-kit-1
-DSTRUCT_IOVEC_DEFINED  -I/usr/include/libpng16  -I/usr/include/libdrm
-I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/include/nss3 -I/usr/include/nspr4 -pthread
-I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid
-I/usr/include/pixman-1  -I/usr/include/capstone
QEMU_LDFLAGS   -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64
-fstack-protector-strong
target list
static build  no
virgl support yes (0.7.0)
TCG support   no
build guest agent yes

$ make vhost-user-gpu
...
  LINKvhost-user-gpu
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.o: in function
`vg_resource_create_2d':
contrib/vhost-user-gpu/vhost-user-gpu.c:322: undefined reference to
`pixman_image_create_bits'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.o: in function
`vg_resource_destroy':
contrib/vhost-user-gpu/vhost-user-gpu.c:381: undefined reference to
`pixman_image_unref'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.o: in function
`vg_transfer_to_host_2d':
contrib/vhost-user-gpu/vhost-user-gpu.c:538: undefined reference to
`pixman_image_get_format'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.c:540: undefined
reference to `pixman_image_get_stride'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.c:543: undefined
reference to `pixman_image_get_width'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.c:544: undefined
reference to `pixman_image_get_data'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.c:556: undefined
reference to `pixman_image_get_stride'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.c:557: undefined
reference to `pixman_image_get_height'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.c:555: undefined
reference to `pixman_image_get_data'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.o: in function
`vg_resource_flush':
contrib/vhost-user-gpu/vhost-user-gpu.c:693: undefined reference to
`pixman_region_init_rect'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.c:705: undefined
reference to `pixman_region_init'
/usr/bin/ld: contrib/vhost-user-gpu/vhost-user-gpu.c:706: undefined
reference to `pixman_

Re: [PATCH v5 00/14] QEMU cpus.c refactoring part2

2020-08-14 Thread Philippe Mathieu-Daudé
On 8/13/20 6:06 PM, Claudio Fontana wrote:
> Any current infra work that could cause this failure?
> 
> I do not have problems when testing this set of commands locally,
> for me it's all green.

Marc-André tried to debug this, but is having hard time reproducing.

> 
> Thanks,
> 
> Claudio
> 
> On 8/13/20 4:16 PM, no-re...@patchew.org wrote:
>> Patchew URL: https://patchew.org/QEMU/20200812183250.9221-1-cfont...@suse.de/
>>
>>
>>
>> Hi,
>>
>> This series failed the docker-quick@centos7 build test. Please find the 
>> testing commands and
>> their output below. If you have Docker installed, you can probably reproduce 
>> it
>> locally.
>>
>> === TEST SCRIPT BEGIN ===
>> #!/bin/bash
>> make docker-image-centos7 V=1 NETWORK=1
>> time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
>> === TEST SCRIPT END ===
>>
>>   TESTcheck-unit: tests/test-char
>> Unexpected error in object_property_try_add() at 
>> /tmp/qemu-test/src/qom/object.c:1181:
>> attempt to add duplicate property 'serial-id' to object (type 'container')
>> ERROR test-char - too few tests run (expected 38, got 9)
>> make: *** [check-unit] Error 1
>> make: *** Waiting for unfinished jobs
>>   TESTcheck-qtest-x86_64: tests/qtest/hd-geo-test
>> qemu-system-aarch64: -accel kvm: invalid accelerator kvm
>> ---
>> raise CalledProcessError(retcode, cmd)
>> subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', 
>> '--label', 'com.qemu.instance.uuid=e2cd2d5f1f1d4eb6bc6bcd79e3d16404', '-u', 
>> '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 
>> 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', 
>> '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', 
>> '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', 
>> '/var/tmp/patchew-tester-tmp-2np4x1wq/src/docker-src.2020-08-13-10.00.40.11908:/var/tmp/qemu:z,ro',
>>  'qemu/centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit 
>> status 2.
>> filter=--filter=label=com.qemu.instance.uuid=e2cd2d5f1f1d4eb6bc6bcd79e3d16404
>> make[1]: *** [docker-run] Error 1
>> make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-2np4x1wq/src'
>> make: *** [docker-run-test-quick@centos7] Error 2
>>
>> real15m49.276s
>> user0m8.608s
>>
>>
>> The full log is available at
>> http://patchew.org/logs/20200812183250.9221-1-cfont...@suse.de/testing.docker-quick@centos7/?type=message.
>> ---
>> Email generated automatically by Patchew [https://patchew.org/].
>> Please send your feedback to patchew-de...@redhat.com
>>
> 




[PATCH 0/7] block: Use definitions instead of magic values

2020-08-14 Thread Philippe Mathieu-Daudé
Trivial block patches:
- Fix a typo
- Replace '1 << 30' by '1 * GiB' in null-co
- Replace 512 by BDRV_SECTOR_SIZE when appropriate.

Philippe Mathieu-Daudé (7):
  block/null: Make more explicit the driver default size is 1GiB
  hw/ide/core: Trivial typo fix
  hw/ide/core: Replace magic '512' value by BDRV_SECTOR_SIZE
  hw/ide/ahci: Replace magic '512' value by BDRV_SECTOR_SIZE
  hw/ide/atapi: Replace magic '512' value by BDRV_SECTOR_SIZE
  hw/ide/pci: Replace magic '512' value by BDRV_SECTOR_SIZE
  hw/scsi/scsi-disk: Replace magic '512' value by BDRV_SECTOR_SIZE

 block/null.c|  4 +++-
 hw/ide/ahci.c   |  5 +++--
 hw/ide/atapi.c  |  8 
 hw/ide/core.c   | 25 +
 hw/ide/pci.c|  2 +-
 hw/scsi/scsi-disk.c | 44 +++-
 6 files changed, 47 insertions(+), 41 deletions(-)

-- 
2.21.3




[PATCH 2/7] hw/ide/core: Trivial typo fix

2020-08-14 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/ide/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index d997a78e47..f76f7e5234 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -709,7 +709,7 @@ void ide_cancel_dma_sync(IDEState *s)
 /*
  * We can't cancel Scatter Gather DMA in the middle of the
  * operation or a partial (not full) DMA transfer would reach
- * the storage so we wait for completion instead (we beahve
+ * the storage so we wait for completion instead (we behave
  * like if the DMA was completed by the time the guest trying
  * to cancel dma with bmdma_cmd_writeb with BM_CMD_START not
  * set).
-- 
2.21.3




[PATCH 1/7] block/null: Make more explicit the driver default size is 1GiB

2020-08-14 Thread Philippe Mathieu-Daudé
As it is not obvious the default size for the null block driver
is 1 GiB, replace the obfuscated '1 << 30' magic value by a
definition using IEC binary prefixes.

Signed-off-by: Philippe Mathieu-Daudé 
---
 block/null.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/null.c b/block/null.c
index 15e1d56746..8354def367 100644
--- a/block/null.c
+++ b/block/null.c
@@ -11,6 +11,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qstring.h"
@@ -21,6 +22,7 @@
 
 #define NULL_OPT_LATENCY "latency-ns"
 #define NULL_OPT_ZEROES  "read-zeroes"
+#define NULL_OPT_SIZE(1 * GiB)
 
 typedef struct {
 int64_t length;
@@ -86,7 +88,7 @@ static int null_file_open(BlockDriverState *bs, QDict 
*options, int flags,
 opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
 qemu_opts_absorb_qdict(opts, options, &error_abort);
 s->length =
-qemu_opt_get_size(opts, BLOCK_OPT_SIZE, 1 << 30);
+qemu_opt_get_size(opts, BLOCK_OPT_SIZE, NULL_OPT_SIZE);
 s->latency_ns =
 qemu_opt_get_number(opts, NULL_OPT_LATENCY, 0);
 if (s->latency_ns < 0) {
-- 
2.21.3




[PATCH 5/7] hw/ide/atapi: Replace magic '512' value by BDRV_SECTOR_SIZE

2020-08-14 Thread Philippe Mathieu-Daudé
Use self-explicit definitions instead of magic '512' value.

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/ide/atapi.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 17a9d635d8..14a2b0bb2f 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -824,9 +824,9 @@ static void cmd_get_configuration(IDEState *s, uint8_t *buf)
  *
  *  Only a problem if the feature/profiles grow.
  */
-if (max_len > 512) {
+if (max_len > BDRV_SECTOR_SIZE) {
 /* XXX: assume 1 sector */
-max_len = 512;
+max_len = BDRV_SECTOR_SIZE;
 }
 
 memset(buf, 0, max_len);
@@ -1186,8 +1186,8 @@ static void cmd_read_dvd_structure(IDEState *s, uint8_t* 
buf)
 }
 }
 
-memset(buf, 0, max_len > IDE_DMA_BUF_SECTORS * 512 + 4 ?
-   IDE_DMA_BUF_SECTORS * 512 + 4 : max_len);
+memset(buf, 0, max_len > IDE_DMA_BUF_SECTORS * BDRV_SECTOR_SIZE + 4 ?
+   IDE_DMA_BUF_SECTORS * BDRV_SECTOR_SIZE + 4 : max_len);
 
 switch (format) {
 case 0x00 ... 0x7f:
-- 
2.21.3




[PATCH 4/7] hw/ide/ahci: Replace magic '512' value by BDRV_SECTOR_SIZE

2020-08-14 Thread Philippe Mathieu-Daudé
Use self-explicit definitions instead of magic '512' value.

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/ide/ahci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 009120f88b..b696c6291a 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1151,7 +1151,7 @@ static void process_ncq_command(AHCIState *s, int port, 
uint8_t *cmd_fis,
 if (!ncq_tfs->sector_count) {
 ncq_tfs->sector_count = 0x1;
 }
-size = ncq_tfs->sector_count * 512;
+size = ncq_tfs->sector_count * BDRV_SECTOR_SIZE;
 ahci_populate_sglist(ad, &ncq_tfs->sglist, ncq_tfs->cmdh, size, 0);
 
 if (ncq_tfs->sglist.size < size) {
@@ -1703,7 +1703,8 @@ static int ahci_state_post_load(void *opaque, int 
version_id)
 return -1;
 }
 ahci_populate_sglist(ncq_tfs->drive, &ncq_tfs->sglist,
- ncq_tfs->cmdh, ncq_tfs->sector_count * 512,
+ ncq_tfs->cmdh,
+ ncq_tfs->sector_count * BDRV_SECTOR_SIZE,
  0);
 if (ncq_tfs->sector_count != ncq_tfs->sglist.size >> 9) {
 return -1;
-- 
2.21.3




[PATCH 3/7] hw/ide/core: Replace magic '512' value by BDRV_SECTOR_SIZE

2020-08-14 Thread Philippe Mathieu-Daudé
Use self-explicit definitions instead of magic '512' value.

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/ide/core.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index f76f7e5234..bcb2aa85fc 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -121,7 +121,7 @@ static void ide_identify(IDEState *s)
 put_le16(p + 0, 0x0040);
 put_le16(p + 1, s->cylinders);
 put_le16(p + 3, s->heads);
-put_le16(p + 4, 512 * s->sectors); /* XXX: retired, remove ? */
+put_le16(p + 4, BDRV_SECTOR_SIZE * s->sectors); /* XXX: retired, remove ? 
*/
 put_le16(p + 5, 512); /* XXX: retired, remove ? */
 put_le16(p + 6, s->sectors);
 padstr((char *)(p + 10), s->drive_serial_str, 20); /* serial number */
@@ -864,7 +864,7 @@ static void ide_dma_cb(void *opaque, int ret)
 }
 }
 
-if (s->io_buffer_size > s->nsector * 512) {
+if (s->io_buffer_size > s->nsector * BDRV_SECTOR_SIZE) {
 /*
  * The PRDs were longer than needed for this request.
  * The Active bit must remain set after the request completes.
@@ -877,7 +877,7 @@ static void ide_dma_cb(void *opaque, int ret)
 
 sector_num = ide_get_sector(s);
 if (n > 0) {
-assert(n * 512 == s->sg.size);
+assert(n * BDRV_SECTOR_SIZE == s->sg.size);
 dma_buf_commit(s, s->sg.size);
 sector_num += n;
 ide_set_sector(s, sector_num);
@@ -894,17 +894,17 @@ static void ide_dma_cb(void *opaque, int ret)
 /* launch next transfer */
 n = s->nsector;
 s->io_buffer_index = 0;
-s->io_buffer_size = n * 512;
+s->io_buffer_size = n * BDRV_SECTOR_SIZE;
 prep_size = s->bus->dma->ops->prepare_buf(s->bus->dma, s->io_buffer_size);
 /* prepare_buf() must succeed and respect the limit */
-assert(prep_size >= 0 && prep_size <= n * 512);
+assert(prep_size >= 0 && prep_size <= n * BDRV_SECTOR_SIZE);
 
 /*
  * Now prep_size stores the number of bytes in the sglist, and
  * s->io_buffer_size stores the number of bytes described by the PRDs.
  */
 
-if (prep_size < n * 512) {
+if (prep_size < n * BDRV_SECTOR_SIZE) {
 /*
  * The PRDs are too short for this request. Error condition!
  * Reset the Active bit and don't raise the interrupt.
@@ -1412,7 +1412,8 @@ static bool cmd_identify(IDEState *s, uint8_t cmd)
 ide_cfata_identify(s);
 }
 s->status = READY_STAT | SEEK_STAT;
-ide_transfer_start(s, s->io_buffer, 512, ide_transfer_stop);
+ide_transfer_start(s, s->io_buffer, BDRV_SECTOR_SIZE,
+   ide_transfer_stop);
 ide_set_irq(s->bus);
 return false;
 } else {
@@ -1482,7 +1483,7 @@ static bool cmd_write_multiple(IDEState *s, uint8_t cmd)
 n = MIN(s->nsector, s->req_nb_sectors);
 
 s->status = SEEK_STAT | READY_STAT;
-ide_transfer_start(s, s->io_buffer, 512 * n, ide_sector_write);
+ide_transfer_start(s, s->io_buffer, BDRV_SECTOR_SIZE * n, 
ide_sector_write);
 
 s->media_changed = 1;
 
@@ -1524,7 +1525,7 @@ static bool cmd_write_pio(IDEState *s, uint8_t cmd)
 
 s->req_nb_sectors = 1;
 s->status = SEEK_STAT | READY_STAT;
-ide_transfer_start(s, s->io_buffer, 512, ide_sector_write);
+ide_transfer_start(s, s->io_buffer, BDRV_SECTOR_SIZE, ide_sector_write);
 
 s->media_changed = 1;
 
@@ -1678,7 +1679,7 @@ static bool cmd_identify_packet(IDEState *s, uint8_t cmd)
 {
 ide_atapi_identify(s);
 s->status = READY_STAT | SEEK_STAT;
-ide_transfer_start(s, s->io_buffer, 512, ide_transfer_stop);
+ide_transfer_start(s, s->io_buffer, BDRV_SECTOR_SIZE, ide_transfer_stop);
 ide_set_irq(s->bus);
 return false;
 }
@@ -2559,7 +2560,7 @@ static void ide_init1(IDEBus *bus, int unit)
 s->unit = unit;
 s->drive_serial = drive_serial++;
 /* we need at least 2k alignment for accessing CDROMs using O_DIRECT */
-s->io_buffer_total_len = IDE_DMA_BUF_SECTORS*512 + 4;
+s->io_buffer_total_len = IDE_DMA_BUF_SECTORS * BDRV_SECTOR_SIZE + 4;
 s->io_buffer = qemu_memalign(2048, s->io_buffer_total_len);
 memset(s->io_buffer, 0, s->io_buffer_total_len);
 
-- 
2.21.3




[PATCH 6/7] hw/ide/pci: Replace magic '512' value by BDRV_SECTOR_SIZE

2020-08-14 Thread Philippe Mathieu-Daudé
Use self-explicit definitions instead of magic '512' value.

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/ide/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 5e85c4ad17..b50091b615 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -138,7 +138,7 @@ static int32_t bmdma_prepare_buf(const IDEDMA *dma, int32_t 
limit)
 int l, len;
 
 pci_dma_sglist_init(&s->sg, pci_dev,
-s->nsector / (BMDMA_PAGE_SIZE / 512) + 1);
+s->nsector / (BMDMA_PAGE_SIZE / BDRV_SECTOR_SIZE) + 1);
 s->io_buffer_size = 0;
 for(;;) {
 if (bm->cur_prd_len == 0) {
-- 
2.21.3




[PATCH 7/7] hw/scsi/scsi-disk: Replace magic '512' value by BDRV_SECTOR_SIZE

2020-08-14 Thread Philippe Mathieu-Daudé
Use self-explicit definitions instead of magic '512' value.

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/scsi/scsi-disk.c | 44 +++-
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 8ce68a9dd6..7612035a4e 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -71,7 +71,7 @@ typedef struct SCSIDiskClass {
 
 typedef struct SCSIDiskReq {
 SCSIRequest req;
-/* Both sector and sector_count are in terms of qemu 512 byte blocks.  */
+/* Both sector and sector_count are in terms of BDRV_SECTOR_SIZE bytes.  */
 uint64_t sector;
 uint32_t sector_count;
 uint32_t buflen;
@@ -141,7 +141,7 @@ static void scsi_init_iovec(SCSIDiskReq *r, size_t size)
 r->buflen = size;
 r->iov.iov_base = blk_blockalign(s->qdev.conf.blk, r->buflen);
 }
-r->iov.iov_len = MIN(r->sector_count * 512, r->buflen);
+r->iov.iov_len = MIN(r->sector_count * BDRV_SECTOR_SIZE, r->buflen);
 qemu_iovec_init_external(&r->qiov, &r->iov, 1);
 }
 
@@ -311,7 +311,7 @@ static void scsi_read_complete_noio(SCSIDiskReq *r, int ret)
 goto done;
 }
 
-n = r->qiov.size / 512;
+n = r->qiov.size / BDRV_SECTOR_SIZE;
 r->sector += n;
 r->sector_count -= n;
 scsi_req_data(&r->req, r->qiov.size);
@@ -505,7 +505,7 @@ static void scsi_write_complete_noio(SCSIDiskReq *r, int 
ret)
 goto done;
 }
 
-n = r->qiov.size / 512;
+n = r->qiov.size / BDRV_SECTOR_SIZE;
 r->sector += n;
 r->sector_count -= n;
 if (r->sector_count == 0) {
@@ -1284,7 +1284,7 @@ static int scsi_disk_emulate_mode_sense(SCSIDiskReq *r, 
uint8_t *outbuf)
 } else { /* MODE_SENSE_10 */
 outbuf[7] = 8; /* Block descriptor length  */
 }
-nb_sectors /= (s->qdev.blocksize / 512);
+nb_sectors /= (s->qdev.blocksize / BDRV_SECTOR_SIZE);
 if (nb_sectors > 0xff) {
 nb_sectors = 0;
 }
@@ -1342,7 +1342,7 @@ static int scsi_disk_emulate_read_toc(SCSIRequest *req, 
uint8_t *outbuf)
 start_track = req->cmd.buf[6];
 blk_get_geometry(s->qdev.conf.blk, &nb_sectors);
 trace_scsi_disk_emulate_read_toc(start_track, format, msf >> 1);
-nb_sectors /= s->qdev.blocksize / 512;
+nb_sectors /= s->qdev.blocksize / BDRV_SECTOR_SIZE;
 switch (format) {
 case 0:
 toclen = cdrom_read_toc(nb_sectors, outbuf, msf, start_track);
@@ -1738,9 +1738,10 @@ static void scsi_write_same_complete(void *opaque, int 
ret)
 
 block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct);
 
-data->nb_sectors -= data->iov.iov_len / 512;
-data->sector += data->iov.iov_len / 512;
-data->iov.iov_len = MIN(data->nb_sectors * 512, data->iov.iov_len);
+data->nb_sectors -= data->iov.iov_len / BDRV_SECTOR_SIZE;
+data->sector += data->iov.iov_len / BDRV_SECTOR_SIZE;
+data->iov.iov_len = MIN(data->nb_sectors * BDRV_SECTOR_SIZE,
+data->iov.iov_len);
 if (data->iov.iov_len) {
 block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct,
  data->iov.iov_len, BLOCK_ACCT_WRITE);
@@ -1805,9 +1806,10 @@ static void scsi_disk_emulate_write_same(SCSIDiskReq *r, 
uint8_t *inbuf)
 
 data = g_new0(WriteSameCBData, 1);
 data->r = r;
-data->sector = r->req.cmd.lba * (s->qdev.blocksize / 512);
-data->nb_sectors = nb_sectors * (s->qdev.blocksize / 512);
-data->iov.iov_len = MIN(data->nb_sectors * 512, SCSI_WRITE_SAME_MAX);
+data->sector = r->req.cmd.lba * (s->qdev.blocksize / BDRV_SECTOR_SIZE);
+data->nb_sectors = nb_sectors * (s->qdev.blocksize / BDRV_SECTOR_SIZE);
+data->iov.iov_len = MIN(data->nb_sectors * BDRV_SECTOR_SIZE,
+SCSI_WRITE_SAME_MAX);
 data->iov.iov_base = buf = blk_blockalign(s->qdev.conf.blk,
   data->iov.iov_len);
 qemu_iovec_init_external(&data->qiov, &data->iov, 1);
@@ -1980,7 +1982,7 @@ static int32_t scsi_disk_emulate_command(SCSIRequest 
*req, uint8_t *buf)
 if ((req->cmd.buf[8] & 1) == 0 && req->cmd.lba) {
 goto illegal_request;
 }
-nb_sectors /= s->qdev.blocksize / 512;
+nb_sectors /= s->qdev.blocksize / BDRV_SECTOR_SIZE;
 /* Returned value is the address of the last sector.  */
 nb_sectors--;
 /* Remember the new size for read/write sanity checking. */
@@ -2049,7 +2051,7 @@ static int32_t scsi_disk_emulate_command(SCSIRequest 
*req, uint8_t *buf)
 if ((req->cmd.buf[14] & 1) == 0 && req->cmd.lba) {
 goto illegal_request;
 }
-nb_sectors /= s->qdev.blocksize / 512;
+nb_sectors /= s->qdev.blocksize / BDRV_SECTOR_SIZE;
 /* Returned value is the address of the last sector.  */
 nb_sectors--;
 /* Remember the new size for read/write sanity checking. */
@@ -2180,

Re: QEMU latest release riscv32-softmmu not working

2020-08-14 Thread Chih-Min Chao
On Fri, Aug 14, 2020 at 3:31 PM Philippe Mathieu-Daudé 
wrote:

> Hi Arman,
>
> On 8/13/20 10:20 PM, arman avetisyan wrote:
> > Hi QEMU Team, having issue running riscv32-softmmu
>
> Cc'ing this to the QEMU RISCV mailing list.
>
> >
> > After running riscv32-softmmu supplying custom linux build it crashes
> > and complains about rom segments overlaping
> >
> > $ qemu-system-riscv32 -nographic -machine virt -kernel bbl   -append
> > "root=/dev/vda ro console=ttyS0"   -drive
> > file=busybear.bin,format=raw,id=hd0   -device virtio-blk-device,drive=hd0
> >



> Log:
> > rom: requested regions overlap (rom phdr #0: bbl.
> > free=0x8000c160, addr=0x8000)
> > qemu-system-riscv32: rom check and register reset failed
> >

Try to add "-bios none"

Chih-Min Chao

>

> qemu version = 5.1.0
> > Pulled from github.com  (latest commit in master =
> > also tagged v5.1.0)
> >
> > Same files are used in 4.2.0 and are working fine.
> > Tried different kernel files, all had same issue.
> >
> > How can I help to debug it? I really want to modify QEMU to support new
> > board/machine but having hard time building latest version from github
> > (which happens to be release v5.1.0)
> >
> > Thanks, Arman
>
>
>


Re: [PATCH 2/3] softfloat: add APIs to handle alternative sNaN propagation

2020-08-14 Thread Chih-Min Chao
On Fri, Aug 14, 2020 at 1:21 AM Richard Henderson <
richard.hender...@linaro.org> wrote:

> On 7/30/20 2:52 AM, Chih-Min Chao wrote:
> > For "fmax/fmin ft0, ft1, ft2" and if one of the inputs is sNaN,
> >   The original logic
> > return NaN and set invalid flag if ft1 == sNaN || ft2 == sNan
> >
> >   The alternative path
> > set invalid flag if ft1 == sNaN || ft2 == sNaN
> > return NaN if ft1 == sNaN && ft2 == sNaN
> >
> >The ieee754 spec allows both implementation and some architecture such
> >as riscv choose differenct defintion in two spec versions.
> >(riscv-spec-v2.2 use original version, riscv-spec-20191213 changes to
> > alternative)
> >
> > Signed-off-by: Chih-Min Chao 
>
> If both ft1 and ft2 are SNaN, surely the returned result is silenced?
> That is
> something that is handled by pick_nan, but is not handled here.
>
 Yes, it returns the default_nan, qNaN.


>
> Also, the patch subject should be modified to emphasize that this only
> applies
> to min/max and not propagation of all SNaN.
>
> Will be fixed in the next version.
By the way,  the other patches have been queued in softfloat-next.
Do I need to resend the other two patches in the next version or just this
one ?

Chih-Min Chao

>

>
> r~
>
>
>


Re: [PATCH v2] block/vhdx: Support vhdx image only with 512 bytes logical sector size

2020-08-14 Thread Swapnil Ingle
Ping

On 07.08.20, 12:03, "Swapnil Ingle"  wrote:

block/vhdx uses qemu block layer where sector size is always 512 bytes.
This may have issues  with 4K logical sector sized vhdx image.

For e.g qemu-img convert on such images fails with following assert:

$qemu-img convert -f vhdx -O raw 4KTest1.vhdx test.raw
qemu-img: util/iov.c:388: qiov_slice: Assertion `offset + len <=
qiov->size' failed.
Aborted

This patch adds an check to return ENOTSUP for vhdx images which
have logical sector size other than 512 bytes.

Signed-off-by: Swapnil Ingle 
---
v2: Fixed commit message, suggested by Philippe Mathieu-Daude
---
 block/vhdx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/vhdx.c b/block/vhdx.c
index 791eb90..356ec4c 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -816,9 +816,9 @@ static int vhdx_parse_metadata(BlockDriverState *bs, 
BDRVVHDXState *s)
 goto exit;
 }

-/* only 2 supported sector sizes */
-if (s->logical_sector_size != 512 && s->logical_sector_size != 4096) {
-ret = -EINVAL;
+/* Currently we only support 512 */
+if (s->logical_sector_size != 512) {
+ret = -ENOTSUP;
 goto exit;
 }

-- 
2.9.3




[PATCH 002/150] optionrom: simplify Makefile

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Make it independent from the rules.mak, and clean up to use pattern rules.

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 pc-bios/optionrom/Makefile | 67 +++---
 1 file changed, 41 insertions(+), 26 deletions(-)

diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index e33a24da0d..51cb6ca9d8 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -1,13 +1,16 @@
-all: build-all
+CURRENT_MAKEFILE := $(realpath $(word $(words 
$(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
+SRC_DIR := $(dir $(CURRENT_MAKEFILE))
+TOPSRC_DIR := $(SRC_DIR)/../..
+VPATH = $(SRC_DIR)
+
+all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
 # Dummy command so that make thinks it has done something
@true
 
 include ../../config-host.mak
-include $(SRC_PATH)/rules.mak
-
-$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
 
-.PHONY : all clean build-all
+quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
+cc-option = $(if $(shell $(CC) $1 -S -o /dev/null -xc /dev/null >/dev/null 
2>&1 && echo OK), $1, $2)
 
 # Compiling with no optimization creates ROMs that are too large
 ifeq ($(lastword $(filter -O%, -O0 $(CFLAGS))),-O0)
@@ -15,48 +18,60 @@ override CFLAGS += -O2
 endif
 override CFLAGS += -march=i486
 
-# Drop -fstack-protector and the like
-QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) $(CFLAGS_NOPIE) -ffreestanding
-QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector)
-QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -m16)
-ifeq ($(filter -m16, $(QEMU_CFLAGS)),)
+# Flags for dependency generation
+override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
+
+override CFLAGS += $(filter -W%, $(QEMU_CFLAGS))
+override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
+override CFLAGS += $(call cc-option, -fno-stack-protector)
+override CFLAGS += $(call cc-option, -m16)
+
+ifeq ($(filter -m16, $(CFLAGS)),)
 # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
 # On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
 # respect to the rest of the code.  clang does not have -fno-toplevel-reorder,
 # but it places all asm blocks at the beginning and we're relying on it for
 # the option ROM header.  So just force clang not to use the integrated
 # assembler, which doesn't support .code16gcc.
-QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-toplevel-reorder)
-QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -no-integrated-as)
-QEMU_CFLAGS += -m32 -include $(SRC_PATH)/pc-bios/optionrom/code16gcc.h
+override CFLAGS += $(call cc-option, -fno-toplevel-reorder)
+override CFLAGS += $(call cc-option, -no-integrated-as)
+override CFLAGS += -m32 -include $(SRC_DIR)/code16gcc.h
 endif
 
-QEMU_INCLUDES += -I$(SRC_PATH)
-
 Wa = -Wa,
-ASFLAGS += -32
-QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32)
+override ASFLAGS += -32
+override CFLAGS += $(call cc-option, $(Wa)-32)
 
-build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
 
-# suppress auto-removal of intermediate files
-.SECONDARY:
+LD_I386_EMULATION ?= elf_i386
+override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
+override LDFLAGS += $(LDFLAGS_NOPIE)
 
+all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
+
+pvh.img: pvh.o pvh_main.o
 
 %.o: %.S
-   $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< 
| $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
+   $(call quiet-command,$(CPP) $(CPPFLAGS) -c -o - $< | $(AS) $(ASFLAGS) 
-o $@,"AS","$@")
 
-pvh.img: pvh.o pvh_main.o
-   $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T 
$(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
+%.o: %.c
+   $(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,"CC","$@")
 
 %.img: %.o
-   $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T 
$(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
+   $(call quiet-command,$(LD) $(LDFLAGS) -s -o $@ $^,"BUILD","$@")
 
 %.raw: %.img
-   $(call quiet-command,$(OBJCOPY) -O binary -j .text $< 
$@,"BUILD","$(TARGET_DIR)$@")
+   $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$@")
 
 %.bin: %.raw
-   $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/signrom.py $< 
$@,"SIGN","$(TARGET_DIR)$@")
+   $(call quiet-command,$(PYTHON) $(TOPSRC_DIR)/scripts/signrom.py $< 
$@,"SIGN","$@")
+
+include $(wildcard *.d)
 
 clean:
rm -f *.o *.d *.raw *.img *.bin *~
+
+# suppress auto-removal of intermediate files
+.SECONDARY:
+
+.PHONY: all clean
-- 
2.26.2





[PATCH 001/150] oss-fuzz/build: remove LIB_FUZZING_ENGINE

2020-08-14 Thread Paolo Bonzini
Meson build scripts will only include qemu-fuzz-TARGET rules if configured
with --enable-fuzzing, and that takes care of adding -fsanitize=fuzzer.
Therefore we can just specify the configure option and stop modifying
the CFLAGS and CONFIG_FUZZ options in the "make" invocation.

Signed-off-by: Paolo Bonzini 
---
 scripts/oss-fuzz/build.sh | 16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/scripts/oss-fuzz/build.sh b/scripts/oss-fuzz/build.sh
index a07b3022e8..52430cb620 100755
--- a/scripts/oss-fuzz/build.sh
+++ b/scripts/oss-fuzz/build.sh
@@ -20,7 +20,7 @@
 # e.g.
 # $CXX $CXXFLAGS -std=c++11 -Iinclude \
 # /path/to/name_of_fuzzer.cc -o $OUT/name_of_fuzzer \
-# $LIB_FUZZING_ENGINE /path/to/library.a
+# -fsanitize=fuzzer /path/to/library.a
 
 fatal () {
 echo "Error : ${*}, exiting."
@@ -54,10 +54,6 @@ mkdir -p $OSS_FUZZ_BUILD_DIR || fatal "mkdir 
$OSS_FUZZ_BUILD_DIR failed"
 cd $OSS_FUZZ_BUILD_DIR || fatal "cd $OSS_FUZZ_BUILD_DIR failed"
 
 
-if [ -z ${LIB_FUZZING_ENGINE+x} ]; then
-LIB_FUZZING_ENGINE="-fsanitize=fuzzer"
-fi
-
 if [ -z ${OUT+x} ]; then
 DEST_DIR=$(realpath "./DEST_DIR")
 else
@@ -67,14 +63,12 @@ fi
 mkdir -p "$DEST_DIR/lib/"  # Copy the shared libraries here
 
 # Build once to get the list of dynamic lib paths, and copy them over
-../configure --disable-werror --cc="$CC" --cxx="$CXX" \
+../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
 --extra-cflags="$EXTRA_CFLAGS" --target-list="i386-softmmu"
 
-if ! make CONFIG_FUZZ=y CFLAGS="$LIB_FUZZING_ENGINE" "-j$(nproc)" \
-i386-softmmu/fuzz; then
+if ! make "-j$(nproc)" i386-softmmu/fuzz; then
 fatal "Build failed. Please specify a compiler with fuzzing support"\
-  "using the \$CC and \$CXX environemnt variables, or specify a"\
-  "\$LIB_FUZZING_ENGINE compatible with your compiler"\
+  "using the \$CC and \$CXX environemnt variables"\
   "\nFor example: CC=clang CXX=clang++ $0"
 fi
 
@@ -87,7 +81,7 @@ rm ./i386-softmmu/qemu-fuzz-i386
 ../configure --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" --disable-werror 
\
 --cc="$CC" --cxx="$CXX" --extra-cflags="$EXTRA_CFLAGS" \
 --extra-ldflags="-Wl,-rpath,'\$\$ORIGIN/lib'"
-make CONFIG_FUZZ=y CFLAGS="$LIB_FUZZING_ENGINE" "-j$(nproc)" i386-softmmu/fuzz
+make "-j$(nproc)" i386-softmmu/fuzz
 
 # Copy over the datadir
 cp  -r ../pc-bios/ "$DEST_DIR/pc-bios"
-- 
2.26.2





[PATCH 003/150] pc-bios/s390-ccw: do not use rules.mak

2020-08-14 Thread Paolo Bonzini
From: Thomas Huth 

Signed-off-by: Paolo Bonzini 
---
 pc-bios/s390-ccw/Makefile | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
index 50bc880272..cc0f77baa6 100644
--- a/pc-bios/s390-ccw/Makefile
+++ b/pc-bios/s390-ccw/Makefile
@@ -3,10 +3,26 @@ all: build-all
@true
 
 include ../../config-host.mak
-include $(SRC_PATH)/rules.mak
 
+quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
+cc-option = $(if $(shell $(CC) $1 -S -o /dev/null -xc /dev/null > /dev/null \
+ 2>&1 && echo OK), $1, $2)
+
+VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in
+set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath 
$(PATTERN) $1)))
 $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw)
 
+# Flags for dependency generation
+QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
+
+%.o: %.c
+   $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
+  -c -o $@ $<,"CC","$(TARGET_DIR)$@")
+
+%.o: %.S
+   $(call quiet-command,$(CCAS) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
+  -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
+
 .PHONY : all clean build-all
 
 OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \
-- 
2.26.2





[PATCH 010/150] tests/docker: add test script for static linux-user builds

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 tests/docker/test-static | 24 
 1 file changed, 24 insertions(+)
 create mode 100755 tests/docker/test-static

diff --git a/tests/docker/test-static b/tests/docker/test-static
new file mode 100755
index 00..372ef6fac7
--- /dev/null
+++ b/tests/docker/test-static
@@ -0,0 +1,24 @@
+#!/bin/bash -e
+#
+# Compile QEMU user mode emulators as static binaries on Linux.
+#
+# Copyright (c) 2020 Red Hat Inc.
+#
+# Authors:
+#  Paolo Bonzini 
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc
+
+cd "$BUILD_DIR"
+
+build_qemu \
+--disable-system \
+--disable-tools \
+--disable-guest-agent \
+--disable-docs \
+--static
+install_qemu
-- 
2.26.2





[PATCH 006/150] meson: rename .inc.h files to .h.inc

2020-08-14 Thread Paolo Bonzini
Make it consistent with '.c.inc' and '.rst.inc'.

Signed-off-by: Paolo Bonzini 
---
 include/exec/cpu-all.h   | 10 +-
 include/exec/memory.h| 12 ++--
 .../exec/{memory_ldst.inc.h => memory_ldst.h.inc}|  0
 ...ry_ldst_cached.inc.h => memory_ldst_cached.h.inc} |  0
 ...memory_ldst_phys.inc.h => memory_ldst_phys.h.inc} |  0
 target/s390x/cpu_features.c  |  2 +-
 target/s390x/cpu_features_def.h  |  2 +-
 ...cpu_features_def.inc.h => cpu_features_def.h.inc} |  0
 8 files changed, 13 insertions(+), 13 deletions(-)
 rename include/exec/{memory_ldst.inc.h => memory_ldst.h.inc} (100%)
 rename include/exec/{memory_ldst_cached.inc.h => memory_ldst_cached.h.inc} 
(100%)
 rename include/exec/{memory_ldst_phys.inc.h => memory_ldst_phys.h.inc} (100%)
 rename target/s390x/{cpu_features_def.inc.h => cpu_features_def.h.inc} (100%)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index fc403d456b..f6439c4705 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -189,13 +189,13 @@ extern unsigned long reserved_va;
 #define ARG1 as
 #define ARG1_DECLAddressSpace *as
 #define TARGET_ENDIANNESS
-#include "exec/memory_ldst.inc.h"
+#include "exec/memory_ldst.h.inc"
 
 #define SUFFIX   _cached_slow
 #define ARG1 cache
 #define ARG1_DECLMemoryRegionCache *cache
 #define TARGET_ENDIANNESS
-#include "exec/memory_ldst.inc.h"
+#include "exec/memory_ldst.h.inc"
 
 static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t 
val)
 {
@@ -207,17 +207,17 @@ static inline void stl_phys_notdirty(AddressSpace *as, 
hwaddr addr, uint32_t val
 #define ARG1 as
 #define ARG1_DECLAddressSpace *as
 #define TARGET_ENDIANNESS
-#include "exec/memory_ldst_phys.inc.h"
+#include "exec/memory_ldst_phys.h.inc"
 
 /* Inline fast path for direct RAM access.  */
 #define ENDIANNESS
-#include "exec/memory_ldst_cached.inc.h"
+#include "exec/memory_ldst_cached.h.inc"
 
 #define SUFFIX   _cached
 #define ARG1 cache
 #define ARG1_DECLMemoryRegionCache *cache
 #define TARGET_ENDIANNESS
-#include "exec/memory_ldst_phys.inc.h"
+#include "exec/memory_ldst_phys.h.inc"
 #endif
 
 /* page related stuff */
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 307e527835..0cfe987ab4 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -2133,12 +2133,12 @@ MemTxResult address_space_write_rom(AddressSpace *as, 
hwaddr addr,
 #define SUFFIX
 #define ARG1 as
 #define ARG1_DECLAddressSpace *as
-#include "exec/memory_ldst.inc.h"
+#include "exec/memory_ldst.h.inc"
 
 #define SUFFIX
 #define ARG1 as
 #define ARG1_DECLAddressSpace *as
-#include "exec/memory_ldst_phys.inc.h"
+#include "exec/memory_ldst_phys.h.inc"
 
 struct MemoryRegionCache {
 void *ptr;
@@ -2179,7 +2179,7 @@ struct MemoryRegionCache {
 #define SUFFIX   _cached_slow
 #define ARG1 cache
 #define ARG1_DECLMemoryRegionCache *cache
-#include "exec/memory_ldst.inc.h"
+#include "exec/memory_ldst.h.inc"
 
 /* Inline fast path for direct RAM access.  */
 static inline uint8_t address_space_ldub_cached(MemoryRegionCache *cache,
@@ -2205,15 +2205,15 @@ static inline void 
address_space_stb_cached(MemoryRegionCache *cache,
 }
 
 #define ENDIANNESS   _le
-#include "exec/memory_ldst_cached.inc.h"
+#include "exec/memory_ldst_cached.h.inc"
 
 #define ENDIANNESS   _be
-#include "exec/memory_ldst_cached.inc.h"
+#include "exec/memory_ldst_cached.h.inc"
 
 #define SUFFIX   _cached
 #define ARG1 cache
 #define ARG1_DECLMemoryRegionCache *cache
-#include "exec/memory_ldst_phys.inc.h"
+#include "exec/memory_ldst_phys.h.inc"
 
 /* address_space_cache_init: prepare for repeated access to a physical
  * memory region
diff --git a/include/exec/memory_ldst.inc.h b/include/exec/memory_ldst.h.inc
similarity index 100%
rename from include/exec/memory_ldst.inc.h
rename to include/exec/memory_ldst.h.inc
diff --git a/include/exec/memory_ldst_cached.inc.h 
b/include/exec/memory_ldst_cached.h.inc
similarity index 100%
rename from include/exec/memory_ldst_cached.inc.h
rename to include/exec/memory_ldst_cached.h.inc
diff --git a/include/exec/memory_ldst_phys.inc.h 
b/include/exec/memory_ldst_phys.h.inc
similarity index 100%
rename from include/exec/memory_ldst_phys.inc.h
rename to include/exec/memory_ldst_phys.h.inc
diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
index 9f817e3cfa..31ea8df246 100644
--- a/target/s390x/cpu_features.c
+++ b/target/s390x/cpu_features.c
@@ -23,7 +23,7 @@
 .desc = _DESC, \
 },
 static const S390FeatDef s390_features[S390_FEAT_MAX] = {
-#include "cpu_features_def.inc.h"
+#include "cpu_features_def.h.inc"
 };
 #undef DEF_FEAT
 
diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_def.h
index 412d356feb..87df31848e 100644
--- a/target/s3

[PATCH 009/150] tests/vm: check for Python YAML parser in the Makefile

2020-08-14 Thread Paolo Bonzini
No need to do it in the configure file if it is only used for a help message.

Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Paolo Bonzini 
---
 configure | 9 -
 tests/vm/Makefile.include | 4 +++-
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 1c17a0f27f..625c14c500 100755
--- a/configure
+++ b/configure
@@ -959,13 +959,6 @@ do
 fi
 done
 
-# Check for existence of python3 yaml, needed to
-# import yaml config files into vm-build.
-python_yaml="no"
-if $(python3 -c "import yaml" 2> /dev/null); then
-python_yaml="yes"
-fi
-
 : ${smbd=${SMBD-/usr/sbin/smbd}}
 
 # Default objcc to clang if available, otherwise use CC
@@ -6844,7 +6837,6 @@ if test "$docs" != "no"; then
 echo "sphinx-build  $sphinx_build"
 fi
 echo "genisoimage   $genisoimage"
-echo "python_yaml   $python_yaml"
 echo "slirp support $slirp $(echo_version $slirp $slirp_version)"
 if test "$slirp" != "no" ; then
 echo "smbd  $smbd"
@@ -7945,7 +7937,6 @@ echo "PYTHON=$python" >> $config_host_mak
 echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
 echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak
 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
-echo "PYTHON_YAML=$python_yaml" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
 if $iasl -h > /dev/null 2>&1; then
   echo "IASL=$iasl" >> $config_host_mak
diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index a599d1994d..257e2edbb3 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -17,6 +17,8 @@ IMAGE_FILES := $(patsubst %, $(IMAGES_DIR)/%.img, $(IMAGES))
 
 .PRECIOUS: $(IMAGE_FILES)
 
+HAVE_PYTHON_YAML = $(shell $(PYTHON) -c "import yaml" 2> /dev/null && echo yes)
+
 # 'vm-help' target was historically named 'vm-test'
 vm-help vm-test:
@echo "vm-help: Test QEMU in preconfigured virtual machines"
@@ -56,7 +58,7 @@ endif
@echo "QEMU_LOCAL=1 - Use QEMU binary local to this 
build."
@echo "QEMU=/path/to/qemu- Change path to QEMU binary"
@echo "QEMU_IMG=/path/to/qemu-img- Change path to qemu-img tool"
-ifeq ($(PYTHON_YAML),yes)
+ifeq ($(HAVE_PYTHON_YAML),yes)
@echo "QEMU_CONFIG=/path/conf.yml   - Change path to VM 
configuration .yml file."
 else
@echo "(install python3-yaml to enable support for yaml file to 
configure a VM.)"
-- 
2.26.2





[PATCH 014/150] configure: prepare CFLAGS/CXXFLAGS/LDFLAGS for Meson

2020-08-14 Thread Paolo Bonzini
Split between CFLAGS/QEMU_CFLAGS and CXXFLAGS/QEMU_CXXFLAGS so that
we will use CFLAGS and CXXFLAGS for flags that we do not want to
pass to add_project_arguments.

Signed-off-by: Paolo Bonzini 
---
 configure | 78 ---
 rules.mak |  4 +--
 softmmu/Makefile.objs |  2 +-
 3 files changed, 40 insertions(+), 44 deletions(-)

diff --git a/configure b/configure
index 373bb22287..42f0c1c20b 100755
--- a/configure
+++ b/configure
@@ -107,15 +107,12 @@ update_cxxflags() {
 # options which some versions of GCC's C++ compiler complain about
 # because they only make sense for C programs.
 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS"
-
+CXXFLAGS=$(echo "$CFLAGS" | sed s/-std=gnu99/-std=gnu++11/)
 for arg in $QEMU_CFLAGS; do
 case $arg in
 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
 ;;
--std=gnu99)
-QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }"-std=gnu++98"
-;;
 *)
 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
 ;;
@@ -125,13 +122,13 @@ update_cxxflags() {
 
 compile_object() {
   local_cflags="$1"
-  do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
+  do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
 }
 
 compile_prog() {
   local_cflags="$1"
   local_ldflags="$2"
-  do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $QEMU_LDFLAGS $local_ldflags
+  do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS 
$QEMU_LDFLAGS $local_ldflags
 }
 
 # symbolically link $1 to $2.  Portable version of "ln -sf".
@@ -597,15 +594,14 @@ ARFLAGS="${ARFLAGS-rv}"
 # left shift of signed integers is well defined and has the expected
 # 2s-complement style results. (Both clang and gcc agree that it
 # provides these semantics.)
-QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv -std=gnu99 $QEMU_CFLAGS"
-QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
+QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
+QEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
$QEMU_CFLAGS"
 QEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote 
${source_path}/accel/tcg -iquote ${source_path}/include"
 QEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl"
-if test "$debug_info" = "yes"; then
-CFLAGS="-g $CFLAGS"
-fi
+CFLAGS="-std=gnu99 -Wall"
+
 
 # running configure in the source tree?
 # we know that's the case if configure is there.
@@ -886,7 +882,6 @@ SunOS)
   QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
 # needed for TIOCWIN* defines in termios.h
   QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
-  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
   solarisnetlibs="-lsocket -lnsl -lresolv"
   LIBS="$solarisnetlibs $LIBS"
   libs_qga="$solarisnetlibs $libs_qga"
@@ -2109,7 +2104,7 @@ EOF
   for flag in $gcc_flags; do
 # We need to check both a compile and a link, since some compiler
 # setups fail only on a .c->.o compile and some only at link time
-if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
+if compile_object "-Werror $flag" &&
compile_prog "-Werror $flag" ""; then
   QEMU_CFLAGS="$QEMU_CFLAGS $flag"
   QEMU_LDFLAGS="$QEMU_LDFLAGS $flag"
@@ -2184,7 +2179,7 @@ fi
 
 if test "$static" = "yes"; then
   if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; 
then
-QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
+CFLAGS="-fPIE -DPIE $CFLAGS"
 QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
 pie="yes"
   elif test "$pie" = "yes"; then
@@ -2194,11 +2189,11 @@ if test "$static" = "yes"; then
 pie="no"
   fi
 elif test "$pie" = "no"; then
-  QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
-  QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
+  CFLAGS="$CFLAGS_NOPIE $CFLAGS"
+  LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
-  QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
-  QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
+  CFLAGS="-fPIE -DPIE $CFLAGS"
+  LDFLAGS="-pie $LDFLAGS"
   pie="yes"
 elif test "$pie" = "yes"; then
   error_exit "PIE not available due to missing toolchain support"
@@ -3981,7 +3976,7 @@ EOF
 if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
 if cc_has_warning_flag "-Wno-unknown-attributes"; then
 glib_cflags="-Wno-unknown-attributes $glib_cflags"
-CFLAGS="-Wno-unknown-attributes $CFLAGS"
+QEMU_CFLAGS="-Wno-unknown-attributes $CFLAGS"
 fi
 fi
 
@@ -6506,10 +6501,28 @@ if test "$gcov" = "yes" ; then
   QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS"
   QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS"
 elif tes

[PATCH v2 000/150] Meson integration for 5.2

2020-08-14 Thread Paolo Bonzini
News since v1:
* automatically generate dependencies for sphinx manuals [Peter]
* fixes for ARM KVM build [Peter]
* work around old libiscsi in vhost-user-scsi.c [Peter]
* hack to support default c:/Program Files/QEMU prefix on mingw cross 
compilation [Peter]
* added --enable-gettext/--disable-gettext [Peter]
* test for setuptools presence [Peter]
* fixes for Darwin [Peter, Roman]
* do not invoke system Meson through Python, always use embedded Meson with 
--python [Roman]
* improvements and fixes to clean and distclean targets [Stefano]
* avoid (incorrect?) ubsan failure from CONFIG_BDRV_*_WHITELIST [Alexander]
* move --s390-pgste to Meson, removed QEMU_CFLAGS/QEMU_LDFLAGS for 
config-target.mak
* remove some dead configure assignments
* update build system docs on how to add configure options, convert to rST
* moved installation of edk2 blobs and descriptors to Meson
* build and install elf2dmp on Windows too
* included headers renamed to .c.inc instead of .inc

Available from https://gitlab.com/bonzini/qemu branch meson-poc-next.

Paolo

Marc-André Lureau (90):
  optionrom: simplify Makefile
  build-sys hack: ensure target directory is there
  configure: expand path variables for meson configure
  configure: generate Meson cross file
  build-sys hack: link with whole .fa archives
  build-sys: add meson submodule
  meson: enable pie
  meson: use coverage option
  meson: add remaining generated tcg trace helpers
  meson: add version.o
  contrib/vhost-user-input: convert to meson
  contrib/vhost-user-gpu: convert to meson
  contrib/ivshmem: convert to meson
  contrib/elf2dmp: convert to meson
  meson: add macos dependencies
  meson: convert vss-win32
  meson: add msi generation
  meson: add qemu-bridge-helper
  meson: add qemu-keymap
  meson: add qemu-edid
  meson: add virtfs-proxy-helper
  meson: keymap-gen
  meson: generate qemu-version.h
  meson: generate shader headers
  meson: generate hxtool files
  meson: handle edk2 bios and descriptors
  meson: convert qom directory to Meson (tools part)
  meson: convert authz directory to Meson
  meson: convert crypto directory to Meson
  meson: convert io directory to Meson
  meson: convert target/s390x/gen-features.h
  meson: add modules infrastructure
  meson: convert chardev directory to Meson (tools part)
  meson: convert block
  meson: qemu-{img,io,nbd}
  meson: qemu-pr-helper
  meson: convert ui directory to Meson
  meson: convert trace/
  meson: convert dump/
  meson: convert replay directory to Meson
  meson: convert migration directory to Meson
  meson: convert net directory to Meson
  meson: convert backends directory to Meson
  meson: convert fsdev/
  meson: convert disas directory to Meson
  meson: convert qapi-specific to meson
  meson: convert hw/xen
  meson: convert hw/core
  meson: convert hw/smbios
  meson: convert hw/mem
  meson: convert hw/watchdog
  meson: convert hw/virtio
  meson: convert hw/vfio
  meson: convert hw/ssi
  meson: convert hw/sd
  meson: convert hw/scsi
  meson: convert hw/pcmcia
  meson: convert hw/pci-host
  meson: convert hw/pci-bridge
  meson: convert hw/pci
  meson: convert hw/nvram
  meson: convert hw/rdma
  meson: convert hw/net
  meson: convert hw/misc
  meson: convert hw/isa
  meson: convert hw/ipmi
  meson: convert hw/ipack
  meson: convert hw/intc
  meson: convert hw/input
  meson: convert hw/ide
  meson: convert hw/i2c
  meson: convert hw/hyperv
  meson: convert hw/gpio
  meson: convert hw/dma
  meson: convert hw/display
  meson: convert hw/cpu
  meson: convert hw/char
  meson: convert hw/block
  meson: convert hw/audio
  meson: convert hw/adc
  meson: convert hw/acpi
  meson: convert hw/9pfs, cleanup
  meson: convert hw/arch*
  meson: accel
  meson: linux-user
  meson: bsd-user
  meson: cpu-emu
  meson: convert systemtap files
  rules.mak: remove version.o
  meson: convert po/

Paolo Bonzini (59):
  oss-fuzz/build: remove LIB_FUZZING_ENGINE
  trace: switch position of headers to what Meson requires
  meson: rename included C source files to .c.inc
  meson: rename .inc.h files to .h.inc
  tests/vm: do not pollute configure with --efi-aarch64
  tests/vm: check for Python YAML parser in the Makefile
  tests/docker: add test script for static linux-user builds
  nsis: use "make DESTDIR=" instead of "make prefix="
  configure: do not include $(...) variables in config-host.mak
  configure: prepare CFLAGS/CXXFLAGS/LDFLAGS for Meson
  tests/vm: include setuptools
  configure: integrate Meson in the build system
  meson: move summary to meson.build
  meson: add sparse support
  meson: add testsuite Makefile generator
  libqemuutil, qapi, trace: convert to meson
  contrib/libvhost-user: convert to Meson
  tools/virtiofsd: convert to Meson
  contrib/vhost-user-blk: convert to Meson
  vhost-user-scsi: add compatibility for libiscsi 1.9.0
  contrib/vhost-user-scsi: convert to Meson
  contrib/rdmacm-mux: convert to Meson
  meson: add solaris and Haiku libraries
  meson: convert qemu-ga
  meson: convert dummy Windows qga/qemu-

[PATCH 007/150] build-sys hack: ensure target directory is there

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

By removing some unnest-vars calls, we miss some directory creation
that may be required by some/dir/object.d.

This will go away once everything is converted to Meson.

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 rules.mak | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rules.mak b/rules.mak
index 694865b63e..56ba540a32 100644
--- a/rules.mak
+++ b/rules.mak
@@ -66,6 +66,7 @@ expand-objs = $(strip $(sort $(filter %.o,$1)) \
   $(filter-out %.o %.mo,$1))
 
 %.o: %.c
+   @mkdir -p $(dir $@)
$(call quiet-command,$(CC) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
   $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) \
   -c -o $@ $<,"CC","$(TARGET_DIR)$@")
-- 
2.26.2





[PATCH 008/150] tests/vm: do not pollute configure with --efi-aarch64

2020-08-14 Thread Paolo Bonzini
Just make EFI_AARCH64 a variable in the makefile that defaults to the efi
firmware included with QEMU.  It can be redefined on the "make" command
line.

Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Paolo Bonzini 
---
 configure | 19 ---
 tests/vm/Makefile.include |  2 ++
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/configure b/configure
index 2acc4d1465..1c17a0f27f 100755
--- a/configure
+++ b/configure
@@ -418,7 +418,6 @@ prefix="/usr/local"
 mandir="\${prefix}/share/man"
 datadir="\${prefix}/share"
 firmwarepath="\${prefix}/share/qemu-firmware"
-efi_aarch64=""
 qemu_docdir="\${prefix}/share/doc/qemu"
 bindir="\${prefix}/bin"
 libdir="\${prefix}/lib"
@@ -1109,8 +1108,6 @@ for opt do
   ;;
   --firmwarepath=*) firmwarepath="$optarg"
   ;;
-  --efi-aarch64=*) efi_aarch64="$optarg"
-  ;;
   --host=*|--build=*|\
   --disable-dependency-tracking|\
   --sbindir=*|--sharedstatedir=*|\
@@ -3650,20 +3647,6 @@ EOF
   fi
 fi
 
-
-# efi-aarch64 probe
-# Check for efi files needed by aarch64 VMs.
-# By default we will use the efi included with QEMU.
-# Allow user to override the path for efi also.
-if ! test -f "$efi_aarch64"; then
-  if test -f $source_path/pc-bios/edk2-aarch64-code.fd.bz2; then
-# valid after build
-efi_aarch64=$PWD/pc-bios/edk2-aarch64-code.fd
-  else
-efi_aarch64=""
-  fi
-fi
-
 ##
 # libcap-ng library probe
 if test "$cap_ng" != "no" ; then
@@ -6861,7 +6844,6 @@ if test "$docs" != "no"; then
 echo "sphinx-build  $sphinx_build"
 fi
 echo "genisoimage   $genisoimage"
-echo "efi_aarch64   $efi_aarch64"
 echo "python_yaml   $python_yaml"
 echo "slirp support $slirp $(echo_version $slirp $slirp_version)"
 if test "$slirp" != "no" ; then
@@ -7963,7 +7945,6 @@ echo "PYTHON=$python" >> $config_host_mak
 echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
 echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak
 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
-echo "EFI_AARCH64=$efi_aarch64" >> $config_host_mak
 echo "PYTHON_YAML=$python_yaml" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
 if $iasl -h > /dev/null 2>&1; then
diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index f21948c46a..a599d1994d 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -2,6 +2,8 @@
 
 .PHONY: vm-build-all vm-clean-all
 
+EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd)
+
 IMAGES := freebsd netbsd openbsd centos fedora
 ifneq ($(GENISOIMAGE),)
 IMAGES += ubuntu.i386 centos
-- 
2.26.2





[PATCH 004/150] trace: switch position of headers to what Meson requires

2020-08-14 Thread Paolo Bonzini
Meson doesn't enjoy the same flexibility we have with Make in choosing
the include path.  In particular the tracing headers are using
$(build_root)/$(
---
 .gitignore   |  1 -
 Makefile | 46 ++--
 Makefile.objs|  1 -
 accel/kvm/trace.h|  1 +
 accel/tcg/cputlb.c   |  2 +-
 accel/tcg/trace.h|  1 +
 accel/tcg/user-exec.c|  2 +-
 audio/trace.h|  1 +
 authz/trace.h|  1 +
 backends/tpm/trace.h |  1 +
 backends/trace.h |  1 +
 block/trace.h|  1 +
 chardev/trace.h  |  1 +
 crypto/trace.h   |  1 +
 dma-helpers.c|  2 +-
 exec.c   |  2 +-
 gdbstub.c|  2 +-
 hw/9pfs/trace.h  |  1 +
 hw/acpi/trace.h  |  1 +
 hw/alpha/trace.h |  1 +
 hw/arm/trace.h   |  1 +
 hw/audio/trace.h |  1 +
 hw/block/dataplane/trace.h   |  1 +
 hw/block/trace.h |  1 +
 hw/char/trace.h  |  1 +
 hw/core/cpu.c|  2 +-
 hw/core/trace.h  |  1 +
 hw/display/trace.h   |  1 +
 hw/dma/trace.h   |  1 +
 hw/gpio/trace.h  |  1 +
 hw/hppa/trace.h  |  1 +
 hw/hyperv/trace.h|  1 +
 hw/i2c/trace.h   |  1 +
 hw/i386/trace.h  |  1 +
 hw/i386/xen/trace.h  |  1 +
 hw/ide/trace.h   |  1 +
 hw/input/trace.h |  1 +
 hw/intc/trace.h  |  1 +
 hw/isa/trace.h   |  1 +
 hw/mem/trace.h   |  1 +
 hw/mips/trace.h  |  1 +
 hw/misc/macio/trace.h|  1 +
 hw/misc/trace.h  |  1 +
 hw/net/trace.h   |  1 +
 hw/nvram/trace.h |  1 +
 hw/pci-host/trace.h  |  1 +
 hw/pci/trace.h   |  1 +
 hw/ppc/trace.h   |  1 +
 hw/rdma/trace.h  |  1 +
 hw/rdma/vmw/trace.h  |  1 +
 hw/riscv/trace.h |  1 +
 hw/rtc/trace.h   |  1 +
 hw/s390x/trace.h |  1 +
 hw/scsi/trace.h  |  1 +
 hw/sd/trace.h|  1 +
 hw/sparc/trace.h |  1 +
 hw/sparc64/trace.h   |  1 +
 hw/ssi/trace.h   |  1 +
 hw/timer/trace.h |  1 +
 hw/tpm/trace.h   |  1 +
 hw/usb/trace.h   |  1 +
 hw/vfio/trace.h  |  1 +
 hw/virtio/trace.h|  1 +
 hw/watchdog/trace.h  |  1 +
 hw/xen/trace.h   |  1 +
 include/user/syscall-trace.h |  2 +-
 io/trace.h   |  1 +
 job-qmp.c|  2 +-
 job.c|  2 +-
 linux-user/trace.h   |  1 +
 migration/trace.h|  1 +
 monitor/trace.h  |  1 +
 nbd/trace.h  |  1 +
 net/trace.h  |  1 +
 qapi/trace.h |  1 +
 qom/trace.h  |  1 +
 scripts/tracetool/format/c.py|  5 +--
 scripts/tracetool/format/tcg_h.py|  2 +-
 scripts/tracetool/format/tcg_helper_c.py |  2 +-
 scsi/trace.h |  1 +
 softmmu/balloon.c|  2 +-
 softmmu/ioport.c |  2 +-
 softmmu/memory.c |  2 +-
 softmmu/vl.c |  2 +-
 target/arm/trace.h   |  1 +
 target/hppa/trace.h  |  1 +
 target/i386/trace.h  |  1 +
 target/mips/trace.h  |  1 +
 target/ppc/trace.h   |  1 +
 target/riscv/trace.h |  1 +
 target/s390x/trace.h |  1 +
 target/sparc/trace.h |  1 +
 trace/control-target.c   |  2 +-
 trace/control.c  |  2 +-
 ui/trace.h   |  1 +
 util/trace.h |  1 +
 96 files changed, 121 insertions(+), 41 deletions(-)
 create mode 100644 accel/kvm/trace.h
 creat

[PATCH 012/150] configure: do not include $(...) variables in config-host.mak

2020-08-14 Thread Paolo Bonzini
This ensures that Meson will be able to reuse the results of
the tests that are performed in the configure script.

Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Paolo Bonzini 
---
 configure | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/configure b/configure
index 625c14c500..606c327cca 100755
--- a/configure
+++ b/configure
@@ -610,8 +610,8 @@ QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv 
-std=gnu99 $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
$QEMU_CFLAGS"
-QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg 
-iquote \$(SRC_PATH)/include"
-QEMU_INCLUDES="$QEMU_INCLUDES -iquote \$(SRC_PATH)/disas/libvixl"
+QEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote 
${source_path}/accel/tcg -iquote ${source_path}/include"
+QEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl"
 if test "$debug_info" = "yes"; then
 CFLAGS="-g $CFLAGS"
 fi
@@ -911,7 +911,7 @@ Linux)
   linux="yes"
   linux_user="yes"
   kvm="yes"
-  QEMU_INCLUDES="-isystem \$(SRC_PATH)/linux-headers -isystem 
$PWD/linux-headers $QEMU_INCLUDES"
+  QEMU_INCLUDES="-isystem ${source_path}/linux-headers -I$PWD/linux-headers 
$QEMU_INCLUDES"
   supported_os="yes"
   libudev="yes"
 ;;
@@ -4397,8 +4397,8 @@ EOF
   if [ "$pwd_is_source_path" != "y" ] ; then
   symlink "$source_path/dtc/Makefile" "dtc/Makefile"
   fi
-  fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
-  fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt"
+  fdt_cflags="-I${source_path}/dtc/libfdt"
+  fdt_ldflags="-L$PWD/dtc/libfdt"
   fdt_libs="$fdt_libs"
   elif test "$fdt" = "yes" ; then
   # Not a git build & no libfdt found, prompt for system install
@@ -5385,13 +5385,13 @@ case "$capstone" in
   git_submodules="${git_submodules} capstone"
 fi
 mkdir -p capstone
-QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include"
+QEMU_CFLAGS="$QEMU_CFLAGS -I${source_path}/capstone/include"
 if test "$mingw32" = "yes"; then
   LIBCAPSTONE=capstone.lib
 else
   LIBCAPSTONE=libcapstone.a
 fi
-libs_cpu="-L\$(BUILD_DIR)/capstone -lcapstone $libs_cpu"
+libs_cpu="-L$PWD/capstone -lcapstone $libs_cpu"
 ;;
 
   system)
@@ -6414,8 +6414,8 @@ case "$slirp" in
   git_submodules="${git_submodules} slirp"
 fi
 mkdir -p slirp
-slirp_cflags="-I\$(SRC_PATH)/slirp/src -I\$(BUILD_DIR)/slirp/src"
-slirp_libs="-L\$(BUILD_DIR)/slirp -lslirp"
+slirp_cflags="-I${source_path}/slirp/src -I$PWD/slirp/src"
+slirp_libs="-L$PWD/slirp -lslirp"
 if test "$mingw32" = "yes" ; then
   slirp_libs="$slirp_libs -lws2_32 -liphlpapi"
 fi
@@ -7909,19 +7909,19 @@ if test "$secret_keyring" = "yes" ; then
 fi
 
 if test "$tcg_interpreter" = "yes"; then
-  QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
+  QEMU_INCLUDES="-iquote ${source_path}/tcg/tci $QEMU_INCLUDES"
 elif test "$ARCH" = "sparc64" ; then
-  QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
+  QEMU_INCLUDES="-iquote ${source_path}/tcg/sparc $QEMU_INCLUDES"
 elif test "$ARCH" = "s390x" ; then
-  QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
+  QEMU_INCLUDES="-iquote ${source_path}/tcg/s390 $QEMU_INCLUDES"
 elif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then
-  QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
+  QEMU_INCLUDES="-iquote ${source_path}/tcg/i386 $QEMU_INCLUDES"
 elif test "$ARCH" = "ppc64" ; then
-  QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
+  QEMU_INCLUDES="-iquote ${source_path}/tcg/ppc $QEMU_INCLUDES"
 elif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then
-  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/riscv $QEMU_INCLUDES"
+  QEMU_INCLUDES="-I${source_path}/tcg/riscv $QEMU_INCLUDES"
 else
-  QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
+  QEMU_INCLUDES="-iquote ${source_path}/tcg/${ARCH} $QEMU_INCLUDES"
 fi
 
 echo "HELPERS=$helpers" >> $config_host_mak
-- 
2.26.2





[PATCH 011/150] nsis: use "make DESTDIR=" instead of "make prefix="

2020-08-14 Thread Paolo Bonzini
The next patch will prevent modifying the prefix on "make install".  Adjust the
creation of the installer.

Signed-off-by: Paolo Bonzini 
---
 Makefile | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 5596482dbd..ec12101a84 100644
--- a/Makefile
+++ b/Makefile
@@ -1188,16 +1188,16 @@ installer: $(INSTALLER)
 
 INSTDIR=/tmp/qemu-nsis
 
-$(INSTALLER): install-doc $(SRC_PATH)/qemu.nsi
-   $(MAKE) install prefix=${INSTDIR}
+$(INSTALLER): $(SRC_PATH)/qemu.nsi
+   $(MAKE) install DESTDIR=${INSTDIR}
 ifdef SIGNCODE
-   (cd ${INSTDIR}; \
+   (cd ${INSTDIR}/${bindir}; \
  for i in *.exe; do \
$(SIGNCODE) $${i}; \
  done \
 )
 endif # SIGNCODE
-   (cd ${INSTDIR}; \
+   (cd ${INSTDIR}/${bindir}; \
  for i in qemu-system-*.exe; do \
arch=$${i%.exe}; \
arch=$${arch#qemu-system-}; \
@@ -1206,11 +1206,11 @@ endif # SIGNCODE
echo File \"\$${BINDIR}\\$$i\"; \
echo SectionEnd; \
  done \
-) >${INSTDIR}/system-emulations.nsh
+) >${INSTDIR}/${bindir}/system-emulations.nsh
makensis $(nsisflags) \
 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
--DBINDIR="${INSTDIR}" \
+-DBINDIR="${INSTDIR}/${bindir}" \
 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
 -DSRCDIR="$(SRC_PATH)" \
 -DOUTFILE="$(INSTALLER)" \
-- 
2.26.2





[PATCH 019/150] build-sys: add meson submodule

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 .gitmodules   |  3 ++
 configure | 73 ++-
 meson |  1 +
 scripts/archive-source.sh |  3 +-
 4 files changed, 71 insertions(+), 9 deletions(-)
 create mode 16 meson

diff --git a/.gitmodules b/.gitmodules
index 9c0501a4d4..ce979398a8 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -58,3 +58,6 @@
 [submodule "roms/qboot"]
path = roms/qboot
url = https://github.com/bonzini/qboot
+[submodule "meson"]
+   path = meson
+   url = https://github.com/mesonbuild/meson/
diff --git a/configure b/configure
index c9f36153dd..213d8d 100755
--- a/configure
+++ b/configure
@@ -174,6 +174,25 @@ path_of() {
 return 1
 }
 
+version_ge () {
+local_ver1=`echo $1 | tr . ' '`
+local_ver2=`echo $2 | tr . ' '`
+while true; do
+set x $local_ver1
+local_first=${2-0}
+# shift 2 does nothing if there are less than 2 arguments
+shift; shift
+local_ver1=$*
+set x $local_ver2
+# the second argument finished, the first must be greater or equal
+test $# = 1 && return 0
+test $local_first -lt $2 && return 1
+test $local_first -gt $2 && return 0
+shift; shift
+local_ver2=$*
+done
+}
+
 have_backend () {
 echo "$trace_backends" | grep "$1" >/dev/null
 }
@@ -506,7 +525,7 @@ fuzzing="no"
 rng_none="no"
 secret_keyring=""
 libdaxctl=""
-meson=meson
+meson=""
 
 supported_cpu="no"
 supported_os="no"
@@ -916,6 +935,7 @@ fi
 # python 2.x, but some distros have it as python 3.x, so
 # we check that too
 python=
+explicit_python=no
 for binary in "${PYTHON-python3}" python
 do
 if has "$binary"
@@ -999,7 +1019,7 @@ for opt do
   ;;
   --install=*) install="$optarg"
   ;;
-  --python=*) python="$optarg"
+  --python=*) python="$optarg" ; explicit_python=yes
   ;;
   --sphinx-build=*) sphinx_build="$optarg"
   ;;
@@ -1978,15 +1998,52 @@ python_version=$($python -c 'import sys; 
print("%d.%d.%d" % (sys.version_info[0]
 # Suppress writing compiled files
 python="$python -B"
 
-if ! has "$meson"
-then
-error_exit "Meson not found. Use --meson=/path/to/meson"
+if test -z "$meson"; then
+if test "$explicit_python" = no && has meson && version_ge "$(meson 
--version)" 0.55.0; then
+meson=meson
+elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
+meson=git
+elif test -e "${source_path}/meson/meson.py" ; then
+meson=internal
+else
+if test "$explicit_python" = yes; then
+error_exit "--python requires using QEMU's embedded Meson 
distribution, but it was not found."
+else
+error_exit "Meson not found.  Use --meson=/path/to/meson"
+fi
+fi
+else
+# Meson uses its own Python interpreter to invoke other Python scripts,
+# but the user wants to use the one they specified with --python.
+#
+# We do not want to override the distro Python interpreter (and sometimes
+# cannot: for example in Homebrew /usr/bin/meson is a bash script), so
+# just require --meson=git|internal together with --python.
+if test "$explicit_python" = yes; then
+case "$meson" in
+git | internal) ;;
+*) error_exit "--python requires using QEMU's embedded Meson 
distribution." ;;
+esac
+fi
 fi
-meson=$(command -v $meson)
 
-if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then
-  error_exit "Python setuptools not found"
+if test "$meson" = git; then
+git_submodules="${git_submodules} meson"
 fi
+if test "$git_update" = yes; then
+(cd "${source_path}" && GIT="$git" "./scripts/git-submodule.sh" update 
"$git_submodules")
+fi
+
+case "$meson" in
+git | internal)
+if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then
+error_exit "Python setuptools not found"
+fi
+meson="$python ${source_path}/meson/meson.py"
+;;
+*) meson=$(command -v meson) ;;
+esac
+
 
 # Check that the C compiler works. Doing this here before testing
 # the host CPU ensures that we had a valid CC to autodetect the
diff --git a/meson b/meson
new file mode 16
index 00..d0c68dc115
--- /dev/null
+++ b/meson
@@ -0,0 +1 @@
+Subproject commit d0c68dc11507a47b9b85de508e023d9590d60565
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index fb5d6b3918..c6169db69f 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -26,7 +26,8 @@ sub_file="${sub_tdir}/submodule.tar"
 # independent of what the developer currently has initialized
 # in their checkout, because the build environment is completely
 # different to the host OS.
-submodules="dtc slirp ui/keycodemapdb tests/fp/berkeley-softfloat-3 
tests/fp/berkeley-testfloat-3"
+submodules="dtc slirp meson ui/keycodemapdb"
+submodules="$submodules tests/fp/berkeley-so

[PATCH 013/150] configure: expand path variables for meson configure

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 configure | 35 ---
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/configure b/configure
index 606c327cca..373bb22287 100755
--- a/configure
+++ b/configure
@@ -415,16 +415,7 @@ LDFLAGS_SHARED="-shared"
 modules="no"
 module_upgrades="no"
 prefix="/usr/local"
-mandir="\${prefix}/share/man"
-datadir="\${prefix}/share"
 firmwarepath="\${prefix}/share/qemu-firmware"
-qemu_docdir="\${prefix}/share/doc/qemu"
-bindir="\${prefix}/bin"
-libdir="\${prefix}/lib"
-libexecdir="\${prefix}/libexec"
-includedir="\${prefix}/include"
-sysconfdir="\${prefix}/etc"
-local_statedir="\${prefix}/var"
 confsuffix="/qemu"
 slirp=""
 oss_lib=""
@@ -979,12 +970,6 @@ if test "$mingw32" = "yes" ; then
 LIBS="-liberty $LIBS"
   fi
   prefix="c:/Program Files/QEMU"
-  mandir="\${prefix}"
-  datadir="\${prefix}"
-  qemu_docdir="\${prefix}"
-  bindir="\${prefix}"
-  sysconfdir="\${prefix}"
-  local_statedir=
   confsuffix=""
   libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi 
-lnetapi32 $libs_qga"
 fi
@@ -1638,6 +1623,26 @@ for opt do
   esac
 done
 
+libdir="${libdir:-$prefix/lib}"
+libexecdir="${libexecdir:-$prefix/libexec}"
+includedir="${includedir:-$prefix/include}"
+
+if test "$mingw32" = "yes" ; then
+mandir="$prefix"
+datadir="$prefix"
+qemu_docdir="$prefix"
+bindir="$prefix"
+sysconfdir="$prefix"
+local_statedir=
+else
+mandir="${mandir:-$prefix/share/man}"
+datadir="${datadir:-$prefix/share}"
+qemu_docdir="${qemu_docdir:-$prefix/share/doc/qemu}"
+bindir="${bindir:-$prefix/bin}"
+sysconfdir="${sysconfdir:-$prefix/etc}"
+local_statedir="${local_statedir:-$prefix/var}"
+fi
+
 case "$cpu" in
 ppc)
CPU_CFLAGS="-m32"
-- 
2.26.2





[PATCH 005/150] meson: rename included C source files to .c.inc

2020-08-14 Thread Paolo Bonzini
With Makefiles that have automatically generated dependencies, you
generated includes are set as dependencies of the Makefile, so that they
are built before everything else and they are available when first
building the .c files.

Alternatively you can use a fine-grained dependency, e.g.

target/arm/translate.o: target/arm/decode-neon-shared.inc.c

With Meson you have only one choice and it is a third option, namely
"build at the beginning of the corresponding target"; the way you
express it is to list the includes in the sources of that target.

The problem is that Meson decides if something is a source vs. a
generated include by looking at the extension: '.c', '.cc', '.m', '.C'
are sources, while everything else is considered an include---including
'.inc.c'.

Use '.c.inc' to avoid this, as it is consistent with our other convention
of using '.rst.inc' for included reStructuredText files.  The editorconfig
file is adjusted.

Signed-off-by: Paolo Bonzini 
---
 .editorconfig |  3 +-
 .gitignore|  4 +-
 Makefile  | 36 -
 ...tomic_common.inc.c => atomic_common.c.inc} |  0
 accel/tcg/cputlb.c|  2 +-
 accel/tcg/user-exec.c |  2 +-
 contrib/gitdm/filetypes.txt   |  2 +-
 exec.c|  4 +-
 ...alize.inc.c => softfloat-specialize.c.inc} |  0
 fpu/softfloat.c   |  2 +-
 include/tcg/tcg.h |  2 +-
 memory_ldst.inc.c => memory_ldst.c.inc|  0
 scripts/clean-includes|  2 +-
 target/arm/Makefile.objs  | 40 +--
 ...nslate-neon.inc.c => translate-neon.c.inc} |  6 +--
 target/arm/translate-sve.c|  2 +-
 ...ranslate-vfp.inc.c => translate-vfp.c.inc} |  4 +-
 target/arm/translate.c| 12 +++---
 target/avr/Makefile.objs  |  4 +-
 target/avr/disas.c|  2 +-
 target/avr/translate.c|  2 +-
 target/cris/translate.c   |  2 +-
 ...ranslate_v10.inc.c => translate_v10.c.inc} |  0
 target/hppa/Makefile.objs |  4 +-
 target/hppa/translate.c   |  2 +-
 target/mips/translate.c   |  2 +-
 ...nslate_init.inc.c => translate_init.c.inc} |  0
 target/openrisc/Makefile.objs |  6 +--
 target/openrisc/disas.c   |  2 +-
 target/openrisc/translate.c   |  2 +-
 target/ppc/int_helper.c   |  2 +-
 .../{mfrom_table.inc.c => mfrom_table.c.inc}  |  0
 target/ppc/translate.c| 22 +-
 .../{dfp-impl.inc.c => dfp-impl.c.inc}|  0
 .../{dfp-ops.inc.c => dfp-ops.c.inc}  |  0
 .../{fp-impl.inc.c => fp-impl.c.inc}  |  0
 .../translate/{fp-ops.inc.c => fp-ops.c.inc}  |  0
 .../{spe-impl.inc.c => spe-impl.c.inc}|  0
 .../{spe-ops.inc.c => spe-ops.c.inc}  |  0
 .../{vmx-impl.inc.c => vmx-impl.c.inc}|  0
 .../{vmx-ops.inc.c => vmx-ops.c.inc}  |  0
 .../{vsx-impl.inc.c => vsx-impl.c.inc}|  0
 .../{vsx-ops.inc.c => vsx-ops.c.inc}  |  0
 ...nslate_init.inc.c => translate_init.c.inc} |  0
 target/riscv/Makefile.objs|  8 ++--
 ...rivileged.inc.c => trans_privileged.c.inc} |  0
 .../{trans_rva.inc.c => trans_rva.c.inc}  |  0
 .../{trans_rvd.inc.c => trans_rvd.c.inc}  |  0
 .../{trans_rvf.inc.c => trans_rvf.c.inc}  |  0
 .../{trans_rvh.inc.c => trans_rvh.c.inc}  |  0
 .../{trans_rvi.inc.c => trans_rvi.c.inc}  |  0
 .../{trans_rvm.inc.c => trans_rvm.c.inc}  |  0
 .../{trans_rvv.inc.c => trans_rvv.c.inc}  |  0
 target/riscv/translate.c  | 20 +-
 target/rx/Makefile.objs   |  6 +--
 target/rx/disas.c |  2 +-
 target/rx/translate.c |  2 +-
 target/s390x/translate.c  |  2 +-
 ...{translate_vx.inc.c => translate_vx.c.inc} |  0
 target/xtensa/core-dc232b.c   |  4 +-
 .../{gdb-config.inc.c => gdb-config.c.inc}|  0
 ...nsa-modules.inc.c => xtensa-modules.c.inc} |  0
 target/xtensa/core-dc233c.c   |  4 +-
 .../{gdb-config.inc.c => gdb-config.c.inc}|  0
 ...nsa-modules.inc.c => xtensa-modules.c.inc} |  0
 target/xtensa/core-de212.c|  4 +-
 .../{gdb-config.inc.c => gdb-config.c.inc}|  0
 ...nsa-modules.inc.c => xtensa-modules.c.inc} |  0
 target/xtensa/core-fsf.c  |  2 +-
 ...nsa-modules.inc.c => xtensa-modules.c.inc} |  0
 target/xtensa/core-sample_controller.c|  4 +-
 .../{gdb-config.inc.c => gdb-config.c.inc}|  0
 ...nsa-modules.inc.c => xtensa-modules.c.inc} |  0
 target/xtensa/core-test_kc705_be.c|  

[PATCH 015/150] tests/vm: include setuptools

2020-08-14 Thread Paolo Bonzini
They are a dependency of Meson, so install them.

Signed-off-by: Paolo Bonzini 
---
 tests/vm/freebsd | 1 +
 tests/vm/netbsd  | 1 +
 tests/vm/openbsd | 1 +
 3 files changed, 3 insertions(+)

diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index 29252fa4a6..b34b14fc53 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -33,6 +33,7 @@ class FreeBSDVM(basevm.BaseVM):
 "pkgconf",
 "bzip2",
 "python37",
+"py37-setuptools",
 
 # gnu tools
 "bash",
diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index 2e87199211..93d48b6fdd 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -31,6 +31,7 @@ class NetBSDVM(basevm.BaseVM):
 "pkgconf",
 "xz",
 "python37",
+"py37-setuptools",
 
 # gnu tools
 "bash",
diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index dfe633e453..7e27fda642 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -30,6 +30,7 @@ class OpenBSDVM(basevm.BaseVM):
 "git",
 "pkgconf",
 "bzip2", "xz",
+"py3-setuptools",
 
 # gnu tools
 "bash",
-- 
2.26.2





[PATCH 022/150] meson: use coverage option

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile   | 14 --
 Makefile.target| 16 
 configure  |  9 ++---
 docs/devel/testing.rst |  7 +++
 meson.build|  2 +-
 5 files changed, 6 insertions(+), 42 deletions(-)

diff --git a/Makefile b/Makefile
index 5a2f6c96d3..7e9663aeb7 100644
--- a/Makefile
+++ b/Makefile
@@ -772,14 +772,6 @@ module_block.h: 
$(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
"GEN","$@")
 
-ifdef CONFIG_GCOV
-.PHONY: clean-coverage
-clean-coverage:
-   $(call quiet-command, \
-   find . \( -name '*.gcda' -o -name '*.gcov' \) -type f -exec rm 
{} +, \
-   "CLEAN", "coverage files")
-endif
-
 clean: recurse-clean ninja-clean clean-ctlist
-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
 # avoid old build problems by removing potentially incorrect old files
@@ -1286,9 +1278,6 @@ endif
echo '')
@echo  'Cleaning targets:'
$(call print-help,clean,Remove most generated files but keep the config)
-ifdef CONFIG_GCOV
-   $(call print-help,clean-coverage,Remove coverage files)
-endif
$(call print-help,distclean,Remove all generated files)
$(call print-help,dist,Build a distributable tarball)
@echo  ''
@@ -1299,9 +1288,6 @@ endif
@echo  ''
@echo  'Documentation targets:'
$(call print-help,html info pdf txt,Build documentation in specified 
format)
-ifdef CONFIG_GCOV
-   $(call print-help,coverage-report,Create code coverage report)
-endif
@echo  ''
 ifdef CONFIG_WIN32
@echo  'Windows targets:'
diff --git a/Makefile.target b/Makefile.target
index ffa2657269..d61a6a978b 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -269,19 +269,3 @@ endif
 
 generated-files-y += config-target.h
 Makefile: $(generated-files-y)
-
-# Reports/Analysis
-#
-# The target specific coverage report only cares about target specific
-# blobs and not the shared code.
-#
-
-%/coverage-report.html:
-   @mkdir -p $*
-   $(call quiet-command,\
-   gcovr -r $(SRC_PATH) --object-directory $(CURDIR) \
-   -p --html --html-details -o $@, \
-   "GEN", "coverage-report.html")
-
-.PHONY: coverage-report
-coverage-report: $(CURDIR)/reports/coverage/coverage-report.html
diff --git a/configure b/configure
index 50ecafa658..54e8b91843 100755
--- a/configure
+++ b/configure
@@ -424,7 +424,6 @@ tcg_interpreter="no"
 bigendian="no"
 mingw32="no"
 gcov="no"
-gcov_tool="gcov"
 EXESUF=""
 DSOSUF=".so"
 LDFLAGS_SHARED="-shared"
@@ -1009,8 +1008,6 @@ for opt do
   ;;
   --meson=*) meson="$optarg"
   ;;
-  --gcov=*) gcov_tool="$optarg"
-  ;;
   --smbd=*) smbd="$optarg"
   ;;
   --extra-cflags=*)
@@ -1817,7 +1814,6 @@ Advanced options (experts only):
   --with-coroutine=BACKEND coroutine backend. Supported options:
ucontext, sigaltstack, windows
   --enable-gcovenable test coverage analysis with gcov
-  --gcov=GCOV  use specified gcov [$gcov_tool]
   --disable-blobs  disable installing provided firmware blobs
   --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent
   --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)
@@ -6551,8 +6547,7 @@ fi
 write_c_skeleton
 
 if test "$gcov" = "yes" ; then
-  QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS"
-  QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS"
+  :
 elif test "$fortify_source" = "yes" ; then
   QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
   debug=no
@@ -7837,7 +7832,6 @@ echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
 echo "POD2MAN=$POD2MAN" >> $config_host_mak
 if test "$gcov" = "yes" ; then
   echo "CONFIG_GCOV=y" >> $config_host_mak
-  echo "GCOV=$gcov_tool" >> $config_host_mak
 fi
 
 if test "$libudev" != "no"; then
@@ -8465,6 +8459,7 @@ NINJA=$PWD/ninjatool $meson setup \
 -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; 
fi) \
 -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; 
fi) \
 -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
+-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; 
fi) \
 $cross_arg \
 "$PWD" "$source_path"
 
diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index c1ff24370b..a4264691be 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -164,13 +164,12 @@ instrumenting the tested code. To use it, configure QEMU 
with
 ``--enable-gcov`` option and build. Then run ``make check`` as usual.
 
 If you want to gather coverage information on a single test the ``make
-clean-coverage`` target can be used to delete any existing coverage
+clean-gcda`` target can be u

[PATCH 020/150] meson: move summary to meson.build

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 configure   | 237 --
 meson.build | 243 
 2 files changed, 243 insertions(+), 237 deletions(-)

diff --git a/configure b/configure
index 213d8d..e8c1ed5aba 100755
--- a/configure
+++ b/configure
@@ -527,8 +527,6 @@ secret_keyring=""
 libdaxctl=""
 meson=""
 
-supported_cpu="no"
-supported_os="no"
 bogus_os="no"
 malloc_trim=""
 
@@ -767,35 +765,27 @@ ARCH=
 # Note that this case should only have supported host CPUs, not guests.
 case "$cpu" in
   ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64)
-supported_cpu="yes"
   ;;
   ppc64le)
 ARCH="ppc64"
-supported_cpu="yes"
   ;;
   i386|i486|i586|i686|i86pc|BePC)
 cpu="i386"
-supported_cpu="yes"
   ;;
   x86_64|amd64)
 cpu="x86_64"
-supported_cpu="yes"
   ;;
   armv*b|armv*l|arm)
 cpu="arm"
-supported_cpu="yes"
   ;;
   aarch64)
 cpu="aarch64"
-supported_cpu="yes"
   ;;
   mips*)
 cpu="mips"
-supported_cpu="yes"
   ;;
   sparc|sun4[cdmuv])
 cpu="sparc"
-supported_cpu="yes"
   ;;
   *)
 # This will result in either an error or falling back to TCI later
@@ -823,7 +813,6 @@ MINGW32*)
 audio_drv_list=""
   fi
   supported_os="yes"
-  pie="no"
 ;;
 GNU/kFreeBSD)
   bsd="yes"
@@ -841,7 +830,6 @@ FreeBSD)
   libs_qga="-lutil $libs_qga"
   netmap=""  # enable netmap autodetect
   HOST_VARIANT_DIR="freebsd"
-  supported_os="yes"
 ;;
 DragonFly)
   bsd="yes"
@@ -858,7 +846,6 @@ NetBSD)
   audio_possible_drivers="oss sdl"
   oss_lib="-lossaudio"
   HOST_VARIANT_DIR="netbsd"
-  supported_os="yes"
 ;;
 OpenBSD)
   bsd="yes"
@@ -866,7 +853,6 @@ OpenBSD)
   audio_drv_list="try-sdl"
   audio_possible_drivers="sdl"
   HOST_VARIANT_DIR="openbsd"
-  supported_os="yes"
 ;;
 Darwin)
   bsd="yes"
@@ -887,7 +873,6 @@ Darwin)
   # won't work when we're compiling with gcc as a C compiler.
   QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
   HOST_VARIANT_DIR="darwin"
-  supported_os="yes"
 ;;
 SunOS)
   solaris="yes"
@@ -918,7 +903,6 @@ Linux)
   linux_user="yes"
   kvm="yes"
   QEMU_INCLUDES="-isystem ${source_path}/linux-headers -I$PWD/linux-headers 
$QEMU_INCLUDES"
-  supported_os="yes"
   libudev="yes"
 ;;
 esac
@@ -5272,8 +5256,6 @@ EOF
 spice="yes"
 libs_softmmu="$libs_softmmu $spice_libs"
 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
-spice_protocol_version=$($pkg_config --modversion spice-protocol)
-spice_server_version=$($pkg_config --modversion spice-server)
   else
 if test "$spice" = "yes" ; then
   feature_not_found "spice" \
@@ -6890,225 +6872,6 @@ QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
 QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS"
 libs_softmmu="$pixman_libs $libs_softmmu"
 
-echo "Install prefix$prefix"
-echo "BIOS directory$(eval echo $qemu_datadir)"
-echo "firmware path $(eval echo $firmwarepath)"
-echo "binary directory  $(eval echo $bindir)"
-echo "library directory $(eval echo $libdir)"
-echo "module directory  $(eval echo $qemu_moddir)"
-echo "libexec directory $(eval echo $libexecdir)"
-echo "include directory $(eval echo $includedir)"
-echo "config directory  $(eval echo $sysconfdir)"
-if test "$mingw32" = "no" ; then
-echo "local state directory   $(eval echo $local_statedir)"
-echo "Manual directory  $(eval echo $mandir)"
-echo "ELF interp prefix $interp_prefix"
-else
-echo "local state directory   queried at runtime"
-echo "Windows SDK   $win_sdk"
-fi
-echo "Build directory   $(pwd)"
-echo "Source path   $source_path"
-echo "GIT binary$git"
-echo "GIT submodules$git_submodules"
-echo "C compiler$cc"
-echo "Host C compiler   $host_cc"
-echo "C++ compiler  $cxx"
-echo "Objective-C compiler $objcc"
-echo "ARFLAGS   $ARFLAGS"
-echo "CFLAGS$CFLAGS"
-echo "QEMU_CFLAGS   $QEMU_CFLAGS"
-echo "QEMU_LDFLAGS  $QEMU_LDFLAGS"
-echo "make  $make"
-echo "install   $install"
-echo "python$python ($python_version)"
-if test "$docs" != "no"; then
-echo "sphinx-build  $sphinx_build"
-fi
-echo "genisoimage   $genisoimage"
-echo "slirp support $slirp $(echo_version $slirp $slirp_version)"
-if test "$slirp" != "no" ; then
-echo "smbd  $smbd"
-fi
-echo "module support$modules"
-echo "alt path mod load $module_upgrades"
-echo "host CPU  $cpu"
-echo "host big endian   $bigendian"
-echo "target list   $target_list"
-echo "gprof enabled $gprof"
-echo "sparse enabled$sparse"
-echo "strip binaries$strip_opt"
-echo "profiler  $profiler"
-echo "static build  $static"
-echo "safe stack$safe_stack"
-if test "$darwin" = "yes" ; then
-echo "Cocoa support $cocoa"
-fi
-echo "SDL support   $sdl $(echo_version $sdl $sdlversion)"
-echo "SDL image support $sdl_image"
-echo "GTK support   $gtk $(echo_version $gtk $gtk_version)"
-echo "GTK GL support$gtk_gl"
-echo "

[PATCH 026/150] meson: add remaining generated tcg trace helpers

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile  | 51 ---
 trace/meson.build | 14 +
 2 files changed, 14 insertions(+), 51 deletions(-)

diff --git a/Makefile b/Makefile
index 4a03af2daa..f89687785f 100644
--- a/Makefile
+++ b/Makefile
@@ -128,61 +128,10 @@ FULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) 
($(QEMU_PKGVERSION)),$(VERSIO
 
 generated-files-y = qemu-version.h config-host.h qemu-options.def
 
-generated-files-y += trace/generated-tcg-tracers.h
-
-generated-files-y += trace/generated-helpers-wrappers.h
-generated-files-y += trace/generated-helpers.h
-generated-files-y += trace/generated-helpers.c
-
 generated-files-y += module_block.h
 
 generated-files-y += .git-submodule-status
 
-tracetool-y = $(SRC_PATH)/scripts/tracetool.py
-tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
-
-trace/generated-helpers-wrappers.h: 
trace/generated-helpers-wrappers.h-timestamp
-   @cmp $< $@ >/dev/null 2>&1 || cp $< $@
-trace/generated-helpers-wrappers.h-timestamp: $(SRC_PATH)/trace-events 
$(BUILD_DIR)/config-host.mak $(tracetool-y)
-   @mkdir -p $(dir $@)
-   $(call quiet-command,$(TRACETOOL) \
-   --group=root \
-   --format=tcg-helper-wrapper-h \
-   --backend=$(TRACE_BACKENDS) \
-   $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
-
-trace/generated-helpers.h: trace/generated-helpers.h-timestamp
-   @cmp $< $@ >/dev/null 2>&1 || cp $< $@
-trace/generated-helpers.h-timestamp: $(SRC_PATH)/trace-events 
$(BUILD_DIR)/config-host.mak $(tracetool-y)
-   @mkdir -p $(dir $@)
-   $(call quiet-command,$(TRACETOOL) \
-   --group=root \
-   --format=tcg-helper-h \
-   --backend=$(TRACE_BACKENDS) \
-   $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
-
-trace/generated-helpers.c: trace/generated-helpers.c-timestamp
-   @cmp $< $@ >/dev/null 2>&1 || cp $< $@
-trace/generated-helpers.c-timestamp: $(SRC_PATH)/trace-events 
$(BUILD_DIR)/config-host.mak $(tracetool-y)
-   @mkdir -p $(dir $@)
-   $(call quiet-command,$(TRACETOOL) \
-   --group=root \
-   --format=tcg-helper-c \
-   --backend=$(TRACE_BACKENDS) \
-   $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
-
-trace/generated-helpers.o: trace/generated-helpers.c
-
-trace/generated-tcg-tracers.h: trace/generated-tcg-tracers.h-timestamp
-   @cmp $< $@ >/dev/null 2>&1 || cp $< $@
-trace/generated-tcg-tracers.h-timestamp: $(SRC_PATH)/trace-events 
$(BUILD_DIR)/config-host.mak $(tracetool-y)
-   @mkdir -p $(dir $@)
-   $(call quiet-command,$(TRACETOOL) \
-   --group=root \
-   --format=tcg-h \
-   --backend=$(TRACE_BACKENDS) \
-   $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
-
 KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
 KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
 
diff --git a/trace/meson.build b/trace/meson.build
index f0a8d1c2e2..cab36a248b 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -55,6 +55,20 @@ custom_target('trace-events-all',
   install: true,
   install_dir: config_host['qemu_datadir'])
 
+foreach d : [
+  ['generated-tcg-tracers.h', 'tcg-h'],
+  ['generated-helpers.c', 'tcg-helper-c'],
+  ['generated-helpers.h', 'tcg-helper-h'],
+  ['generated-helpers-wrappers.h', 'tcg-helper-wrapper-h'],
+]
+  custom_target(d[0],
+output: d[0],
+input: meson.source_root() / 'trace-events',
+command: [ tracetool, '--group=root', 
'--format=@0@'.format(d[1]), '@INPUT@' ],
+build_by_default: true, # to be removed when added to a target
+capture: true)
+endforeach
+
 if 'CONFIG_TRACE_UST' in config_host
   trace_ust_all_h = custom_target('trace-ust-all.h',
   output: 'trace-ust-all.h',
-- 
2.26.2





[PATCH 024/150] meson: add testsuite Makefile generator

2020-08-14 Thread Paolo Bonzini
Rules to execute tests are generated by a simple Python program
that integrates into the existing "make check" mechanism.  This
provides familiarity for developers, and also allows piecewise
conversion of the testsuite Makefiles to meson.

The generated rules are based on QEMU's existing test harness
Makefile and TAP parser.

Signed-off-by: Paolo Bonzini 
---
 Makefile   |   6 ++-
 scripts/mtest2make.py  | 102 +
 tests/Makefile.include |   1 -
 3 files changed, 107 insertions(+), 2 deletions(-)
 create mode 100644 scripts/mtest2make.py

diff --git a/Makefile b/Makefile
index 6198236c40..7419d5e19b 100644
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,10 @@ clean-ctlist:
 ninja-clean::
 ninja-distclean::
 
+Makefile.mtest: build.ninja scripts/mtest2make.py
+   $(MESON) introspect --tests | $(PYTHON) scripts/mtest2make.py > $@
+-include Makefile.mtest
+
 .git-submodule-status: git-submodule-update config-host.mak
 
 # Check that we're not trying to do an out-of-tree build from
@@ -820,7 +824,7 @@ distclean: clean ninja-distclean
rm -f roms/seabios/config.mak roms/vgabios/config.mak
rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
rm -rf meson-private meson-logs meson-info compile_commands.json
-   rm -f Makefile.ninja ninjatool ninjatool.stamp
+   rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
rm -f config.log
rm -f linux-headers/asm
rm -f docs/version.texi
diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py
new file mode 100644
index 00..bdb257bbd9
--- /dev/null
+++ b/scripts/mtest2make.py
@@ -0,0 +1,102 @@
+#! /usr/bin/env python3
+
+# Create Makefile targets to run tests, from Meson's test introspection data.
+#
+# Author: Paolo Bonzini 
+
+from collections import defaultdict
+import json
+import os
+import shlex
+import sys
+
+class Suite(object):
+def __init__(self):
+self.tests = list()
+self.slow_tests = list()
+self.executables = set()
+
+print('''
+SPEED = quick
+
+# $1 = test command, $2 = test name
+.test-human-tap = $1 < /dev/null | ./scripts/tap-driver.pl --test-name="$2" 
$(if $(V),,--show-failures-only)
+.test-human-exitcode = $1 < /dev/null
+.test-tap-tap = $1 < /dev/null | sed "s/^[a-z][a-z]* [0-9]*/& $2/" || true
+.test-tap-exitcode = printf "%s\\n" 1..1 "`$1 < /dev/null > /dev/null || echo 
"not "`ok 1 $2"
+.test.print = echo $(if $(V),'$1','Running test $2') >&3
+.test.env = MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))}
+
+# $1 = test name, $2 = test target (human or tap)
+.test.run = $(call .test.print,$(.test.cmd.$1),$(.test.name.$1)) && $(call 
.test-$2-$(.test.driver.$1),$(.test.cmd.$1),$(.test.name.$1))
+
+define .test.human_k
+@exec 3>&1; rc=0; $(foreach TEST, $1, $(call .test.run,$(TEST),human) 
|| rc=$$?;) \\
+  exit $$rc
+endef
+define .test.human_no_k
+$(foreach TEST, $1, @exec 3>&1; $(call .test.run,$(TEST),human)
+)
+endef
+.test.human = \\
+$(if $(findstring k, $(MAKEFLAGS)), $(.test.human_k), 
$(.test.human_no_k))
+
+define .test.tap
+@exec 3>&1; { $(foreach TEST, $1, $(call .test.run,$(TEST),tap); ) } \\
+  | ./scripts/tap-merge.pl | tee "$@" \\
+  | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only)
+endef
+''')
+
+suites = defaultdict(Suite)
+i = 0
+for test in json.load(sys.stdin):
+env = ' '.join(('%s=%s' % (shlex.quote(k), shlex.quote(v))
+for k, v in test['env'].items()))
+executable = os.path.relpath(test['cmd'][0])
+if test['workdir'] is not None:
+test['cmd'][0] = os.path.relpath(test['cmd'][0], test['workdir'])
+else:
+test['cmd'][0] = executable
+cmd = '$(.test.env) %s %s' % (env, ' '.join((shlex.quote(x) for x in 
test['cmd'])))
+if test['workdir'] is not None:
+cmd = '(cd %s && %s)' % (shlex.quote(test['workdir']), cmd)
+driver = test['protocol'] if 'protocol' in test else 'exitcode'
+
+i += 1
+print('.test.name.%d := %s' % (i, test['name']))
+print('.test.driver.%d := %s' % (i, driver))
+print('.test.cmd.%d := %s' % (i, cmd))
+
+test_suites = test['suite'] or ['default']
+is_slow = any(s.endswith('-slow') for s in test_suites)
+for s in test_suites:
+# The suite name in the introspection info is "PROJECT:SUITE"
+s = s.split(':')[1]
+if s.endswith('-slow'):
+s = s[:-5]
+if is_slow:
+suites[s].slow_tests.append(i)
+else:
+suites[s].tests.append(i)
+suites[s].executables.add(executable)
+
+print('.PHONY: check check-report.tap')
+print('check:')
+print('check-report.tap:')
+print('\t@cat $^ | scripts/tap-merge.pl >$@')
+for name, suite in suites.items():
+executables = ' '.join(suite.executables)
+slow_test_numbers = ' '.join((str(x) for x in suite.slow_tests))
+test_numbers = ' '.join((str(x) for x in sui

[PATCH 031/150] vhost-user-scsi: add compatibility for libiscsi 1.9.0

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 contrib/vhost-user-scsi/vhost-user-scsi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c 
b/contrib/vhost-user-scsi/vhost-user-scsi.c
index 7a1db164c8..3c912384e9 100644
--- a/contrib/vhost-user-scsi/vhost-user-scsi.c
+++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
@@ -12,7 +12,9 @@
 
 #include "qemu/osdep.h"
 #include 
+#define inline __attribute__((gnu_inline))  /* required for libiscsi v1.9.0 */
 #include 
+#undef inline
 #include "contrib/libvhost-user/libvhost-user-glib.h"
 #include "standard-headers/linux/virtio_scsi.h"
 
-- 
2.26.2





[PATCH 018/150] build-sys hack: link with whole .fa archives

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

In order to link the *-obj-y files into tests, we will make static
libraries of them in Meson, and then link them as whole archives
into the tests.  To separate regular static libraries from link-whole
libraries, give them a different file extension.

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 rules.mak | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/rules.mak b/rules.mak
index e79a4005a7..5ab42def82 100644
--- a/rules.mak
+++ b/rules.mak
@@ -39,6 +39,13 @@ find-symbols = $(if $1, $(sort $(shell $(NM) -P -g $1 | $2)))
 defined-symbols = $(call find-symbols,$1,awk '$$2!="U"{print $$1}')
 undefined-symbols = $(call find-symbols,$1,awk '$$2=="U"{print $$1}')
 
+WL := -Wl,
+ifdef CONFIG_DARWIN
+whole-archive = $(WL)-force_load,$1
+else
+whole-archive = $(WL)--whole-archive $1 $(WL)--no-whole-archive
+endif
+
 # All the .mo objects in -m variables are also added into corresponding -y
 # variable in unnest-vars, but filtered out here, when LINK is called.
 #
@@ -54,11 +61,12 @@ undefined-symbols = $(call find-symbols,$1,awk 
'$$2=="U"{print $$1}')
 # This is necessary because the exectuable itself may not use the function, in
 # which case the function would not be linked in. Then the DSO loading will
 # fail because of the missing symbol.
-process-archive-undefs = $(filter-out %.a %.mo,$1) \
+process-archive-undefs = $(filter-out %.a %.fa %.mo,$1) \
 $(addprefix $(WL_U), \
- $(filter $(call defined-symbols,$(filter %.a, $1)), \
+ $(filter $(call defined-symbols,$(filter %.a %.fa, $1)), \
   $(call undefined-symbols,$(filter %.mo,$1 \
-$(filter %.a,$1)
+   $(foreach l,$(filter %.fa,$1),$(call whole-archive,$l)) \
+   $(filter %.a,$1)
 
 extract-libs = $(strip $(foreach o,$(filter-out %.mo,$1),$($o-libs)))
 expand-objs = $(strip $(sort $(filter %.o,$1)) \
@@ -122,7 +130,7 @@ LD_REL := $(CC) -nostdlib $(LD_REL_FLAGS)
 modules:
 
 %$(EXESUF): %.o
-   $(call LINK,$(filter %.o %.a %.mo, $^))
+   $(call LINK,$(filter %.o %.a %.mo %.fa, $^))
 
 %.a:
$(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"AR","$(TARGET_DIR)$@")
@@ -378,7 +386,7 @@ define unnest-vars
 $(error $o added in $v but $o-objs is not set)))
 $(shell mkdir -p ./ $(sort $(dir $($v
 # Include all the .d files
-$(eval -include $(patsubst %.o,%.d,$(patsubst %.mo,%.d,$($v
+$(eval -include $(patsubst %.o,%.d,$(patsubst %.mo,%.d,$(filter 
%.o,$($v)
 $(eval $v := $(filter-out %/,$($v
 endef
 
-- 
2.26.2





[PATCH 016/150] configure: integrate Meson in the build system

2020-08-14 Thread Paolo Bonzini
The Meson build system is integrated in the existing configure/make steps
by invoking Meson from the configure script and converting Meson's build.ninja
rules to an included Makefile.

build.ninja already provides tags/ctags/cscope rules, so they are removed.

Signed-off-by: Paolo Bonzini 
---
 Makefile |   43 +-
 configure|   43 +-
 meson.build  |   24 +
 scripts/ninjatool.py | 1013 ++
 4 files changed, 1103 insertions(+), 20 deletions(-)
 create mode 100644 meson.build
 create mode 100755 scripts/ninjatool.py

diff --git a/Makefile b/Makefile
index ec12101a84..5a2f6c96d3 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,22 @@ git-submodule-update:
 endif
 endif
 
+export NINJA=./ninjatool
+Makefile.ninja: build.ninja ninjatool
+   ./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
+-include Makefile.ninja
+
+${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.ARGS += -MP
+
+ninjatool: ninjatool.stamp
+ninjatool.stamp: $(SRC_PATH)/scripts/ninjatool.py config-host.mak
+   $(MESON) setup --reconfigure . $(SRC_PATH) && touch $@
+
+.PHONY: ninja-clean ninja-distclean clean-ctlist
+clean-ctlist:
+ninja-clean::
+ninja-distclean::
+
 .git-submodule-status: git-submodule-update config-host.mak
 
 # Check that we're not trying to do an out-of-tree build from
@@ -68,6 +84,8 @@ CONFIG_ALL=y
 -include config-all-devices.mak
 -include config-all-disas.mak
 
+build.ninja: meson-private/coredata.dat
+meson-private/coredata.dat: config-host.mak
 config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
@echo $@ is out-of-date, running configure
@./config.status
@@ -762,7 +780,8 @@ clean-coverage:
"CLEAN", "coverage files")
 endif
 
-clean: recurse-clean
+clean: recurse-clean ninja-clean clean-ctlist
+   -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
 # avoid old build problems by removing potentially incorrect old files
rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h 
gen-op-arm.h
rm -f qemu-options.def
@@ -799,7 +818,8 @@ rm -rf $(MANUAL_BUILDDIR)/$1/_static
 rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js 
$(MANUAL_BUILDDIR)/$1/*.html
 endef
 
-distclean: clean
+distclean: clean ninja-distclean
+   -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g
rm -f config-host.mak config-host.h* $(DOCS)
rm -f tests/tcg/config-*.mak
rm -f config-all-devices.mak config-all-disas.mak config.status
@@ -807,6 +827,8 @@ distclean: clean
rm -f po/*.mo tests/qemu-iotests/common.env
rm -f roms/seabios/config.mak roms/vgabios/config.mak
rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
+   rm -rf meson-private meson-logs meson-info compile_commands.json
+   rm -f Makefile.ninja ninjatool ninjatool.stamp
rm -f config.log
rm -f linux-headers/asm
rm -f docs/version.texi
@@ -933,6 +955,8 @@ ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 
512x512
 install-includedir:
$(INSTALL_DIR) "$(DESTDIR)$(includedir)"
 
+# Needed by "meson install"
+export DESTDIR
 install: all $(if $(BUILD_DOCS),install-doc) \
install-datadir install-localstatedir install-includedir \
$(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
@@ -1006,21 +1030,6 @@ endif
done
$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all 
"$(DESTDIR)$(qemu_datadir)/trace-events-all"
 
-.PHONY: ctags
-ctags:
-   rm -f tags
-   find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
-
-.PHONY: TAGS
-TAGS:
-   rm -f TAGS
-   find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
-
-cscope:
-   rm -f "$(SRC_PATH)"/cscope.*
-   find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > 
"$(SRC_PATH)/cscope.files"
-   cscope -b -i"$(SRC_PATH)/cscope.files"
-
 # opengl shader programs
 ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert 
$(SRC_PATH)/scripts/shaderinclude.pl
@mkdir -p $(dir $@)
diff --git a/configure b/configure
index 42f0c1c20b..f99baba99e 100755
--- a/configure
+++ b/configure
@@ -506,6 +506,7 @@ fuzzing="no"
 rng_none="no"
 secret_keyring=""
 libdaxctl=""
+meson=meson
 
 supported_cpu="no"
 supported_os="no"
@@ -1002,6 +1003,8 @@ for opt do
   ;;
   --sphinx-build=*) sphinx_build="$optarg"
   ;;
+  --meson=*) meson="$optarg"
+  ;;
   --gcov=*) gcov_tool="$optarg"
   ;;
   --smbd=*) smbd="$optarg"
@@ -1767,6 +1770,7 @@ Advanced options (experts only):
   --install=INSTALLuse specified install [$install]
   --python=PYTHON  use specified python [$python]
   --sphinx-build=SPHINXuse specified sphinx-build [$sphinx_build]
+  --meson=MESONuse specified meson [$meson]
   --smbd=SMBD  use specified smbd [$smbd]
   --with-git=GIT   use specified git [$git]
   --static enable static build [$static]
@@ 

[PATCH 028/150] contrib/libvhost-user: convert to Meson

2020-08-14 Thread Paolo Bonzini
Since libqemuutil.a has been converted to Meson, the conversion is
straightforward.

Signed-off-by: Paolo Bonzini 
---
 Makefile| 16 +---
 Makefile.objs   |  1 -
 contrib/libvhost-user/Makefile.objs |  1 -
 contrib/libvhost-user/meson.build   |  3 +++
 meson.build |  8 
 5 files changed, 16 insertions(+), 13 deletions(-)
 delete mode 100644 contrib/libvhost-user/Makefile.objs
 create mode 100644 contrib/libvhost-user/meson.build

diff --git a/Makefile b/Makefile
index f89687785f..b30de2fd5d 100644
--- a/Makefile
+++ b/Makefile
@@ -309,7 +309,6 @@ dummy := $(call unnest-vars,, \
 ivshmem-server-obj-y \
 virtiofsd-obj-y \
 rdmacm-mux-obj-y \
-libvhost-user-obj-y \
 vhost-user-scsi-obj-y \
 vhost-user-blk-obj-y \
 vhost-user-input-obj-y \
@@ -434,11 +433,6 @@ $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc 
config-host.h
 
 Makefile: $(version-obj-y)
 
-##
-# Build libraries
-
-libvhost-user.a: $(libvhost-user-obj-y)
-
 ##
 
 COMMON_LDADDS = libqemuutil.a
@@ -537,9 +531,9 @@ ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) 
$(COMMON_LDADDS)
 ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
$(call LINK, $^)
 endif
-vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a 
$(COMMON_LDADDS)
+vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
$(call LINK, $^)
-vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a 
$(COMMON_LDADDS)
+vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
$(call LINK, $^)
 
 rdmacm-mux$(EXESUF): LIBS += "-libumad"
@@ -548,16 +542,16 @@ rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
 
 # relies on Linux-specific syscalls
 ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
-virtiofsd$(EXESUF): $(virtiofsd-obj-y) libvhost-user.a $(COMMON_LDADDS)
+virtiofsd$(EXESUF): $(virtiofsd-obj-y) contrib/libvhost-user/libvhost-user.a 
$(COMMON_LDADDS)
$(call LINK, $^)
 endif
 
-vhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) libvhost-user.a 
$(COMMON_LDADDS)
+vhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
$(call LINK, $^)
 
 ifdef CONFIG_VHOST_USER_INPUT
 ifdef CONFIG_LINUX
-vhost-user-input$(EXESUF): $(vhost-user-input-obj-y) libvhost-user.a 
$(COMMON_LDADDS)
+vhost-user-input$(EXESUF): $(vhost-user-input-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
$(call LINK, $^)
 
 # build by default, do not install
diff --git a/Makefile.objs b/Makefile.objs
index e5c9077517..9489864967 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -106,7 +106,6 @@ qga-vss-dll-obj-y = qga/
 elf2dmp-obj-y = contrib/elf2dmp/
 ivshmem-client-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-client/
 ivshmem-server-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-server/
-libvhost-user-obj-y = contrib/libvhost-user/
 vhost-user-scsi.o-cflags := $(LIBISCSI_CFLAGS)
 vhost-user-scsi.o-libs := $(LIBISCSI_LIBS)
 vhost-user-scsi-obj-y = contrib/vhost-user-scsi/
diff --git a/contrib/libvhost-user/Makefile.objs 
b/contrib/libvhost-user/Makefile.objs
deleted file mode 100644
index ef3778edd4..00
--- a/contrib/libvhost-user/Makefile.objs
+++ /dev/null
@@ -1 +0,0 @@
-libvhost-user-obj-y += libvhost-user.o libvhost-user-glib.o
diff --git a/contrib/libvhost-user/meson.build 
b/contrib/libvhost-user/meson.build
new file mode 100644
index 00..e68dd1a581
--- /dev/null
+++ b/contrib/libvhost-user/meson.build
@@ -0,0 +1,3 @@
+libvhost_user = static_library('vhost-user',
+   files('libvhost-user.c', 
'libvhost-user-glib.c'),
+   build_by_default: false)
diff --git a/meson.build b/meson.build
index f16add33ca..ac70973012 100644
--- a/meson.build
+++ b/meson.build
@@ -239,6 +239,14 @@ libqemuutil = static_library('qemuutil',
 qemuutil = declare_dependency(link_with: libqemuutil,
   sources: genh + version_res)
 
+# Other build targets
+
+if have_tools
+  if 'CONFIG_VHOST_USER' in config_host
+subdir('contrib/libvhost-user')
+  endif
+endif
+
 summary_info = {}
 summary_info += {'Install prefix':config_host['prefix']}
 summary_info += {'BIOS directory':config_host['qemu_datadir']}
-- 
2.26.2





[PATCH 017/150] configure: generate Meson cross file

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 configure | 68 +++
 1 file changed, 59 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index f99baba99e..c9f36153dd 100755
--- a/configure
+++ b/configure
@@ -8580,21 +8580,71 @@ echo "# Automatically generated by configure - do not 
modify" > "$iotests_common
 echo >> "$iotests_common_env"
 echo "export PYTHON='$python'" >> "$iotests_common_env"
 
+cross="config-meson.cross"
+cross_arg=
+
+if test -n "$cross_prefix"; then
+echo "# Automatically generated by configure - do not modify" > $cross
+echo "[binaries]" >> $cross
+echo "c = '$cc'" >> $cross
+echo "cpp = '$cxx'" >> $cross
+echo "ar = '$ar'" >> $cross
+echo "nm = '$nm'" >> $cross
+echo "pkgconfig = '$pkg_config_exe'" >> $cross
+echo "ranlib = '$ranlib'" >> $cross
+echo "strip = '$strip'" >> $cross
+echo "windres = '$windres'" >> $cross
+
+echo "[host_machine]" >> $cross
+
+# Hack: Meson expects an absolute path for the *build* machine
+# for the prefix, so add a slash in front of a Windows path that
+# includes a drive letter.
+#
+# See https://github.com/mesonbuild/meson/issues/7577.
+if test "$mingw32" = "yes" ; then
+echo "system = 'windows'" >> $cross
+case prefix in
+?:*) pre_prefix=/ ;;
+esac
+fi
+case "$ARCH" in
+i386|x86_64)
+echo "cpu_family = 'x86'" >> $cross
+;;
+ppc64le)
+echo "cpu_family = 'ppc64'" >> $cross
+;;
+*)
+echo "cpu_family = '$ARCH'" >> $cross
+;;
+esac
+echo "cpu = '$cpu'" >> $cross
+if test "$bigendian" = "yes" ; then
+echo "endian = 'big'" >> $cross
+else
+echo "endian = 'little'" >> $cross
+fi
+
+cross_arg="--cross-file=$cross"
+fi
+
 rm -rf meson-private/ meson-logs/ meson-info/
 NINJA=$PWD/ninjatool $meson setup \
---prefix "$prefix" \
---libdir "$libdir" \
---libexecdir "$libexecdir" \
---bindir "$bindir" \
---includedir "$includedir" \
---datadir "$datadir" \
---mandir "$mandir" \
---sysconfdir "$sysconfdir" \
---localstatedir "$local_statedir" \
+--prefix "${pre_prefix}$prefix" \
+--libdir "${pre_prefix}$libdir" \
+--libexecdir "${pre_prefix}$libexecdir" \
+--bindir "${pre_prefix}$bindir" \
+--includedir "${pre_prefix}$includedir" \
+--datadir "${pre_prefix}$datadir" \
+--mandir "${pre_prefix}$mandir" \
+--sysconfdir "${pre_prefix}$sysconfdir" \
+--localstatedir "${pre_prefix}$local_statedir" \
 -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) 
\
 -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo 
false; fi) \
 -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; 
fi) \
 -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; 
fi) \
+$cross_arg \
 "$PWD" "$source_path"
 
 if test "$?" -ne 0 ; then
-- 
2.26.2





[PATCH 034/150] contrib/vhost-user-input: convert to meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile   | 11 ---
 Makefile.objs  |  1 -
 contrib/vhost-user-input/Makefile.objs |  1 -
 contrib/vhost-user-input/meson.build   |  5 +
 meson.build|  1 +
 5 files changed, 6 insertions(+), 13 deletions(-)
 delete mode 100644 contrib/vhost-user-input/Makefile.objs
 create mode 100644 contrib/vhost-user-input/meson.build

diff --git a/Makefile b/Makefile
index 0a5bc1f424..8da297f149 100644
--- a/Makefile
+++ b/Makefile
@@ -302,7 +302,6 @@ dummy := $(call unnest-vars,, \
 elf2dmp-obj-y \
 ivshmem-client-obj-y \
 ivshmem-server-obj-y \
-vhost-user-input-obj-y \
 vhost-user-gpu-obj-y \
 qga-vss-dll-obj-y \
 block-obj-y \
@@ -526,16 +525,6 @@ endif
 vhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
$(call LINK, $^)
 
-ifdef CONFIG_VHOST_USER_INPUT
-ifdef CONFIG_LINUX
-vhost-user-input$(EXESUF): $(vhost-user-input-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
-   $(call LINK, $^)
-
-# build by default, do not install
-all: vhost-user-input$(EXESUF)
-endif
-endif
-
 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(call quiet-command,$(PYTHON) $< $@ \
$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
diff --git a/Makefile.objs b/Makefile.objs
index 0f80b63554..0922c3ed00 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -106,7 +106,6 @@ qga-vss-dll-obj-y = qga/
 elf2dmp-obj-y = contrib/elf2dmp/
 ivshmem-client-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-client/
 ivshmem-server-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-server/
-vhost-user-input-obj-y = contrib/vhost-user-input/
 vhost-user-gpu-obj-y = contrib/vhost-user-gpu/
 
 ##
diff --git a/contrib/vhost-user-input/Makefile.objs 
b/contrib/vhost-user-input/Makefile.objs
deleted file mode 100644
index b1fad90d51..00
--- a/contrib/vhost-user-input/Makefile.objs
+++ /dev/null
@@ -1 +0,0 @@
-vhost-user-input-obj-y = main.o
diff --git a/contrib/vhost-user-input/meson.build 
b/contrib/vhost-user-input/meson.build
new file mode 100644
index 00..1eeb1329d9
--- /dev/null
+++ b/contrib/vhost-user-input/meson.build
@@ -0,0 +1,5 @@
+executable('vhost-user-input', files('main.c'),
+   link_with: libvhost_user,
+   dependencies: qemuutil,
+   build_by_default: targetos == 'linux',
+   install: false)
diff --git a/meson.build b/meson.build
index a4b8d66385..4c952c7264 100644
--- a/meson.build
+++ b/meson.build
@@ -261,6 +261,7 @@ if have_tools
   if 'CONFIG_VHOST_USER' in config_host
 subdir('contrib/libvhost-user')
 subdir('contrib/vhost-user-blk')
+subdir('contrib/vhost-user-input')
 subdir('contrib/vhost-user-scsi')
   endif
 endif
-- 
2.26.2





[PATCH 027/150] meson: add version.o

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 meson.build | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 6550262b9b..f16add33ca 100644
--- a/meson.build
+++ b/meson.build
@@ -45,8 +45,14 @@ targetos = host_machine.system()
 m = cc.find_library('m', required: false)
 util = cc.find_library('util', required: false)
 socket = []
+version_res = []
 if host_machine.system() == 'windows'
   socket = cc.find_library('ws2_32')
+
+  win = import('windows')
+  version_res = win.compile_resources('version.rc',
+  depend_files: 
files('pc-bios/qemu-nsis.ico'),
+  include_directories: 
include_directories('.'))
 endif
 glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(),
   link_args: config_host['GLIB_LIBS'].split())
@@ -231,7 +237,7 @@ libqemuutil = static_library('qemuutil',
  sources: util_ss.sources() + stub_ss.sources() + 
genh,
  dependencies: [util_ss.dependencies(), m, glib, 
socket])
 qemuutil = declare_dependency(link_with: libqemuutil,
-  sources: genh)
+  sources: genh + version_res)
 
 summary_info = {}
 summary_info += {'Install prefix':config_host['prefix']}
-- 
2.26.2





[PATCH 021/150] meson: enable pie

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index e8c1ed5aba..50ecafa658 100755
--- a/configure
+++ b/configure
@@ -8464,6 +8464,7 @@ NINJA=$PWD/ninjatool $meson setup \
 -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo 
false; fi) \
 -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; 
fi) \
 -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; 
fi) \
+-Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
 $cross_arg \
 "$PWD" "$source_path"
 
-- 
2.26.2





[PATCH 033/150] contrib/rdmacm-mux: convert to Meson

2020-08-14 Thread Paolo Bonzini
We can use config-host.mak to decide whether the tool has to be built,
apart from that the conversion is straightforward.

Signed-off-by: Paolo Bonzini 
---
 Makefile | 5 -
 Makefile.objs| 1 -
 contrib/rdmacm-mux/Makefile.objs | 3 ---
 contrib/rdmacm-mux/meson.build   | 8 
 meson.build  | 2 ++
 5 files changed, 10 insertions(+), 9 deletions(-)
 delete mode 100644 contrib/rdmacm-mux/Makefile.objs
 create mode 100644 contrib/rdmacm-mux/meson.build

diff --git a/Makefile b/Makefile
index fa7bc837f1..0a5bc1f424 100644
--- a/Makefile
+++ b/Makefile
@@ -302,7 +302,6 @@ dummy := $(call unnest-vars,, \
 elf2dmp-obj-y \
 ivshmem-client-obj-y \
 ivshmem-server-obj-y \
-rdmacm-mux-obj-y \
 vhost-user-input-obj-y \
 vhost-user-gpu-obj-y \
 qga-vss-dll-obj-y \
@@ -524,10 +523,6 @@ ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) 
$(COMMON_LDADDS)
$(call LINK, $^)
 endif
 
-rdmacm-mux$(EXESUF): LIBS += "-libumad"
-rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
-   $(call LINK, $^)
-
 vhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
$(call LINK, $^)
 
diff --git a/Makefile.objs b/Makefile.objs
index ab798b08a7..0f80b63554 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -106,7 +106,6 @@ qga-vss-dll-obj-y = qga/
 elf2dmp-obj-y = contrib/elf2dmp/
 ivshmem-client-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-client/
 ivshmem-server-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-server/
-rdmacm-mux-obj-y = contrib/rdmacm-mux/
 vhost-user-input-obj-y = contrib/vhost-user-input/
 vhost-user-gpu-obj-y = contrib/vhost-user-gpu/
 
diff --git a/contrib/rdmacm-mux/Makefile.objs b/contrib/rdmacm-mux/Makefile.objs
deleted file mode 100644
index 3df744af89..00
--- a/contrib/rdmacm-mux/Makefile.objs
+++ /dev/null
@@ -1,3 +0,0 @@
-ifdef CONFIG_PVRDMA
-rdmacm-mux-obj-y = main.o
-endif
diff --git a/contrib/rdmacm-mux/meson.build b/contrib/rdmacm-mux/meson.build
new file mode 100644
index 00..1a01bb9262
--- /dev/null
+++ b/contrib/rdmacm-mux/meson.build
@@ -0,0 +1,8 @@
+if 'CONFIG_PVRDMA' in config_host
+  # if not found, CONFIG_PVRDMA should not be set
+  libumad = cc.find_library('ibumad', required: true)
+  executable('rdmacm-mux', files('main.c'),
+ dependencies: [glib, libumad],
+ build_by_default: targetos == 'linux',
+ install: false)
+endif
diff --git a/meson.build b/meson.build
index ac151bdd02..a4b8d66385 100644
--- a/meson.build
+++ b/meson.build
@@ -256,6 +256,8 @@ qemuutil = declare_dependency(link_with: libqemuutil,
 # Other build targets
 
 if have_tools
+  subdir('contrib/rdmacm-mux')
+
   if 'CONFIG_VHOST_USER' in config_host
 subdir('contrib/libvhost-user')
 subdir('contrib/vhost-user-blk')
-- 
2.26.2





[PATCH 023/150] meson: add sparse support

2020-08-14 Thread Paolo Bonzini
Do not use cgcc; instead, extract compilation commands from 
compile_commands.json
and invoke sparse directly.

Signed-off-by: Paolo Bonzini 
---
 Makefile|  1 +
 configure   |  8 ++--
 meson.build |  7 +++
 scripts/check_sparse.py | 25 +
 4 files changed, 35 insertions(+), 6 deletions(-)
 create mode 100644 scripts/check_sparse.py

diff --git a/Makefile b/Makefile
index 7e9663aeb7..6198236c40 100644
--- a/Makefile
+++ b/Makefile
@@ -1256,6 +1256,7 @@ endif
$(call print-help,install,Install QEMU, documentation and tools)
$(call print-help,ctags/TAGS,Generate tags file for editors)
$(call print-help,cscope,Generate cscope index)
+   $(call print-help,sparse,Run sparse on the QEMU source)
@echo  ''
@$(if $(TARGET_DIRS), \
echo 'Architecture specific targets:'; \
diff --git a/configure b/configure
index 54e8b91843..017c2df63d 100755
--- a/configure
+++ b/configure
@@ -3009,7 +3009,7 @@ fi
 ##
 # Sparse probe
 if test "$sparse" != "no" ; then
-  if has cgcc; then
+  if has sparse; then
 sparse=yes
   else
 if test "$sparse" = "yes" ; then
@@ -7810,11 +7810,7 @@ echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
 if test "$sparse" = "yes" ; then
-  echo "CC   := REAL_CC=\"\$(CC)\" cgcc"   >> $config_host_mak
-  echo "CPP  := REAL_CC=\"\$(CPP)\" cgcc"  >> $config_host_mak
-  echo "CXX  := REAL_CC=\"\$(CXX)\" cgcc"  >> $config_host_mak
-  echo "HOST_CC  := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
-  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer 
-Wno-non-pointer-null" >> $config_host_mak
+  echo "SPARSE_CFLAGS = -Wbitwise -Wno-transparent-union -Wno-old-initializer 
-Wno-non-pointer-null" >> $config_host_mak
 fi
 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
 echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 3070439fe0..5f32f8293f 100644
--- a/meson.build
+++ b/meson.build
@@ -17,6 +17,13 @@ add_project_arguments(config_host['QEMU_INCLUDES'].split(),
 
 python = import('python').find_installation(config_host['PYTHON'].split()[0])
 
+if 'SPARSE_CFLAGS' in config_host
+  run_target('sparse',
+ command: [find_program('scripts/check_sparse.py'),
+   config_host['SPARSE_CFLAGS'].split(),
+   'compile_commands.json'])
+endif
+
 if host_machine.system() == 'darwin'
   add_languages('objc', required: false, native: false)
 endif
diff --git a/scripts/check_sparse.py b/scripts/check_sparse.py
new file mode 100644
index 00..0de7aa55d9
--- /dev/null
+++ b/scripts/check_sparse.py
@@ -0,0 +1,25 @@
+#! /usr/bin/env python3
+
+# Invoke sparse based on the contents of compile_commands.json
+
+import json
+import subprocess
+import sys
+import shlex
+
+def extract_cflags(shcmd):
+cflags = shlex.split(shcmd)
+return [x for x in cflags
+if x.startswith('-D') or x.startswith('-I') or x.startswith('-W')
+   or x.startswith('-std=')]
+
+cflags = sys.argv[1:-1]
+with open(sys.argv[-1], 'r') as fd:
+compile_commands = json.load(fd)
+
+for cmd in compile_commands:
+cmd = ['sparse'] + cflags + extract_cflags(cmd['command']) + [cmd['file']]
+print(' '.join((shlex.quote(x) for x in cmd)))
+r = subprocess.run(cmd)
+if r.returncode != 0:
+sys.exit(r.returncode)
-- 
2.26.2





[PATCH 030/150] contrib/vhost-user-blk: convert to Meson

2020-08-14 Thread Paolo Bonzini
The GLib pkg-config information is extracted from config-host.mak and
used to link vhost-user-blk.

Signed-off-by: Paolo Bonzini 
---
 Makefile | 3 ---
 Makefile.objs| 1 -
 contrib/vhost-user-blk/Makefile.objs | 1 -
 contrib/vhost-user-blk/meson.build   | 5 +
 meson.build  | 1 +
 5 files changed, 6 insertions(+), 5 deletions(-)
 delete mode 100644 contrib/vhost-user-blk/Makefile.objs
 create mode 100644 contrib/vhost-user-blk/meson.build

diff --git a/Makefile b/Makefile
index 310989ce4d..3d269fad61 100644
--- a/Makefile
+++ b/Makefile
@@ -304,7 +304,6 @@ dummy := $(call unnest-vars,, \
 ivshmem-server-obj-y \
 rdmacm-mux-obj-y \
 vhost-user-scsi-obj-y \
-vhost-user-blk-obj-y \
 vhost-user-input-obj-y \
 vhost-user-gpu-obj-y \
 qga-vss-dll-obj-y \
@@ -527,8 +526,6 @@ ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) 
$(COMMON_LDADDS)
 endif
 vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
$(call LINK, $^)
-vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
-   $(call LINK, $^)
 
 rdmacm-mux$(EXESUF): LIBS += "-libumad"
 rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
diff --git a/Makefile.objs b/Makefile.objs
index fee0f71372..f69736c10c 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -109,7 +109,6 @@ ivshmem-server-obj-$(CONFIG_IVSHMEM) = 
contrib/ivshmem-server/
 vhost-user-scsi.o-cflags := $(LIBISCSI_CFLAGS)
 vhost-user-scsi.o-libs := $(LIBISCSI_LIBS)
 vhost-user-scsi-obj-y = contrib/vhost-user-scsi/
-vhost-user-blk-obj-y = contrib/vhost-user-blk/
 rdmacm-mux-obj-y = contrib/rdmacm-mux/
 vhost-user-input-obj-y = contrib/vhost-user-input/
 vhost-user-gpu-obj-y = contrib/vhost-user-gpu/
diff --git a/contrib/vhost-user-blk/Makefile.objs 
b/contrib/vhost-user-blk/Makefile.objs
deleted file mode 100644
index 72e2cdc3ad..00
--- a/contrib/vhost-user-blk/Makefile.objs
+++ /dev/null
@@ -1 +0,0 @@
-vhost-user-blk-obj-y = vhost-user-blk.o
diff --git a/contrib/vhost-user-blk/meson.build 
b/contrib/vhost-user-blk/meson.build
new file mode 100644
index 00..05cbf816d2
--- /dev/null
+++ b/contrib/vhost-user-blk/meson.build
@@ -0,0 +1,5 @@
+executable('vhost-user-blk', files('vhost-user-blk.c'),
+   link_with: libvhost_user,
+   dependencies: qemuutil,
+   build_by_default: targetos == 'linux',
+   install: false)
diff --git a/meson.build b/meson.build
index cf7d6de67d..5cbcd5775e 100644
--- a/meson.build
+++ b/meson.build
@@ -253,6 +253,7 @@ qemuutil = declare_dependency(link_with: libqemuutil,
 if have_tools
   if 'CONFIG_VHOST_USER' in config_host
 subdir('contrib/libvhost-user')
+subdir('contrib/vhost-user-blk')
   endif
 endif
 
-- 
2.26.2





[PATCH 032/150] contrib/vhost-user-scsi: convert to Meson

2020-08-14 Thread Paolo Bonzini
The libiscsi pkg-config information is extracted from config-host.mak and
used to link vhost-user-blk.

Signed-off-by: Paolo Bonzini 
---
 Makefile  | 3 ---
 Makefile.objs | 3 ---
 contrib/vhost-user-scsi/Makefile.objs | 1 -
 contrib/vhost-user-scsi/meson.build   | 7 +++
 meson.build   | 6 ++
 5 files changed, 13 insertions(+), 7 deletions(-)
 delete mode 100644 contrib/vhost-user-scsi/Makefile.objs
 create mode 100644 contrib/vhost-user-scsi/meson.build

diff --git a/Makefile b/Makefile
index 3d269fad61..fa7bc837f1 100644
--- a/Makefile
+++ b/Makefile
@@ -303,7 +303,6 @@ dummy := $(call unnest-vars,, \
 ivshmem-client-obj-y \
 ivshmem-server-obj-y \
 rdmacm-mux-obj-y \
-vhost-user-scsi-obj-y \
 vhost-user-input-obj-y \
 vhost-user-gpu-obj-y \
 qga-vss-dll-obj-y \
@@ -524,8 +523,6 @@ ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) 
$(COMMON_LDADDS)
 ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
$(call LINK, $^)
 endif
-vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
-   $(call LINK, $^)
 
 rdmacm-mux$(EXESUF): LIBS += "-libumad"
 rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
diff --git a/Makefile.objs b/Makefile.objs
index f69736c10c..ab798b08a7 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -106,9 +106,6 @@ qga-vss-dll-obj-y = qga/
 elf2dmp-obj-y = contrib/elf2dmp/
 ivshmem-client-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-client/
 ivshmem-server-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-server/
-vhost-user-scsi.o-cflags := $(LIBISCSI_CFLAGS)
-vhost-user-scsi.o-libs := $(LIBISCSI_LIBS)
-vhost-user-scsi-obj-y = contrib/vhost-user-scsi/
 rdmacm-mux-obj-y = contrib/rdmacm-mux/
 vhost-user-input-obj-y = contrib/vhost-user-input/
 vhost-user-gpu-obj-y = contrib/vhost-user-gpu/
diff --git a/contrib/vhost-user-scsi/Makefile.objs 
b/contrib/vhost-user-scsi/Makefile.objs
deleted file mode 100644
index e83a38a85b..00
--- a/contrib/vhost-user-scsi/Makefile.objs
+++ /dev/null
@@ -1 +0,0 @@
-vhost-user-scsi-obj-y = vhost-user-scsi.o
diff --git a/contrib/vhost-user-scsi/meson.build 
b/contrib/vhost-user-scsi/meson.build
new file mode 100644
index 00..257cbffc8e
--- /dev/null
+++ b/contrib/vhost-user-scsi/meson.build
@@ -0,0 +1,7 @@
+if 'CONFIG_LIBISCSI' in config_host
+  executable('vhost-user-scsi', files('vhost-user-scsi.c'),
+ link_with: libvhost_user,
+ dependencies: [qemuutil, libiscsi],
+ build_by_default: targetos == 'linux',
+ install: false)
+endif
diff --git a/meson.build b/meson.build
index 5cbcd5775e..ac151bdd02 100644
--- a/meson.build
+++ b/meson.build
@@ -88,6 +88,11 @@ libcap_ng = not_found
 if 'CONFIG_LIBCAP_NG' in config_host
   libcap_ng = declare_dependency(link_args: 
config_host['LIBCAP_NG_LIBS'].split())
 endif
+libiscsi = not_found
+if 'CONFIG_LIBISCSI' in config_host
+  libiscsi = declare_dependency(compile_args: 
config_host['LIBISCSI_CFLAGS'].split(),
+link_args: 
config_host['LIBISCSI_LIBS'].split())
+endif
 
 target_dirs = config_host['TARGET_DIRS'].split()
 have_user = false
@@ -254,6 +259,7 @@ if have_tools
   if 'CONFIG_VHOST_USER' in config_host
 subdir('contrib/libvhost-user')
 subdir('contrib/vhost-user-blk')
+subdir('contrib/vhost-user-scsi')
   endif
 endif
 
-- 
2.26.2





[PATCH 049/150] meson: generate qemu-version.h

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile| 27 +--
 meson.build | 14 --
 scripts/qemu-version.sh | 25 +
 3 files changed, 38 insertions(+), 28 deletions(-)
 create mode 100755 scripts/qemu-version.sh

diff --git a/Makefile b/Makefile
index 5fbf5e4bbd..9abf7be598 100644
--- a/Makefile
+++ b/Makefile
@@ -112,21 +112,7 @@ include $(SRC_PATH)/rules.mak
 # lor is defined in rules.mak
 CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
 
-# Create QEMU_PKGVERSION and FULL_VERSION strings
-# If PKGVERSION is set, use that; otherwise get version and -dirty status from 
git
-QEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
-  cd $(SRC_PATH); \
-  if test -e .git; then \
-git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
-if ! git diff-index --quiet HEAD &>/dev/null; then \
-  echo "-dirty"; \
-fi; \
-  fi))
-
-# Either "version (pkgversion)", or just "version" if pkgversion not set
-FULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) 
($(QEMU_PKGVERSION)),$(VERSION))
-
-generated-files-y = qemu-version.h config-host.h qemu-options.def
+generated-files-y = config-host.h qemu-options.def
 
 generated-files-y += module_block.h
 
@@ -266,17 +252,6 @@ include $(SRC_PATH)/tests/Makefile.include
 
 all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all 
modules
 
-qemu-version.h: FORCE
-   $(call quiet-command, \
-(printf '#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
-   printf '#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
-   ) > $@.tmp)
-   $(call quiet-command, if ! cmp -s $@ $@.tmp; then \
- mv $@.tmp $@; \
-else \
- rm $@.tmp; \
-fi)
-
 config-host.h: config-host.h-timestamp
 config-host.h-timestamp: config-host.mak
 qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
diff --git a/meson.build b/meson.build
index 01ac61c51f..56b3dd2979 100644
--- a/meson.build
+++ b/meson.build
@@ -154,6 +154,7 @@ have_block = have_system or have_tools
 
 # Generators
 
+genh = []
 qapi_gen = find_program('scripts/qapi-gen.py')
 qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
  meson.source_root() / 'scripts/qapi/commands.py',
@@ -179,6 +180,17 @@ tracetool = [
'--backend=' + config_host['TRACE_BACKENDS']
 ]
 
+qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
+meson.current_source_dir(),
+config_host['PKGVERSION'], config_host['VERSION']]
+qemu_version = custom_target('qemu-version.h',
+ output: 'qemu-version.h',
+ command: qemu_version_cmd,
+ capture: true,
+ build_by_default: true,
+ build_always_stale: true)
+genh += qemu_version
+
 # Collect sourcesets.
 
 util_ss = ss.source_set()
@@ -279,8 +291,6 @@ trace_events_subdirs += [
   'util',
 ]
 
-genh = []
-
 subdir('qapi')
 subdir('qobject')
 subdir('stubs')
diff --git a/scripts/qemu-version.sh b/scripts/qemu-version.sh
new file mode 100755
index 00..4847385e42
--- /dev/null
+++ b/scripts/qemu-version.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -eu
+
+dir="$1"
+pkgversion="$2"
+version="$3"
+
+if [ -z "$pkgversion"]; then
+cd "$dir"
+if [ -e .git ]; then
+pkgversion=$(git describe --match 'v*' --dirty | echo "")
+fi
+fi
+
+if [ -n "$pkgversion" ]; then
+fullversion="$version ($pkgversion)"
+else
+fullversion="$version"
+fi
+
+cat <

[PATCH 043/150] meson: convert dummy Windows qga/qemu-ga target

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 Makefile  | 5 -
 qga/meson.build   | 4 
 qga/vss-win32/meson.build | 2 ++
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index f8e5ebaff9..a61c66096e 100644
--- a/Makefile
+++ b/Makefile
@@ -441,11 +441,6 @@ qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx 
$(SRC_PATH)/scripts/hxtool
 qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
 qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
 
-ifneq ($(EXESUF),)
-.PHONY: qga/qemu-ga
-qga/qemu-ga: qga/qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
-endif
-
 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(call quiet-command,$(PYTHON) $< $@ \
$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
diff --git a/qga/meson.build b/qga/meson.build
index 2d33c09fe6..7e7174b0a3 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -44,6 +44,7 @@ qga = executable('qemu-ga', qga_ss.sources(),
  link_args: config_host['LIBS_QGA'].split(),
  dependencies: [qemuutil, libudev],
  install: true)
+all_qga = [qga]
 
 if host_machine.system() == 'windows'
   if 'CONFIG_QGA_VSS' in config_host
@@ -72,6 +73,9 @@ if host_machine.system() == 'windows'
   config_host['QEMU_GA_MSI_WITH_VSS'].split(),
   
config_host['QEMU_GA_MSI_MINGW_DLL_PATH'].split(),
 ])
+all_qga += [qga-msi]
 alias_target('msi', qga_msi)
   endif
 endif
+
+alias_target('qemu-ga', all_qga)
diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build
index 1f39e05335..780c461432 100644
--- a/qga/vss-win32/meson.build
+++ b/qga/vss-win32/meson.build
@@ -14,6 +14,8 @@ if add_languages('cpp', required: false)
cc.find_library('shlwapi'),
cc.find_library('uuid'),
cc.find_library('intl')])
+
+  all_qga += qga_vss
 endif
 
 # rules to build qga-vss.tlb
-- 
2.26.2





[PATCH 029/150] tools/virtiofsd: convert to Meson

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 Makefile  | 12 
 Makefile.objs |  1 -
 configure |  1 +
 meson.build   | 11 +++
 tools/meson.build | 10 ++
 tools/virtiofsd/Makefile.objs | 12 
 tools/virtiofsd/meson.build   | 19 +++
 tools/virtiofsd/passthrough_ll.c  |  2 +-
 .../{seccomp.c => passthrough_seccomp.c}  |  2 +-
 .../{seccomp.h => passthrough_seccomp.h}  |  0
 10 files changed, 43 insertions(+), 27 deletions(-)
 create mode 100644 tools/meson.build
 delete mode 100644 tools/virtiofsd/Makefile.objs
 create mode 100644 tools/virtiofsd/meson.build
 rename tools/virtiofsd/{seccomp.c => passthrough_seccomp.c} (99%)
 rename tools/virtiofsd/{seccomp.h => passthrough_seccomp.h} (100%)

diff --git a/Makefile b/Makefile
index b30de2fd5d..310989ce4d 100644
--- a/Makefile
+++ b/Makefile
@@ -196,11 +196,6 @@ HELPERS-y += vhost-user-gpu$(EXESUF)
 vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
 endif
 
-ifeq 
($(CONFIG_SOFTMMU)$(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),)
-HELPERS-y += virtiofsd$(EXESUF)
-vhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json
-endif
-
 # Sphinx does not allow building manuals into the same directory as
 # the source files, so if we're doing an in-tree QEMU build we must
 # build the manuals into a subdirectory (and then install them from
@@ -307,7 +302,6 @@ dummy := $(call unnest-vars,, \
 elf2dmp-obj-y \
 ivshmem-client-obj-y \
 ivshmem-server-obj-y \
-virtiofsd-obj-y \
 rdmacm-mux-obj-y \
 vhost-user-scsi-obj-y \
 vhost-user-blk-obj-y \
@@ -540,12 +534,6 @@ rdmacm-mux$(EXESUF): LIBS += "-libumad"
 rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
$(call LINK, $^)
 
-# relies on Linux-specific syscalls
-ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
-virtiofsd$(EXESUF): $(virtiofsd-obj-y) contrib/libvhost-user/libvhost-user.a 
$(COMMON_LDADDS)
-   $(call LINK, $^)
-endif
-
 vhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
$(call LINK, $^)
 
diff --git a/Makefile.objs b/Makefile.objs
index 9489864967..fee0f71372 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -113,6 +113,5 @@ vhost-user-blk-obj-y = contrib/vhost-user-blk/
 rdmacm-mux-obj-y = contrib/rdmacm-mux/
 vhost-user-input-obj-y = contrib/vhost-user-input/
 vhost-user-gpu-obj-y = contrib/vhost-user-gpu/
-virtiofsd-obj-y = tools/virtiofsd/
 
 ##
diff --git a/configure b/configure
index 5062576d3f..ca397dbfa5 100755
--- a/configure
+++ b/configure
@@ -6998,6 +6998,7 @@ if test "$gprof" = "yes" ; then
 fi
 if test "$cap_ng" = "yes" ; then
   echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak
+  echo "LIBCAP_NG_LIBS=$cap_libs" >> $config_host_mak
 fi
 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
 for drv in $audio_drv_list; do
diff --git a/meson.build b/meson.build
index ac70973012..cf7d6de67d 100644
--- a/meson.build
+++ b/meson.build
@@ -79,6 +79,15 @@ if 'CONFIG_GNUTLS' in config_host
   gnutls = declare_dependency(compile_args: 
config_host['GNUTLS_CFLAGS'].split(),
   link_args: config_host['GNUTLS_LIBS'].split())
 endif
+seccomp = not_found
+if 'CONFIG_SECCOMP' in config_host
+  seccomp = declare_dependency(compile_args: 
config_host['SECCOMP_CFLAGS'].split(),
+   link_args: config_host['SECCOMP_LIBS'].split())
+endif
+libcap_ng = not_found
+if 'CONFIG_LIBCAP_NG' in config_host
+  libcap_ng = declare_dependency(link_args: 
config_host['LIBCAP_NG_LIBS'].split())
+endif
 
 target_dirs = config_host['TARGET_DIRS'].split()
 have_user = false
@@ -247,6 +256,8 @@ if have_tools
   endif
 endif
 
+subdir('tools')
+
 summary_info = {}
 summary_info += {'Install prefix':config_host['prefix']}
 summary_info += {'BIOS directory':config_host['qemu_datadir']}
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 00..513bd2ff4f
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,10 @@
+have_virtiofsd = (have_system and
+have_tools and
+'CONFIG_LINUX' in config_host and 
+'CONFIG_SECCOMP' in config_host and
+'CONFIG_LIBCAP_NG' in config_host and
+'CONFIG_VHOST_USER' in config_host)
+
+if have_virtiofsd
+  subdir('virtiofsd')
+endif
diff --git a/tools/virtiofsd/Makefile.objs b/tools/virtiofsd/Makefile.objs
deleted file mode 100644
index 076f667e46..00
--- a/tools/virtiofsd/Makefile.objs
+++ /dev/null
@@ -1,12 +0,0 @@
-virtiofsd-obj-y = buffer.o \
-  fuse_opt.o \
-  fuse_log.o \
-  fuse_lowlevel

[PATCH 025/150] libqemuutil, qapi, trace: convert to meson

2020-08-14 Thread Paolo Bonzini
This shows how to do some "computations" in meson.build using its array
and dictionary data structures, and also a basic usage of the sourceset
module for conditional compilation.

Signed-off-by: Paolo Bonzini 
---
 Makefile| 228 +---
 Makefile.objs   |  95 
 Makefile.target |   8 +-
 configure   |   8 +
 crypto/Makefile.objs|   6 -
 crypto/meson.build  |  11 ++
 docs/devel/tracing.txt  |   2 +-
 meson.build | 194 +++
 qapi/Makefile.objs  |  23 ---
 qapi/meson.build| 121 +++
 qobject/Makefile.objs   |   3 -
 qobject/meson.build |   3 +
 rules.mak   |   2 +-
 scripts/qapi-gen.py |   0
 scripts/tracetool.py|   0
 scripts/tracetool/backend/dtrace.py |   2 +-
 scripts/tracetool/backend/ust.py|   6 +-
 storage-daemon/Makefile.objs|   4 +-
 storage-daemon/meson.build  |   1 +
 storage-daemon/qapi/Makefile.objs   |   1 -
 storage-daemon/qapi/meson.build |  10 ++
 stubs/Makefile.objs |  56 ---
 stubs/meson.build   |  50 ++
 trace/Makefile.objs |  51 ---
 trace/meson.build   |  76 ++
 util/Makefile.objs  |  83 --
 util/meson.build|  69 +
 27 files changed, 588 insertions(+), 525 deletions(-)
 create mode 100644 crypto/meson.build
 create mode 100644 qapi/meson.build
 delete mode 100644 qobject/Makefile.objs
 create mode 100644 qobject/meson.build
 mode change 100755 => 100644 scripts/qapi-gen.py
 mode change 100755 => 100644 scripts/tracetool.py
 create mode 100644 storage-daemon/meson.build
 delete mode 100644 storage-daemon/qapi/Makefile.objs
 create mode 100644 storage-daemon/qapi/meson.build
 delete mode 100644 stubs/Makefile.objs
 create mode 100644 stubs/meson.build
 create mode 100644 trace/meson.build
 delete mode 100644 util/Makefile.objs
 create mode 100644 util/meson.build

diff --git a/Makefile b/Makefile
index 7419d5e19b..4a03af2daa 100644
--- a/Makefile
+++ b/Makefile
@@ -128,184 +128,60 @@ FULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) 
($(QEMU_PKGVERSION)),$(VERSIO
 
 generated-files-y = qemu-version.h config-host.h qemu-options.def
 
-GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
-GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
-GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h)
-GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.c)
-GENERATED_QAPI_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c
-GENERATED_QAPI_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
-GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.h)
-GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c)
-GENERATED_QAPI_FILES += qapi/qapi-init-commands.h qapi/qapi-init-commands.c
-GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c
-GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h)
-GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c)
-GENERATED_QAPI_FILES += qapi/qapi-emit-events.h qapi/qapi-emit-events.c
-GENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c
-GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h)
-GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c)
-GENERATED_QAPI_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h
-GENERATED_QAPI_FILES += qapi/qapi-doc.texi
-
-# The following list considers only the storage daemon main module. All other
-# modules are currently shared with the main schema, so we don't actually
-# generate additional files.
-
-GENERATED_STORAGE_DAEMON_QAPI_FILES = storage-daemon/qapi/qapi-commands.h
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-commands.c
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-emit-events.h
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-emit-events.c
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-events.h
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-events.c
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-init-commands.h
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-init-commands.c
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-introspect.h
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-introspect.c
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-types.h
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-types.c
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-visit.h
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-visit.c
-GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-doc.texi

[PATCH 047/150] meson: add virtfs-proxy-helper

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile  | 2 --
 configure | 7 +--
 fsdev/meson.build | 8 
 meson.build   | 6 ++
 4 files changed, 19 insertions(+), 4 deletions(-)
 create mode 100644 fsdev/meson.build

diff --git a/Makefile b/Makefile
index a768af38eb..79abbedd9d 100644
--- a/Makefile
+++ b/Makefile
@@ -420,8 +420,6 @@ qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) 
$(crypto-obj-y) $(io
 qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) 
$(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) 
$(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) 
$(storage-daemon-obj-y) $(COMMON_LDADDS)
 
-fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o 
fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
-
 scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o 
$(authz-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 ifdef CONFIG_MPATH
 scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
diff --git a/configure b/configure
index d521ed4451..c4f694066b 100755
--- a/configure
+++ b/configure
@@ -4339,6 +4339,7 @@ fi
 ##
 # attr probe
 
+libattr_libs=
 if test "$attr" != "no" ; then
   cat > $TMPC <
@@ -4355,7 +4356,8 @@ EOF
   # Older distros have , and need -lattr:
   elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
 attr=yes
-LIBS="-lattr $LIBS"
+libattr_libs="-lattr"
+LIBS="$libattr_libs $LIBS"
 libattr=yes
   else
 if test "$attr" = "yes" ; then
@@ -6667,6 +6669,7 @@ if [ "$eventfd" = "yes" ]; then
 fi
 
 tools=""
+helpers=""
 if test "$want_tools" = "yes" ; then
   tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
@@ -6677,7 +6680,6 @@ if test "$softmmu" = yes ; then
   if test "$linux" = yes; then
 if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; 
then
   virtfs=yes
-  helpers="$helpers fsdev/virtfs-proxy-helper\$(EXESUF)"
 else
   if test "$virtfs" = yes; then
 error_exit "VirtFS requires libcap-ng devel and libattr devel"
@@ -7259,6 +7261,7 @@ if test "$linux_io_uring" = "yes" ; then
 fi
 if test "$attr" = "yes" ; then
   echo "CONFIG_ATTR=y" >> $config_host_mak
+  echo "LIBATTR_LIBS=$libattr_libs" >> $config_host_mak
 fi
 if test "$libattr" = "yes" ; then
   echo "CONFIG_LIBATTR=y" >> $config_host_mak
diff --git a/fsdev/meson.build b/fsdev/meson.build
new file mode 100644
index 00..30e2319960
--- /dev/null
+++ b/fsdev/meson.build
@@ -0,0 +1,8 @@
+have_virtfs_proxy_helper = have_tools and libattr.found() and 
libcap_ng.found() and 'CONFIG_VIRTFS' in config_host
+if have_virtfs_proxy_helper
+  executable('virtfs-proxy-helper',
+ files('virtfs-proxy-helper.c', '9p-marshal.c', 
'9p-iov-marshal.c'),
+ dependencies: [qemuutil, libattr, libcap_ng],
+ install: true,
+ install_dir: get_option('libexecdir'))
+endif
diff --git a/meson.build b/meson.build
index 70b1936299..fb2089bc77 100644
--- a/meson.build
+++ b/meson.build
@@ -98,6 +98,10 @@ if 'CONFIG_GNUTLS' in config_host
 endif
 pixman = declare_dependency(compile_args: config_host['PIXMAN_CFLAGS'].split(),
 link_args: config_host['PIXMAN_LIBS'].split())
+libattr = not_found
+if 'CONFIG_ATTR' in config_host
+  libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
+endif
 seccomp = not_found
 if 'CONFIG_SECCOMP' in config_host
   seccomp = declare_dependency(compile_args: 
config_host['SECCOMP_CFLAGS'].split(),
@@ -297,6 +301,8 @@ libqemuutil = static_library('qemuutil',
 qemuutil = declare_dependency(link_with: libqemuutil,
   sources: genh + version_res)
 
+subdir('fsdev')
+
 # Other build targets
 if 'CONFIG_GUEST_AGENT' in config_host
   subdir('qga')
-- 
2.26.2





[PATCH 036/150] contrib/ivshmem: convert to meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile | 9 -
 Makefile.objs| 2 --
 configure| 3 ---
 contrib/ivshmem-client/Makefile.objs | 1 -
 contrib/ivshmem-client/meson.build   | 4 
 contrib/ivshmem-server/Makefile.objs | 1 -
 contrib/ivshmem-server/meson.build   | 4 
 meson.build  | 5 +
 8 files changed, 13 insertions(+), 16 deletions(-)
 delete mode 100644 contrib/ivshmem-client/Makefile.objs
 create mode 100644 contrib/ivshmem-client/meson.build
 delete mode 100644 contrib/ivshmem-server/Makefile.objs
 create mode 100644 contrib/ivshmem-server/meson.build

diff --git a/Makefile b/Makefile
index 4ce8d2b0c6..208e98dd4d 100644
--- a/Makefile
+++ b/Makefile
@@ -294,8 +294,6 @@ dummy := $(call unnest-vars,, \
 chardev-obj-y \
 qga-obj-y \
 elf2dmp-obj-y \
-ivshmem-client-obj-y \
-ivshmem-server-obj-y \
 qga-vss-dll-obj-y \
 block-obj-y \
 block-obj-m \
@@ -508,13 +506,6 @@ endif
 elf2dmp$(EXESUF): $(elf2dmp-obj-y)
$(call LINK, $^)
 
-ifdef CONFIG_IVSHMEM
-ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
-   $(call LINK, $^)
-ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
-   $(call LINK, $^)
-endif
-
 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(call quiet-command,$(PYTHON) $< $@ \
$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
diff --git a/Makefile.objs b/Makefile.objs
index 2f2d4b2066..336a684ff3 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -104,7 +104,5 @@ qga-vss-dll-obj-y = qga/
 ##
 # contrib
 elf2dmp-obj-y = contrib/elf2dmp/
-ivshmem-client-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-client/
-ivshmem-server-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-server/
 
 ##
diff --git a/configure b/configure
index ca397dbfa5..f64454b090 100755
--- a/configure
+++ b/configure
@@ -6680,9 +6680,6 @@ if test "$want_tools" = "yes" ; then
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
 tools="qemu-nbd\$(EXESUF) qemu-storage-daemon\$(EXESUF) $tools"
   fi
-  if [ "$ivshmem" = "yes" ]; then
-tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
-  fi
   if [ "$curl" = "yes" ]; then
   tools="elf2dmp\$(EXESUF) $tools"
   fi
diff --git a/contrib/ivshmem-client/Makefile.objs 
b/contrib/ivshmem-client/Makefile.objs
deleted file mode 100644
index bfab2d20dd..00
--- a/contrib/ivshmem-client/Makefile.objs
+++ /dev/null
@@ -1 +0,0 @@
-ivshmem-client-obj-y = ivshmem-client.o main.o
diff --git a/contrib/ivshmem-client/meson.build 
b/contrib/ivshmem-client/meson.build
new file mode 100644
index 00..1b171efb4f
--- /dev/null
+++ b/contrib/ivshmem-client/meson.build
@@ -0,0 +1,4 @@
+executable('ivshmem-client', files('ivshmem-client.c', 'main.c'),
+   dependencies: glib,
+   build_by_default: targetos == 'linux',
+   install: false)
diff --git a/contrib/ivshmem-server/Makefile.objs 
b/contrib/ivshmem-server/Makefile.objs
deleted file mode 100644
index c060dd3698..00
--- a/contrib/ivshmem-server/Makefile.objs
+++ /dev/null
@@ -1 +0,0 @@
-ivshmem-server-obj-y = ivshmem-server.o main.o
diff --git a/contrib/ivshmem-server/meson.build 
b/contrib/ivshmem-server/meson.build
new file mode 100644
index 00..3a53942201
--- /dev/null
+++ b/contrib/ivshmem-server/meson.build
@@ -0,0 +1,4 @@
+executable('ivshmem-server', files('ivshmem-server.c', 'main.c'),
+   dependencies: [qemuutil, rt],
+   build_by_default: targetos == 'linux',
+   install: false)
diff --git a/meson.build b/meson.build
index c28285d797..193881c888 100644
--- a/meson.build
+++ b/meson.build
@@ -90,6 +90,7 @@ libcap_ng = not_found
 if 'CONFIG_LIBCAP_NG' in config_host
   libcap_ng = declare_dependency(link_args: 
config_host['LIBCAP_NG_LIBS'].split())
 endif
+rt = cc.find_library('rt', required: false)
 libiscsi = not_found
 if 'CONFIG_LIBISCSI' in config_host
   libiscsi = declare_dependency(compile_args: 
config_host['LIBISCSI_CFLAGS'].split(),
@@ -279,6 +280,10 @@ if have_tools
 subdir('contrib/vhost-user-input')
 subdir('contrib/vhost-user-scsi')
   endif
+  if 'CONFIG_IVSHMEM' in config_host
+subdir('contrib/ivshmem-client')
+subdir('contrib/ivshmem-server')
+  endif
 endif
 
 subdir('tools')
-- 
2.26.2





[PATCH 039/150] meson: add solaris and Haiku libraries

2020-08-14 Thread Paolo Bonzini
There is no probing in configure, so no need to pass them as
variables to meson.

Signed-off-by: Paolo Bonzini 
---
 meson.build | 8 
 1 file changed, 8 insertions(+)

diff --git a/meson.build b/meson.build
index be0a9975bf..2d23c01753 100644
--- a/meson.build
+++ b/meson.build
@@ -62,6 +62,14 @@ elif host_machine.system() == 'darwin'
   iokit = dependency('appleframeworks', modules: 'IOKit')
   cocoa = dependency('appleframeworks', modules: 'Cocoa')
   hvf = dependency('appleframeworks', modules: 'Hypervisor')
+elif host_machine.system() == 'sunos'
+  socket = [cc.find_library('socket'),
+cc.find_library('nsl'),
+cc.find_library('resolv')]
+elif host_machine.system() == 'haiku'
+  socket = [cc.find_library('posix_error_mapper'),
+cc.find_library('network'),
+cc.find_library('bsd')]
 endif
 glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(),
   link_args: config_host['GLIB_LIBS'].split())
-- 
2.26.2





[PATCH 035/150] contrib/vhost-user-gpu: convert to meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile | 18 +-
 Makefile.objs|  1 -
 contrib/vhost-user-gpu/Makefile.objs | 10 --
 contrib/vhost-user-gpu/meson.build   | 13 +
 meson.build  | 15 +++
 rules.mak|  7 ---
 6 files changed, 29 insertions(+), 35 deletions(-)
 delete mode 100644 contrib/vhost-user-gpu/Makefile.objs
 create mode 100644 contrib/vhost-user-gpu/meson.build

diff --git a/Makefile b/Makefile
index 8da297f149..4ce8d2b0c6 100644
--- a/Makefile
+++ b/Makefile
@@ -186,16 +186,10 @@ $(call set-vpath, $(SRC_PATH))
 
 LIBS+=-lz $(LIBS_TOOLS)
 
-vhost-user-json-y =
 HELPERS-y = $(HELPERS)
 
 HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) += 
qemu-bridge-helper$(EXESUF)
 
-ifeq ($(CONFIG_LINUX)$(CONFIG_VIRGL)$(CONFIG_GBM)$(CONFIG_TOOLS),)
-HELPERS-y += vhost-user-gpu$(EXESUF)
-vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
-endif
-
 # Sphinx does not allow building manuals into the same directory as
 # the source files, so if we're doing an in-tree QEMU build we must
 # build the manuals into a subdirectory (and then install them from
@@ -302,7 +296,6 @@ dummy := $(call unnest-vars,, \
 elf2dmp-obj-y \
 ivshmem-client-obj-y \
 ivshmem-server-obj-y \
-vhost-user-gpu-obj-y \
 qga-vss-dll-obj-y \
 block-obj-y \
 block-obj-m \
@@ -316,7 +309,7 @@ dummy := $(call unnest-vars,, \
 
 include $(SRC_PATH)/tests/Makefile.include
 
-all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all 
modules $(vhost-user-json-y)
+all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all 
modules
 
 qemu-version.h: FORCE
$(call quiet-command, \
@@ -522,9 +515,6 @@ ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) 
$(COMMON_LDADDS)
$(call LINK, $^)
 endif
 
-vhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) 
contrib/libvhost-user/libvhost-user.a $(COMMON_LDADDS)
-   $(call LINK, $^)
-
 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(call quiet-command,$(PYTHON) $< $@ \
$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
@@ -722,12 +712,6 @@ endif
 ifneq ($(HELPERS-y),)
$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
 endif
-ifneq ($(vhost-user-json-y),)
-   $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
-   for x in $(vhost-user-json-y); do \
-   $(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
-   done
-endif
 ifdef CONFIG_TRACE_SYSTEMTAP
$(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
 endif
diff --git a/Makefile.objs b/Makefile.objs
index 0922c3ed00..2f2d4b2066 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -106,6 +106,5 @@ qga-vss-dll-obj-y = qga/
 elf2dmp-obj-y = contrib/elf2dmp/
 ivshmem-client-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-client/
 ivshmem-server-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-server/
-vhost-user-gpu-obj-y = contrib/vhost-user-gpu/
 
 ##
diff --git a/contrib/vhost-user-gpu/Makefile.objs 
b/contrib/vhost-user-gpu/Makefile.objs
deleted file mode 100644
index 09296091be..00
--- a/contrib/vhost-user-gpu/Makefile.objs
+++ /dev/null
@@ -1,10 +0,0 @@
-vhost-user-gpu-obj-y = vhost-user-gpu.o virgl.o vugbm.o
-
-vhost-user-gpu.o-cflags := $(PIXMAN_CFLAGS) $(GBM_CFLAGS)
-vhost-user-gpu.o-libs := $(PIXMAN_LIBS)
-
-virgl.o-cflags := $(VIRGL_CFLAGS) $(GBM_CFLAGS)
-virgl.o-libs := $(VIRGL_LIBS)
-
-vugbm.o-cflags := $(GBM_CFLAGS)
-vugbm.o-libs := $(GBM_LIBS)
diff --git a/contrib/vhost-user-gpu/meson.build 
b/contrib/vhost-user-gpu/meson.build
new file mode 100644
index 00..6c1459f54a
--- /dev/null
+++ b/contrib/vhost-user-gpu/meson.build
@@ -0,0 +1,13 @@
+if 'CONFIG_TOOLS' in config_host and 'CONFIG_VIRGL' in config_host \
+and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host
+  executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'),
+ link_with: libvhost_user,
+ dependencies: [qemuutil, pixman, gbm, virgl],
+ install: true,
+ install_dir: get_option('libexecdir'))
+
+  configure_file(input: '50-qemu-gpu.json.in',
+ output: '50-qemu-gpu.json',
+ configuration: config_host,
+ install_dir: config_host['qemu_datadir'] / 'vhost-user')
+endif
diff --git a/meson.build b/meson.build
index 4c952c7264..c28285d797 100644
--- a/meson.build
+++ b/meson.build
@@ -79,6 +79,8 @@ if 'CONFIG_GNUTLS' in config_host
   gnutls = declare_dependency(compile_args: 
config_host['GNUTLS_CFLAGS'].split(),
   link_args: config_host['GNUTLS_LIBS'].split()

[PATCH 037/150] contrib/elf2dmp: convert to meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile  | 4 
 Makefile.objs | 6 --
 configure | 3 ---
 contrib/elf2dmp/Makefile.objs | 4 
 contrib/elf2dmp/meson.build   | 5 +
 meson.build   | 6 ++
 6 files changed, 11 insertions(+), 17 deletions(-)
 delete mode 100644 contrib/elf2dmp/Makefile.objs
 create mode 100644 contrib/elf2dmp/meson.build

diff --git a/Makefile b/Makefile
index 208e98dd4d..653c16bb0d 100644
--- a/Makefile
+++ b/Makefile
@@ -293,7 +293,6 @@ dummy := $(call unnest-vars,, \
 authz-obj-y \
 chardev-obj-y \
 qga-obj-y \
-elf2dmp-obj-y \
 qga-vss-dll-obj-y \
 block-obj-y \
 block-obj-m \
@@ -503,9 +502,6 @@ ifneq ($(EXESUF),)
 qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
 endif
 
-elf2dmp$(EXESUF): $(elf2dmp-obj-y)
-   $(call LINK, $^)
-
 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(call quiet-command,$(PYTHON) $< $@ \
$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
diff --git a/Makefile.objs b/Makefile.objs
index 336a684ff3..1486254a2c 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -100,9 +100,3 @@ version-obj-$(CONFIG_WIN32) += $(BUILD_DIR)/version.o
 # extracted into a QAPI schema module, or perhaps a separate schema.
 qga-obj-y = qga/
 qga-vss-dll-obj-y = qga/
-
-##
-# contrib
-elf2dmp-obj-y = contrib/elf2dmp/
-
-##
diff --git a/configure b/configure
index f64454b090..789569279c 100755
--- a/configure
+++ b/configure
@@ -6680,9 +6680,6 @@ if test "$want_tools" = "yes" ; then
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
 tools="qemu-nbd\$(EXESUF) qemu-storage-daemon\$(EXESUF) $tools"
   fi
-  if [ "$curl" = "yes" ]; then
-  tools="elf2dmp\$(EXESUF) $tools"
-  fi
 fi
 if test "$softmmu" = yes ; then
   if test "$linux" = yes; then
diff --git a/contrib/elf2dmp/Makefile.objs b/contrib/elf2dmp/Makefile.objs
deleted file mode 100644
index 1505716916..00
--- a/contrib/elf2dmp/Makefile.objs
+++ /dev/null
@@ -1,4 +0,0 @@
-elf2dmp-obj-y = main.o addrspace.o download.o pdb.o qemu_elf.o
-
-download.o-cflags := $(CURL_CFLAGS)
-download.o-libs   := $(CURL_LIBS)
diff --git a/contrib/elf2dmp/meson.build b/contrib/elf2dmp/meson.build
new file mode 100644
index 00..b3de173316
--- /dev/null
+++ b/contrib/elf2dmp/meson.build
@@ -0,0 +1,5 @@
+if 'CONFIG_CURL' in config_host
+  executable('elf2dmp', files('main.c', 'addrspace.c', 'download.c', 'pdb.c', 
'qemu_elf.c'),
+ dependencies: [glib, curl],
+ install: true)
+endif
diff --git a/meson.build b/meson.build
index 193881c888..fbbe20de59 100644
--- a/meson.build
+++ b/meson.build
@@ -106,6 +106,11 @@ if 'CONFIG_VIRGL' in config_host
   virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
  link_args: config_host['VIRGL_LIBS'].split())
 endif
+curl = not_found
+if 'CONFIG_CURL' in config_host
+  curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
+link_args: config_host['CURL_LIBS'].split())
+endif
 
 target_dirs = config_host['TARGET_DIRS'].split()
 have_user = false
@@ -270,6 +275,7 @@ qemuutil = declare_dependency(link_with: libqemuutil,
 
 if have_tools
   subdir('contrib/rdmacm-mux')
+  subdir('contrib/elf2dmp')
 
   if 'CONFIG_VHOST_USER' in config_host
 subdir('contrib/libvhost-user')
-- 
2.26.2





[PATCH 065/150] meson: qemu-{img,io,nbd}

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile|  5 -
 configure   |  3 +--
 meson.build | 14 --
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 4abc29cd59..e67fe52ed3 100644
--- a/Makefile
+++ b/Makefile
@@ -280,11 +280,6 @@ Makefile: $(version-obj-y)
 
 COMMON_LDADDS = libqemuutil.a
 
-qemu-img.o: qemu-img-cmds.h
-
-qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) 
$(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
-qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) 
$(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
-qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) 
$(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) 
$(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) 
$(storage-daemon-obj-y) $(COMMON_LDADDS)
 
 scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o 
$(authz-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
diff --git a/configure b/configure
index 966351314f..cc5a44d7e0 100755
--- a/configure
+++ b/configure
@@ -6670,9 +6670,8 @@ fi
 tools=""
 helpers=""
 if test "$want_tools" = "yes" ; then
-  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
-tools="qemu-nbd\$(EXESUF) qemu-storage-daemon\$(EXESUF) $tools"
+tools="qemu-storage-daemon\$(EXESUF) $tools"
   fi
 fi
 if test "$softmmu" = yes ; then
diff --git a/meson.build b/meson.build
index dabba7e452..f19b18077c 100644
--- a/meson.build
+++ b/meson.build
@@ -346,7 +346,7 @@ if have_system
   ]
 endif
 foreach d : hx_headers
-  custom_target(d[1],
+  hxdep += custom_target(d[1],
 input: files(d[0]),
 output: d[1],
 capture: true,
@@ -555,7 +555,8 @@ libblock = static_library('block', block_ss.sources(),
   build_by_default: false)
 
 block = declare_dependency(link_whole: [libblock],
-   link_args: '@block.syms')
+   link_args: '@block.syms',
+   dependencies: [crypto, io])
 
 foreach m : mods
   shared_module(m['dir'] + '-' + m['name'],
@@ -633,6 +634,15 @@ if 'CONFIG_GUEST_AGENT' in config_host
 endif
 
 if have_tools
+  qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
+ dependencies: [authz, block, crypto, io, qom, qemuutil], install: 
true)
+  qemu_io = executable('qemu-io', files('qemu-io.c'),
+ dependencies: [block, qemuutil], install: true)
+  if host_machine.system() == 'linux' or host_machine.system() == 'sunos' or 
host_machine.system().endswith('bsd')
+qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
+   dependencies: [block, qemuutil], install: true)
+  endif
+
   subdir('contrib/rdmacm-mux')
   subdir('contrib/elf2dmp')
 
-- 
2.26.2





[PATCH 056/150] meson: convert qom directory to Meson (tools part)

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile  |  2 +-
 Makefile.objs |  2 +-
 Makefile.target   |  3 ++-
 meson.build   |  1 +
 qom/Makefile.objs |  3 ---
 qom/meson.build   | 15 +++
 6 files changed, 20 insertions(+), 6 deletions(-)
 create mode 100644 qom/meson.build

diff --git a/Makefile b/Makefile
index 0dce00d99a..bd0f208dd6 100644
--- a/Makefile
+++ b/Makefile
@@ -239,7 +239,6 @@ dummy := $(call unnest-vars,, \
 storage-daemon-obj-y \
 storage-daemon-obj-m \
 crypto-obj-y \
-qom-obj-y \
 io-obj-y \
 common-obj-y \
 common-obj-m)
@@ -260,6 +259,7 @@ $(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y)
 $(SOFTMMU_ALL_RULES): $(chardev-obj-y)
 $(SOFTMMU_ALL_RULES): $(crypto-obj-y)
 $(SOFTMMU_ALL_RULES): $(io-obj-y)
+$(SOFTMMU_ALL_RULES): $(qom-obj-y)
 $(SOFTMMU_ALL_RULES): config-all-devices.mak
 
 SOFTMMU_FUZZ_RULES=$(filter %-softmmu/fuzz, $(TARGET_DIRS_RULES))
diff --git a/Makefile.objs b/Makefile.objs
index baf15656e8..84bfa2a61a 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -1,6 +1,6 @@
 ###
 # Common libraries for tools and emulators
-qom-obj-y = qom/
+qom-obj-y = qom/libqom.fa
 
 ###
 # code used by both qemu system emulation and qemu-img
diff --git a/Makefile.target b/Makefile.target
index 257afc2723..1e04551a8e 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -191,13 +191,14 @@ all-obj-y := $(obj-y)
 common-obj-m :=
 
 include $(SRC_PATH)/Makefile.objs
+dummy := $(call fix-paths,../,, \
+  qom-obj-y)
 dummy := $(call unnest-vars,.., \
authz-obj-y \
block-obj-y \
block-obj-m \
chardev-obj-y \
crypto-obj-y \
-   qom-obj-y \
io-obj-y \
common-obj-y \
common-obj-m)
diff --git a/meson.build b/meson.build
index b884a4fcb7..d883fcf926 100644
--- a/meson.build
+++ b/meson.build
@@ -336,6 +336,7 @@ libqemuutil = static_library('qemuutil',
 qemuutil = declare_dependency(link_with: libqemuutil,
   sources: genh + version_res)
 
+subdir('qom')
 subdir('fsdev')
 
 # Other build targets
diff --git a/qom/Makefile.objs b/qom/Makefile.objs
index 1b45d104ba..b9629045e6 100644
--- a/qom/Makefile.objs
+++ b/qom/Makefile.objs
@@ -1,5 +1,2 @@
-qom-obj-y = object.o container.o qom-qobject.o
-qom-obj-y += object_interfaces.o
-
 common-obj-$(CONFIG_SOFTMMU) += qom-hmp-cmds.o qom-qmp-cmds.o
 storage-daemon-obj-y += qom-qmp-cmds.o
diff --git a/qom/meson.build b/qom/meson.build
new file mode 100644
index 00..3c41ed37e4
--- /dev/null
+++ b/qom/meson.build
@@ -0,0 +1,15 @@
+qom_ss = ss.source_set()
+qom_ss.add(files(
+  'container.c',
+  'object.c',
+  'object_interfaces.c',
+  'qom-qobject.c',
+))
+
+qom_ss = qom_ss.apply(config_host, strict: false)
+libqom = static_library('qom', qom_ss.sources(),
+dependencies: [qom_ss.dependencies()],
+link_with: [libqemuutil],
+name_suffix: 'fa')
+
+qom = declare_dependency(link_whole: libqom)
-- 
2.26.2





[PATCH 040/150] meson: convert qemu-ga

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile  | 53 +--
 Makefile.objs |  1 -
 configure | 14 +++
 meson.build   |  8 ++
 qga/Makefile.objs |  9 ---
 qga/installer/qemu-ga.wxs |  2 +-
 qga/meson.build   | 46 +
 tests/Makefile.include|  4 +--
 tests/test-qga.c  |  8 +++---
 9 files changed, 71 insertions(+), 74 deletions(-)
 create mode 100644 qga/meson.build

diff --git a/Makefile b/Makefile
index 653c16bb0d..db535c7fc8 100644
--- a/Makefile
+++ b/Makefile
@@ -292,7 +292,6 @@ endif
 dummy := $(call unnest-vars,, \
 authz-obj-y \
 chardev-obj-y \
-qga-obj-y \
 qga-vss-dll-obj-y \
 block-obj-y \
 block-obj-m \
@@ -440,52 +439,15 @@ endif
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > 
$@,"GEN","$@")
 
-qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
-qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
-
 qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
 qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
 
-qapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
-$(SRC_PATH)/scripts/qapi/commands.py \
-$(SRC_PATH)/scripts/qapi/common.py \
-$(SRC_PATH)/scripts/qapi/doc.py \
-$(SRC_PATH)/scripts/qapi/error.py \
-$(SRC_PATH)/scripts/qapi/events.py \
-$(SRC_PATH)/scripts/qapi/expr.py \
-$(SRC_PATH)/scripts/qapi/gen.py \
-$(SRC_PATH)/scripts/qapi/introspect.py \
-$(SRC_PATH)/scripts/qapi/parser.py \
-$(SRC_PATH)/scripts/qapi/schema.py \
-$(SRC_PATH)/scripts/qapi/source.py \
-$(SRC_PATH)/scripts/qapi/types.py \
-$(SRC_PATH)/scripts/qapi/visit.py \
-$(SRC_PATH)/scripts/qapi-gen.py
-
-qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
-qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
-qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
-qga/qapi-generated/qga-qapi-init-commands.h 
qga/qapi-generated/qga-qapi-init-commands.c \
-qga/qapi-generated/qga-qapi-doc.texi: \
-qga/qapi-generated/qapi-gen-timestamp ;
-qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json 
$(qapi-py)
-   $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
-   -o qga/qapi-generated -p "qga-" $<, \
-   "GEN","$(@:%-timestamp=%)")
-   @>$@
-
-QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h 
qga-qapi-commands.h qga-qapi-init-commands.h)
-$(qga-obj-y): $(QGALIB_GEN)
-
-qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
-   $(call LINK, $^)
-
 ifdef QEMU_GA_MSI_ENABLED
 QEMU_GA_MSI=qemu-ga-$(ARCH).msi
 
 msi: $(QEMU_GA_MSI)
 
-$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
+$(QEMU_GA_MSI): qga/qemu-ga.exe $(QGA_VSS_PROVIDER)
 
 $(QEMU_GA_MSI): config-host.mak
 
@@ -498,8 +460,8 @@ msi:
 endif
 
 ifneq ($(EXESUF),)
-.PHONY: qemu-ga
-qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
+.PHONY: qga/qemu-ga
+qga/qemu-ga: qga/qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
 endif
 
 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
@@ -524,9 +486,6 @@ clean: recurse-clean ninja-clean clean-ctlist
rm -f qemu-img-cmds.h
rm -f ui/shader/*-vert.h ui/shader/*-frag.h
rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
-   rm -f qapi-gen-timestamp
-   rm -f storage-daemon/qapi/qapi-gen-timestamp
-   rm -rf qga/qapi-generated
rm -f config-all-devices.mak
rm -f $(SUBDIR_DEVICES_MAK)
 
@@ -648,7 +607,7 @@ endif
 ifdef CONFIG_TRACE_SYSTEMTAP
$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 
"$(DESTDIR)$(mandir)/man1"
 endif
-ifneq (,$(findstring qemu-ga,$(TOOLS)))
+ifeq ($(CONFIG_GUEST_AGENT),y)
$(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 
"$(DESTDIR)$(mandir)/man8"
$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
$(INSTALL_DATA) docs/interop/qemu-ga-ref.html 
"$(DESTDIR)$(qemu_docdir)/interop"
@@ -669,7 +628,7 @@ install-datadir:
 
 install-localstatedir:
 ifdef CONFIG_POSIX
-ifneq (,$(findstring qemu-ga,$(TOOLS)))
+ifeq ($(CONFIG_GUEST_AGENT),y)
$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
 endif
 endif
@@ -861,7 +820,7 @@ $(MANUAL_BUILDDIR)/index.html: 
$(SRC_PATH)/docs/index.html.in qemu-version.h
 docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
@cp -p $< $@
 
-docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
+docs/interop/qemu-ga-qapi.texi: qga/qga-qapi-doc.texi
@cp -p $< $@
 
 html: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
diff --git a/Makefile.objs b/Makefile.objs
index 1486254a2c..259f9936ac 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -98,5 +98,4 @@ version-obj-$(CONFIG_WIN32) 

[PATCH 042/150] meson: add msi generation

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile  | 18 --
 qga/meson.build   | 25 +
 qga/vss-win32/meson.build |  3 ++-
 3 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index c71269ff22..f8e5ebaff9 100644
--- a/Makefile
+++ b/Makefile
@@ -441,23 +441,6 @@ qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx 
$(SRC_PATH)/scripts/hxtool
 qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
 qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
 
-ifdef QEMU_GA_MSI_ENABLED
-QEMU_GA_MSI=qemu-ga-$(ARCH).msi
-
-msi: $(QEMU_GA_MSI)
-
-$(QEMU_GA_MSI): qga/qemu-ga.exe $(QGA_VSS_PROVIDER)
-
-$(QEMU_GA_MSI): config-host.mak
-
-$(QEMU_GA_MSI):  $(SRC_PATH)/qga/installer/qemu-ga.wxs
-   $(call quiet-command,QEMU_GA_VERSION="$(QEMU_GA_VERSION)" 
QEMU_GA_MANUFACTURER="$(QEMU_GA_MANUFACTURER)" 
QEMU_GA_DISTRO="$(QEMU_GA_DISTRO)" BUILD_DIR="$(BUILD_DIR)" \
-   wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) 
$(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
-else
-msi:
-   @echo "MSI build not configured or dependency resolution failed 
(reconfigure with --enable-guest-agent-msi option)"
-endif
-
 ifneq ($(EXESUF),)
 .PHONY: qga/qemu-ga
 qga/qemu-ga: qga/qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
@@ -473,7 +456,6 @@ clean: recurse-clean ninja-clean clean-ctlist
 # avoid old build problems by removing potentially incorrect old files
rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h 
gen-op-arm.h
rm -f qemu-options.def
-   rm -f *.msi
find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name 
'*.[oda]' \) -type f \
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
diff --git a/qga/meson.build b/qga/meson.build
index 948302e06d..2d33c09fe6 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -48,5 +48,30 @@ qga = executable('qemu-ga', qga_ss.sources(),
 if host_machine.system() == 'windows'
   if 'CONFIG_QGA_VSS' in config_host
 subdir('vss-win32')
+  else
+gen_tlb = []
+  endif
+
+  wixl = find_program('wixl', required: false)
+  if wixl.found()
+deps = [gen_tlb, qga]
+if 'QEMU_GA_MSI_WITH_VSS' in config_host
+  deps += qga_vss
+endif
+qga_msi = custom_target('QGA MSI',
+input: files('installer/qemu-ga.wxs'),
+output: 
'qemu-ga-@0@.msi'.format(config_host['ARCH']),
+depends: deps,
+command: [
+  'QEMU_GA_VERSION=' + 
config_host['QEMU_GA_VERSION'],
+  'QEMU_GA_MANUFACTURER=' + 
config_host['QEMU_GA_MANUFACTURER'],
+  'QEMU_GA_DISTRO=' + 
config_host['QEMU_GA_DISTRO'],
+  'BUILD_DIR=' + meson.build_root(),
+  wixl, '-o', '@OUTPUT0@', '@INPUT0@',
+  config_host['QEMU_GA_MSI_ARCH'].split(),
+  config_host['QEMU_GA_MSI_WITH_VSS'].split(),
+  
config_host['QEMU_GA_MSI_MINGW_DLL_PATH'].split(),
+])
+alias_target('msi', qga_msi)
   endif
 endif
diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build
index 42c8d31a3d..1f39e05335 100644
--- a/qga/vss-win32/meson.build
+++ b/qga/vss-win32/meson.build
@@ -2,7 +2,8 @@ if add_languages('cpp', required: false)
   glib_static = dependency('glib-2.0', static: true)
   link_args = cc.get_supported_link_arguments(['-fstack-protector-all', 
'-fstack-protector-strong',
'-Wl,--add-stdcall-alias', 
'-Wl,--enable-stdcall-fixup'])
-  shared_module('qga-vss', ['requester.cpp', 'provider.cpp', 'install.cpp'],
+
+  qga_vss = shared_module('qga-vss', ['requester.cpp', 'provider.cpp', 
'install.cpp'],
 name_prefix: '',
 cpp_args: ['-Wno-unknown-pragmas', 
'-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'],
 link_args: link_args,
-- 
2.26.2





[PATCH 038/150] meson: add macos dependencies

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

There is no probing in configure, so no need to pass them as
variables to meson. Do a regular meson dependency() instead.

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 meson.build | 9 +
 1 file changed, 9 insertions(+)

diff --git a/meson.build b/meson.build
index fbbe20de59..be0a9975bf 100644
--- a/meson.build
+++ b/meson.build
@@ -46,6 +46,10 @@ m = cc.find_library('m', required: false)
 util = cc.find_library('util', required: false)
 socket = []
 version_res = []
+coref = []
+iokit = []
+cocoa = []
+hvf = []
 if host_machine.system() == 'windows'
   socket = cc.find_library('ws2_32')
 
@@ -53,6 +57,11 @@ if host_machine.system() == 'windows'
   version_res = win.compile_resources('version.rc',
   depend_files: 
files('pc-bios/qemu-nsis.ico'),
   include_directories: 
include_directories('.'))
+elif host_machine.system() == 'darwin'
+  coref = dependency('appleframeworks', modules: 'CoreFoundation')
+  iokit = dependency('appleframeworks', modules: 'IOKit')
+  cocoa = dependency('appleframeworks', modules: 'Cocoa')
+  hvf = dependency('appleframeworks', modules: 'Hypervisor')
 endif
 glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(),
   link_args: config_host['GLIB_LIBS'].split())
-- 
2.26.2





[PATCH 041/150] meson: convert vss-win32

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile|  1 -
 Makefile.objs   |  8 
 qga/Makefile.objs   |  1 -
 qga/meson.build |  6 ++
 qga/vss-win32/Makefile.objs | 23 ---
 qga/vss-win32/meson.build   | 33 +
 6 files changed, 39 insertions(+), 33 deletions(-)
 delete mode 100644 qga/Makefile.objs
 delete mode 100644 qga/vss-win32/Makefile.objs
 create mode 100644 qga/vss-win32/meson.build

diff --git a/Makefile b/Makefile
index db535c7fc8..c71269ff22 100644
--- a/Makefile
+++ b/Makefile
@@ -292,7 +292,6 @@ endif
 dummy := $(call unnest-vars,, \
 authz-obj-y \
 chardev-obj-y \
-qga-vss-dll-obj-y \
 block-obj-y \
 block-obj-m \
 storage-daemon-obj-y \
diff --git a/Makefile.objs b/Makefile.objs
index 259f9936ac..baf15656e8 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -91,11 +91,3 @@ common-obj-y += disas/
 ##
 # Resource file for Windows executables
 version-obj-$(CONFIG_WIN32) += $(BUILD_DIR)/version.o
-
-##
-# guest agent
-
-# FIXME: a few definitions from qapi/qapi-types.o and
-# qapi/qapi-visit.o are needed by libqemuutil.a.  These should be
-# extracted into a QAPI schema module, or perhaps a separate schema.
-qga-vss-dll-obj-y = qga/
diff --git a/qga/Makefile.objs b/qga/Makefile.objs
deleted file mode 100644
index 9ecf2496da..00
--- a/qga/Makefile.objs
+++ /dev/null
@@ -1 +0,0 @@
-qga-vss-dll-obj-$(CONFIG_QGA_VSS) += vss-win32/
diff --git a/qga/meson.build b/qga/meson.build
index 3513a90f5d..948302e06d 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -44,3 +44,9 @@ qga = executable('qemu-ga', qga_ss.sources(),
  link_args: config_host['LIBS_QGA'].split(),
  dependencies: [qemuutil, libudev],
  install: true)
+
+if host_machine.system() == 'windows'
+  if 'CONFIG_QGA_VSS' in config_host
+subdir('vss-win32')
+  endif
+endif
diff --git a/qga/vss-win32/Makefile.objs b/qga/vss-win32/Makefile.objs
deleted file mode 100644
index c82676aeb8..00
--- a/qga/vss-win32/Makefile.objs
+++ /dev/null
@@ -1,23 +0,0 @@
-# rules to build qga-vss.dll
-
-qga-vss-dll-obj-y += requester.o provider.o install.o
-
-obj-qga-vss-dll-obj-y = $(addprefix $(obj)/, $(qga-vss-dll-obj-y))
-$(obj-qga-vss-dll-obj-y): QEMU_CXXFLAGS := $(filter-out -fstack-protector-all 
-fstack-protector-strong, $(QEMU_CXXFLAGS)) -Wno-unknown-pragmas 
-Wno-delete-non-virtual-dtor
-
-QGA_VSS_LDFLAGS = -shared -Wl,--add-stdcall-alias,--enable-stdcall-fixup 
-lglib-2.0 -lole32 -loleaut32 -lshlwapi -luuid -lintl -lws2_32 -static
-$(obj)/qga-vss.dll: $(obj-qga-vss-dll-obj-y) $(SRC_PATH)/$(obj)/qga-vss.def
-   $(call quiet-command,$(CXX) -o $@ $(qga-vss-dll-obj-y) 
$(SRC_PATH)/qga/vss-win32/qga-vss.def $(CXXFLAGS) 
$(QGA_VSS_LDFLAGS),"LINK","$(TARGET_DIR)$@")
-
-
-# rules to build qga-provider.tlb
-# Currently, only native build is supported because building .tlb
-# (TypeLibrary) from .idl requires WindowsSDK and MIDL (and cl.exe in VC++).
-MIDL=$(WIN_SDK)/Bin/midl
-
-$(obj)/qga-vss.tlb: $(SRC_PATH)/$(obj)/qga-vss.idl
-ifeq ($(WIN_SDK),"")
-   $(call quiet-command,cp $(dir $<)qga-vss.tlb 
$@,"COPY","$(TARGET_DIR)$@")
-else
-   $(call quiet-command,$(MIDL) -tlb $@ -I $(WIN_SDK)/Include 
$<,"MIDL","$(TARGET_DIR)$@")
-endif
diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build
new file mode 100644
index 00..42c8d31a3d
--- /dev/null
+++ b/qga/vss-win32/meson.build
@@ -0,0 +1,33 @@
+if add_languages('cpp', required: false)
+  glib_static = dependency('glib-2.0', static: true)
+  link_args = cc.get_supported_link_arguments(['-fstack-protector-all', 
'-fstack-protector-strong',
+   '-Wl,--add-stdcall-alias', 
'-Wl,--enable-stdcall-fixup'])
+  shared_module('qga-vss', ['requester.cpp', 'provider.cpp', 'install.cpp'],
+name_prefix: '',
+cpp_args: ['-Wno-unknown-pragmas', 
'-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'],
+link_args: link_args,
+vs_module_defs: 'qga-vss.def',
+dependencies: [glib_static, socket,
+   cc.find_library('ole32'),
+   cc.find_library('oleaut32'),
+   cc.find_library('shlwapi'),
+   cc.find_library('uuid'),
+   cc.find_library('intl')])
+endif
+
+# rules to build qga-vss.tlb
+# Currently, only native build is supported because building .tlb
+# (TypeLibrary) from .idl requires WindowsSDK and MIDL (and cl.exe in VC++).
+midl = find_program('midl', required: false)
+if midl.found()

[PATCH 064/150] meson: convert block

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile|   8 ---
 Makefile.objs   |  32 ---
 Makefile.target |   3 +-
 block.c |   2 +-
 block/Makefile.objs |  75 
 block/meson.build   | 111 
 block/monitor/Makefile.objs |   2 -
 block/monitor/meson.build   |   2 +
 configure   |  14 +++--
 meson.build |  68 ++
 nbd/Makefile.objs   |   1 -
 nbd/meson.build |   5 ++
 rules.mak   |   3 +-
 scsi/Makefile.objs  |   4 --
 scsi/meson.build|   4 ++
 15 files changed, 227 insertions(+), 107 deletions(-)
 delete mode 100644 block/Makefile.objs
 create mode 100644 block/meson.build
 delete mode 100644 block/monitor/Makefile.objs
 create mode 100644 block/monitor/meson.build
 delete mode 100644 nbd/Makefile.objs
 create mode 100644 nbd/meson.build
 delete mode 100644 scsi/Makefile.objs
 create mode 100644 scsi/meson.build

diff --git a/Makefile b/Makefile
index aaa0c3156b..4abc29cd59 100644
--- a/Makefile
+++ b/Makefile
@@ -112,7 +112,6 @@ include $(SRC_PATH)/rules.mak
 # lor is defined in rules.mak
 CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
 
-generated-files-y += module_block.h
 generated-files-y += target/s390x/gen-features.h
 target/s390x/gen-features.h: Makefile.ninja
 
@@ -173,8 +172,6 @@ include $(SRC_PATH)/Makefile.objs
 endif
 
 dummy := $(call unnest-vars,, \
-block-obj-y \
-block-obj-m \
 storage-daemon-obj-y \
 storage-daemon-obj-m \
 common-obj-y \
@@ -295,11 +292,6 @@ ifdef CONFIG_MPATH
 scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
 endif
 
-module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
-   $(call quiet-command,$(PYTHON) $< $@ \
-   $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
-   "GEN","$@")
-
 clean: recurse-clean ninja-clean clean-ctlist
-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
 # avoid old build problems by removing potentially incorrect old files
diff --git a/Makefile.objs b/Makefile.objs
index 297bd5beeb..eeaa0cfa82 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -10,12 +10,20 @@ ifeq ($(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)),y)
 authz-obj-y = authz/libauthz.fa
 authz/libauthz.fa-libs = $(if $(CONFIG_AUTH_PAM),-lpam)
 
-block-obj-y = block/ nbd/ scsi/
-block-obj-y += block.o blockjob.o job.o
-block-obj-y += qemu-io-cmds.o
-block-obj-$(CONFIG_REPLICATION) += replication.o
-
-block-obj-m = block/
+block-obj-y += libblock.fa
+
+libblock.fa-libs = $(ZSTD_LIBS)
+libblock.fa-libs += $(LIBNFS_LIBS)
+libblock.fa-libs += $(LIBISCSI_LIBS)
+libblock.fa-libs += $(CURL_LIBS)
+libblock.fa-libs += $(RBD_LIBS)
+libblock.fa-libs += $(GLUSTERFS_LIBS)
+libblock.fa-libs += $(VXHS_LIBS)
+libblock.fa-libs += $(LIBSSH_LIBS)
+libblock.fa-libs += $(BZIP2_LIBS)
+libblock.fa-libs += $(LZFSE_LIBS)
+libblock.fa-libs += $(if $(CONFIG_LINUX_AIO),-laio)
+libblock.fa-libs += $(LIBXML2_LIBS)
 
 chardev-obj-y = chardev/libchardev.fa
 
@@ -40,7 +48,7 @@ storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
 # single QEMU executable should support all CPUs and machines.
 
 ifeq ($(CONFIG_SOFTMMU),y)
-common-obj-y = blockdev.o blockdev-nbd.o block/
+common-obj-y = blockdev.o blockdev-nbd.o
 common-obj-y += bootdevice.o iothread.o
 common-obj-y += dump/
 common-obj-y += job-qmp.o
@@ -55,6 +63,16 @@ common-obj-$(CONFIG_LINUX) += fsdev/
 common-obj-y += accel/
 common-obj-y += migration/
 
+common-obj-$(if $(CONFIG_CURL),m) += block-curl$(DSOSUF)
+common-obj-$(if $(CONFIG_GLUSTERFS),m) += block-gluster$(DSOSUF)
+common-obj-$(if $(CONFIG_LIBISCSI),m) += block-iscsi$(DSOSUF)
+common-obj-$(if $(CONFIG_LIBNFS),m) += block-nfs$(DSOSUF)
+common-obj-$(if $(CONFIG_LIBSSH),m) += block-ssh$(DSOSUF)
+common-obj-$(if $(CONFIG_RBD),m) += block-rbd$(DSOSUF)
+
+common-obj-$(if $(CONFIG_LZFSE),m) += block-dmg-lzfse$(DSOSUF)
+common-obj-$(if $(and $(CONFIG_BZIP2),$(CONFIG_DMG)),m) += 
block-dmg-bz2$(DSOSUF)
+
 common-obj-y += audio/
 common-obj-m += audio/
 common-obj-y += hw/
diff --git a/Makefile.target b/Makefile.target
index 6b9de09df5..c0575da132 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -199,13 +199,12 @@ common-obj-m :=
 include $(SRC_PATH)/Makefile.objs
 dummy := $(call fix-paths,../,, \
   authz-obj-y \
+  block-obj-y \
   chardev-obj-y \
   crypto-obj-y \
   io-obj-y \
   qom-obj-y)
 dummy := $(call unnest-vars,.., \
-   block-obj-y \
-   block-obj-m \
common-obj-y \
common-obj-m)
 all-obj-y += $(common-obj-y)
diff --git a/block.c b/block.c
index d9ac0e07eb..67c5028dd8 100644
--- a/block.c
+++ b/b

[PATCH 077/150] meson: convert qemu-storage-daemon

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 Makefile|  5 -
 Makefile.objs   | 10 --
 meson.build |  2 +-
 storage-daemon/Makefile.objs|  3 ---
 storage-daemon/meson.build  | 13 +
 storage-daemon/qapi/meson.build |  5 +
 .../qemu-storage-daemon.c   |  0
 7 files changed, 15 insertions(+), 23 deletions(-)
 delete mode 100644 storage-daemon/Makefile.objs
 rename qemu-storage-daemon.c => storage-daemon/qemu-storage-daemon.c (100%)

diff --git a/Makefile b/Makefile
index 4ce2f4b2de..98d18c0bfb 100644
--- a/Makefile
+++ b/Makefile
@@ -170,8 +170,6 @@ include $(SRC_PATH)/Makefile.objs
 endif
 
 dummy := $(call unnest-vars,, \
-storage-daemon-obj-y \
-storage-daemon-obj-m \
 common-obj-y \
 common-obj-m)
 
@@ -187,7 +185,6 @@ TARGET_DIRS_RULES := $(foreach t, all fuzz clean install, 
$(addsuffix /$(t), $(T
 SOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES))
 $(SOFTMMU_ALL_RULES): $(authz-obj-y)
 $(SOFTMMU_ALL_RULES): $(block-obj-y)
-$(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y)
 $(SOFTMMU_ALL_RULES): $(chardev-obj-y)
 $(SOFTMMU_ALL_RULES): $(crypto-obj-y)
 $(SOFTMMU_ALL_RULES): $(io-obj-y)
@@ -278,8 +275,6 @@ Makefile: $(version-obj-y)
 
 COMMON_LDADDS = libqemuutil.a
 
-qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) 
$(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) 
$(storage-daemon-obj-y) $(COMMON_LDADDS)
-
 clean: recurse-clean ninja-clean clean-ctlist
-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
 # avoid old build problems by removing potentially incorrect old files
diff --git a/Makefile.objs b/Makefile.objs
index d7826c1e5c..e304d92954 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -33,16 +33,6 @@ io-obj-y = io/libio.fa
 
 endif # CONFIG_SOFTMMU or CONFIG_TOOLS
 
-###
-# storage-daemon-obj-y is code used by qemu-storage-daemon (these objects are
-# used for system emulation, too, but specified separately there)
-
-storage-daemon-obj-y = block/ qapi/ qom/ storage-daemon/
-storage-daemon-obj-y += blockdev.o blockdev-nbd.o iothread.o job-qmp.o
-storage-daemon-obj-$(CONFIG_WIN32) += os-win32.o
-storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
-storage-daemon-obj-y += libqmp.fa
-
 ##
 # Target independent part of system emulation. The long term path is to
 # suppress *all* target specific code in case of system emulation, i.e. a
diff --git a/meson.build b/meson.build
index 602a6fa206..c623d76db9 100644
--- a/meson.build
+++ b/meson.build
@@ -586,7 +586,6 @@ subdir('util')
 subdir('qom')
 subdir('authz')
 subdir('crypto')
-subdir('storage-daemon')
 subdir('ui')
 
 
@@ -796,6 +795,7 @@ if have_tools
dependencies: [block, qemuutil], install: true)
   endif
 
+  subdir('storage-daemon')
   subdir('contrib/rdmacm-mux')
   subdir('contrib/elf2dmp')
 
diff --git a/storage-daemon/Makefile.objs b/storage-daemon/Makefile.objs
deleted file mode 100644
index 41c0d02178..00
--- a/storage-daemon/Makefile.objs
+++ /dev/null
@@ -1,3 +0,0 @@
-storage-daemon-obj-y = qapi/libqsd-qapi.fa
-
-qemu-storage-daemon.o: storage-daemon/qapi/qapi-commands.h 
storage-daemon/qapi/qapi-init-commands.h
diff --git a/storage-daemon/meson.build b/storage-daemon/meson.build
index 35f8949924..0409acc3f5 100644
--- a/storage-daemon/meson.build
+++ b/storage-daemon/meson.build
@@ -1 +1,14 @@
+qsd_ss = ss.source_set()
+qsd_ss.add(files('qemu-storage-daemon.c'))
+qsd_ss.add(block, chardev, qmp, qom, qemuutil)
+qsd_ss.add_all(blockdev_ss)
+
 subdir('qapi')
+
+if have_tools
+  qsd_ss = qsd_ss.apply(config_host, strict: false)
+  executable('qemu-storage-daemon',
+ qsd_ss.sources(),
+ dependencies: qsd_ss.dependencies(),
+ install: true)
+endif
diff --git a/storage-daemon/qapi/meson.build b/storage-daemon/qapi/meson.build
index 7a2b041247..cea618bec0 100644
--- a/storage-daemon/qapi/meson.build
+++ b/storage-daemon/qapi/meson.build
@@ -4,7 +4,4 @@ qsd_qapi_files = custom_target('QAPI files for 
qemu-storage-daemon',
command: [ qapi_gen, '-o', 
'storage-daemon/qapi', '@INPUT@' ],
depend_files: [ qapi_inputs, qapi_gen_depends ])
 
-static_library('qsd-qapi',
-   qsd_qapi_files.to_list(),
-   name_suffix: 'fa',
-   build_by_default: false)
+qsd_ss.add(qsd_qapi_files.to_list())
diff --git a/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
similarity index 100%
rename from qemu-storage-daemon.c
rename to storage-daemon/qemu-storage-daemon.c
-- 
2.26.2





[PATCH 048/150] meson: keymap-gen

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile   | 38 --
 meson.build|  1 +
 ui/meson.build | 34 ++
 3 files changed, 35 insertions(+), 38 deletions(-)
 create mode 100644 ui/meson.build

diff --git a/Makefile b/Makefile
index 79abbedd9d..5fbf5e4bbd 100644
--- a/Makefile
+++ b/Makefile
@@ -132,44 +132,6 @@ generated-files-y += module_block.h
 
 generated-files-y += .git-submodule-status
 
-KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
-KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
-
-KEYCODEMAP_FILES = \
-ui/input-keymap-atset1-to-qcode.c.inc \
-ui/input-keymap-linux-to-qcode.c.inc \
-ui/input-keymap-qcode-to-atset1.c.inc \
-ui/input-keymap-qcode-to-atset2.c.inc \
-ui/input-keymap-qcode-to-atset3.c.inc \
-ui/input-keymap-qcode-to-linux.c.inc \
-ui/input-keymap-qcode-to-qnum.c.inc \
-ui/input-keymap-qcode-to-sun.c.inc \
-ui/input-keymap-qnum-to-qcode.c.inc \
-ui/input-keymap-usb-to-qcode.c.inc \
-ui/input-keymap-win32-to-qcode.c.inc \
-ui/input-keymap-x11-to-qcode.c.inc \
-ui/input-keymap-xorgevdev-to-qcode.c.inc \
-ui/input-keymap-xorgkbd-to-qcode.c.inc \
-ui/input-keymap-xorgxquartz-to-qcode.c.inc \
-ui/input-keymap-xorgxwin-to-qcode.c.inc \
-ui/input-keymap-osx-to-qcode.c.inc \
-$(NULL)
-
-generated-files-$(CONFIG_SOFTMMU) += $(KEYCODEMAP_FILES)
-
-ui/input-keymap-%.c.inc: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) 
$(SRC_PATH)/ui/Makefile.objs
-   $(call quiet-command,\
-   stem=$* && src=$${stem%-to-*} dst=$${stem#*-to-} && \
-   test -e $(KEYCODEMAP_GEN) && \
-   $(PYTHON) $(KEYCODEMAP_GEN) \
- --lang glib2 \
- --varname qemu_input_map_$${src}_to_$${dst} \
- code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
-   > $@ || rm -f $@, "GEN", "$@")
-
-$(KEYCODEMAP_GEN): .git-submodule-status
-$(KEYCODEMAP_CSV): .git-submodule-status
-
 edk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.bz2))
 pc-bios/edk2-%.fd: pc-bios/edk2-%.fd.bz2
$(call quiet-command,bzip2 -d -c $< > $@,"BUNZIP2",$<)
diff --git a/meson.build b/meson.build
index fb2089bc77..01ac61c51f 100644
--- a/meson.build
+++ b/meson.build
@@ -288,6 +288,7 @@ subdir('trace')
 subdir('util')
 subdir('crypto')
 subdir('storage-daemon')
+subdir('ui')
 
 # Build targets from sourcesets
 
diff --git a/ui/meson.build b/ui/meson.build
new file mode 100644
index 00..a6aa7f2b36
--- /dev/null
+++ b/ui/meson.build
@@ -0,0 +1,34 @@
+keymaps = [
+  ['atset1', 'qcode'],
+  ['linux', 'qcode'],
+  ['qcode', 'atset1'],
+  ['qcode', 'atset2'],
+  ['qcode', 'atset3'],
+  ['qcode', 'linux'],
+  ['qcode', 'qnum'],
+  ['qcode', 'sun'],
+  ['qnum', 'qcode'],
+  ['usb', 'qcode'],
+  ['win32', 'qcode'],
+  ['x11', 'qcode'],
+  ['xorgevdev', 'qcode'],
+  ['xorgkbd', 'qcode'],
+  ['xorgxquartz', 'qcode'],
+  ['xorgxwin', 'qcode'],
+  ['osx', 'qcode'],
+]
+
+if have_system
+  foreach e : keymaps
+output = 'input-keymap-@0@-to-@1...@.c.inc'.format(e[0], e[1])
+genh += custom_target(output,
+  output: output,
+  capture: true,
+  build_by_default: true, # to be removed when added to a 
target
+  input: files('keycodemapdb/data/keymaps.csv'),
+  command: [python.full_path(), 
files('keycodemapdb/tools/keymap-gen'),
+'--lang', 'glib2',
+'--varname', 
'qemu_input_map_@0@_to_@1@'.format(e[0], e[1]),
+'code-map', '@INPUT0@', e[0], e[1]])
+  endforeach
+endif
-- 
2.26.2





[PATCH 053/150] meson: convert check-decodetree

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 meson.build| 2 ++
 tests/Makefile.include | 8 +---
 tests/meson.build  | 4 
 3 files changed, 7 insertions(+), 7 deletions(-)
 create mode 100644 tests/meson.build

diff --git a/meson.build b/meson.build
index e5617df1b3..b884a4fcb7 100644
--- a/meson.build
+++ b/meson.build
@@ -6,6 +6,7 @@ not_found = dependency('', required: false)
 keyval = import('unstable-keyval')
 ss = import('sourceset')
 
+sh = find_program('sh')
 cc = meson.get_compiler('c')
 config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
 
@@ -380,6 +381,7 @@ endif
 
 subdir('tools')
 subdir('pc-bios')
+subdir('tests')
 
 summary_info = {}
 summary_info += {'Install prefix':config_host['prefix']}
diff --git a/tests/Makefile.include b/tests/Makefile.include
index f277d238fb..8e953a24ee 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -894,13 +894,6 @@ check-tests/qapi-schema/frontend: $(addprefix 
$(SRC_PATH)/, $(check-qapi-schema-
 check-tests/qapi-schema/doc-good.texi: tests/qapi-schema/doc-good.test.texi
@diff -u $(SRC_PATH)/tests/qapi-schema/doc-good.texi $<
 
-.PHONY: check-decodetree
-check-decodetree:
-   $(call quiet-command, \
- cd $(SRC_PATH)/tests/decode && \
-  ./check.sh "$(PYTHON)" "$(SRC_PATH)/scripts/decodetree.py", \
-  TEST, decodetree.py)
-
 # Python venv for running tests
 
 .PHONY: check-venv check-acceptance
@@ -962,6 +955,7 @@ check-block: $(patsubst %,check-%, $(check-block-y))
 endif
 check-build: build-unit build-softfloat build-qtest
 
+check: check-block check-qapi-schema check-unit check-softfloat check-qtest
 check-clean:
rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), 
$(check-qtest-$(target)-y:%=tests/qtest/%$(EXESUF))) 
$(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)))
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 00..5c52021dc9
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,4 @@
+test('decodetree', sh,
+ args: [ files('decode/check.sh'), config_host['PYTHON'], 
files('../scripts/decodetree.py') ],
+ workdir: meson.current_source_dir() / 'decode',
+ suite: 'decodetree')
-- 
2.26.2





[PATCH 046/150] meson: add qemu-edid

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Paolo Bonzini 
---
 Makefile| 2 --
 configure   | 2 +-
 meson.build | 4 
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index ec3c0a7371..a768af38eb 100644
--- a/Makefile
+++ b/Makefile
@@ -420,8 +420,6 @@ qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) 
$(crypto-obj-y) $(io
 qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) 
$(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) 
$(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) 
$(storage-daemon-obj-y) $(COMMON_LDADDS)
 
-qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
-
 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o 
fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
 
 scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o 
$(authz-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
diff --git a/configure b/configure
index d6baf31e2a..d521ed4451 100755
--- a/configure
+++ b/configure
@@ -6668,7 +6668,7 @@ fi
 
 tools=""
 if test "$want_tools" = "yes" ; then
-  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools"
+  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
 tools="qemu-nbd\$(EXESUF) qemu-storage-daemon\$(EXESUF) $tools"
   fi
diff --git a/meson.build b/meson.build
index f4d4b52a2d..70b1936299 100644
--- a/meson.build
+++ b/meson.build
@@ -311,6 +311,10 @@ if have_tools
dependencies: [qemuutil, xkbcommon], install: true)
   endif
 
+  executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
+ dependencies: qemuutil,
+ install: true)
+
   if 'CONFIG_VHOST_USER' in config_host
 subdir('contrib/libvhost-user')
 subdir('contrib/vhost-user-blk')
-- 
2.26.2





[PATCH 044/150] meson: add qemu-bridge-helper

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Paolo Bonzini 
---
 Makefile| 4 
 meson.build | 9 -
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index a61c66096e..b66b443037 100644
--- a/Makefile
+++ b/Makefile
@@ -188,8 +188,6 @@ LIBS+=-lz $(LIBS_TOOLS)
 
 HELPERS-y = $(HELPERS)
 
-HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) += 
qemu-bridge-helper$(EXESUF)
-
 # Sphinx does not allow building manuals into the same directory as
 # the source files, so if we're doing an in-tree QEMU build we must
 # build the manuals into a subdirectory (and then install them from
@@ -422,8 +420,6 @@ qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) 
$(crypto-obj-y) $(io
 qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) 
$(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) 
$(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) 
$(storage-daemon-obj-y) $(COMMON_LDADDS)
 
-qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
-
 qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
 
 qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
diff --git a/meson.build b/meson.build
index 0ff50108d8..504b834304 100644
--- a/meson.build
+++ b/meson.build
@@ -293,7 +293,6 @@ qemuutil = declare_dependency(link_with: libqemuutil,
   sources: genh + version_res)
 
 # Other build targets
-
 if 'CONFIG_GUEST_AGENT' in config_host
   subdir('qga')
 endif
@@ -311,6 +310,14 @@ if have_tools
 subdir('contrib/vhost-user-input')
 subdir('contrib/vhost-user-scsi')
   endif
+
+  if host_machine.system() == 'linux'
+executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
+   dependencies: [qemuutil, libcap_ng],
+   install: true,
+   install_dir: get_option('libexecdir'))
+  endif
+
   if 'CONFIG_IVSHMEM' in config_host
 subdir('contrib/ivshmem-client')
 subdir('contrib/ivshmem-server')
-- 
2.26.2





[PATCH 070/150] meson: convert audio directory to Meson

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs   |  7 +--
 Makefile.target |  3 ++-
 audio/Makefile.objs | 35 ---
 audio/meson.build   | 32 
 configure   | 16 
 meson.build | 29 -
 6 files changed, 83 insertions(+), 39 deletions(-)
 delete mode 100644 audio/Makefile.objs
 create mode 100644 audio/meson.build

diff --git a/Makefile.objs b/Makefile.objs
index e43526fe5f..ec7627a4c6 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -63,6 +63,11 @@ common-obj-$(CONFIG_LINUX) += fsdev/
 common-obj-y += accel/
 common-obj-y += migration/
 
+common-obj-$(CONFIG_AUDIO_ALSA) += audio-alsa$(DSOSUF)
+common-obj-$(CONFIG_AUDIO_OSS) += audio-oss$(DSOSUF)
+common-obj-$(CONFIG_AUDIO_PA) += audio-pa$(DSOSUF)
+common-obj-$(CONFIG_AUDIO_SDL) += audio-sdl$(DSOSUF)
+
 common-obj-$(if $(CONFIG_CURL),m) += block-curl$(DSOSUF)
 common-obj-$(if $(CONFIG_GLUSTERFS),m) += block-gluster$(DSOSUF)
 common-obj-$(if $(CONFIG_LIBISCSI),m) += block-iscsi$(DSOSUF)
@@ -73,8 +78,6 @@ common-obj-$(if $(CONFIG_RBD),m) += block-rbd$(DSOSUF)
 common-obj-$(if $(CONFIG_LZFSE),m) += block-dmg-lzfse$(DSOSUF)
 common-obj-$(if $(and $(CONFIG_BZIP2),$(CONFIG_DMG)),m) += 
block-dmg-bz2$(DSOSUF)
 
-common-obj-y += audio/
-common-obj-m += audio/
 common-obj-y += hw/
 common-obj-m += hw/
 
diff --git a/Makefile.target b/Makefile.target
index c8c4b70162..ff0e1b2d10 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -166,9 +166,10 @@ LIBS := $(libs_softmmu) $(LIBS)
 # Temporary until emulators are linked by Meson
 LIBS := $(LIBS) @../block.syms @../qemu.syms
 ifneq ($(CONFIG_MODULES),y)
-LIBS := $(LIBS)
+LIBS := $(LIBS) $(ALSA_LIBS) $(OSS_LIBS) $(PULSE_LIBS) $(SDL_LIBS)
 endif
 LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS)
+LIBS := $(LIBS) $(COREAUDIO_LIBS) $(DSOUND_LIBS)
 
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
diff --git a/audio/Makefile.objs b/audio/Makefile.objs
deleted file mode 100644
index b4a4c11f31..00
--- a/audio/Makefile.objs
+++ /dev/null
@@ -1,35 +0,0 @@
-common-obj-y = audio.o audio_legacy.o noaudio.o wavaudio.o mixeng.o
-common-obj-$(CONFIG_SPICE) += spiceaudio.o
-common-obj-$(CONFIG_AUDIO_COREAUDIO) += coreaudio.o
-common-obj-$(CONFIG_AUDIO_DSOUND) += dsoundaudio.o
-common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
-common-obj-y += wavcapture.o
-
-coreaudio.o-libs := $(COREAUDIO_LIBS)
-dsoundaudio.o-libs := $(DSOUND_LIBS)
-
-# alsa module
-common-obj-$(CONFIG_AUDIO_ALSA) += alsa.mo
-alsa.mo-objs = alsaaudio.o
-alsa.mo-libs := $(ALSA_LIBS)
-
-# oss module
-common-obj-$(CONFIG_AUDIO_OSS) += oss.mo
-oss.mo-objs = ossaudio.o
-oss.mo-libs := $(OSS_LIBS)
-
-# pulseaudio module
-common-obj-$(CONFIG_AUDIO_PA) += pa.mo
-pa.mo-objs = paaudio.o
-pa.mo-libs := $(PULSE_LIBS)
-
-# sdl module
-common-obj-$(CONFIG_AUDIO_SDL) += sdl.mo
-sdl.mo-objs = sdlaudio.o
-sdl.mo-cflags := $(SDL_CFLAGS)
-sdl.mo-libs := $(SDL_LIBS)
-
-# jack module
-common-obj-$(CONFIG_AUDIO_JACK) += jack.mo
-jack.mo-objs = jackaudio.o
-jack.mo-libs := $(JACK_LIBS)
diff --git a/audio/meson.build b/audio/meson.build
new file mode 100644
index 00..08137221e0
--- /dev/null
+++ b/audio/meson.build
@@ -0,0 +1,32 @@
+softmmu_ss.add(files(
+  'audio.c',
+  'audio_legacy.c',
+  'mixeng.c',
+  'noaudio.c',
+  'wavaudio.c',
+  'wavcapture.c',
+))
+
+softmmu_ss.add(when: [spice, 'CONFIG_SPICE'], if_true: files('spiceaudio.c'))
+softmmu_ss.add(when: [coreaudio, 'CONFIG_AUDIO_COREAUDIO'], if_true: 
files('coreaudio.c'))
+softmmu_ss.add(when: [dsound, 'CONFIG_AUDIO_DSOUND'], if_true: 
files('dsoundaudio.c'))
+softmmu_ss.add(when: ['CONFIG_AUDIO_WIN_INT'], if_true: 
files('audio_win_int.c'))
+
+audio_modules = []
+if 'CONFIG_AUDIO_ALSA' in config_host
+  audio_modules += [['alsa', files('alsaaudio.c'), alsa]]
+endif
+if 'CONFIG_AUDIO_OSS' in config_host
+  audio_modules += [['oss', files('ossaudio.c'), oss]]
+endif
+if 'CONFIG_AUDIO_PA' in config_host
+  audio_modules += [['pa', files('paaudio.c'), pulse]]
+endif
+if 'CONFIG_AUDIO_SDL' in config_host
+  audio_modules += [['sdl', files('sdlaudio.c'), sdl]]
+endif
+if 'CONFIG_AUDIO_JACK' in config_host
+  audio_modules += [['jack', files('jackaudio.c'), jack]]
+endif
+
+modules += {'audio': audio_modules}
diff --git a/configure b/configure
index 88f3fb861d..171a1c71d2 100755
--- a/configure
+++ b/configure
@@ -3718,6 +3718,8 @@ for drv in $audio_drv_list; do
 alsa | try-alsa)
 if $pkg_config alsa --exists; then
 alsa_libs=$($pkg_config alsa --libs)
+alsa_cflags=$($pkg_config alsa --cflags)
+alsa=yes
 if test "$drv" = "try-alsa"; then
 audio_drv_list=$(echo "$audio_drv_list" | sed -e 
's/try-alsa/alsa/')
 fi
@@ -3733,7 +3735,9 @@ for drv in $audio_drv_list; do
 
 pa | try-pa)
 if $pkg_config libpulse --exists; then
+libpulse=yes
 pulse_libs=$($pkg_config lib

[PATCH 051/150] meson: generate hxtool files

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile|  8 +---
 Makefile.target |  6 --
 meson.build | 22 ++
 scripts/hxtool  |  2 +-
 4 files changed, 24 insertions(+), 14 deletions(-)
 mode change 100644 => 100755 scripts/hxtool

diff --git a/Makefile b/Makefile
index 0732886563..8f750a8551 100644
--- a/Makefile
+++ b/Makefile
@@ -112,7 +112,7 @@ include $(SRC_PATH)/rules.mak
 # lor is defined in rules.mak
 CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
 
-generated-files-y = config-host.h qemu-options.def
+generated-files-y = config-host.h
 
 generated-files-y += module_block.h
 
@@ -254,8 +254,6 @@ all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) 
$(HELPERS-y) recurse-all mo
 
 config-host.h: config-host.h-timestamp
 config-host.h-timestamp: config-host.mak
-qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
-   $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > 
$@,"GEN","$@")
 
 TARGET_DIRS_RULES := $(foreach t, all fuzz clean install, $(addsuffix /$(t), 
$(TARGET_DIRS)))
 
@@ -362,9 +360,6 @@ ifdef CONFIG_MPATH
 scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
 endif
 
-qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
-   $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > 
$@,"GEN","$@")
-
 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(call quiet-command,$(PYTHON) $< $@ \
$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
@@ -383,7 +378,6 @@ clean: recurse-clean ninja-clean clean-ctlist
rm -f $(edk2-decompressed)
rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ 
*/*~
rm -f fsdev/*.pod scsi/*.pod
-   rm -f qemu-img-cmds.h
rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
rm -f config-all-devices.mak
rm -f $(SUBDIR_DEVICES_MAK)
diff --git a/Makefile.target b/Makefile.target
index 0b323641bb..257afc2723 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -225,12 +225,6 @@ endif
 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
$(call quiet-command,rm -f $@ && $(SHELL) 
$(SRC_PATH)/scripts/feature_to_c.sh $@ 
$(TARGET_XML_FILES),"GEN","$(TARGET_DIR)$@")
 
-hmp-commands.h: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
-   $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > 
$@,"GEN","$(TARGET_DIR)$@")
-
-hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx 
$(SRC_PATH)/scripts/hxtool
-   $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > 
$@,"GEN","$(TARGET_DIR)$@")
-
 clean: clean-target
rm -f *.a *~ $(PROGS)
rm -f $(shell find . -name '*.[od]')
diff --git a/meson.build b/meson.build
index ad2b0d6478..e37cd88cc1 100644
--- a/meson.build
+++ b/meson.build
@@ -155,6 +155,7 @@ have_block = have_system or have_tools
 # Generators
 
 genh = []
+hxtool = find_program('scripts/hxtool')
 shaderinclude = find_program('scripts/shaderinclude.pl')
 qapi_gen = find_program('scripts/qapi-gen.py')
 qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
@@ -192,6 +193,27 @@ qemu_version = custom_target('qemu-version.h',
  build_always_stale: true)
 genh += qemu_version
 
+hxdep = []
+hx_headers = [
+  ['qemu-options.hx', 'qemu-options.def'],
+  ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
+]
+if have_system
+  hx_headers += [
+['hmp-commands.hx', 'hmp-commands.h'],
+['hmp-commands-info.hx', 'hmp-commands-info.h'],
+  ]
+endif
+foreach d : hx_headers
+  custom_target(d[1],
+input: files(d[0]),
+output: d[1],
+capture: true,
+build_by_default: true, # to be removed when added to a target
+command: [hxtool, '-h', '@INPUT0@'])
+endforeach
+genh += hxdep
+
 # Collect sourcesets.
 
 util_ss = ss.source_set()
diff --git a/scripts/hxtool b/scripts/hxtool
old mode 100644
new mode 100755
index 7b1452f3cf..80516b9437
--- a/scripts/hxtool
+++ b/scripts/hxtool
@@ -19,6 +19,6 @@ hxtoh()
 case "$1" in
 "-h") hxtoh ;;
 *) exit 1 ;;
-esac
+esac < "$2"
 
 exit 0
-- 
2.26.2





[PATCH 045/150] meson: add qemu-keymap

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile|  5 -
 configure   |  4 +---
 meson.build | 10 ++
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index b66b443037..ec3c0a7371 100644
--- a/Makefile
+++ b/Makefile
@@ -420,8 +420,6 @@ qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) 
$(crypto-obj-y) $(io
 qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) 
$(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) 
$(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) 
$(storage-daemon-obj-y) $(COMMON_LDADDS)
 
-qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
-
 qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
 
 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o 
fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
@@ -434,9 +432,6 @@ endif
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > 
$@,"GEN","$@")
 
-qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
-qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
-
 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(call quiet-command,$(PYTHON) $< $@ \
$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
diff --git a/configure b/configure
index 123b5632b7..d6baf31e2a 100755
--- a/configure
+++ b/configure
@@ -6703,9 +6703,6 @@ if test "$softmmu" = yes ; then
 fi
 mpath=no
   fi
-  if test "$xkbcommon" = "yes"; then
-tools="qemu-keymap\$(EXESUF) $tools"
-  fi
 fi
 
 # Probe for guest agent support/options
@@ -7022,6 +7019,7 @@ if test "$vnc_png" = "yes" ; then
   echo "CONFIG_VNC_PNG=y" >> $config_host_mak
 fi
 if test "$xkbcommon" = "yes" ; then
+  echo "CONFIG_XKBCOMMON=y" >> $config_host_mak
   echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
   echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
 fi
diff --git a/meson.build b/meson.build
index 504b834304..f4d4b52a2d 100644
--- a/meson.build
+++ b/meson.build
@@ -107,6 +107,11 @@ libcap_ng = not_found
 if 'CONFIG_LIBCAP_NG' in config_host
   libcap_ng = declare_dependency(link_args: 
config_host['LIBCAP_NG_LIBS'].split())
 endif
+xkbcommon = not_found
+if 'CONFIG_XKBCOMMON' in config_host
+  xkbcommon = declare_dependency(compile_args: 
config_host['XKBCOMMON_CFLAGS'].split(),
+ link_args: 
config_host['XKBCOMMON_LIBS'].split())
+endif
 rt = cc.find_library('rt', required: false)
 libiscsi = not_found
 if 'CONFIG_LIBISCSI' in config_host
@@ -301,6 +306,11 @@ if have_tools
   subdir('contrib/rdmacm-mux')
   subdir('contrib/elf2dmp')
 
+  if 'CONFIG_XKBCOMMON' in config_host
+executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c'),
+   dependencies: [qemuutil, xkbcommon], install: true)
+  endif
+
   if 'CONFIG_VHOST_USER' in config_host
 subdir('contrib/libvhost-user')
 subdir('contrib/vhost-user-blk')
-- 
2.26.2





[PATCH 050/150] meson: generate shader headers

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile  | 19 ---
 meson.build   |  1 +
 ui/meson.build|  2 ++
 ui/shader/meson.build | 15 +++
 4 files changed, 18 insertions(+), 19 deletions(-)
 create mode 100644 ui/shader/meson.build

diff --git a/Makefile b/Makefile
index 9abf7be598..0732886563 100644
--- a/Makefile
+++ b/Makefile
@@ -384,7 +384,6 @@ clean: recurse-clean ninja-clean clean-ctlist
rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ 
*/*~
rm -f fsdev/*.pod scsi/*.pod
rm -f qemu-img-cmds.h
-   rm -f ui/shader/*-vert.h ui/shader/*-frag.h
rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
rm -f config-all-devices.mak
rm -f $(SUBDIR_DEVICES_MAK)
@@ -609,24 +608,6 @@ endif
$(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
 done
 
-# opengl shader programs
-ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert 
$(SRC_PATH)/scripts/shaderinclude.pl
-   @mkdir -p $(dir $@)
-   $(call quiet-command,\
-   perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
-   "VERT","$@")
-
-ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag 
$(SRC_PATH)/scripts/shaderinclude.pl
-   @mkdir -p $(dir $@)
-   $(call quiet-command,\
-   perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
-   "FRAG","$@")
-
-ui/shader.o: $(SRC_PATH)/ui/shader.c \
-   ui/shader/texture-blit-vert.h \
-   ui/shader/texture-blit-flip-vert.h \
-   ui/shader/texture-blit-frag.h
-
 # documentation
 MAKEINFO=makeinfo
 MAKEINFOINCLUDES= -I docs -I $(

[PATCH 057/150] meson: convert authz directory to Meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile|  1 -
 Makefile.objs   |  3 ++-
 Makefile.target |  2 +-
 authz/Makefile.objs |  7 ---
 authz/meson.build   | 19 +++
 meson.build |  5 +
 6 files changed, 27 insertions(+), 10 deletions(-)
 delete mode 100644 authz/Makefile.objs
 create mode 100644 authz/meson.build

diff --git a/Makefile b/Makefile
index bd0f208dd6..2742f92706 100644
--- a/Makefile
+++ b/Makefile
@@ -232,7 +232,6 @@ include $(SRC_PATH)/Makefile.objs
 endif
 
 dummy := $(call unnest-vars,, \
-authz-obj-y \
 chardev-obj-y \
 block-obj-y \
 block-obj-m \
diff --git a/Makefile.objs b/Makefile.objs
index 84bfa2a61a..0bc361d338 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -9,7 +9,8 @@ ifeq ($(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)),y)
 
 chardev-obj-y = chardev/
 
-authz-obj-y = authz/
+authz-obj-y = authz/libauthz.fa
+authz/libauthz.fa-libs = $(if $(CONFIG_AUTH_PAM),-lpam)
 
 block-obj-y = block/ nbd/ scsi/
 block-obj-y += block.o blockjob.o job.o
diff --git a/Makefile.target b/Makefile.target
index 1e04551a8e..79b6e02bed 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -192,9 +192,9 @@ common-obj-m :=
 
 include $(SRC_PATH)/Makefile.objs
 dummy := $(call fix-paths,../,, \
+  authz-obj-y \
   qom-obj-y)
 dummy := $(call unnest-vars,.., \
-   authz-obj-y \
block-obj-y \
block-obj-m \
chardev-obj-y \
diff --git a/authz/Makefile.objs b/authz/Makefile.objs
deleted file mode 100644
index ed7b273596..00
--- a/authz/Makefile.objs
+++ /dev/null
@@ -1,7 +0,0 @@
-authz-obj-y += base.o
-authz-obj-y += simple.o
-authz-obj-y += list.o
-authz-obj-y += listfile.o
-authz-obj-$(CONFIG_AUTH_PAM) += pamacct.o
-
-pamacct.o-libs = -lpam
diff --git a/authz/meson.build b/authz/meson.build
new file mode 100644
index 00..c1f63627c1
--- /dev/null
+++ b/authz/meson.build
@@ -0,0 +1,19 @@
+authz_ss = ss.source_set()
+authz_ss.add(genh)
+authz_ss.add(files(
+  'base.c',
+  'list.c',
+  'listfile.c',
+  'simple.c',
+))
+
+authz_ss.add(when: ['CONFIG_AUTH_PAM', pam], if_true: files('pamacct.c'))
+
+authz_ss = authz_ss.apply(config_host, strict: false)
+libauthz = static_library('authz', authz_ss.sources(),
+  dependencies: [authz_ss.dependencies()],
+  name_suffix: 'fa',
+  build_by_default: false)
+
+authz = declare_dependency(link_whole: libauthz,
+   dependencies: qom)
diff --git a/meson.build b/meson.build
index d883fcf926..0454061543 100644
--- a/meson.build
+++ b/meson.build
@@ -99,6 +99,10 @@ if 'CONFIG_GNUTLS' in config_host
 endif
 pixman = declare_dependency(compile_args: config_host['PIXMAN_CFLAGS'].split(),
 link_args: config_host['PIXMAN_LIBS'].split())
+pam = not_found
+if 'CONFIG_AUTH_PAM' in config_host
+  pam = cc.find_library('pam')
+endif
 libattr = not_found
 if 'CONFIG_ATTR' in config_host
   libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
@@ -337,6 +341,7 @@ qemuutil = declare_dependency(link_with: libqemuutil,
   sources: genh + version_res)
 
 subdir('qom')
+subdir('authz')
 subdir('fsdev')
 
 # Other build targets
-- 
2.26.2





[PATCH 055/150] meson: convert check-qapi-schema

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 tests/Makefile.include| 218 +---
 tests/meson.build |   2 +
 tests/qapi-schema/meson.build | 225 ++
 3 files changed, 229 insertions(+), 216 deletions(-)
 create mode 100644 tests/qapi-schema/meson.build

diff --git a/tests/Makefile.include b/tests/Makefile.include
index b3f8fdd321..676d099631 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -161,201 +161,6 @@ check-unit-y += tests/test-qapi-util$(EXESUF)
 
 check-block-$(call land,$(CONFIG_POSIX),$(CONFIG_SOFTMMU)) += 
tests/check-block.sh
 
-qapi-schema += alternate-any.json
-qapi-schema += alternate-array.json
-qapi-schema += alternate-base.json
-qapi-schema += alternate-branch-if-invalid.json
-qapi-schema += alternate-clash.json
-qapi-schema += alternate-conflict-dict.json
-qapi-schema += alternate-conflict-enum-bool.json
-qapi-schema += alternate-conflict-enum-int.json
-qapi-schema += alternate-conflict-string.json
-qapi-schema += alternate-conflict-bool-string.json
-qapi-schema += alternate-conflict-num-string.json
-qapi-schema += alternate-empty.json
-qapi-schema += alternate-invalid-dict.json
-qapi-schema += alternate-nested.json
-qapi-schema += alternate-unknown.json
-qapi-schema += args-alternate.json
-qapi-schema += args-any.json
-qapi-schema += args-array-empty.json
-qapi-schema += args-array-unknown.json
-qapi-schema += args-bad-boxed.json
-qapi-schema += args-boxed-anon.json
-qapi-schema += args-boxed-string.json
-qapi-schema += args-int.json
-qapi-schema += args-invalid.json
-qapi-schema += args-member-array-bad.json
-qapi-schema += args-member-case.json
-qapi-schema += args-member-unknown.json
-qapi-schema += args-name-clash.json
-qapi-schema += args-union.json
-qapi-schema += args-unknown.json
-qapi-schema += bad-base.json
-qapi-schema += bad-data.json
-qapi-schema += bad-ident.json
-qapi-schema += bad-if.json
-qapi-schema += bad-if-empty.json
-qapi-schema += bad-if-empty-list.json
-qapi-schema += bad-if-list.json
-qapi-schema += bad-type-bool.json
-qapi-schema += bad-type-dict.json
-qapi-schema += bad-type-int.json
-qapi-schema += base-cycle-direct.json
-qapi-schema += base-cycle-indirect.json
-qapi-schema += command-int.json
-qapi-schema += comments.json
-qapi-schema += doc-bad-alternate-member.json
-qapi-schema += doc-bad-boxed-command-arg.json
-qapi-schema += doc-bad-command-arg.json
-qapi-schema += doc-bad-enum-member.json
-qapi-schema += doc-bad-event-arg.json
-qapi-schema += doc-bad-feature.json
-qapi-schema += doc-bad-section.json
-qapi-schema += doc-bad-symbol.json
-qapi-schema += doc-bad-union-member.json
-qapi-schema += doc-before-include.json
-qapi-schema += doc-before-pragma.json
-qapi-schema += doc-duplicated-arg.json
-qapi-schema += doc-duplicated-return.json
-qapi-schema += doc-duplicated-since.json
-qapi-schema += doc-empty-arg.json
-qapi-schema += doc-empty-section.json
-qapi-schema += doc-empty-symbol.json
-qapi-schema += doc-good.json
-qapi-schema += doc-interleaved-section.json
-qapi-schema += doc-invalid-end.json
-qapi-schema += doc-invalid-end2.json
-qapi-schema += doc-invalid-return.json
-qapi-schema += doc-invalid-section.json
-qapi-schema += doc-invalid-start.json
-qapi-schema += doc-missing-colon.json
-qapi-schema += doc-missing-expr.json
-qapi-schema += doc-missing-space.json
-qapi-schema += doc-missing.json
-qapi-schema += doc-no-symbol.json
-qapi-schema += doc-undoc-feature.json
-qapi-schema += double-type.json
-qapi-schema += duplicate-key.json
-qapi-schema += empty.json
-qapi-schema += enum-bad-member.json
-qapi-schema += enum-bad-name.json
-qapi-schema += enum-bad-prefix.json
-qapi-schema += enum-clash-member.json
-qapi-schema += enum-dict-member-unknown.json
-qapi-schema += enum-if-invalid.json
-qapi-schema += enum-int-member.json
-qapi-schema += enum-member-case.json
-qapi-schema += enum-missing-data.json
-qapi-schema += enum-wrong-data.json
-qapi-schema += event-boxed-empty.json
-qapi-schema += event-case.json
-qapi-schema += event-member-invalid-dict.json
-qapi-schema += event-nest-struct.json
-qapi-schema += features-bad-type.json
-qapi-schema += features-deprecated-type.json
-qapi-schema += features-duplicate-name.json
-qapi-schema += features-if-invalid.json
-qapi-schema += features-missing-name.json
-qapi-schema += features-name-bad-type.json
-qapi-schema += features-no-list.json
-qapi-schema += features-unknown-key.json
-qapi-schema += flat-union-array-branch.json
-qapi-schema += flat-union-bad-base.json
-qapi-schema += flat-union-bad-discriminator.json
-qapi-schema += flat-union-base-any.json
-qapi-schema += flat-union-base-union.json
-qapi-schema += flat-union-clash-member.json
-qapi-schema += flat-union-discriminator-bad-name.json
-qapi-schema += flat-union-empty.json
-qapi-schema += flat-union-inline.json
-qapi-schema += flat-union-inline-invalid-dict.json
-qapi-schema += flat-union-int-branch.json
-qapi-schema += flat-union-invalid-branch-key.json
-qapi-schema +

[PATCH 080/150] meson: convert net directory to Meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs |  3 +--
 Makefile.target   |  1 +
 meson.build   | 10 ++
 net/Makefile.objs | 32 
 net/can/Makefile.objs |  2 --
 net/can/meson.build   |  5 +
 net/meson.build   | 40 
 7 files changed, 57 insertions(+), 36 deletions(-)
 delete mode 100644 net/Makefile.objs
 delete mode 100644 net/can/Makefile.objs
 create mode 100644 net/can/meson.build
 create mode 100644 net/meson.build

diff --git a/Makefile.objs b/Makefile.objs
index 9d0a82d82a..f2700442a4 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -39,8 +39,7 @@ endif # CONFIG_SOFTMMU or CONFIG_TOOLS
 # single QEMU executable should support all CPUs and machines.
 
 ifeq ($(CONFIG_SOFTMMU),y)
-common-obj-y = net/
-common-obj-$(CONFIG_LINUX) += fsdev/
+common-obj-$(CONFIG_LINUX) = fsdev/
 
 common-obj-y += accel/
 
diff --git a/Makefile.target b/Makefile.target
index 4d912df3a3..bf3fda92c1 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -168,6 +168,7 @@ LIBS := $(LIBS) $(GTK_LIBS) $(VTE_LIBS) $(X11_LIBS) 
$(CURSES_LIBS) $(ICONV_LIBS)
 endif
 LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS) $(OPENGL_LIBS) 
$(SECCOMP_LIBS)
 LIBS := $(LIBS) $(COREAUDIO_LIBS) $(DSOUND_LIBS)
+LIBS := $(LIBS) $(VDE_LIBS) $(SLIRP_LIBS)
 
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
diff --git a/meson.build b/meson.build
index e8e5f6f48a..18d9e97d32 100644
--- a/meson.build
+++ b/meson.build
@@ -145,6 +145,15 @@ if 'CONFIG_XKBCOMMON' in config_host
   xkbcommon = declare_dependency(compile_args: 
config_host['XKBCOMMON_CFLAGS'].split(),
  link_args: 
config_host['XKBCOMMON_LIBS'].split())
 endif
+slirp = not_found
+if config_host.has_key('CONFIG_SLIRP')
+  slirp = declare_dependency(compile_args: config_host['SLIRP_CFLAGS'].split(),
+ link_args: config_host['SLIRP_LIBS'].split())
+endif
+vde = not_found
+if config_host.has_key('CONFIG_VDE')
+  vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
+endif
 pulse = not_found
 if 'CONFIG_LIBPULSE' in config_host
   pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
@@ -657,6 +666,7 @@ common_ss.add(files('cpus-common.c'))
 subdir('softmmu')
 subdir('migration')
 subdir('monitor')
+subdir('net')
 subdir('replay')
 
 # needed for fuzzing binaries
diff --git a/net/Makefile.objs b/net/Makefile.objs
deleted file mode 100644
index 5ab45545db..00
--- a/net/Makefile.objs
+++ /dev/null
@@ -1,32 +0,0 @@
-common-obj-y = net.o queue.o checksum.o util.o hub.o
-common-obj-y += socket.o
-common-obj-y += dump.o
-common-obj-y += eth.o
-common-obj-y += announce.o
-common-obj-$(CONFIG_L2TPV3) += l2tpv3.o
-common-obj-$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET_USER)) += 
vhost-user.o
-common-obj-$(call land,$(call 
lnot,$(CONFIG_VIRTIO_NET)),$(CONFIG_VHOST_NET_USER)) += vhost-user-stub.o
-common-obj-$(CONFIG_ALL) += vhost-user-stub.o
-common-obj-$(CONFIG_SLIRP) += slirp.o
-slirp.o-cflags := $(SLIRP_CFLAGS)
-slirp.o-libs := $(SLIRP_LIBS)
-common-obj-$(CONFIG_VDE) += vde.o
-common-obj-$(CONFIG_NETMAP) += netmap.o
-common-obj-y += filter.o
-common-obj-y += filter-buffer.o
-common-obj-y += filter-mirror.o
-common-obj-y += colo-compare.o
-common-obj-y += colo.o
-common-obj-y += filter-rewriter.o
-common-obj-y += filter-replay.o
-
-tap-obj-$(CONFIG_LINUX) = tap-linux.o
-tap-obj-$(CONFIG_BSD) = tap-bsd.o
-tap-obj-$(CONFIG_SOLARIS) = tap-solaris.o
-tap-obj-y ?= tap-stub.o
-common-obj-$(CONFIG_POSIX) += tap.o $(tap-obj-y)
-common-obj-$(CONFIG_WIN32) += tap-win32.o
-common-obj-$(CONFIG_VHOST_NET_VDPA) += vhost-vdpa.o
-vde.o-libs = $(VDE_LIBS)
-
-common-obj-$(CONFIG_CAN_BUS) += can/
diff --git a/net/can/Makefile.objs b/net/can/Makefile.objs
deleted file mode 100644
index 9f35dc5c87..00
--- a/net/can/Makefile.objs
+++ /dev/null
@@ -1,2 +0,0 @@
-common-obj-y += can_core.o can_host.o
-common-obj-$(CONFIG_LINUX) += can_socketcan.o
diff --git a/net/can/meson.build b/net/can/meson.build
new file mode 100644
index 00..f53d9ec54f
--- /dev/null
+++ b/net/can/meson.build
@@ -0,0 +1,5 @@
+can_ss = ss.source_set()
+can_ss.add(files('can_core.c', 'can_host.c'))
+can_ss.add(when: 'CONFIG_LINUX', if_true: files('can_socketcan.c'))
+
+softmmu_ss.add_all(when: 'CONFIG_CAN_BUS', if_true: can_ss)
diff --git a/net/meson.build b/net/meson.build
new file mode 100644
index 00..6c2ec47dd5
--- /dev/null
+++ b/net/meson.build
@@ -0,0 +1,40 @@
+softmmu_ss.add(files(
+  'announce.c',
+  'checksum.c',
+  'colo-compare.c',
+  'colo.c',
+  'dump.c',
+  'eth.c',
+  'filter-buffer.c',
+  'filter-mirror.c',
+  'filter-replay.c',
+  'filter-rewriter.c',
+  'filter.c',
+  'hub.c',
+  'net.c',
+  'queue.c',
+  'socket.c',
+  'util.c',
+))
+
+softmmu_ss.add(when: 'CONFIG_L2TPV3', if_true: files('l2tpv3.c'))
+softmmu_ss.add(when: 

[PATCH 084/150] meson: convert qapi-specific to meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs  |  2 --
 Makefile.target|  1 -
 qapi/Makefile.objs | 15 ---
 qapi/meson.build   | 10 +++---
 4 files changed, 7 insertions(+), 21 deletions(-)
 delete mode 100644 qapi/Makefile.objs

diff --git a/Makefile.objs b/Makefile.objs
index 3b32a4c9bb..c332323b81 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -64,8 +64,6 @@ common-obj-$(if $(and $(CONFIG_BZIP2),$(CONFIG_DMG)),m) += 
block-dmg-bz2$(DSOSUF
 common-obj-y += hw/
 common-obj-m += hw/
 
-common-obj-y += qapi/
-
 common-obj-y += libqmp.fa
 
 endif # CONFIG_SOFTMMU
diff --git a/Makefile.target b/Makefile.target
index bf3fda92c1..386378b9c8 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -157,7 +157,6 @@ ifdef CONFIG_SOFTMMU
 obj-y += softmmu/
 obj-y += gdbstub.o
 obj-y += hw/
-obj-y += qapi/
 LIBS := $(libs_softmmu) $(LIBS)
 
 # Temporary until emulators are linked by Meson
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
deleted file mode 100644
index c0a31be1a1..00
--- a/qapi/Makefile.objs
+++ /dev/null
@@ -1,15 +0,0 @@
-QAPI_TARGET_MODULES = machine-target misc-target
-
-obj-y = qapi-introspect.o
-obj-y += $(QAPI_TARGET_MODULES:%=qapi-types-%.o)
-obj-y += qapi-types.o
-obj-y += $(QAPI_TARGET_MODULES:%=qapi-visit-%.o)
-obj-y += qapi-visit.o
-obj-y += $(QAPI_TARGET_MODULES:%=qapi-events-%.o)
-obj-y += qapi-events.o
-obj-y += $(QAPI_TARGET_MODULES:%=qapi-commands-%.o)
-obj-y += qapi-commands.o
-obj-y += qapi-init-commands.o
-
-QAPI_MODULES_STORAGE_DAEMON = block-core char common control crypto
-QAPI_MODULES_STORAGE_DAEMON += introspect job qom sockets pragma transaction
diff --git a/qapi/meson.build b/qapi/meson.build
index f45b80bbfa..2b2872a41d 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -114,8 +114,12 @@ foreach output : qapi_util_outputs
   i = i + 1
 endforeach
 
-# These are still handled by the Makefile
-i += qapi_nonmodule_outputs.length()
-i += qapi_specific_outputs.length()
+foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
+  if output.endswith('.h')
+genh += qapi_files[i]
+  endif
+  specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i])
+  i = i + 1
+endforeach
 
 qapi_doc_texi = qapi_files[i]
-- 
2.26.2





[PATCH 063/150] meson: convert chardev directory to Meson (tools part)

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Paolo Bonzini 
---
 Makefile  |  1 -
 Makefile.objs |  4 ++--
 Makefile.target   |  2 +-
 chardev/Makefile.objs | 19 ---
 chardev/meson.build   | 32 
 meson.build   |  1 +
 6 files changed, 36 insertions(+), 23 deletions(-)
 create mode 100644 chardev/meson.build

diff --git a/Makefile b/Makefile
index a126963ab0..aaa0c3156b 100644
--- a/Makefile
+++ b/Makefile
@@ -173,7 +173,6 @@ include $(SRC_PATH)/Makefile.objs
 endif
 
 dummy := $(call unnest-vars,, \
-chardev-obj-y \
 block-obj-y \
 block-obj-m \
 storage-daemon-obj-y \
diff --git a/Makefile.objs b/Makefile.objs
index 0920cdb40c..297bd5beeb 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -7,8 +7,6 @@ qom-obj-y = qom/libqom.fa
 
 ifeq ($(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)),y)
 
-chardev-obj-y = chardev/
-
 authz-obj-y = authz/libauthz.fa
 authz/libauthz.fa-libs = $(if $(CONFIG_AUTH_PAM),-lpam)
 
@@ -19,6 +17,8 @@ block-obj-$(CONFIG_REPLICATION) += replication.o
 
 block-obj-m = block/
 
+chardev-obj-y = chardev/libchardev.fa
+
 crypto-obj-y = crypto/libcrypto.fa
 
 io-obj-y = io/libio.fa
diff --git a/Makefile.target b/Makefile.target
index d1d8906b4d..6b9de09df5 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -199,13 +199,13 @@ common-obj-m :=
 include $(SRC_PATH)/Makefile.objs
 dummy := $(call fix-paths,../,, \
   authz-obj-y \
+  chardev-obj-y \
   crypto-obj-y \
   io-obj-y \
   qom-obj-y)
 dummy := $(call unnest-vars,.., \
block-obj-y \
block-obj-m \
-   chardev-obj-y \
common-obj-y \
common-obj-m)
 all-obj-y += $(common-obj-y)
diff --git a/chardev/Makefile.objs b/chardev/Makefile.objs
index 3783dadc4c..6662d0df41 100644
--- a/chardev/Makefile.objs
+++ b/chardev/Makefile.objs
@@ -1,23 +1,4 @@
-chardev-obj-y += char.o
 chardev-obj-$(CONFIG_SOFTMMU) += chardev-sysemu.o
-chardev-obj-$(CONFIG_WIN32) += char-console.o
-chardev-obj-$(CONFIG_POSIX) += char-fd.o
-chardev-obj-y += char-fe.o
-chardev-obj-y += char-file.o
-chardev-obj-y += char-io.o
-chardev-obj-y += char-mux.o
-chardev-obj-y += char-null.o
-chardev-obj-$(CONFIG_POSIX) += char-parallel.o
-chardev-obj-y += char-pipe.o
-chardev-obj-$(CONFIG_POSIX) += char-pty.o
-chardev-obj-y += char-ringbuf.o
-chardev-obj-y += char-serial.o
-chardev-obj-y += char-socket.o
-chardev-obj-y += char-stdio.o
-chardev-obj-y += char-udp.o
-chardev-obj-$(CONFIG_WIN32) += char-win.o
-chardev-obj-$(CONFIG_WIN32) += char-win-stdio.o
-
 common-obj-$(CONFIG_SOFTMMU) += msmouse.o wctablet.o testdev.o
 
 ifeq ($(CONFIG_BRLAPI),y)
diff --git a/chardev/meson.build b/chardev/meson.build
new file mode 100644
index 00..a2e671ddfc
--- /dev/null
+++ b/chardev/meson.build
@@ -0,0 +1,32 @@
+chardev_ss = ss.source_set()
+chardev_ss.add(files(
+  'char-fe.c',
+  'char-file.c',
+  'char-io.c',
+  'char-mux.c',
+  'char-null.c',
+  'char-pipe.c',
+  'char-ringbuf.c',
+  'char-serial.c',
+  'char-socket.c',
+  'char-stdio.c',
+  'char-udp.c',
+  'char.c',
+))
+chardev_ss.add(when: 'CONFIG_POSIX', if_true: files(
+  'char-fd.c',
+  'char-parallel.c',
+  'char-pty.c',
+))
+chardev_ss.add(when: 'CONFIG_WIN32', if_true: files(
+  'char-console.c',
+  'char-win-stdio.c',
+  'char-win.c',
+))
+
+chardev_ss = chardev_ss.apply(config_host, strict: false)
+libchardev = static_library('chardev', chardev_ss.sources(),
+name_suffix: 'fa',
+build_by_default: false)
+
+chardev = declare_dependency(link_whole: libchardev)
diff --git a/meson.build b/meson.build
index 2155c111df..19538284e1 100644
--- a/meson.build
+++ b/meson.build
@@ -450,6 +450,7 @@ qemuutil = declare_dependency(link_with: libqemuutil,
   sources: genh + version_res)
 
 subdir('io')
+subdir('chardev')
 subdir('fsdev')
 subdir('target')
 
-- 
2.26.2





[PATCH 052/150] meson: handle edk2 bios and descriptors

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Paolo Bonzini 
---
 Makefile| 29 -
 meson.build |  1 +
 pc-bios/descriptors/meson.build | 14 ++
 pc-bios/meson.build | 27 +++
 4 files changed, 42 insertions(+), 29 deletions(-)
 create mode 100644 pc-bios/descriptors/meson.build
 create mode 100644 pc-bios/meson.build

diff --git a/Makefile b/Makefile
index 8f750a8551..0dce00d99a 100644
--- a/Makefile
+++ b/Makefile
@@ -118,10 +118,6 @@ generated-files-y += module_block.h
 
 generated-files-y += .git-submodule-status
 
-edk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.bz2))
-pc-bios/edk2-%.fd: pc-bios/edk2-%.fd.bz2
-   $(call quiet-command,bzip2 -d -c $< > $@,"BUNZIP2",$<)
-
 # Don't try to regenerate Makefile or configure
 # We don't generate any of them
 Makefile: ;
@@ -265,9 +261,6 @@ $(SOFTMMU_ALL_RULES): $(chardev-obj-y)
 $(SOFTMMU_ALL_RULES): $(crypto-obj-y)
 $(SOFTMMU_ALL_RULES): $(io-obj-y)
 $(SOFTMMU_ALL_RULES): config-all-devices.mak
-ifdef DECOMPRESS_EDK2_BLOBS
-$(SOFTMMU_ALL_RULES): $(edk2-decompressed)
-endif
 
 SOFTMMU_FUZZ_RULES=$(filter %-softmmu/fuzz, $(TARGET_DIRS_RULES))
 $(SOFTMMU_FUZZ_RULES): $(authz-obj-y)
@@ -375,7 +368,6 @@ clean: recurse-clean ninja-clean clean-ctlist
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll 
\
-exec rm {} +
-   rm -f $(edk2-decompressed)
rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ 
*/*~
rm -f fsdev/*.pod scsi/*.pod
rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
@@ -452,13 +444,8 @@ edk2-licenses.txt \
 hppa-firmware.img \
 opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
 opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
-
-
-DESCS=50-edk2-i386-secure.json 50-edk2-x86_64-secure.json \
-60-edk2-aarch64.json 60-edk2-arm.json 60-edk2-i386.json 60-edk2-x86_64.json
 else
 BLOBS=
-DESCS=
 endif
 
 # Note that we manually filter-out the non-Sphinx documentation which
@@ -535,7 +522,6 @@ install-includedir:
 export DESTDIR
 install: all $(if $(BUILD_DOCS),install-doc) \
install-datadir install-localstatedir install-includedir \
-   $(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
recurse-install
 ifneq ($(TOOLS),)
$(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
@@ -558,21 +544,6 @@ ifneq ($(BLOBS),)
set -e; for x in $(BLOBS); do \
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x 
"$(DESTDIR)$(qemu_datadir)"; \
done
-endif
-ifdef INSTALL_BLOBS
-   set -e; for x in $(edk2-decompressed); do \
-   $(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)"; \
-   done
-endif
-ifneq ($(DESCS),)
-   $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/firmware"
-   set -e; tmpf=$$(mktemp); trap 'rm -f -- "$$tmpf"' EXIT; \
-   for x in $(DESCS); do \
-   sed -e 's,@DATADIR@,$(qemu_datadir),' \
-   "$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
-   $(INSTALL_DATA) "$$tmpf" \
-   "$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
-   done
 endif
for s in $(ICON_SIZES); do \
mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
diff --git a/meson.build b/meson.build
index e37cd88cc1..e5617df1b3 100644
--- a/meson.build
+++ b/meson.build
@@ -379,6 +379,7 @@ if have_tools
 endif
 
 subdir('tools')
+subdir('pc-bios')
 
 summary_info = {}
 summary_info += {'Install prefix':config_host['prefix']}
diff --git a/pc-bios/descriptors/meson.build b/pc-bios/descriptors/meson.build
new file mode 100644
index 00..7c715bace8
--- /dev/null
+++ b/pc-bios/descriptors/meson.build
@@ -0,0 +1,14 @@
+foreach f: [
+  '50-edk2-i386-secure.json',
+  '50-edk2-x86_64-secure.json',
+  '60-edk2-aarch64.json',
+  '60-edk2-arm.json',
+  '60-edk2-i386.json',
+  '60-edk2-x86_64.json'
+]
+  configure_file(input: files(f),
+ output: f,
+ configuration: {'DATADIR': config_host['qemu_datadir']},
+ install: install_blobs,
+ install_dir: config_host['qemu_datadir'] / 'firmware')
+endforeach
diff --git a/pc-bios/meson.build b/pc-bios/meson.build
new file mode 100644
index 00..6e3bfe3ca4
--- /dev/null
+++ b/pc-bios/meson.build
@@ -0,0 +1,27 @@
+bzip2 = find_program('bzip2')
+
+install_blobs = 'INSTALL_BLOBS' in config_host
+if 'DECOMPRESS_EDK2_BLOBS' in config_host
+  fds = [
+'edk2-aarch64-code.fd',
+'edk2-arm-code.fd',
+'edk2-arm-vars.fd',
+'edk2-i386-code.fd',
+'edk2-i386-secure-code.fd',
+'edk2-i386-vars.fd',
+'edk2-x86_64-code.fd',
+'edk2-x86_64-secure-code.fd',
+  ]
+
+  foreach f : fds
+custom_target(f,
+  

[PATCH 060/150] meson: convert target/s390x/gen-features.h

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Needed by linux-user/s390x/cpu_loop.c; this removes the only use of HOST_CC.

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile|  2 ++
 configure   |  1 -
 meson.build |  1 +
 target/meson.build  |  1 +
 target/s390x/Makefile.objs  | 20 
 target/s390x/cpu_features.h |  2 +-
 target/s390x/cpu_models.h   |  2 +-
 target/s390x/meson.build|  9 +
 8 files changed, 15 insertions(+), 23 deletions(-)
 create mode 100644 target/meson.build
 create mode 100644 target/s390x/meson.build

diff --git a/Makefile b/Makefile
index b0cae10ce0..420f2661eb 100644
--- a/Makefile
+++ b/Makefile
@@ -115,6 +115,8 @@ CONFIG_BLOCK := $(call 
lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
 generated-files-y = config-host.h
 
 generated-files-y += module_block.h
+generated-files-y += target/s390x/gen-features.h
+target/s390x/gen-features.h: Makefile.ninja
 
 generated-files-y += .git-submodule-status
 
diff --git a/configure b/configure
index b1f3ea9040..100f6b41ee 100755
--- a/configure
+++ b/configure
@@ -7785,7 +7785,6 @@ echo "CC=$cc" >> $config_host_mak
 if $iasl -h > /dev/null 2>&1; then
   echo "IASL=$iasl" >> $config_host_mak
 fi
-echo "HOST_CC=$host_cc" >> $config_host_mak
 echo "CXX=$cxx" >> $config_host_mak
 echo "OBJCC=$objcc" >> $config_host_mak
 echo "AR=$ar" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 1f3688f67f..34aa43cc4e 100644
--- a/meson.build
+++ b/meson.build
@@ -344,6 +344,7 @@ qemuutil = declare_dependency(link_with: libqemuutil,
 
 subdir('io')
 subdir('fsdev')
+subdir('target')
 
 # Other build targets
 if 'CONFIG_GUEST_AGENT' in config_host
diff --git a/target/meson.build b/target/meson.build
new file mode 100644
index 00..e29dd3e01f
--- /dev/null
+++ b/target/meson.build
@@ -0,0 +1 @@
+subdir('s390x')
diff --git a/target/s390x/Makefile.objs b/target/s390x/Makefile.objs
index 3e2745594a..9b9accc5fd 100644
--- a/target/s390x/Makefile.objs
+++ b/target/s390x/Makefile.objs
@@ -8,23 +8,3 @@ obj-$(CONFIG_SOFTMMU) += sigp.o
 obj-$(CONFIG_KVM) += kvm.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
 obj-$(call lnot,$(CONFIG_TCG)) += tcg-stub.o
-
-# build and run feature list generator
-feat-src = $(SRC_PATH)/target/$(TARGET_BASE_ARCH)/
-feat-dst = $(BUILD_DIR)/$(TARGET_DIR)
-ifneq ($(MAKECMDGOALS),clean)
-generated-files-y += $(feat-dst)gen-features.h
-endif
-
-$(feat-dst)gen-features.h: $(feat-dst)gen-features.h-timestamp
-   @cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(feat-dst)gen-features.h-timestamp: $(feat-dst)gen-features
-   $(call quiet-command,$< >$@,"GEN","$(TARGET_DIR)gen-features.h")
-
-$(feat-dst)gen-features: $(feat-src)gen-features.c
-   $(call quiet-command,$(HOST_CC) $(QEMU_INCLUDES) -o $@ 
$<,"CC","$(TARGET_DIR)gen-features")
-
-clean-target:
-   rm -f gen-features.h-timestamp
-   rm -f gen-features.h
-   rm -f gen-features
diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
index da695a8346..2a29475493 100644
--- a/target/s390x/cpu_features.h
+++ b/target/s390x/cpu_features.h
@@ -16,7 +16,7 @@
 
 #include "qemu/bitmap.h"
 #include "cpu_features_def.h"
-#include "gen-features.h"
+#include "target/s390x/gen-features.h"
 
 /* CPU features are announced via different ways */
 typedef enum {
diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h
index 88bd01a616..74d1f87e4f 100644
--- a/target/s390x/cpu_models.h
+++ b/target/s390x/cpu_models.h
@@ -14,7 +14,7 @@
 #define TARGET_S390X_CPU_MODELS_H
 
 #include "cpu_features.h"
-#include "gen-features.h"
+#include "target/s390x/gen-features.h"
 #include "hw/core/cpu.h"
 
 /* static CPU definition */
diff --git a/target/s390x/meson.build b/target/s390x/meson.build
new file mode 100644
index 00..ddf8d20a36
--- /dev/null
+++ b/target/s390x/meson.build
@@ -0,0 +1,9 @@
+gen_features = executable('gen-features', 'gen-features.c', native: true,
+  build_by_default: false)
+
+gen_features_h = custom_target('gen-features.h',
+   output: 'gen-features.h',
+   capture: true,
+   command: gen_features)
+
+specific_ss.add(gen_features_h)
-- 
2.26.2





[PATCH 062/150] meson: add modules infrastructure

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile| 10 +
 Makefile.target |  6 ++
 meson.build | 52 +
 rules.mak   | 10 -
 scripts/undefsym.sh | 20 +
 5 files changed, 84 insertions(+), 14 deletions(-)
 create mode 100755 scripts/undefsym.sh

diff --git a/Makefile b/Makefile
index 538537f711..a126963ab0 100644
--- a/Makefile
+++ b/Makefile
@@ -257,7 +257,7 @@ slirp/all: .git-submodule-status
CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
 
 $(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
-   $(qom-obj-y)
+   $(qom-obj-y) block.syms qemu.syms
 
 $(filter %/fuzz, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
$(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
@@ -465,14 +465,6 @@ install: all $(if $(BUILD_DOCS),install-doc) \
 ifneq ($(TOOLS),)
$(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
 endif
-ifneq ($(CONFIG_MODULES),)
-   $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
-   for s in $(modules-m:.mo=$(DSOSUF)); do \
-   t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
-   $(INSTALL_LIB) $$s "$$t"; \
-   test -z "$(STRIP)" || $(STRIP) "$$t"; \
-   done
-endif
 ifneq ($(HELPERS-y),)
$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
 endif
diff --git a/Makefile.target b/Makefile.target
index 43d2f9734f..d1d8906b4d 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -162,6 +162,12 @@ obj-y += qapi/
 obj-y += migration/ram.o
 LIBS := $(libs_softmmu) $(LIBS)
 
+# Temporary until emulators are linked by Meson
+LIBS := $(LIBS) @../block.syms @../qemu.syms
+ifneq ($(CONFIG_MODULES),y)
+LIBS := $(LIBS)
+endif
+
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
 obj-y += hw/sparc64/
diff --git a/meson.build b/meson.build
index ad93f89bc5..2155c111df 100644
--- a/meson.build
+++ b/meson.build
@@ -10,6 +10,7 @@ sh = find_program('sh')
 cc = meson.get_compiler('c')
 config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
 config_all_disas = keyval.load(meson.current_build_dir() / 
'config-all-disas.mak')
+enable_modules = 'CONFIG_MODULES' in config_host
 
 add_project_arguments(config_host['QEMU_CFLAGS'].split(),
   language: ['c', 'objc'])
@@ -312,6 +313,7 @@ genh += hxdep
 util_ss = ss.source_set()
 stub_ss = ss.source_set()
 trace_ss = ss.source_set()
+block_ss = ss.source_set()
 common_ss = ss.source_set()
 softmmu_ss = ss.source_set()
 user_ss = ss.source_set()
@@ -319,6 +321,7 @@ bsd_user_ss = ss.source_set()
 linux_user_ss = ss.source_set()
 specific_ss = ss.source_set()
 
+modules = {}
 hw_arch = {}
 target_arch = {}
 target_softmmu_arch = {}
@@ -428,6 +431,12 @@ subdir('crypto')
 subdir('storage-daemon')
 subdir('ui')
 
+
+if enable_modules
+  libmodulecommon = static_library('module-common', files('module-common.c') + 
genh, pic: true, c_args: '-DBUILD_DSO')
+  modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: 
'-DBUILD_DSO')
+endif
+
 # Build targets from sourcesets
 
 stub_ss = stub_ss.apply(config_all, strict: false)
@@ -444,6 +453,49 @@ subdir('io')
 subdir('fsdev')
 subdir('target')
 
+mods = []
+block_mods = []
+softmmu_mods = []
+foreach d, list : modules
+  foreach m : list
+if enable_modules and host_machine.system() != 'windows'
+  sl = static_library(d + '-' + m[0], m[1], dependencies: m[2], pic: true)
+  if d == 'block'
+block_mods += sl
+  else
+softmmu_mods += sl
+  endif
+  mods += {'dir': d, 'name': m[0], 'lib': sl, 'deps': m[2]}
+else
+  if d == 'block'
+block_ss.add(when: [m.get(3, []), m[2]], if_true: m[1])
+  else
+softmmu_ss.add(when: [m.get(3, []), m[2]], if_true: m[1])
+  endif
+endif
+  endforeach
+endforeach
+
+nm = find_program('nm')
+undefsym = find_program('scripts/undefsym.sh')
+block_syms = custom_target('block.syms', output: 'block.syms',
+ input: [libqemuutil, block_mods],
+ capture: true,
+ command: [undefsym, nm, '@INPUT@'])
+qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
+ input: [libqemuutil, softmmu_mods],
+ capture: true,
+ command: [undefsym, nm, '@INPUT@'])
+
+
+foreach m : mods
+  shared_module(m['dir'] + '-' + m['name'],
+name_prefix: '',
+link_whole: m['lib'],
+install: true,
+install_dir: config_host['qemu_moddir'])
+endforeach
+
 common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: softmmu_ss)
 common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
 
diff --git a/rules.mak b/rules.mak
index d8d35f735a..9da9dcd4f6 100644
--- a/rules.mak
+++ b/rules.mak
@@ -61,17 +61,

[PATCH 086/150] meson: convert hw/core

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 hw/Makefile.objs   |  1 -
 hw/core/Makefile.objs  | 34 -
 hw/core/meson.build| 49 ++
 hw/meson.build |  1 +
 tests/Makefile.include | 10 +
 5 files changed, 51 insertions(+), 44 deletions(-)
 delete mode 100644 hw/core/Makefile.objs
 create mode 100644 hw/core/meson.build

diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index d204a906af..bdf8bdf256 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -1,4 +1,3 @@
-devices-dirs-y = core/
 ifeq ($(CONFIG_SOFTMMU), y)
 devices-dirs-$(call lor,$(CONFIG_VIRTIO_9P),$(call 
land,$(CONFIG_VIRTFS),$(CONFIG_XEN))) += 9pfs/
 devices-dirs-y += acpi/
diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
deleted file mode 100644
index d8fee8effe..00
--- a/hw/core/Makefile.objs
+++ /dev/null
@@ -1,34 +0,0 @@
-# core qdev-related obj files, also used by *-user:
-common-obj-y += qdev.o qdev-properties.o
-common-obj-y += bus.o
-common-obj-y += cpu.o
-common-obj-y += resettable.o
-common-obj-y += hotplug.o
-common-obj-y += vmstate-if.o
-# irq.o needed for qdev GPIO handling:
-common-obj-y += irq.o
-common-obj-y += clock.o qdev-clock.o
-
-common-obj-$(CONFIG_SOFTMMU) += reset.o
-common-obj-$(CONFIG_SOFTMMU) += qdev-fw.o
-common-obj-$(CONFIG_SOFTMMU) += fw-path-provider.o
-common-obj-$(CONFIG_SOFTMMU) += nmi.o
-common-obj-$(CONFIG_SOFTMMU) += vm-change-state-handler.o
-common-obj-$(CONFIG_SOFTMMU) += qdev-properties-system.o
-common-obj-$(CONFIG_SOFTMMU) += sysbus.o
-common-obj-$(CONFIG_SOFTMMU) += machine.o
-common-obj-$(CONFIG_SOFTMMU) += null-machine.o
-common-obj-$(CONFIG_SOFTMMU) += loader.o
-common-obj-$(CONFIG_SOFTMMU) += machine-hmp-cmds.o
-common-obj-$(CONFIG_SOFTMMU) += numa.o
-common-obj-$(CONFIG_SOFTMMU) += clock-vmstate.o
-obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o
-
-common-obj-$(CONFIG_XILINX_AXI) += stream.o
-common-obj-$(CONFIG_PTIMER) += ptimer.o
-common-obj-$(CONFIG_FITLOADER) += loader-fit.o
-common-obj-$(CONFIG_REGISTER) += register.o
-common-obj-$(CONFIG_OR_IRQ) += or-irq.o
-common-obj-$(CONFIG_SPLIT_IRQ) += split-irq.o
-common-obj-$(CONFIG_PLATFORM_BUS) += platform-bus.o
-common-obj-$(CONFIG_GENERIC_LOADER) += generic-loader.o
diff --git a/hw/core/meson.build b/hw/core/meson.build
new file mode 100644
index 00..fc91f98075
--- /dev/null
+++ b/hw/core/meson.build
@@ -0,0 +1,49 @@
+# core qdev-related obj files, also used by *-user and unit tests
+hwcore_files = files(
+  'bus.c',
+  'fw-path-provider.c',
+  'hotplug.c',
+  'qdev-properties.c',
+  'qdev.c',
+  'reset.c',
+  'resettable.c',
+  'vmstate-if.c',
+  # irq.c needed for qdev GPIO handling:
+  'irq.c',
+  'clock.c',
+  'qdev-clock.c',
+)
+
+libhwcore = static_library('hwcore', sources: hwcore_files + genh,
+   name_suffix: 'fa',
+   build_by_default: false)
+hwcore = declare_dependency(link_whole: libhwcore)
+common_ss.add(hwcore)
+
+common_ss.add(files('cpu.c'))
+common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c'))
+common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true: 
files('generic-loader.c'))
+common_ss.add(when: 'CONFIG_OR_IRQ', if_true: files('or-irq.c'))
+common_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('platform-bus.c'))
+common_ss.add(when: 'CONFIG_PTIMER', if_true: files('ptimer.c'))
+common_ss.add(when: 'CONFIG_REGISTER', if_true: files('register.c'))
+common_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files('split-irq.c'))
+common_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c'))
+
+softmmu_ss.add(files(
+  'loader.c',
+  'machine-hmp-cmds.c',
+  'machine.c',
+  'nmi.c',
+  'null-machine.c',
+  'qdev-fw.c',
+  'qdev-properties-system.c',
+  'sysbus.c',
+  'vm-change-state-handler.c',
+  'clock-vmstate.c',
+))
+
+specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
+  'machine-qmp-cmds.c',
+  'numa.c',
+))
diff --git a/hw/meson.build b/hw/meson.build
index 08112a5e4b..fe7c466460 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -1 +1,2 @@
+subdir('core')
 subdir('xen')
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 425c8ce699..b6d96614cb 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -244,15 +244,7 @@ tests/test-bufferiszero$(EXESUF): 
tests/test-bufferiszero.o $(test-util-obj-y)
 tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
 tests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
 
-tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
-   hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
-   hw/core/bus.o \
-   hw/core/resettable.o \
-   hw/core/irq.o \
-   hw/core/fw-path-provider.o \
-   hw/core/reset.o \
-   hw/core/vmstate-if.o \
-   hw/core/clock.o hw/core/qdev-clock.o \
+tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-p

[PATCH 058/150] meson: convert crypto directory to Meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile |  1 -
 Makefile.objs|  2 +-
 Makefile.target  |  2 +-
 crypto/Makefile.objs | 37 ---
 crypto/meson.build   | 52 
 meson.build  |  4 ++--
 qom/meson.build  |  2 +-
 7 files changed, 57 insertions(+), 43 deletions(-)
 delete mode 100644 crypto/Makefile.objs

diff --git a/Makefile b/Makefile
index 2742f92706..897a320ffc 100644
--- a/Makefile
+++ b/Makefile
@@ -237,7 +237,6 @@ dummy := $(call unnest-vars,, \
 block-obj-m \
 storage-daemon-obj-y \
 storage-daemon-obj-m \
-crypto-obj-y \
 io-obj-y \
 common-obj-y \
 common-obj-m)
diff --git a/Makefile.objs b/Makefile.objs
index 0bc361d338..018338d2db 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -19,7 +19,7 @@ block-obj-$(CONFIG_REPLICATION) += replication.o
 
 block-obj-m = block/
 
-crypto-obj-y = crypto/
+crypto-obj-y = crypto/libcrypto.fa
 
 io-obj-y = io/
 
diff --git a/Makefile.target b/Makefile.target
index 79b6e02bed..b213955a81 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -193,12 +193,12 @@ common-obj-m :=
 include $(SRC_PATH)/Makefile.objs
 dummy := $(call fix-paths,../,, \
   authz-obj-y \
+  crypto-obj-y \
   qom-obj-y)
 dummy := $(call unnest-vars,.., \
block-obj-y \
block-obj-m \
chardev-obj-y \
-   crypto-obj-y \
io-obj-y \
common-obj-y \
common-obj-m)
diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs
deleted file mode 100644
index a9885919f2..00
--- a/crypto/Makefile.objs
+++ /dev/null
@@ -1,37 +0,0 @@
-crypto-obj-y = init.o
-crypto-obj-y += hash.o
-crypto-obj-$(CONFIG_NETTLE) += hash-nettle.o
-crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT)) += hash-gcrypt.o
-crypto-obj-$(if $(CONFIG_NETTLE),n,$(if $(CONFIG_GCRYPT),n,y)) += hash-glib.o
-crypto-obj-y += hmac.o
-crypto-obj-$(CONFIG_NETTLE) += hmac-nettle.o
-crypto-obj-$(CONFIG_GCRYPT_HMAC) += hmac-gcrypt.o
-crypto-obj-$(if $(CONFIG_NETTLE),n,$(if $(CONFIG_GCRYPT_HMAC),n,y)) += 
hmac-glib.o
-crypto-obj-y += aes.o
-crypto-obj-y += desrfb.o
-crypto-obj-y += cipher.o
-crypto-obj-$(CONFIG_AF_ALG) += afalg.o
-crypto-obj-$(CONFIG_AF_ALG) += cipher-afalg.o
-crypto-obj-$(CONFIG_AF_ALG) += hash-afalg.o
-crypto-obj-$(CONFIG_GNUTLS) += tls-cipher-suites.o
-crypto-obj-y += tlscreds.o
-crypto-obj-y += tlscredsanon.o
-crypto-obj-y += tlscredspsk.o
-crypto-obj-y += tlscredsx509.o
-crypto-obj-y += tlssession.o
-crypto-obj-y += secret_common.o
-crypto-obj-y += secret.o
-crypto-obj-$(CONFIG_SECRET_KEYRING) += secret_keyring.o
-crypto-obj-y += pbkdf.o
-crypto-obj-$(CONFIG_NETTLE) += pbkdf-nettle.o
-crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT)) += pbkdf-gcrypt.o
-crypto-obj-$(if $(CONFIG_NETTLE),n,$(if $(CONFIG_GCRYPT),n,y)) += pbkdf-stub.o
-crypto-obj-y += ivgen.o
-crypto-obj-y += ivgen-essiv.o
-crypto-obj-y += ivgen-plain.o
-crypto-obj-y += ivgen-plain64.o
-crypto-obj-y += afsplit.o
-crypto-obj-$(CONFIG_QEMU_PRIVATE_XTS) += xts.o
-crypto-obj-y += block.o
-crypto-obj-y += block-qcow.o
-crypto-obj-y += block-luks.o
diff --git a/crypto/meson.build b/crypto/meson.build
index 1b244315b9..7aab8db9f9 100644
--- a/crypto/meson.build
+++ b/crypto/meson.build
@@ -1,3 +1,55 @@
+crypto_ss = ss.source_set()
+crypto_ss.add(genh)
+crypto_ss.add(files(
+  'afsplit.c',
+  'block-luks.c',
+  'block-qcow.c',
+  'block.c',
+  'cipher.c',
+  'desrfb.c',
+  'hash.c',
+  'hmac.c',
+  'ivgen-essiv.c',
+  'ivgen-plain.c',
+  'ivgen-plain64.c',
+  'ivgen.c',
+  'pbkdf.c',
+  'secret_common.c',
+  'secret.c',
+  'tlscreds.c',
+  'tlscredsanon.c',
+  'tlscredspsk.c',
+  'tlscredsx509.c',
+  'tlssession.c',
+))
+
+if 'CONFIG_GCRYPT' in config_host
+  wo_nettle = files('hash-gcrypt.c', 'pbkdf-gcrypt.c')
+else
+  wo_nettle = files('hash-glib.c', 'pbkdf-stub.c')
+endif
+if 'CONFIG_GCRYPT_HMAC' not in config_host
+  wo_nettle += files('hmac-glib.c')
+endif
+crypto_ss.add(when: [nettle, 'CONFIG_NETTLE'],
+ if_true: files('hash-nettle.c', 'hmac-nettle.c', 
'pbkdf-nettle.c'),
+ if_false: wo_nettle)
+
+crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: 
files('secret_keyring.c'))
+crypto_ss.add(when: 'CONFIG_QEMU_PRIVATE_XTS', if_true: files('xts.c'))
+crypto_ss.add(when: 'CONFIG_GCRYPT_HMAC', if_true: files('hmac-gcrypt.c'))
+crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 
'cipher-afalg.c', 'hash-afalg.c'))
+crypto_ss.add(when: 'CONFIG_GNUTLS', if_true: files('tls-cipher-suites.c'))
+
+crypto_ss = crypto_ss.apply(config_host, strict: false)
+libcrypto = static_library('crypto', crypto_ss.sources(),
+   dependencies: [crypto_ss.dependencies()],
+   name_suffix: 'fa

[PATCH 068/150] meson: convert chardev directory to Meson (emulator part)

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs |  2 --
 Makefile.target   |  2 ++
 chardev/Makefile.objs | 10 --
 chardev/meson.build   | 11 +++
 configure |  2 ++
 meson.build   | 14 ++
 6 files changed, 29 insertions(+), 12 deletions(-)
 delete mode 100644 chardev/Makefile.objs

diff --git a/Makefile.objs b/Makefile.objs
index eeaa0cfa82..e43526fe5f 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -87,8 +87,6 @@ common-obj-y += dma-helpers.o
 common-obj-$(CONFIG_TPM) += tpm.o
 
 common-obj-y += backends/
-common-obj-y += chardev/
-common-obj-m += chardev/
 
 common-obj-$(CONFIG_SECCOMP) += qemu-seccomp.o
 qemu-seccomp.o-cflags := $(SECCOMP_CFLAGS)
diff --git a/Makefile.target b/Makefile.target
index c0575da132..c8c4b70162 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -104,6 +104,7 @@ all: $(PROGS) stap
@true
 
 obj-y += $(LIBQEMU)
+
 obj-y += trace/
 
 #
@@ -167,6 +168,7 @@ LIBS := $(LIBS) @../block.syms @../qemu.syms
 ifneq ($(CONFIG_MODULES),y)
 LIBS := $(LIBS)
 endif
+LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS)
 
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
diff --git a/chardev/Makefile.objs b/chardev/Makefile.objs
deleted file mode 100644
index 6662d0df41..00
--- a/chardev/Makefile.objs
+++ /dev/null
@@ -1,10 +0,0 @@
-chardev-obj-$(CONFIG_SOFTMMU) += chardev-sysemu.o
-common-obj-$(CONFIG_SOFTMMU) += msmouse.o wctablet.o testdev.o
-
-ifeq ($(CONFIG_BRLAPI),y)
-common-obj-m += baum.o
-baum.o-cflags := $(SDL_CFLAGS)
-baum.o-libs := $(BRLAPI_LIBS)
-endif
-
-common-obj-$(CONFIG_SPICE) += spice.o
diff --git a/chardev/meson.build b/chardev/meson.build
index a2e671ddfc..2122505599 100644
--- a/chardev/meson.build
+++ b/chardev/meson.build
@@ -30,3 +30,14 @@ libchardev = static_library('chardev', chardev_ss.sources(),
 build_by_default: false)
 
 chardev = declare_dependency(link_whole: libchardev)
+
+softmmu_ss.add(files('chardev-sysemu.c', 'msmouse.c', 'wctablet.c', 
'testdev.c'))
+softmmu_ss.add(when: ['CONFIG_SPICE', spice], if_true: files('spice.c'))
+
+chardev_modules = []
+
+if config_host.has_key('CONFIG_BRLAPI') and config_host.has_key('CONFIG_SDL')
+  chardev_modules += [['baum', files('baum.c'), [sdl, brlapi]]]
+endif
+
+modules += { 'chardev': chardev_modules }
diff --git a/configure b/configure
index 8a3c7aab4b..88f3fb861d 100755
--- a/configure
+++ b/configure
@@ -7344,6 +7344,8 @@ if test "$zlib" != "no" ; then
 fi
 if test "$spice" = "yes" ; then
   echo "CONFIG_SPICE=y" >> $config_host_mak
+  echo "SPICE_CFLAGS=$spice_cflags" >> $config_host_mak
+  echo "SPICE_LIBS=$spice_libs" >> $config_host_mak
 fi
 
 if test "$smartcard" = "yes" ; then
diff --git a/meson.build b/meson.build
index 8aff811b9b..3dd1443fa8 100644
--- a/meson.build
+++ b/meson.build
@@ -143,6 +143,11 @@ if 'CONFIG_XKBCOMMON' in config_host
   xkbcommon = declare_dependency(compile_args: 
config_host['XKBCOMMON_CFLAGS'].split(),
  link_args: 
config_host['XKBCOMMON_LIBS'].split())
 endif
+spice = not_found
+if 'CONFIG_SPICE' in config_host
+  spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
+ link_args: config_host['SPICE_LIBS'].split())
+endif
 rt = cc.find_library('rt', required: false)
 libmpathpersist = not_found
 if config_host.has_key('CONFIG_MPATH')
@@ -177,6 +182,15 @@ libudev = not_found
 if 'CONFIG_LIBUDEV' in config_host
   libudev = declare_dependency(link_args: config_host['LIBUDEV_LIBS'].split())
 endif
+brlapi = not_found
+if 'CONFIG_BRLAPI' in config_host
+  brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
+endif
+sdl = not_found
+if 'CONFIG_SDL' in config_host
+  sdl = declare_dependency(compile_args: config_host['SDL_CFLAGS'].split(),
+   link_args: config_host['SDL_LIBS'].split())
+endif
 rbd = not_found
 if 'CONFIG_RBD' in config_host
   rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
-- 
2.26.2





[PATCH 054/150] meson: convert tests/fp and check-softfloat

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 configure  |   2 +-
 tests/Makefile.include | 160 +--
 tests/fp/Makefile  | 600 --
 tests/fp/meson.build   | 636 +
 tests/meson.build  |   4 +
 5 files changed, 644 insertions(+), 758 deletions(-)
 delete mode 100644 tests/fp/Makefile
 create mode 100644 tests/fp/meson.build

diff --git a/configure b/configure
index c4f694066b..b1f3ea9040 100755
--- a/configure
+++ b/configure
@@ -8329,7 +8329,7 @@ DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw"
 DIRS="$DIRS roms/seabios"
 LINKS="Makefile"
 LINKS="$LINKS tests/tcg/lm32/Makefile po/Makefile"
-LINKS="$LINKS tests/tcg/Makefile.target tests/fp/Makefile"
+LINKS="$LINKS tests/tcg/Makefile.target"
 LINKS="$LINKS tests/plugin/Makefile"
 LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps"
 LINKS="$LINKS pc-bios/s390-ccw/Makefile"
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 8e953a24ee..b3f8fdd321 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -437,9 +437,6 @@ tests/test-bufferiszero$(EXESUF): tests/test-bufferiszero.o 
$(test-util-obj-y)
 tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
 tests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
 
-tests/fp/%:
-   $(MAKE) -C $(dir $@) $(notdir $@)
-
 tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
hw/core/bus.o \
@@ -675,157 +672,6 @@ check-report-unit.tap: $(check-unit-y)
 
 check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) 
check-report-unit.tap
 
-# FPU Emulation tests (aka softfloat)
-#
-# As we still have some places that need fixing the rules are a little
-# more complex than they need to be and have to override some of the
-# generic Makefile expansions. Once we are cleanly passing all
-# the tests we can simplify the make syntax.
-
-FP_TEST_BIN=$(BUILD_DIR)/tests/fp/fp-test
-
-# the build dir is created by configure
-$(FP_TEST_BIN): config-host.h $(test-util-obj-y)
-   $(call quiet-command, \
-   $(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" $(notdir $@), 
\
-"BUILD", "$(notdir $@)")
-
-# The full test suite can take a bit of time, default to a quick run
-# "-l 2 -r all" can take more than a day for some operations and is best
-# run manually
-FP_TL=-l 1 -r all
-
-# $1 = tests, $2 = description, $3 = test flags
-test-softfloat = $(call quiet-command, \
-   cd $(BUILD_DIR)/tests/fp && \
-   ./fp-test -s $(if $3,$3,$(FP_TL)) $1 > $2.out 2>&1 || \
-   (cat $2.out && exit 1;), \
-   "FLOAT TEST", $2)
-
-# Conversion Routines: Float to Float
-# FIXME: f32_to_f128 (broken), f64_to_f128 (broken)
-# FIXME: f128_to_f32(broken), f128_to_f64 (broken)
-# FIXME: f128_to_extF80 (broken)
-check-softfloat-conv-f2f: $(FP_TEST_BIN)
-   $(call test-softfloat, \
-   f16_to_f32 f16_to_f64 \
-   f16_to_extF80 f16_to_f128 \
-   f32_to_f16 f32_to_f64 \
-   f32_to_extF80 \
-   f64_to_f16 f64_to_f32 \
-   extF80_to_f16 extF80_to_f32 \
-   extF80_to_f64 extF80_to_f128 \
-   f128_to_f16, \
-   float-to-float)
-
-# Conversion Routines: Int and Uint to Float
-# FIXME: i32_to_extF80 (broken), i64_to_extF80 (broken)
-#ui32_to_f128 (not implemented)
-check-softfloat-conv-to-float: $(FP_TEST_BIN)
-   $(call test-softfloat, \
-   i32_to_f16 i64_to_f16 \
-   i32_to_f32 i64_to_f32 \
-   i32_to_f64 i64_to_f64 \
-   i32_to_f128 i64_to_f128, int-to-float)
-   $(call test-softfloat, \
-   ui32_to_f16 ui64_to_f16 \
-   ui32_to_f32 ui64_to_f32 \
-   ui32_to_f64 ui64_to_f64 \
-   ui32_to_extF80 ui64_to_extF80 \
-   ui64_to_f128, uint-to-float)
-
-# Conversion Routines: Float to integers
-# FIXME: extF80_roundToInt (broken)
-check-softfloat-conv-to-int: $(FP_TEST_BIN)
-   $(call test-softfloat, \
-   f16_to_i32 f16_to_i32_r_minMag \
-   f32_to_i32 f32_to_i32_r_minMag \
-   f64_to_i32 f64_to_i32_r_minMag \
-   extF80_to_i32 extF80_to_i32_r_minMag \
-   f128_to_i32 f128_to_i32_r_minMag \
-   f16_to_i64 f16_to_i64_r_minMag \
-   f32_to_i64 f32_to_i64_r_minMag \
-   f64_to_i64 f64_to_i64_r_minMag \
-   extF80_to_i64 extF80_to_i64_r_minMag \
-   f128_to_i64 f128_to_i64_r_minMag, \
-   float-to-int)
-   $(call test-softfloat, \
-   f16_to_ui32 f16_to_ui32_r_minMag \
-   f32_to_ui32 f32_to_ui32_r_minMag \
-   f64_to_ui32 f64_to_ui32_r_minMag \
-   extF80_to_ui32 extF80_to_ui32

[PATCH 061/150] meson: infrastructure for building emulators

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile   |  74 ++
 Makefile.target|  19 +++--
 configure  |   6 --
 hw/i386/fw_cfg.c   |   2 +-
 hw/i386/pc.c   |   2 +-
 hw/i386/pc_piix.c  |   2 +-
 hw/i386/x86.c  |   2 +-
 hw/vfio/pci-quirks.c   |   2 +-
 hw/virtio/virtio-mem.c |   2 +-
 include/qemu/osdep.h   |   2 +-
 meson.build| 166 -
 rules.mak  |   8 --
 scripts/create_config  |   2 +
 scripts/grepy.sh   |   3 +
 scripts/minikconf.py   |   0
 softmmu/qtest.c|   2 +-
 util/meson.build   |   5 +-
 17 files changed, 193 insertions(+), 106 deletions(-)
 create mode 100755 scripts/grepy.sh
 mode change 100755 => 100644 scripts/minikconf.py

diff --git a/Makefile b/Makefile
index 420f2661eb..538537f711 100644
--- a/Makefile
+++ b/Makefile
@@ -112,8 +112,6 @@ include $(SRC_PATH)/rules.mak
 # lor is defined in rules.mak
 CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
 
-generated-files-y = config-host.h
-
 generated-files-y += module_block.h
 generated-files-y += target/s390x/gen-features.h
 target/s390x/gen-features.h: Makefile.ninja
@@ -169,65 +167,6 @@ DOCS=
 endif
 
 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) 
BUILD_DIR=$(BUILD_DIR)
-SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, 
$(TARGET_DIRS)))
-SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))
-
-ifeq ($(SUBDIR_DEVICES_MAK),)
-config-all-devices.mak: config-host.mak
-   $(call quiet-command,echo '# no devices' > $@,"GEN","$@")
-else
-config-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak
-   $(call quiet-command, sed -n \
- 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
- $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
- "GEN","$@")
-endif
-
--include $(SUBDIR_DEVICES_MAK_DEP)
-
-# This has to be kept in sync with Kconfig.host.
-MINIKCONF_ARGS = \
-$(CONFIG_MINIKCONF_MODE) \
-$@ $*/config-devices.mak.d $< $(SRC_PATH)/Kconfig \
-CONFIG_TCG=$(CONFIG_TCG) \
-CONFIG_KVM=$(CONFIG_KVM) \
-CONFIG_SPICE=$(CONFIG_SPICE) \
-CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
-CONFIG_TPM=$(CONFIG_TPM) \
-CONFIG_XEN=$(CONFIG_XEN) \
-CONFIG_OPENGL=$(CONFIG_OPENGL) \
-CONFIG_X11=$(CONFIG_X11) \
-CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
-CONFIG_VHOST_KERNEL=$(CONFIG_VHOST_KERNEL) \
-CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
-CONFIG_LINUX=$(CONFIG_LINUX) \
-CONFIG_PVRDMA=$(CONFIG_PVRDMA)
-
-MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py
-
-$(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak 
$(SRC_PATH)/Kconfig $(BUILD_DIR)/config-host.mak
-   $(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) \
-   > $@.tmp, "GEN", "$@.tmp")
-   $(call quiet-command, if test -f $@; then \
- if cmp -s $@.old $@; then \
-   mv $@.tmp $@; \
-   cp -p $@ $@.old; \
- else \
-   if test -f $@.old; then \
- echo "WARNING: $@ (user modified) out of date.";\
-   else \
- echo "WARNING: $@ out of date.";\
-   fi; \
-   echo "Run \"$(MAKE) defconfig\" to regenerate."; \
-   rm $@.tmp; \
- fi; \
-else \
- mv $@.tmp $@; \
- cp -p $@ $@.old; \
-fi,"GEN","$@");
-
-defconfig:
-   rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
 
 ifneq ($(wildcard config-host.mak),)
 include $(SRC_PATH)/Makefile.objs
@@ -270,10 +209,15 @@ $(SOFTMMU_FUZZ_RULES): $(io-obj-y)
 $(SOFTMMU_FUZZ_RULES): config-all-devices.mak
 $(SOFTMMU_FUZZ_RULES): $(edk2-decompressed)
 
+# meson: this is sub-optimal but going away after conversion
+TARGET_DEPS = $(patsubst %,%-config-target.h, $(TARGET_DIRS))
+TARGET_DEPS += $(patsubst %,%-config-devices.h, $(filter 
%-softmmu,$(TARGET_DIRS)))
+TARGET_DEPS += $(patsubst %,libqemu-%.fa, $(TARGET_DIRS))
+
 .PHONY: $(TARGET_DIRS_RULES)
 # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
 # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
-$(TARGET_DIRS_RULES):
+$(TARGET_DIRS_RULES): $(TARGET_DEPS)
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" 
TARGET_DIR="$(dir $@)" $(notdir $@),)
 
 # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
@@ -361,7 +305,6 @@ clean: recurse-clean ninja-clean clean-ctlist
-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
 # avoid old build problems by removing potentially incorrect old files
rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h 
gen-op-arm.h
-   rm -f qemu-options.def
find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name 
'*.[oda]' \) -type f \
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
! -path ./roms/edk2/ArmPkg/Library/GccL

[PATCH 072/150] meson: convert root directory to Meson

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs   | 21 ++---
 Makefile.target |  2 +-
 configure   |  2 ++
 meson.build | 33 +
 4 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/Makefile.objs b/Makefile.objs
index 72e935023d..ec15ebc4b4 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -48,16 +48,9 @@ storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
 # single QEMU executable should support all CPUs and machines.
 
 ifeq ($(CONFIG_SOFTMMU),y)
-common-obj-y = blockdev.o blockdev-nbd.o
-common-obj-y += bootdevice.o iothread.o
-common-obj-y += dump/
-common-obj-y += job-qmp.o
+common-obj-y = dump/
 common-obj-y += monitor/
 common-obj-y += net/
-common-obj-y += qdev-monitor.o
-common-obj-$(CONFIG_WIN32) += os-win32.o
-common-obj-$(CONFIG_POSIX) += os-posix.o
-
 common-obj-$(CONFIG_LINUX) += fsdev/
 
 common-obj-y += accel/
@@ -87,25 +80,15 @@ common-obj-y += hw/
 common-obj-m += hw/
 
 common-obj-y += replay/
-
-common-obj-y += dma-helpers.o
-common-obj-$(CONFIG_TPM) += tpm.o
-
 common-obj-y += backends/
 
-common-obj-$(CONFIG_SECCOMP) += qemu-seccomp.o
-qemu-seccomp.o-cflags := $(SECCOMP_CFLAGS)
-qemu-seccomp.o-libs := $(SECCOMP_LIBS)
-
-common-obj-$(CONFIG_FDT) += device_tree.o
-
 common-obj-y += qapi/
 
 endif # CONFIG_SOFTMMU
 
 ###
 # Target-independent parts used in system and user emulation
-common-obj-y += cpus-common.o
+
 common-obj-y += hw/
 common-obj-y += qom/
 common-obj-y += disas/
diff --git a/Makefile.target b/Makefile.target
index 16f1e781e9..5f926e5bfa 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -169,7 +169,7 @@ ifneq ($(CONFIG_MODULES),y)
 LIBS := $(LIBS) $(ALSA_LIBS) $(OSS_LIBS) $(PULSE_LIBS) $(SDL_LIBS)
 LIBS := $(LIBS) $(GTK_LIBS) $(VTE_LIBS) $(X11_LIBS) $(CURSES_LIBS) 
$(ICONV_LIBS) $(GIO_LIBS)
 endif
-LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS) $(OPENGL_LIBS)
+LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS) $(OPENGL_LIBS) 
$(SECCOMP_LIBS)
 LIBS := $(LIBS) $(COREAUDIO_LIBS) $(DSOUND_LIBS)
 
 # Hardware support
diff --git a/configure b/configure
index 26d2479b80..454a244141 100755
--- a/configure
+++ b/configure
@@ -7331,6 +7331,8 @@ if test "$preadv" = "yes" ; then
 fi
 if test "$fdt" != "no" ; then
   echo "CONFIG_FDT=y" >> $config_host_mak
+  echo "FDT_CFLAGS=$fdt_cflags" >> $config_host_mak
+  echo "FDT_LIBS=$fdt_ldflags $fdt_libs" >> $config_host_mak
 fi
 if test "$membarrier" = "yes" ; then
   echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
diff --git a/meson.build b/meson.build
index db5a000a23..7dba00a1dc 100644
--- a/meson.build
+++ b/meson.build
@@ -47,6 +47,7 @@ targetos = host_machine.system()
 
 m = cc.find_library('m', required: false)
 util = cc.find_library('util', required: false)
+winmm = []
 socket = []
 version_res = []
 coref = []
@@ -55,6 +56,7 @@ cocoa = []
 hvf = []
 if host_machine.system() == 'windows'
   socket = cc.find_library('ws2_32')
+  winmm = cc.find_library('winmm')
 
   win = import('windows')
   version_res = win.compile_resources('version.rc',
@@ -289,6 +291,11 @@ if 'CONFIG_VNC_SASL' in config_host
   sasl = declare_dependency(compile_args: config_host['SASL_CFLAGS'].split(),
 link_args: config_host['SASL_LIBS'].split())
 endif
+fdt = not_found
+if 'CONFIG_FDT' in config_host
+  fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
+   link_args: config_host['FDT_LIBS'].split())
+endif
 
 create_config = find_program('scripts/create_config')
 minikconf = find_program('scripts/minikconf.py')
@@ -455,6 +462,7 @@ util_ss = ss.source_set()
 stub_ss = ss.source_set()
 trace_ss = ss.source_set()
 block_ss = ss.source_set()
+blockdev_ss = ss.source_set()
 common_ss = ss.source_set()
 softmmu_ss = ss.source_set()
 user_ss = ss.source_set()
@@ -608,6 +616,31 @@ subdir('nbd')
 subdir('scsi')
 subdir('block')
 
+blockdev_ss.add(files(
+  'blockdev.c',
+  'blockdev-nbd.c',
+  'iothread.c',
+  'job-qmp.c',
+), sdl)
+
+# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
+# os-win32.c does not
+blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
+softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
+
+softmmu_ss.add_all(blockdev_ss)
+softmmu_ss.add(files(
+  'bootdevice.c',
+  'dma-helpers.c',
+  'qdev-monitor.c',
+), sdl)
+
+softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
+softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), 
seccomp])
+softmmu_ss.add(when: ['CONFIG_FDT', fdt],  if_true: [files('device_tree.c')])
+
+common_ss.add(files('cpus-common.c'))
+
 # needed for fuzzing binaries
 subdir('tests/qtest/libqos')
 
-- 
2.26.2





[PATCH 090/150] meson: convert hw/mem

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 hw/Makefile.objs | 1 -
 hw/mem/Kconfig   | 1 +
 hw/mem/Makefile.objs | 3 ---
 hw/mem/meson.build   | 6 ++
 hw/meson.build   | 1 +
 5 files changed, 8 insertions(+), 4 deletions(-)
 delete mode 100644 hw/mem/Makefile.objs
 create mode 100644 hw/mem/meson.build

diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 73c49ddd3b..df72b25a64 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -34,7 +34,6 @@ devices-dirs-y += usb/
 devices-dirs-$(CONFIG_VFIO) += vfio/
 devices-dirs-y += virtio/
 devices-dirs-y += watchdog/
-devices-dirs-$(CONFIG_MEM_DEVICE) += mem/
 endif
 
 common-obj-y += $(devices-dirs-y)
diff --git a/hw/mem/Kconfig b/hw/mem/Kconfig
index c27844900d..a0ef2cf648 100644
--- a/hw/mem/Kconfig
+++ b/hw/mem/Kconfig
@@ -9,3 +9,4 @@ config NVDIMM
 bool
 default y
 depends on (PC || PSERIES || ARM_VIRT)
+select MEM_DEVICE
diff --git a/hw/mem/Makefile.objs b/hw/mem/Makefile.objs
deleted file mode 100644
index 56345befd0..00
--- a/hw/mem/Makefile.objs
+++ /dev/null
@@ -1,3 +0,0 @@
-common-obj-$(CONFIG_DIMM) += pc-dimm.o
-common-obj-y += memory-device.o
-common-obj-$(CONFIG_NVDIMM) += nvdimm.o
diff --git a/hw/mem/meson.build b/hw/mem/meson.build
new file mode 100644
index 00..ba424622bb
--- /dev/null
+++ b/hw/mem/meson.build
@@ -0,0 +1,6 @@
+mem_ss = ss.source_set()
+mem_ss.add(files('memory-device.c'))
+mem_ss.add(when: 'CONFIG_DIMM', if_true: files('pc-dimm.c'))
+mem_ss.add(when: 'CONFIG_NVDIMM', if_true: files('nvdimm.c'))
+
+softmmu_ss.add_all(when: 'CONFIG_MEM_DEVICE', if_true: mem_ss)
diff --git a/hw/meson.build b/hw/meson.build
index dccc2d19a6..542d675618 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -1,4 +1,5 @@
 subdir('core')
+subdir('mem')
 subdir('nubus')
 subdir('semihosting')
 subdir('smbios')
-- 
2.26.2





[PATCH 094/150] meson: convert hw/usb

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.target  |  1 +
 hw/Makefile.objs |  1 -
 hw/meson.build   |  1 +
 hw/usb/Makefile.objs | 71 
 hw/usb/meson.build   | 69 ++
 meson.build  | 15 ++
 6 files changed, 86 insertions(+), 72 deletions(-)
 delete mode 100644 hw/usb/Makefile.objs
 create mode 100644 hw/usb/meson.build

diff --git a/Makefile.target b/Makefile.target
index 386378b9c8..3d5a2af4af 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -168,6 +168,7 @@ endif
 LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS) $(OPENGL_LIBS) 
$(SECCOMP_LIBS)
 LIBS := $(LIBS) $(COREAUDIO_LIBS) $(DSOUND_LIBS)
 LIBS := $(LIBS) $(VDE_LIBS) $(SLIRP_LIBS)
+LIBS := $(LIBS) $(LIBUSB_LIBS) $(SMARTCARD_LIBS) $(USB_REDIR_LIBS)
 
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index f6e08f6660..c2619bbb50 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -30,7 +30,6 @@ devices-dirs-y += sd/
 devices-dirs-y += ssi/
 devices-dirs-y += timer/
 devices-dirs-$(CONFIG_TPM) += tpm/
-devices-dirs-y += usb/
 endif
 
 common-obj-y += $(devices-dirs-y)
diff --git a/hw/meson.build b/hw/meson.build
index 4dafc8a08e..89bd6adb70 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -3,6 +3,7 @@ subdir('mem')
 subdir('nubus')
 subdir('semihosting')
 subdir('smbios')
+subdir('usb')
 subdir('vfio')
 subdir('virtio')
 subdir('watchdog')
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
deleted file mode 100644
index e342ff59fa..00
--- a/hw/usb/Makefile.objs
+++ /dev/null
@@ -1,71 +0,0 @@
-# usb subsystem core
-common-obj-y += core.o combined-packet.o bus.o libhw.o
-common-obj-$(CONFIG_USB) += desc.o desc-msos.o
-
-# usb host adapters
-common-obj-$(CONFIG_USB_UHCI) += hcd-uhci.o
-common-obj-$(CONFIG_USB_OHCI) += hcd-ohci.o
-common-obj-$(CONFIG_USB_OHCI_PCI) += hcd-ohci-pci.o
-common-obj-$(CONFIG_USB_EHCI) += hcd-ehci.o
-common-obj-$(CONFIG_USB_EHCI_PCI) += hcd-ehci-pci.o
-common-obj-$(CONFIG_USB_EHCI_SYSBUS) += hcd-ehci-sysbus.o
-common-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o
-common-obj-$(CONFIG_USB_XHCI_NEC) += hcd-xhci-nec.o
-common-obj-$(CONFIG_USB_MUSB) += hcd-musb.o
-common-obj-$(CONFIG_USB_DWC2) += hcd-dwc2.o
-
-common-obj-$(CONFIG_TUSB6010) += tusb6010.o
-common-obj-$(CONFIG_IMX)  += chipidea.o
-
-# emulated usb devices
-common-obj-$(CONFIG_USB) += dev-hub.o
-common-obj-$(CONFIG_USB) += dev-hid.o
-common-obj-$(CONFIG_USB_TABLET_WACOM) += dev-wacom.o
-common-obj-$(CONFIG_USB_STORAGE_BOT)  += dev-storage.o
-common-obj-$(CONFIG_USB_STORAGE_UAS)  += dev-uas.o
-common-obj-$(CONFIG_USB_AUDIO)+= dev-audio.o
-common-obj-$(CONFIG_USB_SERIAL)   += dev-serial.o
-common-obj-$(CONFIG_USB_NETWORK)  += dev-network.o
-
-ifeq ($(CONFIG_USB_SMARTCARD),y)
-common-obj-y  += dev-smartcard-reader.o
-ifeq ($(CONFIG_SMARTCARD),y)
-common-obj-m  += smartcard.mo
-smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
-smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
-smartcard.mo-libs := $(SMARTCARD_LIBS)
-endif
-endif
-
-ifeq ($(CONFIG_POSIX),y)
-common-obj-$(CONFIG_USB_STORAGE_MTP)  += dev-mtp.o
-endif
-
-# usb redirection
-ifeq ($(CONFIG_USB),y)
-ifeq ($(CONFIG_USB_REDIR),y)
-common-obj-m += redirect.mo
-redirect.mo-objs = redirect.o quirks.o
-redirect.mo-cflags = $(USB_REDIR_CFLAGS)
-redirect.mo-libs = $(USB_REDIR_LIBS)
-endif
-endif
-
-# usb pass-through
-ifeq ($(CONFIG_USB_LIBUSB)$(CONFIG_USB),yy)
-common-obj-y += host-libusb.o
-else
-common-obj-y += host-stub.o
-endif
-common-obj-$(CONFIG_ALL) += host-stub.o
-
-host-libusb.o-cflags := $(LIBUSB_CFLAGS)
-host-libusb.o-libs := $(LIBUSB_LIBS)
-
-ifeq ($(CONFIG_USB_LIBUSB),y)
-common-obj-$(CONFIG_XEN) += xen-usb.o
-xen-usb.o-cflags := $(LIBUSB_CFLAGS)
-xen-usb.o-libs := $(LIBUSB_LIBS)
-endif
-
-common-obj-$(CONFIG_IMX_USBPHY) += imx-usb-phy.o
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
new file mode 100644
index 00..f40d158ab5
--- /dev/null
+++ b/hw/usb/meson.build
@@ -0,0 +1,69 @@
+hw_usb_modules = []
+
+# usb subsystem core
+softmmu_ss.add(files(
+  'bus.c',
+  'combined-packet.c',
+  'core.c',
+  'libhw.c'
+))
+
+softmmu_ss.add(when: 'CONFIG_USB', if_true: files(
+  'desc.c',
+  'desc-msos.c',
+))
+
+# usb host adapters
+softmmu_ss.add(when: 'CONFIG_USB_UHCI', if_true: files('hcd-uhci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_OHCI', if_true: files('hcd-ohci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_OHCI_PCI', if_true: files('hcd-ohci-pci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_EHCI', if_true: files('hcd-ehci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_EHCI_PCI', if_true: files('hcd-ehci-pci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_EHCI_SYSBUS', if_true: files('hcd-ehci.c', 
'hcd-ehci-sysbus.c'))
+softmmu_ss.add(when: 'CONFIG_USB_XHCI', if_true: files('hcd-xhci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_XHCI_NEC', if_true:

[PATCH 059/150] meson: convert io directory to Meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile |  1 -
 Makefile.objs|  2 +-
 Makefile.target  |  2 +-
 io/Makefile.objs | 12 
 io/meson.build   | 25 +
 meson.build  |  1 +
 6 files changed, 28 insertions(+), 15 deletions(-)
 delete mode 100644 io/Makefile.objs
 create mode 100644 io/meson.build

diff --git a/Makefile b/Makefile
index 897a320ffc..b0cae10ce0 100644
--- a/Makefile
+++ b/Makefile
@@ -237,7 +237,6 @@ dummy := $(call unnest-vars,, \
 block-obj-m \
 storage-daemon-obj-y \
 storage-daemon-obj-m \
-io-obj-y \
 common-obj-y \
 common-obj-m)
 
diff --git a/Makefile.objs b/Makefile.objs
index 018338d2db..0920cdb40c 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -21,7 +21,7 @@ block-obj-m = block/
 
 crypto-obj-y = crypto/libcrypto.fa
 
-io-obj-y = io/
+io-obj-y = io/libio.fa
 
 endif # CONFIG_SOFTMMU or CONFIG_TOOLS
 
diff --git a/Makefile.target b/Makefile.target
index b213955a81..f6b7a86390 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -194,12 +194,12 @@ include $(SRC_PATH)/Makefile.objs
 dummy := $(call fix-paths,../,, \
   authz-obj-y \
   crypto-obj-y \
+  io-obj-y \
   qom-obj-y)
 dummy := $(call unnest-vars,.., \
block-obj-y \
block-obj-m \
chardev-obj-y \
-   io-obj-y \
common-obj-y \
common-obj-m)
 all-obj-y += $(common-obj-y)
diff --git a/io/Makefile.objs b/io/Makefile.objs
deleted file mode 100644
index 9a20fce4ed..00
--- a/io/Makefile.objs
+++ /dev/null
@@ -1,12 +0,0 @@
-io-obj-y = channel.o
-io-obj-y += channel-buffer.o
-io-obj-y += channel-command.o
-io-obj-y += channel-file.o
-io-obj-y += channel-socket.o
-io-obj-y += channel-tls.o
-io-obj-y += channel-watch.o
-io-obj-y += channel-websock.o
-io-obj-y += channel-util.o
-io-obj-y += dns-resolver.o
-io-obj-y += net-listener.o
-io-obj-y += task.o
diff --git a/io/meson.build b/io/meson.build
new file mode 100644
index 00..062e011bf0
--- /dev/null
+++ b/io/meson.build
@@ -0,0 +1,25 @@
+io_ss = ss.source_set()
+io_ss.add(genh)
+io_ss.add(files(
+  'channel-buffer.c',
+  'channel-command.c',
+  'channel-file.c',
+  'channel-socket.c',
+  'channel-tls.c',
+  'channel-util.c',
+  'channel-watch.c',
+  'channel-websock.c',
+  'channel.c',
+  'dns-resolver.c',
+  'net-listener.c',
+  'task.c',
+))
+
+io_ss = io_ss.apply(config_host, strict: false)
+libio = static_library('io', io_ss.sources(),
+   dependencies: [io_ss.dependencies()],
+   link_with: libqemuutil,
+   name_suffix: 'fa',
+   build_by_default: false)
+
+io = declare_dependency(link_whole: libio, dependencies: [crypto, qom])
diff --git a/meson.build b/meson.build
index c5e98e43d8..1f3688f67f 100644
--- a/meson.build
+++ b/meson.build
@@ -342,6 +342,7 @@ libqemuutil = static_library('qemuutil',
 qemuutil = declare_dependency(link_with: libqemuutil,
   sources: genh + version_res)
 
+subdir('io')
 subdir('fsdev')
 
 # Other build targets
-- 
2.26.2





[PATCH 076/150] meson: convert common QMP bits for qemu and qemu-storage-daemon

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs |  8 +---
 Makefile.target   |  1 -
 meson.build   | 10 ++
 monitor/Makefile.objs |  6 --
 monitor/meson.build   |  9 +
 qom/Makefile.objs |  2 --
 qom/meson.build   |  3 +++
 7 files changed, 27 insertions(+), 12 deletions(-)
 delete mode 100644 monitor/Makefile.objs
 create mode 100644 monitor/meson.build
 delete mode 100644 qom/Makefile.objs

diff --git a/Makefile.objs b/Makefile.objs
index 6657a6cce3..d7826c1e5c 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -37,10 +37,11 @@ endif # CONFIG_SOFTMMU or CONFIG_TOOLS
 # storage-daemon-obj-y is code used by qemu-storage-daemon (these objects are
 # used for system emulation, too, but specified separately there)
 
-storage-daemon-obj-y = block/ monitor/ qapi/ qom/ storage-daemon/
+storage-daemon-obj-y = block/ qapi/ qom/ storage-daemon/
 storage-daemon-obj-y += blockdev.o blockdev-nbd.o iothread.o job-qmp.o
 storage-daemon-obj-$(CONFIG_WIN32) += os-win32.o
 storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
+storage-daemon-obj-y += libqmp.fa
 
 ##
 # Target independent part of system emulation. The long term path is to
@@ -48,8 +49,7 @@ storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
 # single QEMU executable should support all CPUs and machines.
 
 ifeq ($(CONFIG_SOFTMMU),y)
-common-obj-y = monitor/
-common-obj-y += net/
+common-obj-y = net/
 common-obj-$(CONFIG_LINUX) += fsdev/
 
 common-obj-y += accel/
@@ -83,6 +83,8 @@ common-obj-y += backends/
 
 common-obj-y += qapi/
 
+common-obj-y += libqmp.fa
+
 endif # CONFIG_SOFTMMU
 
 ###
diff --git a/Makefile.target b/Makefile.target
index c8f7a6c04b..54a9ef1330 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -157,7 +157,6 @@ ifdef CONFIG_SOFTMMU
 obj-y += softmmu/
 obj-y += gdbstub.o
 obj-y += hw/
-obj-y += monitor/
 obj-y += qapi/
 obj-y += migration/ram.o
 LIBS := $(libs_softmmu) $(LIBS)
diff --git a/meson.build b/meson.build
index 648febf65b..602a6fa206 100644
--- a/meson.build
+++ b/meson.build
@@ -471,6 +471,7 @@ stub_ss = ss.source_set()
 trace_ss = ss.source_set()
 block_ss = ss.source_set()
 blockdev_ss = ss.source_set()
+qmp_ss = ss.source_set()
 common_ss = ss.source_set()
 softmmu_ss = ss.source_set()
 user_ss = ss.source_set()
@@ -651,6 +652,7 @@ softmmu_ss.add(when: ['CONFIG_FDT', fdt],  if_true: 
[files('device_tree.c')])
 common_ss.add(files('cpus-common.c'))
 
 subdir('softmmu')
+subdir('monitor')
 
 # needed for fuzzing binaries
 subdir('tests/qtest/libqos')
@@ -700,6 +702,14 @@ block = declare_dependency(link_whole: [libblock],
link_args: '@block.syms',
dependencies: [crypto, io])
 
+qmp_ss = qmp_ss.apply(config_host, strict: false)
+libqmp = static_library('qmp', qmp_ss.sources(),
+dependencies: qmp_ss.dependencies(),
+name_suffix: 'fa',
+build_by_default: false)
+
+qmp = declare_dependency(link_whole: [libqmp])
+
 foreach m : mods
   shared_module(m['dir'] + '-' + m['name'],
 name_prefix: '',
diff --git a/monitor/Makefile.objs b/monitor/Makefile.objs
deleted file mode 100644
index a8533c9dd7..00
--- a/monitor/Makefile.objs
+++ /dev/null
@@ -1,6 +0,0 @@
-obj-y += misc.o
-common-obj-y += monitor.o qmp.o hmp.o
-common-obj-y += qmp-cmds.o qmp-cmds-control.o
-common-obj-y += hmp-cmds.o
-
-storage-daemon-obj-y += monitor.o qmp.o qmp-cmds-control.o
diff --git a/monitor/meson.build b/monitor/meson.build
new file mode 100644
index 00..0484a64341
--- /dev/null
+++ b/monitor/meson.build
@@ -0,0 +1,9 @@
+qmp_ss.add(files('monitor.c', 'qmp.c', 'qmp-cmds-control.c'))
+
+softmmu_ss.add(files(
+  'hmp-cmds.c',
+  'hmp.c',
+  'qmp-cmds.c',
+))
+
+specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files('misc.c'))
diff --git a/qom/Makefile.objs b/qom/Makefile.objs
deleted file mode 100644
index b9629045e6..00
--- a/qom/Makefile.objs
+++ /dev/null
@@ -1,2 +0,0 @@
-common-obj-$(CONFIG_SOFTMMU) += qom-hmp-cmds.o qom-qmp-cmds.o
-storage-daemon-obj-y += qom-qmp-cmds.o
diff --git a/qom/meson.build b/qom/meson.build
index 4af044d858..35815f6c04 100644
--- a/qom/meson.build
+++ b/qom/meson.build
@@ -7,6 +7,9 @@ qom_ss.add(files(
   'qom-qobject.c',
 ))
 
+qmp_ss.add(files('qom-qmp-cmds.c'))
+softmmu_ss.add(files('qom-hmp-cmds.c'))
+
 qom_ss = qom_ss.apply(config_host, strict: false)
 libqom = static_library('qom', qom_ss.sources(),
 dependencies: [qom_ss.dependencies()],
-- 
2.26.2





[PATCH 067/150] configure, Makefile; remove TOOLS and HELPERS-y variable

2020-08-14 Thread Paolo Bonzini
Everything involving tools is now done by meson.

Signed-off-by: Paolo Bonzini 
---
 Makefile  | 22 ++
 configure |  7 ---
 2 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/Makefile b/Makefile
index 414c631aee..4ce2f4b2de 100644
--- a/Makefile
+++ b/Makefile
@@ -129,8 +129,6 @@ $(call set-vpath, $(SRC_PATH))
 
 LIBS+=-lz $(LIBS_TOOLS)
 
-HELPERS-y =
-
 # Sphinx does not allow building manuals into the same directory as
 # the source files, so if we're doing an in-tree QEMU build we must
 # build the manuals into a subdirectory (and then install them from
@@ -179,7 +177,7 @@ dummy := $(call unnest-vars,, \
 
 include $(SRC_PATH)/tests/Makefile.include
 
-all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all 
modules
+all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) recurse-all modules
 
 config-host.h: config-host.h-timestamp
 config-host.h-timestamp: config-host.mak
@@ -291,7 +289,7 @@ clean: recurse-clean ninja-clean clean-ctlist
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll 
\
-exec rm {} +
-   rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ 
*/*~
+   rm -f TAGS cscope.* *.pod *~ */*~
rm -f fsdev/*.pod scsi/*.pod
rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
 
@@ -443,12 +441,6 @@ export DESTDIR
 install: all $(if $(BUILD_DOCS),install-doc) \
install-datadir install-localstatedir install-includedir \
recurse-install
-ifneq ($(TOOLS),)
-   $(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
-endif
-ifneq ($(HELPERS-y),)
-   $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
-endif
 ifdef CONFIG_TRACE_SYSTEMTAP
$(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
 endif
@@ -708,16 +700,6 @@ endif
$(call print-help-run,$(t)/fuzz,Build fuzzer 
for $(t)); \
))) \
echo '')
-   @$(if $(HELPERS-y), \
-   echo 'Helper targets:'; \
-   $(foreach t, $(HELPERS-y), \
-   $(call print-help-run,$(t),Build $(shell basename $(t)));) \
-   echo '')
-   @$(if $(TOOLS), \
-   echo 'Tools targets:'; \
-   $(foreach t, $(TOOLS), \
-   $(call print-help-run,$(t),Build $(shell basename $(t)) tool);) 
\
-   echo '')
@echo  'Cleaning targets:'
$(call print-help,clean,Remove most generated files but keep the config)
$(call print-help,distclean,Remove all generated files)
diff --git a/configure b/configure
index 1dd0c693f3..8a3c7aab4b 100755
--- a/configure
+++ b/configure
@@ -6667,12 +6667,6 @@ if [ "$eventfd" = "yes" ]; then
   ivshmem=yes
 fi
 
-tools=""
-if test "$want_tools" = "yes" ; then
-  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
-tools="qemu-storage-daemon\$(EXESUF) $tools"
-  fi
-fi
 if test "$softmmu" = yes ; then
   if test "$linux" = yes; then
 if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; 
then
@@ -7768,7 +7762,6 @@ else
   QEMU_INCLUDES="-iquote ${source_path}/tcg/${ARCH} $QEMU_INCLUDES"
 fi
 
-echo "TOOLS=$tools" >> $config_host_mak
 echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
 echo "INSTALL=$install" >> $config_host_mak
-- 
2.26.2





[PATCH 066/150] meson: qemu-pr-helper

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile|  7 +--
 configure   |  3 ---
 meson.build | 10 ++
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index e67fe52ed3..414c631aee 100644
--- a/Makefile
+++ b/Makefile
@@ -129,7 +129,7 @@ $(call set-vpath, $(SRC_PATH))
 
 LIBS+=-lz $(LIBS_TOOLS)
 
-HELPERS-y = $(HELPERS)
+HELPERS-y =
 
 # Sphinx does not allow building manuals into the same directory as
 # the source files, so if we're doing an in-tree QEMU build we must
@@ -282,11 +282,6 @@ COMMON_LDADDS = libqemuutil.a
 
 qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) 
$(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) 
$(storage-daemon-obj-y) $(COMMON_LDADDS)
 
-scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o 
$(authz-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
-ifdef CONFIG_MPATH
-scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
-endif
-
 clean: recurse-clean ninja-clean clean-ctlist
-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
 # avoid old build problems by removing potentially incorrect old files
diff --git a/configure b/configure
index cc5a44d7e0..1dd0c693f3 100755
--- a/configure
+++ b/configure
@@ -6668,7 +6668,6 @@ if [ "$eventfd" = "yes" ]; then
 fi
 
 tools=""
-helpers=""
 if test "$want_tools" = "yes" ; then
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
 tools="qemu-storage-daemon\$(EXESUF) $tools"
@@ -6692,7 +6691,6 @@ if test "$softmmu" = yes ; then
   fi
   mpath=no
 fi
-helpers="$helpers scsi/qemu-pr-helper\$(EXESUF)"
   else
 if test "$virtfs" = yes; then
   error_exit "VirtFS is supported only on Linux"
@@ -7770,7 +7768,6 @@ else
   QEMU_INCLUDES="-iquote ${source_path}/tcg/${ARCH} $QEMU_INCLUDES"
 fi
 
-echo "HELPERS=$helpers" >> $config_host_mak
 echo "TOOLS=$tools" >> $config_host_mak
 echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
diff --git a/meson.build b/meson.build
index f19b18077c..8aff811b9b 100644
--- a/meson.build
+++ b/meson.build
@@ -144,6 +144,10 @@ if 'CONFIG_XKBCOMMON' in config_host
  link_args: 
config_host['XKBCOMMON_LIBS'].split())
 endif
 rt = cc.find_library('rt', required: false)
+libmpathpersist = not_found
+if config_host.has_key('CONFIG_MPATH')
+  libmpathpersist = cc.find_library('mpathpersist')
+endif
 libiscsi = not_found
 if 'CONFIG_LIBISCSI' in config_host
   libiscsi = declare_dependency(compile_args: 
config_host['LIBISCSI_CFLAGS'].split(),
@@ -629,6 +633,7 @@ foreach target : target_dirs
 endforeach
 
 # Other build targets
+
 if 'CONFIG_GUEST_AGENT' in config_host
   subdir('qga')
 endif
@@ -670,6 +675,11 @@ if have_tools
dependencies: [qemuutil, libcap_ng],
install: true,
install_dir: get_option('libexecdir'))
+
+executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 
'scsi/utils.c'),
+   dependencies: [authz, crypto, io, qom, qemuutil,
+  libcap_ng, libudev, libmpathpersist],
+   install: true)
   endif
 
   if 'CONFIG_IVSHMEM' in config_host
-- 
2.26.2





[PATCH 071/150] meson: convert ui directory to Meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs|  8 +++--
 Makefile.target  |  8 ++---
 configure|  6 
 meson.build  | 50 +
 ui/Makefile.objs | 73 --
 ui/meson.build   | 83 +++-
 ui/shader.c  |  6 ++--
 7 files changed, 150 insertions(+), 84 deletions(-)
 delete mode 100644 ui/Makefile.objs

diff --git a/Makefile.objs b/Makefile.objs
index ec7627a4c6..72e935023d 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -68,6 +68,11 @@ common-obj-$(CONFIG_AUDIO_OSS) += audio-oss$(DSOSUF)
 common-obj-$(CONFIG_AUDIO_PA) += audio-pa$(DSOSUF)
 common-obj-$(CONFIG_AUDIO_SDL) += audio-sdl$(DSOSUF)
 
+common-obj-$(if $(CONFIG_CURSES),m) += ui-curses$(DSOSUF)
+common-obj-$(if $(CONFIG_GTK),m) += ui-gtk$(DSOSUF)
+common-obj-$(if $(CONFIG_SDL),m) += ui-sdl$(DSOSUF)
+common-obj-$(if $(CONFIG_SPICE),m) += ui-spice-app$(DSOSUF)
+
 common-obj-$(if $(CONFIG_CURL),m) += block-curl$(DSOSUF)
 common-obj-$(if $(CONFIG_GLUSTERFS),m) += block-gluster$(DSOSUF)
 common-obj-$(if $(CONFIG_LIBISCSI),m) += block-iscsi$(DSOSUF)
@@ -83,9 +88,6 @@ common-obj-m += hw/
 
 common-obj-y += replay/
 
-common-obj-y += ui/
-common-obj-m += ui/
-
 common-obj-y += dma-helpers.o
 common-obj-$(CONFIG_TPM) += tpm.o
 
diff --git a/Makefile.target b/Makefile.target
index ff0e1b2d10..16f1e781e9 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -167,8 +167,9 @@ LIBS := $(libs_softmmu) $(LIBS)
 LIBS := $(LIBS) @../block.syms @../qemu.syms
 ifneq ($(CONFIG_MODULES),y)
 LIBS := $(LIBS) $(ALSA_LIBS) $(OSS_LIBS) $(PULSE_LIBS) $(SDL_LIBS)
+LIBS := $(LIBS) $(GTK_LIBS) $(VTE_LIBS) $(X11_LIBS) $(CURSES_LIBS) 
$(ICONV_LIBS) $(GIO_LIBS)
 endif
-LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS)
+LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS) $(OPENGL_LIBS)
 LIBS := $(LIBS) $(COREAUDIO_LIBS) $(DSOUND_LIBS)
 
 # Hardware support
@@ -207,9 +208,8 @@ dummy := $(call fix-paths,../,, \
   crypto-obj-y \
   io-obj-y \
   qom-obj-y)
-dummy := $(call unnest-vars,.., \
-   common-obj-y \
-   common-obj-m)
+dummy := $(call unnest-vars,..,common-obj-y)
+
 all-obj-y += $(common-obj-y)
 all-obj-y += $(qom-obj-y)
 all-obj-$(CONFIG_SOFTMMU) += $(authz-obj-y)
diff --git a/configure b/configure
index 171a1c71d2..26d2479b80 100755
--- a/configure
+++ b/configure
@@ -7020,12 +7020,18 @@ fi
 if test "$vnc_sasl" = "yes" ; then
   echo "CONFIG_VNC_SASL=y" >> $config_host_mak
 fi
+echo "SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
+echo "SASL_LIBS=$vnc_sasl_libs" >> $config_host_mak
 if test "$vnc_jpeg" = "yes" ; then
   echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
 fi
+echo "JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
+echo "JPEG_LIBS=$vnc_jpeg_libs" >> $config_host_mak
 if test "$vnc_png" = "yes" ; then
   echo "CONFIG_VNC_PNG=y" >> $config_host_mak
 fi
+echo "PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
+echo "PNG_LIBS=$vnc_png_libs" >> $config_host_mak
 if test "$xkbcommon" = "yes" ; then
   echo "CONFIG_XKBCOMMON=y" >> $config_host_mak
   echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 98182049d8..db5a000a23 100644
--- a/meson.build
+++ b/meson.build
@@ -239,6 +239,56 @@ coreaudio = not_found
 if 'CONFIG_AUDIO_COREAUDIO' in config_host
   coreaudio = declare_dependency(link_args: 
config_host['COREAUDIO_LIBS'].split())
 endif
+opengl = not_found
+if 'CONFIG_OPENGL' in config_host
+  opengl = declare_dependency(link_args: config_host['OPENGL_LIBS'].split())
+else
+endif
+gtk = not_found
+if 'CONFIG_GTK' in config_host
+  gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
+  link_args: config_host['GTK_LIBS'].split())
+endif
+vte = not_found
+if 'CONFIG_VTE' in config_host
+  vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
+   link_args: config_host['VTE_LIBS'].split())
+endif
+x11 = not_found
+if 'CONFIG_X11' in config_host
+  x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
+   link_args: config_host['X11_LIBS'].split())
+endif
+curses = not_found
+if 'CONFIG_CURSES' in config_host
+  curses = declare_dependency(compile_args: 
config_host['CURSES_CFLAGS'].split(),
+  link_args: config_host['CURSES_LIBS'].split())
+endif
+iconv = not_found
+if 'CONFIG_ICONV' in config_host
+  iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
+ link_args: config_host['ICONV_LIBS'].split())
+endif
+gio = not_found
+if 'CONFIG_GIO' in config_host
+  gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
+   link_args: config_host['GIO_LIBS'].split())
+endif
+png = not_found
+if 'CONFIG_VNC_PNG' 

[PATCH 069/150] meson: convert tests/qtest to meson

2020-08-14 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini 
---
 meson.build   |   3 +
 tests/Makefile.include|  47 +--
 tests/meson.build |   1 +
 tests/qtest/Makefile.include  | 332 --
 tests/qtest/ac97-test.c   |   2 +-
 tests/qtest/acpi-utils.h  |   2 +-
 tests/qtest/ahci-test.c   |   2 +-
 tests/qtest/arm-cpu-features.c|   2 +-
 tests/qtest/boot-order-test.c |   2 +-
 tests/qtest/boot-sector.c |   2 +-
 tests/qtest/boot-sector.h |   2 +-
 tests/qtest/boot-serial-test.c|   2 +-
 tests/qtest/cdrom-test.c  |   2 +-
 tests/qtest/dbus-vmstate-test.c   |   2 +-
 tests/qtest/device-introspect-test.c  |   2 +-
 tests/qtest/device-plug-test.c|   2 +-
 tests/qtest/drive_del-test.c  |   2 +-
 tests/qtest/ds1338-test.c |   2 +-
 tests/qtest/e1000-test.c  |   2 +-
 tests/qtest/eepro100-test.c   |   2 +-
 tests/qtest/endianness-test.c |   2 +-
 tests/qtest/es1370-test.c |   2 +-
 tests/qtest/fuzz/fuzz.c   |   2 +-
 tests/qtest/fuzz/fuzz.h   |   2 +-
 tests/qtest/fuzz/i440fx_fuzz.c|   2 +-
 tests/qtest/fuzz/qos_fuzz.c   |   2 +-
 tests/qtest/fuzz/virtio_net_fuzz.c|   2 +-
 tests/qtest/fw_cfg-test.c |   2 +-
 tests/qtest/hd-geo-test.c |   2 +-
 tests/qtest/hexloader-test.c  |   2 +-
 tests/qtest/ide-test.c|   2 +-
 tests/qtest/ipoctal232-test.c |   2 +-
 tests/qtest/ivshmem-test.c|   2 +-
 .../libqos/aarch64-xlnx-zcu102-machine.c  |   4 +-
 tests/qtest/libqos/ahci.c |   6 +-
 tests/qtest/libqos/ahci.h |   6 +-
 tests/qtest/libqos/arm-imx25-pdk-machine.c|   6 +-
 tests/qtest/libqos/arm-n800-machine.c |   6 +-
 tests/qtest/libqos/arm-raspi2-machine.c   |   4 +-
 tests/qtest/libqos/arm-sabrelite-machine.c|   4 +-
 tests/qtest/libqos/arm-smdkc210-machine.c |   4 +-
 tests/qtest/libqos/arm-virt-machine.c |   6 +-
 .../qtest/libqos/arm-xilinx-zynq-a9-machine.c |   4 +-
 tests/qtest/libqos/e1000e.c   |   6 +-
 tests/qtest/libqos/e1000e.h   |   2 +-
 tests/qtest/libqos/fw_cfg.c   |   2 +-
 tests/qtest/libqos/i2c-imx.c  |   2 +-
 tests/qtest/libqos/i2c-omap.c |   2 +-
 tests/qtest/libqos/i2c.c  |   2 +-
 tests/qtest/libqos/i2c.h  |   2 +-
 tests/qtest/libqos/libqos-pc.c|   6 +-
 tests/qtest/libqos/libqos-pc.h|   2 +-
 tests/qtest/libqos/libqos-spapr.c |   6 +-
 tests/qtest/libqos/libqos-spapr.h |   2 +-
 tests/qtest/libqos/libqos.c   |   4 +-
 tests/qtest/libqos/libqos.h   |   4 +-
 tests/qtest/{ => libqos}/libqtest.h   |   0
 tests/qtest/libqos/malloc-pc.c|   4 +-
 tests/qtest/libqos/malloc-pc.h|   2 +-
 tests/qtest/libqos/malloc-spapr.c |   2 +-
 tests/qtest/libqos/malloc-spapr.h |   2 +-
 tests/qtest/libqos/malloc.c   |   2 +-
 tests/qtest/libqos/meson.build|  57 +++
 tests/qtest/libqos/pci-pc.c   |   2 +-
 tests/qtest/libqos/pci-pc.h   |   6 +-
 tests/qtest/libqos/pci-spapr.c|   6 +-
 tests/qtest/libqos/pci-spapr.h|   6 +-
 tests/qtest/libqos/pci.c  |   4 +-
 tests/qtest/libqos/pci.h  |   2 +-
 tests/qtest/libqos/ppc64_pseries-machine.c|   4 +-
 tests/qtest/libqos/qgraph.c   |   4 +-
 tests/qtest/libqos/qgraph.h   |   6 +-
 tests/qtest/libqos/qgraph_internal.h  |   4 +-
 tests/qtest/libqos/qos_external.c |   8 +-
 tests/qtest/libqos/qos_external.h |   4 +-
 tests/qtest/libqos/rtas.c |   2 +-
 tests/qtest/libqos/rtas.h |   2 +-
 tests/qtest/libqos/sdhci.c|   2 +-
 tests/qtest/libqos/sdhci.h|   2 +-
 tests/qtest/libqos/tpci200.c  |   4 +-
 tests/qtest/libqos/usb.c  |   2 +-
 tests/qtest/libqos/usb.h  |   2 +-
 tests/qtest/libqos/virtio-9p.c|   4 +-
 tests/qtest/libqos/virtio-9p.h|   6 +-
 tests/qtest/libqos/virtio-balloon.c   |   4 +-
 tests/qtest/libqos/virtio-balloon.h   |   6 +-
 tests/qtest/libqos/virtio-blk.c   |   4 +-
 tests/qtest/libqos/virtio-blk.h   |   6 +-
 tests/qtest/libqos/virt

[PATCH 108/150] meson: convert hw/misc

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 hw/Makefile.objs|  1 -
 hw/meson.build  |  1 +
 hw/misc/Makefile.objs   | 95 ---
 hw/misc/macio/Makefile.objs |  5 --
 hw/misc/macio/meson.build   |  8 +++
 hw/misc/meson.build | 99 +
 6 files changed, 108 insertions(+), 101 deletions(-)
 delete mode 100644 hw/misc/Makefile.objs
 delete mode 100644 hw/misc/macio/Makefile.objs
 create mode 100644 hw/misc/macio/meson.build
 create mode 100644 hw/misc/meson.build

diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index d0d7816118..ac8278edf7 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -17,7 +17,6 @@ devices-dirs-y += intc/
 devices-dirs-$(CONFIG_IPACK) += ipack/
 devices-dirs-$(CONFIG_IPMI) += ipmi/
 devices-dirs-y += isa/
-devices-dirs-y += misc/
 endif
 
 common-obj-y += $(devices-dirs-y)
diff --git a/hw/meson.build b/hw/meson.build
index 1f7b2c4fb9..6ca82b0375 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -1,5 +1,6 @@
 subdir('core')
 subdir('mem')
+subdir('misc')
 subdir('net')
 subdir('nubus')
 subdir('nvram')
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
deleted file mode 100644
index 6be3d255ab..00
--- a/hw/misc/Makefile.objs
+++ /dev/null
@@ -1,95 +0,0 @@
-common-obj-$(CONFIG_APPLESMC) += applesmc.o
-common-obj-$(CONFIG_MAX111X) += max111x.o
-common-obj-$(CONFIG_TMP105) += tmp105.o
-common-obj-$(CONFIG_TMP421) += tmp421.o
-common-obj-$(CONFIG_ISA_DEBUG) += debugexit.o
-common-obj-$(CONFIG_SGA) += sga.o
-common-obj-$(CONFIG_ISA_TESTDEV) += pc-testdev.o
-common-obj-$(CONFIG_PCI_TESTDEV) += pci-testdev.o
-common-obj-$(CONFIG_EDU) += edu.o
-common-obj-$(CONFIG_PCA9552) += pca9552.o
-
-common-obj-$(CONFIG_UNIMP) += unimp.o
-common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
-common-obj-$(CONFIG_FW_CFG_DMA) += vmcoreinfo.o
-
-# ARM devices
-common-obj-$(CONFIG_PL310) += arm_l2x0.o
-common-obj-$(CONFIG_INTEGRATOR_DEBUG) += arm_integrator_debug.o
-common-obj-$(CONFIG_A9SCU) += a9scu.o
-common-obj-$(CONFIG_ARM11SCU) += arm11scu.o
-
-# Mac devices
-common-obj-$(CONFIG_MOS6522) += mos6522.o
-
-# PKUnity SoC devices
-common-obj-$(CONFIG_PUV3) += puv3_pm.o
-
-common-obj-$(CONFIG_MACIO) += macio/
-
-common-obj-$(CONFIG_IVSHMEM_DEVICE) += ivshmem.o
-
-common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-ccu.o
-obj-$(CONFIG_ALLWINNER_H3) += allwinner-cpucfg.o
-common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-dramc.o
-common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-sysctrl.o
-common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-sid.o
-common-obj-$(CONFIG_REALVIEW) += arm_sysctl.o
-common-obj-$(CONFIG_NSERIES) += cbus.o
-common-obj-$(CONFIG_ECCMEMCTL) += eccmemctl.o
-common-obj-$(CONFIG_EXYNOS4) += exynos4210_pmu.o exynos4210_clk.o 
exynos4210_rng.o
-common-obj-$(CONFIG_IMX) += imx_ccm.o
-common-obj-$(CONFIG_IMX) += imx31_ccm.o
-common-obj-$(CONFIG_IMX) += imx25_ccm.o
-common-obj-$(CONFIG_IMX) += imx6_ccm.o
-common-obj-$(CONFIG_IMX) += imx6ul_ccm.o
-obj-$(CONFIG_IMX) += imx6_src.o
-common-obj-$(CONFIG_IMX) += imx7_ccm.o
-common-obj-$(CONFIG_IMX) += imx7_snvs.o
-common-obj-$(CONFIG_IMX) += imx7_gpr.o
-common-obj-$(CONFIG_IMX) += imx_rngc.o
-common-obj-$(CONFIG_MILKYMIST) += milkymist-hpdmc.o
-common-obj-$(CONFIG_MILKYMIST) += milkymist-pfpu.o
-common-obj-$(CONFIG_MAINSTONE) += mst_fpga.o
-common-obj-$(CONFIG_OMAP) += omap_clk.o
-common-obj-$(CONFIG_OMAP) += omap_gpmc.o
-common-obj-$(CONFIG_OMAP) += omap_l4.o
-common-obj-$(CONFIG_OMAP) += omap_sdrc.o
-common-obj-$(CONFIG_OMAP) += omap_tap.o
-common-obj-$(CONFIG_RASPI) += bcm2835_mbox.o
-common-obj-$(CONFIG_RASPI) += bcm2835_mphi.o
-common-obj-$(CONFIG_RASPI) += bcm2835_property.o
-common-obj-$(CONFIG_RASPI) += bcm2835_rng.o
-common-obj-$(CONFIG_RASPI) += bcm2835_thermal.o
-common-obj-$(CONFIG_SLAVIO) += slavio_misc.o
-common-obj-$(CONFIG_ZYNQ) += zynq_slcr.o
-common-obj-$(CONFIG_ZYNQ) += zynq-xadc.o
-common-obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o
-common-obj-$(CONFIG_STM32F4XX_SYSCFG) += stm32f4xx_syscfg.o
-common-obj-$(CONFIG_STM32F4XX_EXTI) += stm32f4xx_exti.o
-obj-$(CONFIG_MIPS_CPS) += mips_cmgcr.o
-obj-$(CONFIG_MIPS_CPS) += mips_cpc.o
-obj-$(CONFIG_MIPS_ITU) += mips_itu.o
-common-obj-$(CONFIG_MPS2_FPGAIO) += mps2-fpgaio.o
-common-obj-$(CONFIG_MPS2_SCC) += mps2-scc.o
-
-common-obj-$(CONFIG_TZ_MPC) += tz-mpc.o
-common-obj-$(CONFIG_TZ_MSC) += tz-msc.o
-common-obj-$(CONFIG_TZ_PPC) += tz-ppc.o
-common-obj-$(CONFIG_IOTKIT_SECCTL) += iotkit-secctl.o
-obj-$(CONFIG_IOTKIT_SYSCTL) += iotkit-sysctl.o
-common-obj-$(CONFIG_IOTKIT_SYSINFO) += iotkit-sysinfo.o
-common-obj-$(CONFIG_ARMSSE_CPUID) += armsse-cpuid.o
-common-obj-$(CONFIG_ARMSSE_MHU) += armsse-mhu.o
-
-common-obj-$(CONFIG_PVPANIC) += pvpanic.o
-common-obj-$(CONFIG_AUX) += auxbus.o
-common-obj-$(CONFIG_ASPEED_SOC) += aspeed_xdma.o
-common-obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
-common-obj-$(CONFIG_MSF2) += msf2-sysreg.o

[PATCH 111/150] meson: convert hw/ipack

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 hw/Makefile.objs   | 1 -
 hw/ipack/Makefile.objs | 2 --
 hw/ipack/meson.build   | 1 +
 hw/meson.build | 1 +
 4 files changed, 2 insertions(+), 3 deletions(-)
 delete mode 100644 hw/ipack/Makefile.objs
 create mode 100644 hw/ipack/meson.build

diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index f136377866..76d9305959 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -14,7 +14,6 @@ devices-dirs-$(CONFIG_I2C) += i2c/
 devices-dirs-y += ide/
 devices-dirs-y += input/
 devices-dirs-y += intc/
-devices-dirs-$(CONFIG_IPACK) += ipack/
 endif
 
 common-obj-y += $(devices-dirs-y)
diff --git a/hw/ipack/Makefile.objs b/hw/ipack/Makefile.objs
deleted file mode 100644
index 8b9bdcb549..00
--- a/hw/ipack/Makefile.objs
+++ /dev/null
@@ -1,2 +0,0 @@
-common-obj-$(CONFIG_IPACK) += ipack.o
-common-obj-$(CONFIG_IPACK) += tpci200.o
diff --git a/hw/ipack/meson.build b/hw/ipack/meson.build
new file mode 100644
index 00..3f8138b6f2
--- /dev/null
+++ b/hw/ipack/meson.build
@@ -0,0 +1 @@
+softmmu_ss.add(when: 'CONFIG_IPACK', if_true: files('ipack.c', 'tpci200.c'))
diff --git a/hw/meson.build b/hw/meson.build
index 9796f95e5c..ec4bb48a0f 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -1,4 +1,5 @@
 subdir('core')
+subdir('ipack')
 subdir('ipmi')
 subdir('isa')
 subdir('mem')
-- 
2.26.2





[PATCH 075/150] meson: convert dump/

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs  | 3 +--
 Makefile.target| 1 -
 configure  | 4 
 dump/Makefile.objs | 3 ---
 dump/meson.build   | 4 
 meson.build| 9 +
 6 files changed, 18 insertions(+), 6 deletions(-)
 delete mode 100644 dump/Makefile.objs
 create mode 100644 dump/meson.build

diff --git a/Makefile.objs b/Makefile.objs
index ec15ebc4b4..6657a6cce3 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -48,8 +48,7 @@ storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
 # single QEMU executable should support all CPUs and machines.
 
 ifeq ($(CONFIG_SOFTMMU),y)
-common-obj-y = dump/
-common-obj-y += monitor/
+common-obj-y = monitor/
 common-obj-y += net/
 common-obj-$(CONFIG_LINUX) += fsdev/
 
diff --git a/Makefile.target b/Makefile.target
index 5f926e5bfa..c8f7a6c04b 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -156,7 +156,6 @@ endif #CONFIG_BSD_USER
 ifdef CONFIG_SOFTMMU
 obj-y += softmmu/
 obj-y += gdbstub.o
-obj-y += dump/
 obj-y += hw/
 obj-y += monitor/
 obj-y += qapi/
diff --git a/configure b/configure
index 454a244141..ebce9e6766 100755
--- a/configure
+++ b/configure
@@ -2571,6 +2571,7 @@ int main(void) { lzo_version(); return 0; }
 EOF
 if compile_prog "" "-llzo2" ; then
 libs_softmmu="$libs_softmmu -llzo2"
+lzo_libs="-llzo2"
 lzo="yes"
 else
 if test "$lzo" = "yes"; then
@@ -2590,6 +2591,7 @@ int main(void) { snappy_max_compressed_length(4096); 
return 0; }
 EOF
 if compile_prog "" "-lsnappy" ; then
 libs_softmmu="$libs_softmmu -lsnappy"
+snappy_libs='-lsnappy'
 snappy="yes"
 else
 if test "$snappy" = "yes"; then
@@ -7419,10 +7421,12 @@ fi
 
 if test "$lzo" = "yes" ; then
   echo "CONFIG_LZO=y" >> $config_host_mak
+  echo "LZO_LIBS=$lzo_libs" >> $config_host_mak
 fi
 
 if test "$snappy" = "yes" ; then
   echo "CONFIG_SNAPPY=y" >> $config_host_mak
+  echo "SNAPPY_LIBS=$snappy_libs" >> $config_host_mak
 fi
 
 if test "$bzip2" = "yes" ; then
diff --git a/dump/Makefile.objs b/dump/Makefile.objs
deleted file mode 100644
index d2a5db3b81..00
--- a/dump/Makefile.objs
+++ /dev/null
@@ -1,3 +0,0 @@
-obj-y += dump.o
-common-obj-y += dump-hmp-cmds.o
-obj-$(TARGET_X86_64) += win_dump.o
diff --git a/dump/meson.build b/dump/meson.build
new file mode 100644
index 00..2eff29c3ea
--- /dev/null
+++ b/dump/meson.build
@@ -0,0 +1,4 @@
+softmmu_ss.add(files('dump-hmp-cmds.c'))
+
+specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('dump.c'), snappy, 
lzo])
+specific_ss.add(when: ['CONFIG_SOFTMMU', 'TARGET_X86_64'], if_true: 
files('win_dump.c'))
diff --git a/meson.build b/meson.build
index 98ba7a09f6..648febf65b 100644
--- a/meson.build
+++ b/meson.build
@@ -296,6 +296,14 @@ if 'CONFIG_FDT' in config_host
   fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
link_args: config_host['FDT_LIBS'].split())
 endif
+snappy = not_found
+if 'CONFIG_SNAPPY' in config_host
+  snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
+endif
+lzo = not_found
+if 'CONFIG_LZO' in config_host
+  lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
+endif
 
 create_config = find_program('scripts/create_config')
 minikconf = find_program('scripts/minikconf.py')
@@ -603,6 +611,7 @@ subdir('io')
 subdir('chardev')
 subdir('fsdev')
 subdir('target')
+subdir('dump')
 
 block_ss.add(files(
   'block.c',
-- 
2.26.2





[PATCH 078/150] meson: convert replay directory to Meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs|  1 -
 meson.build  |  1 +
 replay/Makefile.objs | 10 --
 replay/meson.build   | 12 
 4 files changed, 13 insertions(+), 11 deletions(-)
 delete mode 100644 replay/Makefile.objs
 create mode 100644 replay/meson.build

diff --git a/Makefile.objs b/Makefile.objs
index e304d92954..cfb2cf2b49 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -68,7 +68,6 @@ common-obj-$(if $(and $(CONFIG_BZIP2),$(CONFIG_DMG)),m) += 
block-dmg-bz2$(DSOSUF
 common-obj-y += hw/
 common-obj-m += hw/
 
-common-obj-y += replay/
 common-obj-y += backends/
 
 common-obj-y += qapi/
diff --git a/meson.build b/meson.build
index c623d76db9..e294b4790a 100644
--- a/meson.build
+++ b/meson.build
@@ -652,6 +652,7 @@ common_ss.add(files('cpus-common.c'))
 
 subdir('softmmu')
 subdir('monitor')
+subdir('replay')
 
 # needed for fuzzing binaries
 subdir('tests/qtest/libqos')
diff --git a/replay/Makefile.objs b/replay/Makefile.objs
deleted file mode 100644
index 939be964a9..00
--- a/replay/Makefile.objs
+++ /dev/null
@@ -1,10 +0,0 @@
-common-obj-y += replay.o
-common-obj-y += replay-internal.o
-common-obj-y += replay-events.o
-common-obj-y += replay-time.o
-common-obj-y += replay-input.o
-common-obj-y += replay-char.o
-common-obj-y += replay-snapshot.o
-common-obj-y += replay-net.o
-common-obj-y += replay-audio.o
-common-obj-y += replay-random.o
diff --git a/replay/meson.build b/replay/meson.build
new file mode 100644
index 00..8783aea7c8
--- /dev/null
+++ b/replay/meson.build
@@ -0,0 +1,12 @@
+softmmu_ss.add(files(
+  'replay.c',
+  'replay-internal.c',
+  'replay-events.c',
+  'replay-time.c',
+  'replay-input.c',
+  'replay-char.c',
+  'replay-snapshot.c',
+  'replay-net.c',
+  'replay-audio.c',
+  'replay-random.c',
+))
-- 
2.26.2





[PATCH 081/150] meson: convert backends directory to Meson

2020-08-14 Thread Paolo Bonzini
From: Marc-André Lureau 

Signed-off-by: Marc-André Lureau 
Signed-off-by: Paolo Bonzini 
---
 Makefile.objs  |  2 --
 backends/Makefile.objs | 23 ---
 backends/meson.build   | 19 +++
 backends/tpm/Makefile.objs |  4 
 backends/tpm/meson.build   |  8 
 configure  |  2 ++
 meson.build|  5 +
 7 files changed, 34 insertions(+), 29 deletions(-)
 delete mode 100644 backends/Makefile.objs
 create mode 100644 backends/meson.build
 delete mode 100644 backends/tpm/Makefile.objs
 create mode 100644 backends/tpm/meson.build

diff --git a/Makefile.objs b/Makefile.objs
index f2700442a4..c00851a0cd 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -66,8 +66,6 @@ common-obj-$(if $(and $(CONFIG_BZIP2),$(CONFIG_DMG)),m) += 
block-dmg-bz2$(DSOSUF
 common-obj-y += hw/
 common-obj-m += hw/
 
-common-obj-y += backends/
-
 common-obj-y += qapi/
 
 common-obj-y += libqmp.fa
diff --git a/backends/Makefile.objs b/backends/Makefile.objs
deleted file mode 100644
index 22d204cb48..00
--- a/backends/Makefile.objs
+++ /dev/null
@@ -1,23 +0,0 @@
-common-obj-y += rng.o rng-egd.o rng-builtin.o
-common-obj-$(CONFIG_POSIX) += rng-random.o
-
-common-obj-$(CONFIG_TPM) += tpm/
-
-common-obj-y += hostmem.o hostmem-ram.o
-common-obj-$(CONFIG_POSIX) += hostmem-file.o
-
-common-obj-y += cryptodev.o
-common-obj-y += cryptodev-builtin.o
-
-ifeq ($(CONFIG_VIRTIO_CRYPTO),y)
-common-obj-y += cryptodev-vhost.o
-common-obj-$(CONFIG_VHOST_CRYPTO) += cryptodev-vhost-user.o
-endif
-
-common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO)) += vhost-user.o
-
-common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
-
-common-obj-$(CONFIG_GIO) += dbus-vmstate.o
-dbus-vmstate.o-cflags = $(GIO_CFLAGS)
-dbus-vmstate.o-libs = $(GIO_LIBS)
diff --git a/backends/meson.build b/backends/meson.build
new file mode 100644
index 00..484456ece7
--- /dev/null
+++ b/backends/meson.build
@@ -0,0 +1,19 @@
+softmmu_ss.add([files(
+  'cryptodev-builtin.c',
+  'cryptodev.c',
+  'hostmem-ram.c',
+  'hostmem.c',
+  'rng-builtin.c',
+  'rng-egd.c',
+  'rng.c',
+), numa])
+
+softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('rng-random.c'))
+softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('hostmem-file.c'))
+softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('hostmem-memfd.c'))
+softmmu_ss.add(when: ['CONFIG_VHOST_USER', 'CONFIG_VIRTIO'], if_true: 
files('vhost-user.c'))
+softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: 
files('cryptodev-vhost.c'))
+softmmu_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VHOST_CRYPTO'], if_true: 
files('cryptodev-vhost-user.c'))
+softmmu_ss.add(when: 'CONFIG_GIO', if_true: [files('dbus-vmstate.c'), gio])
+
+subdir('tpm')
diff --git a/backends/tpm/Makefile.objs b/backends/tpm/Makefile.objs
deleted file mode 100644
index db2731f634..00
--- a/backends/tpm/Makefile.objs
+++ /dev/null
@@ -1,4 +0,0 @@
-common-obj-y += tpm_backend.o
-common-obj-y += tpm_util.o
-common-obj-$(CONFIG_TPM_PASSTHROUGH) += tpm_passthrough.o
-common-obj-$(CONFIG_TPM_EMULATOR) += tpm_emulator.o
diff --git a/backends/tpm/meson.build b/backends/tpm/meson.build
new file mode 100644
index 00..857929082e
--- /dev/null
+++ b/backends/tpm/meson.build
@@ -0,0 +1,8 @@
+tpm_ss = ss.source_set()
+
+tpm_ss.add(files('tpm_backend.c'))
+tpm_ss.add(files('tpm_util.c'))
+tpm_ss.add(when: 'CONFIG_TPM_PASSTHROUGH', if_true: files('tpm_passthrough.c'))
+tpm_ss.add(when: 'CONFIG_TPM_EMULATOR', if_true: files('tpm_emulator.c'))
+
+softmmu_ss.add_all(when: 'CONFIG_TPM', if_true: tpm_ss)
diff --git a/configure b/configure
index ebce9e6766..c2aa600084 100755
--- a/configure
+++ b/configure
@@ -4692,6 +4692,7 @@ EOF
   if compile_prog "" "-lnuma" ; then
 numa=yes
 libs_softmmu="-lnuma $libs_softmmu"
+numa_libs="-lnuma"
   else
 if test "$numa" = "yes" ; then
   feature_not_found "numa" "install numactl devel"
@@ -8318,6 +8319,7 @@ fi
 
 if test "$numa" = "yes"; then
   echo "CONFIG_NUMA=y" >> $config_host_mak
+  echo "NUMA_LIBS=$numa_libs" >> $config_host_mak
 fi
 
 if test "$ccache_cpp2" = "yes"; then
diff --git a/meson.build b/meson.build
index 18d9e97d32..8955ca280e 100644
--- a/meson.build
+++ b/meson.build
@@ -317,6 +317,10 @@ rdma = not_found
 if 'CONFIG_RDMA' in config_host
   rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
 endif
+numa = not_found
+if 'CONFIG_NUMA' in config_host
+  numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
+endif
 
 create_config = find_program('scripts/create_config')
 minikconf = find_program('scripts/minikconf.py')
@@ -664,6 +668,7 @@ softmmu_ss.add(when: ['CONFIG_FDT', fdt],  if_true: 
[files('device_tree.c')])
 common_ss.add(files('cpus-common.c'))
 
 subdir('softmmu')
+subdir('backends')
 subdir('migration')
 subdir('monitor')
 subdir('net')
-- 
2.26.2





  1   2   3   4   >