[PATCH RESEND v2 0/9] iOS and Apple Silicon host support

Joelle van Dyne posted 9 patches 3 years, 6 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201019051953.90107-1-j@getutm.app
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Huacai Chen <chenhc@lemote.com>, Paolo Bonzini <pbonzini@redhat.com>, Andrzej Zaborowski <balrogg@gmail.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, Samuel Thibault <samuel.thibault@ens-lyon.org>, Max Reitz <mreitz@redhat.com>, Alistair Francis <Alistair.Francis@wdc.com>, Chris Wulff <crwulff@gmail.com>, Laurent Vivier <laurent@vivier.eu>, Peter Maydell <peter.maydell@linaro.org>, Richard Henderson <rth@twiddle.net>, Palmer Dabbelt <palmer@dabbelt.com>, Kevin Wolf <kwolf@redhat.com>, Jason Wang <jasowang@redhat.com>, Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>, Aurelien Jarno <aurelien@aurel32.net>, Richard Henderson <richard.henderson@linaro.org>, Marek Vasut <marex@denx.de>, Stefan Weil <sw@weilnetz.de>, Thomas Huth <thuth@redhat.com>
There is a newer version of this series
docs/devel/ios.rst           |  40 +++++++++
configure                    | 104 ++++++++++++++++++++--
meson.build                  |  32 ++++++-
include/exec/exec-all.h      |  10 +++
include/sysemu/tcg.h         |   2 +-
include/tcg/tcg-apple-jit.h  |  85 ++++++++++++++++++
include/tcg/tcg.h            |  28 +++++-
tcg/aarch64/tcg-target.h     |  23 ++++-
tcg/arm/tcg-target.h         |   9 +-
tcg/i386/tcg-target.h        |  24 ++++-
tcg/mips/tcg-target.h        |   8 +-
tcg/ppc/tcg-target.h         |   8 +-
tcg/riscv/tcg-target.h       |   9 +-
tcg/s390/tcg-target.h        |  13 ++-
tcg/sparc/tcg-target.h       |   8 +-
tcg/tci/tcg-target.h         |   9 +-
accel/tcg/cpu-exec-common.c  |   2 +
accel/tcg/cpu-exec.c         |   9 +-
accel/tcg/tcg-all.c          |  27 +++++-
accel/tcg/translate-all.c    | 168 ++++++++++++++++++++++++++++++++---
block.c                      |   2 +-
block/file-posix.c           |  50 ++++++++---
bsd-user/main.c              |   2 +-
linux-user/main.c            |   2 +-
net/slirp.c                  |  16 ++--
qga/commands-posix.c         |   6 ++
target/arm/arm-semi.c        |   2 +
target/m68k/m68k-semi.c      |   2 +
target/nios2/nios2-semi.c    |   2 +
tcg/tcg.c                    |  64 ++++++++-----
util/coroutine-ucontext.c    |   9 ++
.gitmodules                  |   3 +
libucontext                  |   1 +
meson_options.txt            |   2 +
qemu-options.hx              |  11 +++
tcg/aarch64/tcg-target.c.inc |  48 ++++++----
tcg/arm/tcg-target.c.inc     |  33 ++++---
tcg/i386/tcg-target.c.inc    |  28 +++---
tcg/mips/tcg-target.c.inc    |  64 +++++++------
tcg/ppc/tcg-target.c.inc     |  55 +++++++-----
tcg/riscv/tcg-target.c.inc   |  51 ++++++-----
tcg/s390/tcg-target.c.inc    |  25 +++---
tcg/sparc/tcg-target.c.inc   |  33 ++++---
tcg/tcg-ldst.c.inc           |   2 +-
tcg/tcg-pool.c.inc           |   9 +-
tcg/tci/tcg-target.c.inc     |   8 +-
tests/qtest/meson.build      |   7 +-
47 files changed, 919 insertions(+), 236 deletions(-)
create mode 100644 docs/devel/ios.rst
create mode 100644 include/tcg/tcg-apple-jit.h
create mode 160000 libucontext
[PATCH RESEND v2 0/9] iOS and Apple Silicon host support
Posted by Joelle van Dyne 3 years, 6 months ago
These set of changes brings QEMU TCG to iOS devices and future Apple Silicon
devices. They were originally developed last year and have been working in the
UTM app. Recently, we ported the changes to master, re-wrote a lot of the build
script changes for meson, and broke up the patches into more distinct units.

