[PATCH v5 0/7] iOS and Apple Silicon host support

Joelle van Dyne posted 7 patches 3 years, 5 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201108232425.1705-1-j@getutm.app
Maintainers: Richard Henderson <rth@twiddle.net>, Laurent Vivier <lvivier@redhat.com>, Markus Armbruster <armbru@redhat.com>, Thomas Huth <thuth@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, Max Reitz <mreitz@redhat.com>, Eric Blake <eblake@redhat.com>, Jason Wang <jasowang@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Samuel Thibault <samuel.thibault@ens-lyon.org>, Joelle van Dyne <j@getutm.app>
There is a newer version of this series
docs/devel/index.rst        |  1 +
docs/devel/ios.rst          | 28 ++++++++++++
configure                   | 76 +++++++++++++++++++++++++++++---
meson.build                 | 33 +++++++++++++-
qapi/block-core.json        | 10 +++--
include/exec/exec-all.h     |  2 +
include/qemu/osdep.h        | 11 +++++
include/tcg/tcg-apple-jit.h | 86 +++++++++++++++++++++++++++++++++++++
include/tcg/tcg.h           |  3 ++
accel/tcg/cpu-exec-common.c |  2 +
accel/tcg/cpu-exec.c        |  2 +
accel/tcg/translate-all.c   | 46 ++++++++++++++++++++
block.c                     |  2 +-
block/file-posix.c          | 53 +++++++++++++++++------
net/slirp.c                 | 16 +++----
qga/commands-posix.c        |  6 +++
tcg/tcg.c                   |  4 ++
util/coroutine-ucontext.c   |  9 ++++
.gitmodules                 |  3 ++
MAINTAINERS                 |  7 +++
libucontext                 |  1 +
meson_options.txt           |  2 +
tests/qtest/meson.build     |  7 ++-
23 files changed, 373 insertions(+), 37 deletions(-)
create mode 100644 docs/devel/ios.rst
create mode 100644 include/tcg/tcg-apple-jit.h
create mode 160000 libucontext
[PATCH v5 0/7] iOS and Apple Silicon host support
Posted by Joelle van Dyne 3 years, 5 months ago
Based-on: 20201106032921.600200-1-richard.henderson@linaro.org
([PATCH v3 00/41] Mirror map JIT memory for TCG)

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` 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.
* 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 v5:

* Fixed some more instances of QAPI define of CONFIG_HOST_BLOCK_DEVICE
* Fixed libucontext build on newer version of GCC

Since v4:

* Updated QAPI schema for CONFIG_HOST_BLOCK_DEVICE
* Updated maintainers file for iOS host support
* Moved system() changes to osdep.h
* Fixed typo in libucontext meson.build change

Since v3:

* Moved mirror JIT support to a different patch set.
* Removed dependency on `pthread_jit_write_protect_np` because it was redundent
  and also crashes if called on a non-jailbroken iOS device.
* Removed `--enable-cross-compile` option
* Fixed checkpatch errors
* Fixed iOS build on master due to new test recently added which calls system()

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

Joelle van Dyne (7):
  configure: option to disable host block devices
  configure: cross-compiling with empty cross_prefix
  qemu: add support for iOS host
  coroutine: add libucontext as external library
  slirp: update build flags for iOS resolv fix
  tcg: implement JIT for iOS and Apple Silicon
  block: check availablity for preadv/pwritev on mac

 docs/devel/index.rst        |  1 +
 docs/devel/ios.rst          | 28 ++++++++++++
 configure                   | 76 +++++++++++++++++++++++++++++---
 meson.build                 | 33 +++++++++++++-
 qapi/block-core.json        | 10 +++--
 include/exec/exec-all.h     |  2 +
 include/qemu/osdep.h        | 11 +++++
 include/tcg/tcg-apple-jit.h | 86 +++++++++++++++++++++++++++++++++++++
 include/tcg/tcg.h           |  3 ++
 accel/tcg/cpu-exec-common.c |  2 +
 accel/tcg/cpu-exec.c        |  2 +
 accel/tcg/translate-all.c   | 46 ++++++++++++++++++++
 block.c                     |  2 +-
 block/file-posix.c          | 53 +++++++++++++++++------
 net/slirp.c                 | 16 +++----
 qga/commands-posix.c        |  6 +++
 tcg/tcg.c                   |  4 ++
 util/coroutine-ucontext.c   |  9 ++++
 .gitmodules                 |  3 ++
 MAINTAINERS                 |  7 +++
 libucontext                 |  1 +
 meson_options.txt           |  2 +
 tests/qtest/meson.build     |  7 ++-
 23 files changed, 373 insertions(+), 37 deletions(-)
 create mode 100644 docs/devel/ios.rst
 create mode 100644 include/tcg/tcg-apple-jit.h
 create mode 160000 libucontext

-- 
2.28.0


Re: [PATCH v5 0/7] iOS and Apple Silicon host support
Posted by Stefan Hajnoczi 3 years, 5 months ago
On Sun, Nov 08, 2020 at 03:24:17PM -0800, Joelle van Dyne wrote:
> Based-on: 20201106032921.600200-1-richard.henderson@linaro.org
> ([PATCH v3 00/41] Mirror map JIT memory for TCG)
> 
> 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` 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.
> * 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 v5:
> 
> * Fixed some more instances of QAPI define of CONFIG_HOST_BLOCK_DEVICE
> * Fixed libucontext build on newer version of GCC

I have pinged Software Freedom Conservancy about an opinion regarding
merging the reverse-engineered part. Hope to get a reply soon. You are
on CC so you'll see it.

QEMU is currently in freeze (fixes only, no new features) for the
upcoming 5.2 release. The development tree will open again at the start
of December:
https://wiki.qemu.org/Planning/5.2

The code looks good to me. Thank you!

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>