From nobody Sun Feb 8 21:22:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609813399; cv=none; d=zohomail.com; s=zohoarc; b=Rs5j94CF8FtUeJM+ZR+pOUER8GgursAx2GRKDNQa6NTY10xZ9Zbmc7DCK88AEY2MWE3Pzorba6i2PLidkxFEdTtzRxe1o5TIi16o4DFYOehsPh6178dIVuKIvjFYtk/xLzQ4Eq7Eeiqw0q8fnjtmDxlhm/zc/638otwr6hGPqbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609813399; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/1FD2pLv5EtovTqe0eqpd1vRpl3eMJUhyhI+mD8p7/s=; b=agZJjnP5InhHCNIT335vWxIL/+iCBA1sA1oTtZ6vJGr33/glJSDHb9O+uCoJwWtYd3hRg3ygd6ybvRtcSMFgcq5ul6sYPVFKeOp0MGUwJ7znjAO+hB4dc2nOUZeBImbTDbknfHwok/QIjgPMe3e4BAA0LpXoezSuXRXzag5ntOg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160981339946471.44140535731583; Mon, 4 Jan 2021 18:23:19 -0800 (PST) Received: from localhost ([::1]:32960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwc0E-0002SR-6S for importer@patchew.org; Mon, 04 Jan 2021 21:23:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwbyA-0000ms-IW; Mon, 04 Jan 2021 21:21:10 -0500 Received: from mail-pl1-f170.google.com ([209.85.214.170]:42737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwby5-0001xE-7T; Mon, 04 Jan 2021 21:21:10 -0500 Received: by mail-pl1-f170.google.com with SMTP id s15so15553034plr.9; Mon, 04 Jan 2021 18:21:00 -0800 (PST) Received: from localhost.localdomain ([73.93.154.186]) by smtp.gmail.com with ESMTPSA id y27sm57674386pfr.78.2021.01.04.18.20.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jan 2021 18:20:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/1FD2pLv5EtovTqe0eqpd1vRpl3eMJUhyhI+mD8p7/s=; b=SH2tkkrur/ue4gey37QjbVOoGaR6KWzp0aF+M3e2Qy2RBKzHdFgzw6/qUJVup36awF QBz+BBv0M+DbShYnnl0iO3l5RQp1zLRDoDnM0AGi+EccTKUJ/GR0qzTJNZpOZkwS8bOG 8RTA+LXqQ8F5zLuHb+oiLkIcyfMG1UL/WT6MfaODheB2JgJzmImdIp/H7rrV9moveXxQ Y2nekbfmvdjArRZ81xeGNUxEEbq7wV+vT/QF+wKeqQYY3j0LflU4lnAdyAgWcd6NL1/x rURq/ieziin58/nMZK6/k6PbB1d6/NZ4cM3JYKLLQZT1tUUllBOPeZapwxukQ57dIoYa feBQ== X-Gm-Message-State: AOAM5322v3/N0e1sqO/ABDw9qourRqSuTY6R/XOaGlTbVyiJ2+g4j7+c Op6a+9yWvH9jwxpk95Nl4glGZSWPR88= X-Google-Smtp-Source: ABdhPJygdr43FmrqZ9LuhDD9JWfAuKVt9mcYaklRUfNkfo8vgP4yCT3agLLNJAv9Yh2/gAbjF8noRA== X-Received: by 2002:a17:90b:24c:: with SMTP id fz12mr1824242pjb.138.1609813259341; Mon, 04 Jan 2021 18:20:59 -0800 (PST) From: Joelle van Dyne To: qemu-devel@nongnu.org Subject: [PATCH v6 1/7] configure: option to disable host block devices Date: Mon, 4 Jan 2021 18:20:49 -0800 Message-Id: <20210105022055.12113-2-j@getutm.app> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210105022055.12113-1-j@getutm.app> References: <20210105022055.12113-1-j@getutm.app> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=209.85.214.170; envelope-from=osy86github@gmail.com; helo=mail-pl1-f170.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "open list:raw" , Markus Armbruster , Max Reitz , Roman Bolshakov , Joelle van Dyne Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Some hosts (iOS) have a sandboxed filesystem and do not provide low-level APIs for interfacing with host block devices. Signed-off-by: Joelle van Dyne --- configure | 4 ++++ meson.build | 1 + qapi/block-core.json | 10 +++++++--- block/file-posix.c | 10 +++++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 3f823ed163..7cd2ee0b9c 100755 --- a/configure +++ b/configure @@ -451,6 +451,7 @@ skip_meson=3Dno gettext=3D"" fuse=3D"auto" fuse_lseek=3D"auto" +host_block_device_support=3D"yes" =20 bogus_os=3D"no" malloc_trim=3D"auto" @@ -5937,6 +5938,9 @@ if test "$default_devices" =3D "yes" ; then else echo "CONFIG_MINIKCONF_MODE=3D--allnoconfig" >> $config_host_mak fi +if test "$host_block_device_support" =3D "yes" ; then + echo "CONFIG_HOST_BLOCK_DEVICE=3Dy" >> $config_host_mak +fi if test "$debug_tcg" =3D "yes" ; then echo "CONFIG_DEBUG_TCG=3Dy" >> $config_host_mak fi diff --git a/meson.build b/meson.build index f344b25955..9a640d3407 100644 --- a/meson.build +++ b/meson.build @@ -2219,6 +2219,7 @@ summary_info +=3D {'vvfat support': config_host.h= as_key('CONFIG_VVFAT')} summary_info +=3D {'qed support': config_host.has_key('CONFIG_QED')} summary_info +=3D {'parallels support': config_host.has_key('CONFIG_PARALL= ELS')} summary_info +=3D {'sheepdog support': config_host.has_key('CONFIG_SHEEPD= OG')} +summary_info +=3D {'host block dev support': config_host.has_key('CONFIG_H= OST_BLOCK_DEVICE')} summary_info +=3D {'capstone': capstone_opt =3D=3D 'disabled' ? f= alse : capstone_opt} summary_info +=3D {'libpmem support': config_host.has_key('CONFIG_LIBPME= M')} summary_info +=3D {'libdaxctl support': config_host.has_key('CONFIG_LIBDAX= CTL')} diff --git a/qapi/block-core.json b/qapi/block-core.json index 04c5196e59..516b823461 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -959,7 +959,8 @@ 'discriminator': 'driver', 'data': { 'file': 'BlockStatsSpecificFile', - 'host_device': 'BlockStatsSpecificFile', + 'host_device': { 'type': 'BlockStatsSpecificFile', + 'if': 'defined(CONFIG_HOST_BLOCK_DEVICE)' }, 'nvme': 'BlockStatsSpecificNvme' } } =20 ## @@ -2827,7 +2828,9 @@ { 'enum': 'BlockdevDriver', 'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs', 'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ft= ps', - 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscs= i', + 'gluster', 'host_cdrom', + {'name': 'host_device', 'if': 'defined(CONFIG_HOST_BLOCK_DEVIC= E)' }, + 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallel= s', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' }, @@ -3995,7 +3998,8 @@ 'ftps': 'BlockdevOptionsCurlFtps', 'gluster': 'BlockdevOptionsGluster', 'host_cdrom': 'BlockdevOptionsFile', - 'host_device':'BlockdevOptionsFile', + 'host_device': { 'type': 'BlockdevOptionsFile', + 'if': 'defined(CONFIG_HOST_BLOCK_DEVICE)' }, 'http': 'BlockdevOptionsCurlHttp', 'https': 'BlockdevOptionsCurlHttps', 'iscsi': 'BlockdevOptionsIscsi', diff --git a/block/file-posix.c b/block/file-posix.c index 83e2cc5530..c34bb9fac1 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -41,7 +41,7 @@ #include "scsi/pr-manager.h" #include "scsi/constants.h" =20 -#if defined(__APPLE__) && (__MACH__) +#if defined(CONFIG_HOST_BLOCK_DEVICE) && defined(__APPLE__) && (__MACH__) #include #include #include @@ -3014,6 +3014,7 @@ static BlockStatsSpecific *raw_get_specific_stats(Blo= ckDriverState *bs) return stats; } =20 +#if defined(CONFIG_HOST_BLOCK_DEVICE) static BlockStatsSpecific *hdev_get_specific_stats(BlockDriverState *bs) { BlockStatsSpecific *stats =3D g_new(BlockStatsSpecific, 1); @@ -3023,6 +3024,7 @@ static BlockStatsSpecific *hdev_get_specific_stats(Bl= ockDriverState *bs) =20 return stats; } +#endif /* CONFIG_HOST_BLOCK_DEVICE */ =20 static QemuOptsList raw_create_opts =3D { .name =3D "raw-create-opts", @@ -3247,6 +3249,8 @@ BlockDriver bdrv_file =3D { /***********************************************/ /* host device */ =20 +#if defined(CONFIG_HOST_BLOCK_DEVICE) + #if defined(__APPLE__) && defined(__MACH__) static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize, int flags); @@ -3872,6 +3876,8 @@ static BlockDriver bdrv_host_cdrom =3D { }; #endif /* __FreeBSD__ */ =20 +#endif /* CONFIG_HOST_BLOCK_DEVICE */ + static void bdrv_file_init(void) { /* @@ -3879,6 +3885,7 @@ static void bdrv_file_init(void) * registered last will get probed first. */ bdrv_register(&bdrv_file); +#if defined(CONFIG_HOST_BLOCK_DEVICE) bdrv_register(&bdrv_host_device); #ifdef __linux__ bdrv_register(&bdrv_host_cdrom); @@ -3886,6 +3893,7 @@ static void bdrv_file_init(void) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) bdrv_register(&bdrv_host_cdrom); #endif +#endif /* CONFIG_HOST_BLOCK_DEVICE */ } =20 block_init(bdrv_file_init); --=20 2.28.0 From nobody Sun Feb 8 21:22:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609813399; cv=none; d=zohomail.com; s=zohoarc; b=LAQdXMfEhy4ZGXlbFglKQphq0A813a2i2xnGafUuF7PZ72C1BuscshMqdxjWva+9fuSo3Y50qiq1ntS1T0Z4HJFktmRLizy5fTwdqW6reSE/am4S5pikRspXzvWvoPPESElza2grVi47Ny0WF3vnRdZvS+QahW1F9JvJwxBFBKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609813399; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1zdV2COLrOWhddqnsrvlyO9Xf6BG1jQJesmU0Mtodfo=; b=hyiC8rxaHUztoqLwsOO9RuAWqJSEoHG+/tr2wGYNOkfuxxH0Co9p03NlyheX1TD1zj22BtqSNlBFBcdLP9AOsTxd3dbXnnpQV/phHdqn9ex4UwswQvogN2S2KQJjdmR9rFDP2SpnMDdVZNYXZvOf4SjqQyUkOkBSXvHxZHLQZYE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609813399103639.0123776419215; Mon, 4 Jan 2021 18:23:19 -0800 (PST) Received: from localhost ([::1]:32846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwc0D-0002Pe-3H for importer@patchew.org; Mon, 04 Jan 2021 21:23:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwbyA-0000mz-O2 for qemu-devel@nongnu.org; Mon, 04 Jan 2021 21:21:10 -0500 Received: from mail-pf1-f172.google.com ([209.85.210.172]:41064) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwby6-0001y0-TM for qemu-devel@nongnu.org; Mon, 04 Jan 2021 21:21:10 -0500 Received: by mail-pf1-f172.google.com with SMTP id t8so17522593pfg.8 for ; Mon, 04 Jan 2021 18:21:01 -0800 (PST) Received: from localhost.localdomain ([73.93.154.186]) by smtp.gmail.com with ESMTPSA id y27sm57674386pfr.78.2021.01.04.18.20.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jan 2021 18:21:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1zdV2COLrOWhddqnsrvlyO9Xf6BG1jQJesmU0Mtodfo=; b=OuQLlx5J3Qaej3sBK1iIB+t/VlvusMWQJzBgzzidpKa+EMJMO7zgjdzWqg9g/cyo4H vXfgaKT2TjlgiQbs0WXVAPyUIqxePbq6NubNqJDAEwwHEN0pCasasPitKR8BJNthzHOh fyVWJ1SOw/qYdi3I5RDaiy6K2Mwayz4Z/PUs4dR8rsRRoCA3jH9oxtKyIg0NemNxI4qr uoK9m6S+R6q6I/DkTeUGJI1XmoWGC0Peae4bDAbe0ZC9yIqDVvrvBlfFDwQw8TeJo+SY Ib8RW6NuUVvUzNAywQ9nAOwqqDepjBGzyFtMETl6MTB16mCzU/+80Z89A4Xn6GT9PAMh liyQ== X-Gm-Message-State: AOAM531KP+/EvwpYbTdcSQ6eVDa3ByH2BapbFUue4FfTDgp2J3wslYZp /7pIRWGQowDwbVf2VAKGQJquaz11rLE= X-Google-Smtp-Source: ABdhPJyo1RLbtk+LmwvKR4HEaeKC4VwNHwB5a+63dCs6HP24WgyhEZVLw3U/9b6+C1vLvYW6gXPOOQ== X-Received: by 2002:a63:d18:: with SMTP id c24mr72613295pgl.442.1609813260372; Mon, 04 Jan 2021 18:21:00 -0800 (PST) From: Joelle van Dyne To: qemu-devel@nongnu.org Subject: [PATCH v6 2/7] configure: cross-compiling with empty cross_prefix Date: Mon, 4 Jan 2021 18:20:50 -0800 Message-Id: <20210105022055.12113-3-j@getutm.app> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210105022055.12113-1-j@getutm.app> References: <20210105022055.12113-1-j@getutm.app> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=209.85.210.172; envelope-from=osy86github@gmail.com; helo=mail-pf1-f172.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Bolshakov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Joelle van Dyne Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The iOS toolchain does not use the host prefix naming convention. So we need to enable cross-compile options while allowing the PREFIX to be blank. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Joelle van Dyne --- configure | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 7cd2ee0b9c..744d1990be 100755 --- a/configure +++ b/configure @@ -234,6 +234,7 @@ cpu=3D"" iasl=3D"iasl" interp_prefix=3D"/usr/gnemul/qemu-%M" static=3D"no" +cross_compile=3D"no" cross_prefix=3D"" audio_drv_list=3D"" block_drv_rw_whitelist=3D"" @@ -461,6 +462,7 @@ for opt do optarg=3D$(expr "x$opt" : 'x[^=3D]*=3D\(.*\)') case "$opt" in --cross-prefix=3D*) cross_prefix=3D"$optarg" + cross_compile=3D"yes" ;; --cc=3D*) CC=3D"$optarg" ;; @@ -1674,7 +1676,7 @@ $(echo Deprecated targets: $deprecated_targets_list |= \ --target-list-exclude=3DLIST exclude a set of targets from the default t= arget-list =20 Advanced options (experts only): - --cross-prefix=3DPREFIX use PREFIX for compile tools [$cross_prefix] + --cross-prefix=3DPREFIX use PREFIX for compile tools, PREFIX can be b= lank [$cross_prefix] --cc=3DCC use C compiler CC [$cc] --iasl=3DIASL use ACPI compiler IASL [$iasl] --host-cc=3DCC use C compiler CC [$host_cc] for code run at @@ -6963,7 +6965,7 @@ if has $sdl2_config; then fi echo "strip =3D [$(meson_quote $strip)]" >> $cross echo "windres =3D [$(meson_quote $windres)]" >> $cross -if test -n "$cross_prefix"; then +if test "$cross_compile" =3D "yes"; then cross_arg=3D"--cross-file config-meson.cross" echo "[host_machine]" >> $cross if test "$mingw32" =3D "yes" ; then --=20 2.28.0 From nobody Sun Feb 8 21:22:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609813530; cv=none; d=zohomail.com; s=zohoarc; b=kO4N54Uho+OITX9nENqOj+qBJeHsRJpukBE8vz88OaOc0WiKNmFIAesGrSXWmr+5l90aMI1uoiVy+DKfKZtT7gbKJ9PvRMcUg9B8GdQ1CNnBvOh5G3JAMcGL7JZpY7vyB3UbOzztrLq91FUyF+v8p7c2sEzJZYgXj9NtW1y75B0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609813530; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xcmmNnx5sKD4ruzOX0lhQ8usYfBuywgyniQ6FiHnrzc=; b=hcs5gC9RqnJTQrpX6zziJMYvZKkLUmyj5EL50bMAfqye5+kUn40tad8Hy8obgokqYjs6MWIP3W4Vv5WbTjuoehHYH9YLXMcA/vjWp+NQpIzqBqVeVkXEanz+l4fEIDESiJOUWF69FbunSrYQ36Ppl+WgoQ7sHBzgmi2xrvV3eIU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609813530489782.412912136059; Mon, 4 Jan 2021 18:25:30 -0800 (PST) Received: from localhost ([::1]:40386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwc2L-0005Q0-BC for importer@patchew.org; Mon, 04 Jan 2021 21:25:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwbyE-0000nF-VL; Mon, 04 Jan 2021 21:21:15 -0500 Received: from mail-pl1-f176.google.com ([209.85.214.176]:41862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwby9-0001y8-P3; Mon, 04 Jan 2021 21:21:12 -0500 Received: by mail-pl1-f176.google.com with SMTP id y8so15548274plp.8; Mon, 04 Jan 2021 18:21:03 -0800 (PST) Received: from localhost.localdomain ([73.93.154.186]) by smtp.gmail.com with ESMTPSA id y27sm57674386pfr.78.2021.01.04.18.21.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jan 2021 18:21:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xcmmNnx5sKD4ruzOX0lhQ8usYfBuywgyniQ6FiHnrzc=; b=Qf6TwTToEYp5gbe92hJIkfNRohBifV31aJsTQpZSNgnOytHSSFKCnIIGU2qIo/mlEd 7aSmqCD1hfzIv16tTDCSo8vfYKuISVmWQMarM1OHF/izBC3KMQcljkSb3kzgERypkAlu PnJTC65XffxeTNp900mdJPLVnf+V33HJoHlibcpCAaSoUgxzmCOwz8RqINvLfMm2fhbk XQcQDPVf1QhrZVQC7TiILOQ5gVGF6jv7nE0jWW0sO5570sUqZ3A7zC9z6OIAB6WqPbOF dqyex+Fv/+wVxjw1+Mhc1Y7vD0N7AVATV0mcunwdt9BgPYRBZVgAuuNcXiOujIzY1rLD Kokg== X-Gm-Message-State: AOAM532wd9XBTECng8gm1UOfX0uJ6o4Y+23FJGadWOzxxiucSsLC223t RoBufGWyVp9+fCEZRjAlwXOd/xgV9xY= X-Google-Smtp-Source: ABdhPJxkn5IKv4acLiZpwlAb3lC0q+C3d4W4sGRPLxkZj4U8zRjDga21smMWilhRIZu6C55zE6bgVQ== X-Received: by 2002:a17:90a:4a4:: with SMTP id g33mr1738308pjg.221.1609813262071; Mon, 04 Jan 2021 18:21:02 -0800 (PST) From: Joelle van Dyne To: qemu-devel@nongnu.org Subject: [PATCH v6 3/7] qemu: add support for iOS host Date: Mon, 4 Jan 2021 18:20:51 -0800 Message-Id: <20210105022055.12113-4-j@getutm.app> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210105022055.12113-1-j@getutm.app> References: <20210105022055.12113-1-j@getutm.app> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=209.85.214.176; envelope-from=osy86github@gmail.com; helo=mail-pl1-f176.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Laurent Vivier , Thomas Huth , "open list:Block layer core" , Jason Wang , Michael Roth , Max Reitz , Roman Bolshakov , Joelle van Dyne , Paolo Bonzini , Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This introduces support for building for iOS hosts. When the correct Xcode toolchain is used, iOS host will be detected automatically. * block: disable features not supported by iOS sandbox * slirp: disable SMB features for iOS * osdep: disable system() calls for iOS Signed-off-by: Joelle van Dyne --- docs/devel/index.rst | 1 + docs/devel/ios.rst | 28 +++++++++++++++++++++++++++ configure | 43 ++++++++++++++++++++++++++++++++++++++++- meson.build | 2 +- include/qemu/osdep.h | 11 +++++++++++ block.c | 2 +- block/file-posix.c | 31 +++++++++++++++++------------ net/slirp.c | 16 +++++++-------- qga/commands-posix.c | 6 ++++++ MAINTAINERS | 7 +++++++ tests/qtest/meson.build | 7 +++---- 11 files changed, 127 insertions(+), 27 deletions(-) create mode 100644 docs/devel/ios.rst diff --git a/docs/devel/index.rst b/docs/devel/index.rst index f10ed77e4c..2cc8a13ebe 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -35,3 +35,4 @@ Contents: clocks qom block-coroutine-wrapper + ios diff --git a/docs/devel/ios.rst b/docs/devel/ios.rst new file mode 100644 index 0000000000..b4ab11bec1 --- /dev/null +++ b/docs/devel/ios.rst @@ -0,0 +1,28 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +iOS Support +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +To run qemu on the iOS platform, some modifications were required. Most of= the +modifications are conditioned on the ``CONFIG_IOS`` and configuration vari= able. + +Build support +------------- + +For the code to compile, certain changes in the block driver and the slirp +driver had to be made. There is no ``system()`` call, so it has been repla= ced +with an assertion error. There should be no code path that call system() f= rom +iOS. + +``ucontext`` support is broken on iOS. The implementation from ``libuconte= xt`` +is used instead. + +JIT support +----------- + +On iOS, allocating RWX pages require special entitlements not usually gran= ted to +apps. However, it is possible to use `bulletproof JIT`_ with a development +certificate. This means that we need to allocate one chunk of memory with = RX +permissions and then mirror map the same memory with RW permissions. We ge= nerate +code to the mirror mapping and execute the original mapping. + +.. _bulletproof JIT: https://www.blackhat.com/docs/us-16/materials/us-16-K= rstic.pdf diff --git a/configure b/configure index 744d1990be..c1a08f0171 100755 --- a/configure +++ b/configure @@ -560,6 +560,19 @@ EOF compile_object } =20 +check_ios() { + cat > $TMPC < $TMPC < @@ -602,7 +615,11 @@ elif check_define __DragonFly__ ; then elif check_define __NetBSD__; then targetos=3D'NetBSD' elif check_define __APPLE__; then - targetos=3D'Darwin' + if check_ios ; then + targetos=3D'iOS' + else + targetos=3D'Darwin' + fi else # This is a fatal error, but don't report it yet, because we # might be going to just print the --help text, or it might @@ -779,6 +796,22 @@ Darwin) # won't work when we're compiling with gcc as a C compiler. QEMU_CFLAGS=3D"-DOS_OBJECT_USE_OBJC=3D0 $QEMU_CFLAGS" ;; +iOS) + bsd=3D"yes" + darwin=3D"yes" + ios=3D"yes" + if [ "$cpu" =3D "x86_64" ] ; then + QEMU_CFLAGS=3D"-arch x86_64 $QEMU_CFLAGS" + QEMU_LDFLAGS=3D"-arch x86_64 $QEMU_LDFLAGS" + fi + host_block_device_support=3D"no" + audio_drv_list=3D"" + audio_possible_drivers=3D"" + QEMU_LDFLAGS=3D"-framework CoreFoundation $QEMU_LDFLAGS" + # Disable attempts to use ObjectiveC features in os/object.h since they + # won't work when we're compiling with gcc as a C compiler. + QEMU_CFLAGS=3D"-DOS_OBJECT_USE_OBJC=3D0 $QEMU_CFLAGS" +;; SunOS) solaris=3D"yes" make=3D"${MAKE-gmake}" @@ -5992,6 +6025,10 @@ if test "$darwin" =3D "yes" ; then echo "CONFIG_DARWIN=3Dy" >> $config_host_mak fi =20 +if test "$ios" =3D "yes" ; then + echo "CONFIG_IOS=3Dy" >> $config_host_mak +fi + if test "$solaris" =3D "yes" ; then echo "CONFIG_SOLARIS=3Dy" >> $config_host_mak fi @@ -6956,6 +6993,7 @@ echo "cpp_link_args =3D [${LDFLAGS:+$(meson_quote $LD= FLAGS)}]" >> $cross echo "[binaries]" >> $cross echo "c =3D [$(meson_quote $cc)]" >> $cross test -n "$cxx" && echo "cpp =3D [$(meson_quote $cxx)]" >> $cross +test -n "$objcc" && echo "objc =3D [$(meson_quote $objcc)]" >> $cross echo "ar =3D [$(meson_quote $ar)]" >> $cross echo "nm =3D [$(meson_quote $nm)]" >> $cross echo "pkgconfig =3D [$(meson_quote $pkg_config_exe)]" >> $cross @@ -6974,6 +7012,9 @@ if test "$cross_compile" =3D "yes"; then if test "$linux" =3D "yes" ; then echo "system =3D 'linux'" >> $cross fi + if test "$darwin" =3D "yes" ; then + echo "system =3D 'darwin'" >> $cross + fi case "$ARCH" in i386|x86_64) echo "cpu_family =3D 'x86'" >> $cross diff --git a/meson.build b/meson.build index 9a640d3407..ee333b7a94 100644 --- a/meson.build +++ b/meson.build @@ -181,7 +181,7 @@ if targetos =3D=3D 'windows' include_directories: include_directo= ries('.')) elif targetos =3D=3D 'darwin' coref =3D dependency('appleframeworks', modules: 'CoreFoundation') - iokit =3D dependency('appleframeworks', modules: 'IOKit') + iokit =3D dependency('appleframeworks', modules: 'IOKit', required: 'CON= FIG_IOS' not in config_host) cocoa =3D dependency('appleframeworks', modules: 'Cocoa', required: get_= option('cocoa')) elif targetos =3D=3D 'sunos' socket =3D [cc.find_library('socket'), diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index f9ec8c84e9..eb8d06cbf5 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -686,4 +686,15 @@ char *qemu_get_host_name(Error **errp); */ size_t qemu_get_host_physmem(void); =20 +/** + * iOS does not support system() so we replace it with an assertion failur= e. + */ +#ifdef CONFIG_IOS +#define system ios_does_not_support_system +static inline int ios_does_not_support_system(const char *command) +{ + assert(0); +} +#endif /* CONFIG_IOS */ + #endif diff --git a/block.c b/block.c index 8f177504d4..984a73a82c 100644 --- a/block.c +++ b/block.c @@ -54,7 +54,7 @@ #ifdef CONFIG_BSD #include #include -#ifndef __DragonFly__ +#if !defined(__DragonFly__) && !defined(CONFIG_IOS) #include #endif #endif diff --git a/block/file-posix.c b/block/file-posix.c index c34bb9fac1..9f556322e6 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -181,7 +181,17 @@ typedef struct BDRVRawReopenState { bool check_cache_dropped; } BDRVRawReopenState; =20 -static int fd_open(BlockDriverState *bs); +static int fd_open(BlockDriverState *bs) +{ + BDRVRawState *s =3D bs->opaque; + + /* this is just to ensure s->fd is sane (its called by io ops) */ + if (s->fd >=3D 0) { + return 0; + } + return -EIO; +} + static int64_t raw_getlength(BlockDriverState *bs); =20 typedef struct RawPosixAIOData { @@ -252,6 +262,12 @@ static int raw_normalize_devicepath(const char **filen= ame, Error **errp) } #endif =20 +#if defined(CONFIG_IOS) +static int probe_logical_blocksize(int fd, unsigned int *sector_size_p) +{ + return -ENOTSUP; /* not supported on iOS */ +} +#else /* CONFIG_IOS */ /* * Get logical block size via ioctl. On success store it in @sector_size_p. */ @@ -284,6 +300,7 @@ static int probe_logical_blocksize(int fd, unsigned int= *sector_size_p) =20 return success ? 0 : -errno; } +#endif /* !CONFIG_IOS */ =20 /** * Get physical block size of @fd. @@ -2307,7 +2324,7 @@ again: } if (size =3D=3D 0) #endif -#if defined(__APPLE__) && defined(__MACH__) +#if !defined(CONFIG_IOS) && defined(__APPLE__) && defined(__MACH__) { uint64_t sectors =3D 0; uint32_t sector_size =3D 0; @@ -3543,16 +3560,6 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long in= t req, void *buf) } #endif /* linux */ =20 -static int fd_open(BlockDriverState *bs) -{ - BDRVRawState *s =3D bs->opaque; - - /* this is just to ensure s->fd is sane (its called by io ops) */ - if (s->fd >=3D 0) - return 0; - return -EIO; -} - static coroutine_fn int hdev_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) { diff --git a/net/slirp.c b/net/slirp.c index 77042e6df7..8413042c09 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -27,7 +27,7 @@ #include "net/slirp.h" =20 =20 -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(CONFIG_IOS) #include #include #endif @@ -90,7 +90,7 @@ typedef struct SlirpState { Slirp *slirp; Notifier poll_notifier; Notifier exit_notifier; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(CONFIG_IOS) gchar *smb_dir; #endif GSList *fwd; @@ -103,7 +103,7 @@ static QTAILQ_HEAD(, SlirpState) slirp_stacks =3D static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **err= p); static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **e= rrp); =20 -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(CONFIG_IOS) static int slirp_smb(SlirpState *s, const char *exported_dir, struct in_addr vserver_addr, Error **errp); static void slirp_smb_cleanup(SlirpState *s); @@ -368,7 +368,7 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, struct in6_addr ip6_prefix; struct in6_addr ip6_host; struct in6_addr ip6_dns; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(CONFIG_IOS) struct in_addr smbsrv =3D { .s_addr =3D 0 }; #endif NetClientState *nc; @@ -478,7 +478,7 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, return -1; } =20 -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(CONFIG_IOS) if (vsmbserver && !inet_aton(vsmbserver, &smbsrv)) { error_setg(errp, "Failed to parse SMB address"); return -1; @@ -593,7 +593,7 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, } } } -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(CONFIG_IOS) if (smb_export) { if (slirp_smb(s, smb_export, smbsrv, errp) < 0) { goto error; @@ -785,7 +785,7 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict) =20 } =20 -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(CONFIG_IOS) =20 /* automatic user mode samba server configuration */ static void slirp_smb_cleanup(SlirpState *s) @@ -900,7 +900,7 @@ static int slirp_smb(SlirpState* s, const char *exporte= d_dir, return 0; } =20 -#endif /* !defined(_WIN32) */ +#endif /* !defined(_WIN32) && !defined(CONFIG_IOS) */ =20 static int guestfwd_can_read(void *opaque) { diff --git a/qga/commands-posix.c b/qga/commands-posix.c index c089e38120..81e40ac14a 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -34,6 +34,12 @@ =20 #ifndef CONFIG_HAS_ENVIRON #ifdef __APPLE__ +#include "TargetConditionals.h" +#if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR +#define APPLE_USE_CRT_EXTERNS +#endif +#endif +#ifdef APPLE_USE_CRT_EXTERNS #include #define environ (*_NSGetEnviron()) #else diff --git a/MAINTAINERS b/MAINTAINERS index ce5ef9bde6..3baf289a1d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -538,6 +538,13 @@ F: include/*/*win32* X: qga/*win32* F: qemu.nsi =20 +IOS +M: Joelle van Dyne +S: Maintained +K: ^Subject:.*(?i)iOS +F: docs/devel/ios.rst +F: include/tcg/tcg-apple-jit.h + Alpha Machines -------------- M: Richard Henderson diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 6a67c538be..42b46a7ca4 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -46,12 +46,11 @@ qtests_i386 =3D \ (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-swtpm-test= '] : []) + \ (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['rtl8139-test'] : [= ]) + \ + (not config_host.has_key('CONFIG_IOS') ? ['bios-tables-test', 'hd-geo-te= st'] : []) + \ qtests_pci + = \ ['fdc-test', 'ide-test', - 'hd-geo-test', 'boot-order-test', - 'bios-tables-test', 'rtc-test', 'i440fx-test', 'fuzz-test', @@ -148,9 +147,9 @@ qtests_arm =3D \ 'boot-serial-test', 'hexloader-test'] =20 -# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-tes= t unconditional +# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-tes= t unconditional (except on iOS) qtests_aarch64 =3D \ - (cpu !=3D 'arm' ? ['bios-tables-test'] : []) + = \ + (cpu !=3D 'arm' and not config_host.has_key('CONFIG_IOS') ? ['bios-table= s-test'] : []) + \ (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-= test'] : []) + \ (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-= swtpm-test'] : []) + \ ['arm-cpu-features', --=20 2.28.0 From nobody Sun Feb 8 21:22:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609813519; cv=none; d=zohomail.com; s=zohoarc; b=hH1Vxv82QSoij56VX62IcpssIDjzyMrhSXBTNlCCqbUSu3nFKGX8Qn4RR/rBFNLggK8CzNvtvb0ofjSeHvChXHILPJ8SjBaCk2takCR8pUx//fLuQbcQRGhOWj1p7tQOivZaQizJgAOD4VBopNMN7wZScQrn4CrWrp44PNqzlMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609813519; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v5BNWwkrmsr0+1jr5dkAm77cFUsSTxwd9AJb5H3W96g=; b=PgnSmCpGJ9NwBxMGstGFJT/iGN2DbdskciZ8UMJxjDiC8qSM43CWRPaQZziC2RPpvvmJH0HAyJULQFwNlsM8THqMZA85JiM/80BmN66eDaUnkhGiheqOIm9TIzu0A3ReJwyDg4SQfRkn4Gr2+FE9/BgFnif6QwL6P586uYfVvIU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609813519301550.9066186122798; Mon, 4 Jan 2021 18:25:19 -0800 (PST) Received: from localhost ([::1]:39924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwc29-0005Es-Vj for importer@patchew.org; Mon, 04 Jan 2021 21:25:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwbyE-0000nG-Vo for qemu-devel@nongnu.org; Mon, 04 Jan 2021 21:21:15 -0500 Received: from mail-pg1-f176.google.com ([209.85.215.176]:42647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwbyA-0001zh-5x for qemu-devel@nongnu.org; Mon, 04 Jan 2021 21:21:12 -0500 Received: by mail-pg1-f176.google.com with SMTP id g15so20309141pgu.9 for ; Mon, 04 Jan 2021 18:21:04 -0800 (PST) Received: from localhost.localdomain ([73.93.154.186]) by smtp.gmail.com with ESMTPSA id y27sm57674386pfr.78.2021.01.04.18.21.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jan 2021 18:21:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v5BNWwkrmsr0+1jr5dkAm77cFUsSTxwd9AJb5H3W96g=; b=YjWgUl4FmBV2bXmL1Tm8qutVeObO3mH5bxjQg8f9ULwHVn5B7XL+FzzlkAPsRx9dZP 0wzf2Sq7gDj5WD7BwHWupLwPEZaoVqhg29Hc+yOdSxGKeVKWxZ4ei64sEHBC45evOrt+ gLuf5Sjos0czHdn3L+SLX9ILr3KSXdjy5r8yQhyBzSZKQPOXzNjNgmTU4C6MLXUixR7K zz0PQhkdMF5sWsDabbRvbadNb8daXgy6uPtJf6Ms75xJPdij6caOlwVzrE3u+lVmHC9f WLCl4QQCo10rG9lUIFK8QxRgl+3CjKEhFfqVZNGy7Q6wQHFAHus/Cnt1p9AHnCzSfxr3 5wPw== X-Gm-Message-State: AOAM531eQW7uhv3+D6yUk4bD3OUBTYIIW0MibbWA/YmHwvshCUO5btHC Aw84/oYVg1rGXw5s1qxc6sCt61EpA6k= X-Google-Smtp-Source: ABdhPJzSAwsgsWglXpqN0n/X3ZsZwe2Rq38nXWuNCcwC4RWo3b1+ythfjPIR8jRoFELCt0ZDsX84oQ== X-Received: by 2002:a63:1401:: with SMTP id u1mr61580204pgl.229.1609813263330; Mon, 04 Jan 2021 18:21:03 -0800 (PST) From: Joelle van Dyne To: qemu-devel@nongnu.org Subject: [PATCH v6 4/7] coroutine: add libucontext as external library Date: Mon, 4 Jan 2021 18:20:52 -0800 Message-Id: <20210105022055.12113-5-j@getutm.app> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210105022055.12113-1-j@getutm.app> References: <20210105022055.12113-1-j@getutm.app> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=209.85.215.176; envelope-from=osy86github@gmail.com; helo=mail-pg1-f176.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Roman Bolshakov , Joelle van Dyne , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" iOS does not support ucontext natively for aarch64 and the sigaltstack is also unsupported (even worse, it fails silently, see: https://openradar.appspot.com/13002712 ) As a workaround we include a library implementation of ucontext and add it as a build option. Signed-off-by: Joelle van Dyne --- configure | 23 ++++++++++++++++++++--- meson.build | 11 ++++++++++- util/coroutine-ucontext.c | 9 +++++++++ .gitmodules | 3 +++ meson_options.txt | 2 ++ subprojects/libucontext | 1 + 6 files changed, 45 insertions(+), 4 deletions(-) create mode 160000 subprojects/libucontext diff --git a/configure b/configure index c1a08f0171..09dd22ebad 100755 --- a/configure +++ b/configure @@ -1767,7 +1767,7 @@ Advanced options (experts only): --oss-lib path to OSS library --cpu=3DCPU Build for host CPU [$cpu] --with-coroutine=3DBACKEND coroutine backend. Supported options: - ucontext, sigaltstack, windows + ucontext, libucontext, sigaltstack, windows --enable-gcov enable test coverage analysis with gcov --disable-blobs disable installing provided firmware blobs --with-vss-sdk=3DSDK-path enable Windows VSS support in QEMU Guest Agent @@ -4913,6 +4913,8 @@ if test "$coroutine" =3D ""; then coroutine=3Dwin32 elif test "$ucontext_works" =3D "yes"; then coroutine=3Ducontext + elif test "$ios" =3D "yes"; then + coroutine=3Dlibucontext else coroutine=3Dsigaltstack fi @@ -4936,12 +4938,27 @@ else error_exit "only the 'windows' coroutine backend is valid for Window= s" fi ;; + libucontext) + ;; *) error_exit "unknown coroutine backend $coroutine" ;; esac fi =20 +case $coroutine in +libucontext) + git_submodules=3D"${git_submodules} subprojects/libucontext" + mkdir -p libucontext + coroutine_impl=3Ducontext + libucontext=3D"enabled" + ;; +*) + coroutine_impl=3D$coroutine + libucontext=3D"disabled" + ;; +esac + if test "$coroutine_pool" =3D ""; then coroutine_pool=3Dyes fi @@ -6487,7 +6504,7 @@ if test "$rbd" =3D "yes" ; then echo "RBD_LIBS=3D$rbd_libs" >> $config_host_mak fi =20 -echo "CONFIG_COROUTINE_BACKEND=3D$coroutine" >> $config_host_mak +echo "CONFIG_COROUTINE_BACKEND=3D$coroutine_impl" >> $config_host_mak if test "$coroutine_pool" =3D "yes" ; then echo "CONFIG_COROUTINE_POOL=3D1" >> $config_host_mak else @@ -7069,7 +7086,7 @@ NINJA=3D$ninja $meson setup \ -Dcocoa=3D$cocoa -Dmpath=3D$mpath -Dsdl=3D$sdl -Dsdl_image=3D$sdl_= image \ -Dvnc=3D$vnc -Dvnc_sasl=3D$vnc_sasl -Dvnc_jpeg=3D$vnc_jpeg -Dvnc_p= ng=3D$vnc_png \ -Dgettext=3D$gettext -Dxkbcommon=3D$xkbcommon -Du2f=3D$u2f -Dvirti= ofsd=3D$virtiofsd \ - -Dcapstone=3D$capstone -Dslirp=3D$slirp -Dfdt=3D$fdt \ + -Dcapstone=3D$capstone -Dslirp=3D$slirp -Dfdt=3D$fdt -Ducontext=3D= $libucontext \ -Diconv=3D$iconv -Dcurses=3D$curses -Dlibudev=3D$libudev\ -Ddocs=3D$docs -Dsphinx_build=3D$sphinx_build -Dinstall_blobs=3D$b= lobs \ -Dvhost_user_blk_server=3D$vhost_user_blk_server \ diff --git a/meson.build b/meson.build index ee333b7a94..900dbc36c8 100644 --- a/meson.build +++ b/meson.build @@ -1308,9 +1308,17 @@ if not fdt.found() and fdt_required.length() > 0 error('fdt not available but required by targets ' + ', '.join(fdt_requi= red)) endif =20 +ucontext =3D dependency('libucontext', required : false) +if not ucontext.found() and get_option('ucontext').enabled() + libucontext_proj =3D subproject('libucontext', + default_options: ['freestanding=3Dtrue']) + ucontext =3D libucontext_proj.get_variable('libucontext_dep') +endif + config_host_data.set('CONFIG_CAPSTONE', capstone.found()) config_host_data.set('CONFIG_FDT', fdt.found()) config_host_data.set('CONFIG_SLIRP', slirp.found()) +config_host_data.set('CONFIG_LIBUCONTEXT', ucontext.found()) =20 ##################### # Generated sources # @@ -1528,7 +1536,7 @@ util_ss.add_all(trace_ss) util_ss =3D util_ss.apply(config_all, strict: false) libqemuutil =3D static_library('qemuutil', sources: util_ss.sources() + stub_ss.sources(= ) + genh, - dependencies: [util_ss.dependencies(), m, gli= b, socket, malloc]) + dependencies: [util_ss.dependencies(), m, gli= b, socket, malloc, ucontext]) qemuutil =3D declare_dependency(link_with: libqemuutil, sources: genh + version_res) =20 @@ -2188,6 +2196,7 @@ if targetos =3D=3D 'windows' summary_info +=3D {'QGA MSI support': config_host.has_key('CONFIG_QGA_= MSI')} endif summary_info +=3D {'seccomp support': config_host.has_key('CONFIG_SECCOM= P')} +summary_info +=3D {'libucontext support': ucontext.found()} summary_info +=3D {'coroutine backend': config_host['CONFIG_COROUTINE_BACK= END']} summary_info +=3D {'coroutine pool': config_host['CONFIG_COROUTINE_POOL= '] =3D=3D '1'} summary_info +=3D {'debug stack usage': config_host.has_key('CONFIG_DEBUG_= STACK_USAGE')} diff --git a/util/coroutine-ucontext.c b/util/coroutine-ucontext.c index 904b375192..220c57a743 100644 --- a/util/coroutine-ucontext.c +++ b/util/coroutine-ucontext.c @@ -23,7 +23,16 @@ #undef _FORTIFY_SOURCE #endif #include "qemu/osdep.h" +#if defined(CONFIG_LIBUCONTEXT) +#include +#define ucontext_t libucontext_ucontext_t +#define getcontext libucontext_getcontext +#define setcontext libucontext_setcontext +#define swapcontext libucontext_swapcontext +#define makecontext libucontext_makecontext +#else #include +#endif #include "qemu/coroutine_int.h" =20 #ifdef CONFIG_VALGRIND_H diff --git a/.gitmodules b/.gitmodules index 2bdeeacef8..4f02eed79a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -64,3 +64,6 @@ [submodule "roms/vbootrom"] path =3D roms/vbootrom url =3D https://git.qemu.org/git/vbootrom.git +[submodule "libucontext"] + path =3D subprojects/libucontext + url =3D https://github.com/utmapp/libucontext.git diff --git a/meson_options.txt b/meson_options.txt index 74ac853548..0a93bccea3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -70,6 +70,8 @@ option('fuse', type: 'feature', value: 'auto', description: 'FUSE block device export') option('fuse_lseek', type : 'feature', value : 'auto', description: 'SEEK_HOLE/SEEK_DATA support for FUSE exports') +option('ucontext', type : 'feature', value : 'disabled', + description: 'libucontext support') =20 option('capstone', type: 'combo', value: 'auto', choices: ['disabled', 'enabled', 'auto', 'system', 'internal'], diff --git a/subprojects/libucontext b/subprojects/libucontext new file mode 160000 index 0000000000..fc3b5e724e --- /dev/null +++ b/subprojects/libucontext @@ -0,0 +1 @@ +Subproject commit fc3b5e724e21c2c01e2c93b344ab0e34b5a6649b --=20 2.28.0 From nobody Sun Feb 8 21:22:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609813622; cv=none; d=zohomail.com; s=zohoarc; b=XjAWuEOm/sehlMLeS41B1XrIWfcLoBd0wSvJp6eB+R0+2NaamxA1KmP96LGg24Dd9w7mfW08hXDASKrPmIExoXkTVeHoeDl7vtIndfWyOCuOwPoKELUUHv309i3DwFgwH+OHKe+6xw54aMxd6yYXDq7w3fLElxKdOFlBRDIs9Ww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609813622; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yAXoghHf8NZM+SSeWXlvSfABz7ORBxz555YpOU/PWJo=; b=Jyy4/391vYlX5WkCojYMs/2Sq1YTLdTHblGMnpCGVy9slNdWnCIPt4gvV2Xxb7/qdc0JG/rbeR8K9tX0EoYoi0P8kh+8LYvMTr6O2HB0En18wmWGOgaGKrgjzxVTOwGG4lXLJhXfBYvd/FSEYrYMsRYTCSmViWBdttpdLJfj/PY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609813622793575.4184092033196; Mon, 4 Jan 2021 18:27:02 -0800 (PST) Received: from localhost ([::1]:44240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwc3p-000739-Ok for importer@patchew.org; Mon, 04 Jan 2021 21:27:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwbyE-0000nI-WF for qemu-devel@nongnu.org; Mon, 04 Jan 2021 21:21:15 -0500 Received: from mail-pf1-f172.google.com ([209.85.210.172]:45442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwby9-000204-E6 for qemu-devel@nongnu.org; Mon, 04 Jan 2021 21:21:11 -0500 Received: by mail-pf1-f172.google.com with SMTP id q22so17506140pfk.12 for ; Mon, 04 Jan 2021 18:21:05 -0800 (PST) Received: from localhost.localdomain ([73.93.154.186]) by smtp.gmail.com with ESMTPSA id y27sm57674386pfr.78.2021.01.04.18.21.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jan 2021 18:21:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yAXoghHf8NZM+SSeWXlvSfABz7ORBxz555YpOU/PWJo=; b=MN1NxGJLSyZKD0UhDh94JQyQ/YHQAHWIFYjp9PyYEfYf7qMbIw0GnAHjxX5hvX/OQC CM/cL4B2XfTzd6Ikw/pnq7UlmwATvp0WZjoXGVedH0Cgjq/NeCfXqbB1aZjvsSl8e3CL YWenTgdPM5f8L+ZHni5wTjDrInqad/zgBask6eboKvlVX9AkaDnFJxn4CNFcPpHUzuyI kUFB+raIMwOvVfL0u0D+441zEm1dvg1XCgY/bjMSy9vWGqq8V6Ex/JGqJYWyuOhn0Xsm UYqg9z3N7ixMiRHcQPvvhsPu7a79BeU47eVxKgj3G3I5tPM9c7Yydapb3FSjH+ACfKxI wu4w== X-Gm-Message-State: AOAM532JSTTVrHuzdGsn+fsiu5gGa2lhVosADFMPdvB1sWo2WQY4Ib+u 2xh2w76iustwjkRGjdpNcFkSDgrgEIw= X-Google-Smtp-Source: ABdhPJzVzSe8hPs2AFgyi8gdTg/IPqNLWNl68c0OIAjIwcQbo86XUnqkcUWvunjYuLxZlUYIYrrw0A== X-Received: by 2002:a63:d041:: with SMTP id s1mr62739783pgi.249.1609813264315; Mon, 04 Jan 2021 18:21:04 -0800 (PST) From: Joelle van Dyne To: qemu-devel@nongnu.org Subject: [PATCH v6 5/7] configure: cross compile should use x86_64 cpu_family Date: Mon, 4 Jan 2021 18:20:53 -0800 Message-Id: <20210105022055.12113-6-j@getutm.app> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210105022055.12113-1-j@getutm.app> References: <20210105022055.12113-1-j@getutm.app> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=209.85.210.172; envelope-from=osy86github@gmail.com; helo=mail-pf1-f172.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Bolshakov , Joelle van Dyne Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Joelle van Dyne Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 09dd22ebad..79dc9811e8 100755 --- a/configure +++ b/configure @@ -7033,9 +7033,12 @@ if test "$cross_compile" =3D "yes"; then echo "system =3D 'darwin'" >> $cross fi case "$ARCH" in - i386|x86_64) + i386) echo "cpu_family =3D 'x86'" >> $cross ;; + x86_64) + echo "cpu_family =3D 'x86_64'" >> $cross + ;; ppc64le) echo "cpu_family =3D 'ppc64'" >> $cross ;; --=20 2.28.0 From nobody Sun Feb 8 21:22:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609813398; cv=none; d=zohomail.com; s=zohoarc; b=MJ9eMg8a6f55tUZ9P2xeBxqaR0PorcFQk43F1KGC+ZfPjHlU/Go8XI4BiqEAEDL8uMw9miSaPtXt1fd1bHXcYjJ8Tr59PPjmMr7To4OKjM/Qtd+boEPCin3oo+a9rFi7bWGGHNtLLoS7uURCMjD6LRXHpGT7j575CoIgoMIgbAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609813398; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V9kFQE4hJuNgJVApR0o9VqLxa8LiAtZL/Wn+gwDxVWA=; b=EIKDoE8AtNTwCGnKJ6iuKJpMK1g+Nk95tI49G4agCvIzktxHyA9C/dmruThTGxPcz4KakxwH3F1LmYcAO9d7hgsIm3Tumrm55lFu7mofNcwO4bq4iMV/pcsxKO4s+gykr6LG5o2YwruYSNiwkLhD6vYU7fHuJJLV1XwlokvcMdk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609813398922231.09757406024835; Mon, 4 Jan 2021 18:23:18 -0800 (PST) Received: from localhost ([::1]:32890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwc0D-0002QX-4Q for importer@patchew.org; Mon, 04 Jan 2021 21:23:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwbyE-0000nE-VG for qemu-devel@nongnu.org; Mon, 04 Jan 2021 21:21:15 -0500 Received: from mail-pf1-f179.google.com ([209.85.210.179]:45450) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwby9-00020h-EL for qemu-devel@nongnu.org; Mon, 04 Jan 2021 21:21:11 -0500 Received: by mail-pf1-f179.google.com with SMTP id q22so17506170pfk.12 for ; Mon, 04 Jan 2021 18:21:06 -0800 (PST) Received: from localhost.localdomain ([73.93.154.186]) by smtp.gmail.com with ESMTPSA id y27sm57674386pfr.78.2021.01.04.18.21.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jan 2021 18:21:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V9kFQE4hJuNgJVApR0o9VqLxa8LiAtZL/Wn+gwDxVWA=; b=S6PvgYs3uK4epWCu6BokH3oO5imQAAGm77FqxMeLTFMxorpheubUnSFLKqUzXqMorC FaaGoaO2+v02YjoICzp9RptV+0DF7cPYHQuT96V/08Dg7hE7JkUQRoEy8Ekr+bEPWoh9 c/+wISoYMatIYLMVhuprC8RDyDMMFyjixDGrm/VrxKy1N8x9HGoMlAU89lQ1WOgWJrgU 76wPSPFKwy0rZwATrQREgevxoEcAqZozDiLEkLHaRbWHv7VRCvJU2vgKTCX9kxQWHKq8 7Tncz6eA06xcENs9RVSzeXmUA3fUkyLtDTnBs3/KkmGaYUonpWnjJefLKvr9PBAvQMzo NPCQ== X-Gm-Message-State: AOAM531Ln+w++O6LK6fVx4Ptg+UORFccExPMMQga3GQWSVxu1QdZs8Uf 8hL4WCgDWm0KMfSOKZMXT8hAqW++Y98= X-Google-Smtp-Source: ABdhPJzejx6CXr8UCZ+NW3uPMdBRBLhiQG4pozpYXQlZxl95TPXgC3URx2yYUyuPflkYiYEkado1eg== X-Received: by 2002:a63:1626:: with SMTP id w38mr72860661pgl.278.1609813265710; Mon, 04 Jan 2021 18:21:05 -0800 (PST) From: Joelle van Dyne To: qemu-devel@nongnu.org Subject: [PATCH v6 6/7] slirp: update build flags for iOS resolv fix Date: Mon, 4 Jan 2021 18:20:54 -0800 Message-Id: <20210105022055.12113-7-j@getutm.app> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210105022055.12113-1-j@getutm.app> References: <20210105022055.12113-1-j@getutm.app> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=209.85.210.179; envelope-from=osy86github@gmail.com; helo=mail-pf1-f179.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Bolshakov , Joelle van Dyne , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" A future libslirp update will use libresolv on Darwin systems, so we add the flags in QEMU build now. Reviewed-by: Stefan Hajnoczi Signed-off-by: Joelle van Dyne --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index 900dbc36c8..d8951d4d6c 100644 --- a/meson.build +++ b/meson.build @@ -1205,6 +1205,8 @@ if have_system slirp_deps =3D [] if targetos =3D=3D 'windows' slirp_deps =3D cc.find_library('iphlpapi') + elif targetos =3D=3D 'darwin' + slirp_deps =3D cc.find_library('resolv') endif slirp_conf =3D configuration_data() slirp_conf.set('SLIRP_MAJOR_VERSION', meson.project_version().split('.= ')[0]) --=20 2.28.0 From nobody Sun Feb 8 21:22:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609813630; cv=none; d=zohomail.com; s=zohoarc; b=Vsr933i7hBZ42vSE2gBcC/0B8RUzqGO68+qlFjXpZ7qjlQb2NJow4rJjF4JdXtQDO2KcJI28AeB+Il65N6CkIvaC9Qu5+RobSQ63w5Mv8LiGYkFtl3IhIAAf1HoulqGHoPW/kTZMcQi1R2M9qQMdtbLxs2S9hR1IIGDl2E7gHtQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609813630; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2beqqzeGhDVR66ppVSfUzIPL472cxrqAoVT6lzv9HXY=; b=SXCCuPxu2QTToqlbJ+Y8Y2J6cEvssJ2GRx2H9IgLMMy2pTXqmH7Oa1g8OsIETVzElVuuPu5gD1s5FC2KLw6NZwrf/OQo8xl7PtTgAXkvdBzN5N/Pr5NLU5eXDmDrRb8nUvM+Q9VSO4dz/x8hQR/5XgRLM3L59/T7qz6DvrzyF7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609813630593567.1627059863304; Mon, 4 Jan 2021 18:27:10 -0800 (PST) Received: from localhost ([::1]:44730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwc3x-0007GK-DS for importer@patchew.org; Mon, 04 Jan 2021 21:27:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwbyG-0000nQ-2f; Mon, 04 Jan 2021 21:21:16 -0500 Received: from mail-pf1-f178.google.com ([209.85.210.178]:44168) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwbyA-000218-S4; Mon, 04 Jan 2021 21:21:15 -0500 Received: by mail-pf1-f178.google.com with SMTP id a188so4849795pfa.11; Mon, 04 Jan 2021 18:21:07 -0800 (PST) Received: from localhost.localdomain ([73.93.154.186]) by smtp.gmail.com with ESMTPSA id y27sm57674386pfr.78.2021.01.04.18.21.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jan 2021 18:21:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2beqqzeGhDVR66ppVSfUzIPL472cxrqAoVT6lzv9HXY=; b=rLjpICn6GH8KT+vDp+TQE8KpBfzbHPkraC+oh4oWMymr7ZwlXGvyQJKww3rTAxY3H1 bqxwbRBmSrfgGrG/bmHLSXKoF4UEiNsF0Nv2FNxpE8CUlXqdKLQ6V1Z7gq/t1Vg6nj/6 gd0g52GXvwuHtIMb66PmcjBH3Ar4qIZf9B2uTU9T77Pk4uxacNve/9d8H9UCcjHv2DW0 rZ+SS3x5y8EjJP7t66RnfyLzU+nqQKBIF2cMiZmm4bQz6Bo9R8CQ/IjyDs3AP7j16H5Q waYujbDBmH8lOOhwtZEfEIB0Aon9qTuPh7Ai7/yqVuPRbjlboCQutj63nCwrklTfQOI9 Agww== X-Gm-Message-State: AOAM531Vx/n4X6Zkxx+c2TYut26RznquLqCQfFesY3GlzoSPgfyaentz akF7Mrw/J7t/mUJRbwwqnEqN20c8x48= X-Google-Smtp-Source: ABdhPJyoUpWlEImryPuPMXtw6Auz0GT4ete79/haeGmotxXm2ha+BhzkNUEm5hku+WmM8t2rxSH2hg== X-Received: by 2002:aa7:8159:0:b029:1a5:54e4:7cf2 with SMTP id d25-20020aa781590000b02901a554e47cf2mr45214006pfn.69.1609813266858; Mon, 04 Jan 2021 18:21:06 -0800 (PST) From: Joelle van Dyne To: qemu-devel@nongnu.org Subject: [PATCH v6 7/7] block: check availablity for preadv/pwritev on mac Date: Mon, 4 Jan 2021 18:20:55 -0800 Message-Id: <20210105022055.12113-8-j@getutm.app> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210105022055.12113-1-j@getutm.app> References: <20210105022055.12113-1-j@getutm.app> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=209.85.210.178; envelope-from=osy86github@gmail.com; helo=mail-pf1-f178.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Roman Bolshakov , Joelle van Dyne , "open list:raw" , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" macOS 11/iOS 14 added preadv/pwritev APIs. Due to weak linking, configure will succeed with CONFIG_PREADV even when targeting a lower OS version. We therefore need to check at run time if we can actually use these APIs. Signed-off-by: Joelle van Dyne --- block/file-posix.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 9f556322e6..f109e1f305 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1390,17 +1390,50 @@ static int handle_aiocb_flush(void *opaque) #ifdef CONFIG_PREADV =20 static bool preadv_present =3D true; +static bool preadv_checked; =20 static ssize_t qemu_preadv(int fd, const struct iovec *iov, int nr_iov, off_t offset) { +#ifdef CONFIG_DARWIN /* preadv introduced in macOS 11 */ + if (unlikely(!preadv_checked)) { + if (__builtin_available(macOS 11, iOS 14, watchOS 7, tvOS 14, *)) { + preadv_checked =3D true; + } else { + preadv_present =3D false; + return -ENOSYS; + } + } + /* Now we suppress the availability warning since we use the cached ch= eck */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability-new" + return preadv(fd, iov, nr_iov, offset); +#pragma clang diagnostic pop +#else /* CONFIG_DARWIN */ return preadv(fd, iov, nr_iov, offset); +#endif } =20 static ssize_t qemu_pwritev(int fd, const struct iovec *iov, int nr_iov, off_t offset) { +#ifdef CONFIG_DARWIN /* preadv introduced in macOS 11 */ + if (unlikely(!preadv_checked)) { + if (__builtin_available(macOS 11, iOS 14, watchOS 7, tvOS 14, *)) { + preadv_checked =3D true; + } else { + preadv_present =3D false; + return -ENOSYS; + } + } + /* Now we suppress the availability warning since we use the cached ch= eck */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability-new" + return pwritev(fd, iov, nr_iov, offset); +#pragma clang diagnostic pop +#else /* CONFIG_DARWIN */ return pwritev(fd, iov, nr_iov, offset); +#endif } =20 #else --=20 2.28.0