A summary of the changes:

* `CONFIG_IOS` and `CONFIG_IOS_JIT` defined when building for iOS and
  iOS specific changes (as well as unsupported code) are gated behind it.
* A new dependency, libucontext is added since iOS does not have native ucontext
  and broken support for sigaltstack. libucontext is available as a new option
  for coroutine backend.
* On stock iOS devices, there is a workaround for running JIT code without
  any special entitlement. It requires the JIT region to be mirror mapped with
  one region RW and another one RX. To support this style of JIT, TCG is changed
  to support writing to a different code_ptr. These changes are gated by the
  `CONFIG_IOS_JIT`.
* For (recent) jailbroken iOS devices as well as upcoming Apple Silicon devices,
  there are new rules for applications supporting JIT (with the proper
  entitlement). These rules are implemented as well.

Since v2:

* Changed getting mirror pointer from a macro to inline functions
* Split constification of TCG code pointers to separate patch
* Removed slirp updates (will send future patch once slirp changes are in)
* Removed shared library patch (will send future patch)

-j

osy (9):
  configure: option to disable host block devices
  configure: cross-compiling without cross_prefix
  qemu: add support for iOS host
  coroutine: add libucontext as external library
  tcg: add const hints for code pointers
  tcg: implement mirror mapped JIT for iOS
  tcg: mirror mapping RWX pages for iOS optional
  tcg: support JIT on Apple Silicon
  block: check availablity for preadv/pwritev on mac

 docs/devel/ios.rst           |  40 +++++++++
 configure                    | 104 ++++++++++++++++++++--
 meson.build                  |  32 ++++++-
 include/exec/exec-all.h      |  10 +++
 include/sysemu/tcg.h         |   2 +-
 include/tcg/tcg-apple-jit.h  |  85 ++++++++++++++++++
 include/tcg/tcg.h            |  28 +++++-
 tcg/aarch64/tcg-target.h     |  23 ++++-
 tcg/arm/tcg-target.h         |   9 +-
 tcg/i386/tcg-target.h        |  24 ++++-
 tcg/mips/tcg-target.h        |   8 +-
 tcg/ppc/tcg-target.h         |   8 +-
 tcg/riscv/tcg-target.h       |   9 +-
 tcg/s390/tcg-target.h        |  13 ++-
 tcg/sparc/tcg-target.h       |   8 +-
 tcg/tci/tcg-target.h         |   9 +-
 accel/tcg/cpu-exec-common.c  |   2 +
 accel/tcg/cpu-exec.c         |   9 +-
 accel/tcg/tcg-all.c          |  27 +++++-
 accel/tcg/translate-all.c    | 168 ++++++++++++++++++++++++++++++++---
 block.c                      |   2 +-
 block/file-posix.c           |  50 ++++++++---
 bsd-user/main.c              |   2 +-
 linux-user/main.c            |   2 +-
 net/slirp.c                  |  16 ++--
 qga/commands-posix.c         |   6 ++
 target/arm/arm-semi.c        |   2 +
 target/m68k/m68k-semi.c      |   2 +
 target/nios2/nios2-semi.c    |   2 +
 tcg/tcg.c                    |  64 ++++++++-----
 util/coroutine-ucontext.c    |   9 ++
 .gitmodules                  |   3 +
 libucontext                  |   1 +
 meson_options.txt            |   2 +
 qemu-options.hx              |  11 +++
 tcg/aarch64/tcg-target.c.inc |  48 ++++++----
 tcg/arm/tcg-target.c.inc     |  33 ++++---
 tcg/i386/tcg-target.c.inc    |  28 +++---
 tcg/mips/tcg-target.c.inc    |  64 +++++++------
 tcg/ppc/tcg-target.c.inc     |  55 +++++++-----
 tcg/riscv/tcg-target.c.inc   |  51 ++++++-----
 tcg/s390/tcg-target.c.inc    |  25 +++---
 tcg/sparc/tcg-target.c.inc   |  33 ++++---
 tcg/tcg-ldst.c.inc           |   2 +-
 tcg/tcg-pool.c.inc           |   9 +-
 tcg/tci/tcg-target.c.inc     |   8 +-
 tests/qtest/meson.build      |   7 +-
 47 files changed, 919 insertions(+), 236 deletions(-)
 create mode 100644 docs/devel/ios.rst
 create mode 100644 include/tcg/tcg-apple-jit.h
 create mode 160000 libucontext

-- 
2.24.3 (Apple Git-128)


Re: [PATCH RESEND v2 0/9] iOS and Apple Silicon host support
Posted by no-reply@patchew.org 3 years, 6 months ago
Patchew URL: https://patchew.org/QEMU/20201019051953.90107-1-j@getutm.app/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20201019051953.90107-1-j@getutm.app
Subject: [PATCH RESEND v2 0/9] iOS and Apple Silicon host support

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20201019051953.90107-1-j@getutm.app -> patchew/20201019051953.90107-1-j@getutm.app
Switched to a new branch 'test'
9faec40 block: check availablity for preadv/pwritev on mac
86ad651 tcg: support JIT on Apple Silicon
29dfbc5 tcg: mirror mapping RWX pages for iOS optional
b114cca tcg: implement mirror mapped JIT for iOS
88d6dc4 tcg: add const hints for code pointers
dd2e464 coroutine: add libucontext as external library
49f3648 qemu: add support for iOS host
90e8d82 configure: cross-compiling without cross_prefix
01c26cd configure: option to disable host block devices

=== OUTPUT BEGIN ===
1/9 Checking commit 01c26cd84fe6 (configure: option to disable host block devices)
WARNING: architecture specific defines should be avoided
#22: FILE: block/file-posix.c:44:
+#if defined(CONFIG_HOST_BLOCK_DEVICE) && defined(__APPLE__) && (__MACH__)

total: 0 errors, 1 warnings, 61 lines checked

Patch 1/9 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
2/9 Checking commit 90e8d8255c14 (configure: cross-compiling without cross_prefix)
3/9 Checking commit 49f3648f7dad (qemu: add support for iOS host)
WARNING: architecture specific defines should be avoided
#27: FILE: block.c:56:
+#if !defined(__DragonFly__) && !defined(CONFIG_IOS)

ERROR: braces {} are necessary for all arms of this statement
#45: FILE: block/file-posix.c:189:
+    if (s->fd >= 0)
[...]

WARNING: architecture specific defines should be avoided
#79: FILE: block/file-posix.c:2325:
+#if !defined(CONFIG_IOS) && defined(__APPLE__) && defined(__MACH__)

WARNING: architecture specific defines should be avoided
#363: FILE: tcg/aarch64/tcg-target.h:151:
+#if defined(__APPLE__)

WARNING: architecture specific defines should be avoided
#369: FILE: tcg/aarch64/tcg-target.h:157:
+#if defined(__APPLE__)

total: 1 errors, 4 warnings, 316 lines checked

Patch 3/9 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

4/9 Checking commit dd2e4646744e (coroutine: add libucontext as external library)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#97: 
new file mode 160000

total: 0 errors, 1 warnings, 140 lines checked

Patch 4/9 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
5/9 Checking commit 88d6dc4d22eb (tcg: add const hints for code pointers)
6/9 Checking commit b114cca7a292 (tcg: implement mirror mapped JIT for iOS)
ERROR: externs should be avoided in .c files
#51: FILE: accel/tcg/translate-all.c:65:
+extern kern_return_t mach_vm_remap(vm_map_t target_task,

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#187: 
new file mode 100644

WARNING: architecture specific defines should be avoided
#416: FILE: tcg/aarch64/tcg-target.h:171:
+#if defined(__APPLE__)

WARNING: architecture specific defines should be avoided
#608: FILE: tcg/i386/tcg-target.h:209:
+#ifdef __APPLE__

WARNING: architecture specific defines should be avoided
#619: FILE: tcg/i386/tcg-target.h:220:
+#if defined(__APPLE__)

total: 1 errors, 4 warnings, 1285 lines checked

Patch 6/9 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

7/9 Checking commit 29dfbc56da64 (tcg: mirror mapping RWX pages for iOS optional)
8/9 Checking commit 86ad651f4ca1 (tcg: support JIT on Apple Silicon)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#206: 
new file mode 100644

WARNING: architecture specific defines should be avoided
#238: FILE: include/tcg/tcg-apple-jit.h:28:
+#if defined(__aarch64__) && defined(CONFIG_DARWIN)

total: 0 errors, 2 warnings, 259 lines checked

Patch 8/9 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
9/9 Checking commit 9faec405cec8 (block: check availablity for preadv/pwritev on mac)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20201019051953.90107-1-j@getutm.app/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com