Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2215614/?format=api
{ "id": 2215614, "url": "http://patchwork.ozlabs.org/api/patches/2215614/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260324204855.29759-2-mohamed@unpredictable.fr/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260324204855.29759-2-mohamed@unpredictable.fr>", "list_archive_url": null, "date": "2026-03-24T20:48:49", "name": "[RFC,v7,1/7] vmapple: apple-gfx: make it work on the latest macOS release", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f7f465df5a45612921b2f4f6a4cd70fe2a76b310", "submitter": { "id": 91318, "url": "http://patchwork.ozlabs.org/api/people/91318/?format=api", "name": "Mohamed Mediouni", "email": "mohamed@unpredictable.fr" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260324204855.29759-2-mohamed@unpredictable.fr/mbox/", "series": [ { "id": 497347, "url": "http://patchwork.ozlabs.org/api/series/497347/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497347", "date": "2026-03-24T20:48:49", "name": "vmapple: making it work on the latest macOS host releases", "version": 7, "mbox": "http://patchwork.ozlabs.org/series/497347/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2215614/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2215614/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=unpredictable.fr header.i=@unpredictable.fr\n header.a=rsa-sha256 header.s=sig1 header.b=atUXs/6l;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgMc06y8nz1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 07:49:52 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w58gp-0000od-Ba; Tue, 24 Mar 2026 16:49:27 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <mohamed@unpredictable.fr>)\n id 1w58gl-0000mT-Se\n for qemu-devel@nongnu.org; Tue, 24 Mar 2026 16:49:23 -0400", "from p-west2-cluster5-host3-snip4-1.eps.apple.com ([57.103.71.84]\n helo=outbound.mr.icloud.com)\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <mohamed@unpredictable.fr>)\n id 1w58gk-0004dk-2p\n for qemu-devel@nongnu.org; Tue, 24 Mar 2026 16:49:23 -0400", "from outbound.mr.icloud.com (unknown [127.0.0.2])\n by p00-icloudmta-asmtp-us-west-2a-10-percent-0 (Postfix) with ESMTPS id\n 7D8F31800143; Tue, 24 Mar 2026 20:49:19 +0000 (UTC)", "from localhost.localdomain (unknown [17.57.152.38])\n by p00-icloudmta-asmtp-us-west-2a-10-percent-0 (Postfix) with ESMTPSA id\n 2473C1800462; Tue, 24 Mar 2026 20:49:13 +0000 (UTC)" ], "Dkim-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr;\n s=sig1; t=1774385360; x=1776977360;\n bh=FBH3qmZPf7N3qFdetPUWzmKqQjMulIkpLcLbzIqxLeM=;\n h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme;\n b=atUXs/6l64vYCN8ggJ0bjQtvkYbvgyohXuLNByvnySILtHliY/+Jfphi1AmKuBQVUth+HM0rVqhFT2gEA9tcop1iFRegr9DWeaUhK3lMiMjzNsappCRk9iF7S6aHveof2FsOYgq2V2q4No5rHY7gfAXkw173p3JeplsAGDMzFyuS/wBMC7y4tRW5HjEzMNfDMuyZLHXVY/JUCKoCKIzeauHC5kEiPio8q1ZxWciFHSM3XNTOmIkMPC8a6iYFqmNeSAOLbowd3XmaU+RDtH2lsVIW1uwNdPAOSmqIc0xYdpNbV84nEUYP5zq9EqSxOOqH4AZXJXA2JcAUhVhLGK6+pA==", "mail-alias-created-date": "1752046281608", "From": "Mohamed Mediouni <mohamed@unpredictable.fr>", "To": "qemu-devel@nongnu.org", "Cc": "Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>, qemu-arm@nongnu.org,\n Peter Maydell <peter.maydell@linaro.org>, =?utf-8?q?Philippe_Mathieu-Daud?=\n\t=?utf-8?q?=C3=A9?= <philmd@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>,\n Phil Dennis-Jordan <phil@philjordan.eu>, Peter Xu <peterx@redhat.com>,\n Mads Ynddal <mads@ynddal.dk>, Roman Bolshakov <rbolshakov@ddn.com>,\n Alexander Graf <agraf@csgraf.de>, Mohamed Mediouni <mohamed@unpredictable.fr>", "Subject": "[RFC PATCH v7 1/7] vmapple: apple-gfx: make it work on the latest\n macOS release", "Date": "Tue, 24 Mar 2026 21:48:49 +0100", "Message-ID": "<20260324204855.29759-2-mohamed@unpredictable.fr>", "X-Mailer": "git-send-email 2.50.1", "In-Reply-To": "<20260324204855.29759-1-mohamed@unpredictable.fr>", "References": "<20260324204855.29759-1-mohamed@unpredictable.fr>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Proofpoint-GUID": "RNBHlEtrobwsmRWf6n1c7nr2-x4BYAUV", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMzI0MDE2MSBTYWx0ZWRfX7eYvnjC+1YBR\n yq8FGl8bkeUFMNdv0PndBycSkbKyDL4g6k6kjRJ2NqTk96N3tuNjlrkSgZ6kiYNLJp/YRWSe3D1\n RTp8NVrg1qf6fbje/7r5Tygo+kO5R9adZ2bZHUHsJ72Xw35NPcMqOj8kepDtdKxk10VLxwWemNI\n xcmLQncNVgR9pj9Vw8nrfl9xkLeOp2JJQCvQ5Kgbd0NfetjagEOjUTIYbpJzrB9vLuU32U65j4m\n WFb7KeqdXsmjSDcXlJoDJAzdsmPcDjgRkG/hi+C8dwA4zpioU/lESDdJAHYgRlu1rchRA0PYf3q\n K2RsF9oJ6j/S5Vpkx7Rm0/pBYDt557QFlJm/53qddhjtVAUeAOfm+gIJV4qFG4=", "X-Authority-Info-Out": "v=2.4 cv=Kt5AGGWN c=1 sm=1 tr=0 ts=69c2f8d0\n cx=c_apl:c_pps:t_out a=9OgfyREA4BUYbbCgc0Y0oA==:117\n a=9OgfyREA4BUYbbCgc0Y0oA==:17 a=XaNHVGzJZ3ayr3Wv:21 a=Yq5XynenixoA:10\n a=VkNPw1HP01LnGYTKEx00:22 a=2lQx5wYd1WNrG3klcQkA:9", "X-Proofpoint-ORIG-GUID": "RNBHlEtrobwsmRWf6n1c7nr2-x4BYAUV", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-03-24_03,2026-03-24_01,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=notspam policy=default score=0 phishscore=0\n bulkscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 suspectscore=0\n mlxscore=0 clxscore=1030 adultscore=0 spamscore=0 classifier=spam authscore=0\n adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000\n definitions=main-2603240161", "Received-SPF": "pass client-ip=57.103.71.84;\n envelope-from=mohamed@unpredictable.fr; helo=outbound.mr.icloud.com", "X-Spam_score_int": "-27", "X-Spam_score": "-2.8", "X-Spam_bar": "--", "X-Spam_report": "(-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001,\n SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Follow changes in memory management introduced on macOS 15.4.\n\nThe legacy memory management API has been removed for the IOSurface mapper on that macOS version.\n\nAlso enable process isolation for a sandboxed GPU process when on a new OS.\n\nSigned-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>\n---\n hw/display/apple-gfx-mmio.m | 59 ++++++++++++++++++++++++++++---------\n hw/display/apple-gfx.h | 16 ++++++++++\n hw/display/apple-gfx.m | 41 +++++++++++++++++++++++++-\n 3 files changed, 101 insertions(+), 15 deletions(-)", "diff": "diff --git a/hw/display/apple-gfx-mmio.m b/hw/display/apple-gfx-mmio.m\nindex 58beaadd1f..cc1f8cfcad 100644\n--- a/hw/display/apple-gfx-mmio.m\n+++ b/hw/display/apple-gfx-mmio.m\n@@ -19,6 +19,7 @@\n #include \"hw/core/irq.h\"\n #include \"apple-gfx.h\"\n #include \"trace.h\"\n+#include \"system/address-spaces.h\"\n \n #import <ParavirtualizedGraphics/ParavirtualizedGraphics.h>\n \n@@ -36,12 +37,19 @@ typedef bool(^IOSFCMapMemory)(uint64_t phys, uint64_t len, bool ro, void **va,\n \n @interface PGDeviceDescriptor (IOSurfaceMapper)\n @property (readwrite, nonatomic) bool usingIOSurfaceMapper;\n+@property (readwrite, nonatomic) bool enableArgumentBuffers;\n+@property (readwrite, nonatomic) bool enableProcessIsolation;\n+@property (readwrite, nonatomic) bool enableProtectedContent;\n+\n+@property (readwrite, nonatomic, copy, nullable) PGMemoryMapDescriptor* memoryMapDescriptor;\n @end\n \n @interface PGIOSurfaceHostDeviceDescriptor : NSObject\n -(PGIOSurfaceHostDeviceDescriptor *)init;\n @property (readwrite, nonatomic, copy, nullable) IOSFCMapMemory mapMemory;\n @property (readwrite, nonatomic, copy, nullable) IOSFCUnmapMemory unmapMemory;\n+@property (readwrite, nonatomic, copy, nullable) PGMemoryMapDescriptor* memoryMapDescriptor;\n+@property (readwrite, nonatomic) unsigned long long mmioLength;\n @property (readwrite, nonatomic, copy, nullable) IOSFCRaiseInterrupt raiseInterrupt;\n @end\n \n@@ -183,19 +191,32 @@ static bool apple_gfx_mmio_unmap_surface_memory(void *ptr)\n [PGIOSurfaceHostDeviceDescriptor new];\n PGIOSurfaceHostDevice *iosfc_host_dev;\n \n- iosfc_desc.mapMemory =\n- ^bool(uint64_t phys, uint64_t len, bool ro, void **va, void *e, void *f) {\n- *va = apple_gfx_mmio_map_surface_memory(phys, len, ro);\n-\n- trace_apple_gfx_iosfc_map_memory(phys, len, ro, va, e, f, *va);\n-\n- return *va != NULL;\n- };\n-\n- iosfc_desc.unmapMemory =\n- ^bool(void *va, void *b, void *c, void *d, void *e, void *f) {\n- return apple_gfx_mmio_unmap_surface_memory(va);\n- };\n+ /*\n+ * The legacy memory management API is no longer present\n+ * for the IOSurface mapper as of macOS 15.4.\n+ */\n+ if (@available(macOS 15.4, *)) {\n+ PGMemoryMapDescriptor *memory_map_descriptor = [PGMemoryMapDescriptor new];\n+ FlatView* fv = address_space_to_flatview(&address_space_memory);\n+ flatview_for_each_range(fv, apple_gfx_register_memory_cb, memory_map_descriptor);\n+ /* the device model defines this as a single-page MMIO region, hence 16KB */\n+ iosfc_desc.mmioLength = 0x10000;\n+ iosfc_desc.memoryMapDescriptor = memory_map_descriptor;\n+ } else {\n+ iosfc_desc.mapMemory =\n+ ^bool(uint64_t phys, uint64_t len, bool ro, void **va, void *e, void *f) {\n+ *va = apple_gfx_mmio_map_surface_memory(phys, len, ro);\n+\n+ trace_apple_gfx_iosfc_map_memory(phys, len, ro, va, e, f, *va);\n+\n+ return *va != NULL;\n+ };\n+\n+ iosfc_desc.unmapMemory =\n+ ^bool(void *va, void *b, void *c, void *d, void *e, void *f) {\n+ return apple_gfx_mmio_unmap_surface_memory(va);\n+ };\n+ }\n \n iosfc_desc.raiseInterrupt = ^bool(uint32_t vector) {\n trace_apple_gfx_iosfc_raise_irq(vector);\n@@ -223,13 +244,23 @@ static void apple_gfx_mmio_realize(DeviceState *dev, Error **errp)\n };\n \n desc.usingIOSurfaceMapper = true;\n- s->pgiosfc = apple_gfx_prepare_iosurface_host_device(s);\n+ desc.enableArgumentBuffers = true;\n+ /* \n+ * Process isolation needs PGMemoryMapDescriptor instead of\n+ * the legacy memory management interface present in releases\n+ * older than macOS 15.4.\n+ */\n+ if (@available(macOS 15.4, *)) {\n+ desc.enableProcessIsolation = true;\n+ }\n \n if (!apple_gfx_common_realize(&s->common, dev, desc, errp)) {\n [s->pgiosfc release];\n s->pgiosfc = nil;\n }\n \n+ s->pgiosfc = apple_gfx_prepare_iosurface_host_device(s);\n+\n [desc release];\n desc = nil;\n }\ndiff --git a/hw/display/apple-gfx.h b/hw/display/apple-gfx.h\nindex 3197bd853d..384aee0c5f 100644\n--- a/hw/display/apple-gfx.h\n+++ b/hw/display/apple-gfx.h\n@@ -12,6 +12,7 @@\n #include \"system/memory.h\"\n #include \"hw/core/qdev-properties.h\"\n #include \"ui/surface.h\"\n+#include \"objc/NSObject.h\"\n \n #define TYPE_APPLE_GFX_MMIO \"apple-gfx-mmio\"\n #define TYPE_APPLE_GFX_PCI \"apple-gfx-pci\"\n@@ -23,6 +24,17 @@\n @protocol MTLTexture;\n @protocol MTLCommandQueue;\n \n+typedef struct PGGuestPhysicalRange_s\n+{\n+ uint64_t physicalAddress;\n+ uint64_t physicalLength;\n+ void *hostAddress;\n+} PGGuestPhysicalRange_t;\n+\n+@interface PGMemoryMapDescriptor : NSObject\n+-(void)addRange:(PGGuestPhysicalRange_t) range;\n+@end\n+\n typedef QTAILQ_HEAD(, PGTask_s) PGTaskList;\n \n typedef struct AppleGFXDisplayMode {\n@@ -68,6 +80,10 @@ void *apple_gfx_host_ptr_for_gpa_range(uint64_t guest_physical,\n uint64_t length, bool read_only,\n MemoryRegion **mapping_in_region);\n \n+bool apple_gfx_register_memory_cb(Int128 start, Int128 len,\n+ const MemoryRegion *mr,\n+ hwaddr offset_in_region, void *opaque);\n+\n extern const PropertyInfo qdev_prop_apple_gfx_display_mode;\n \n #endif\ndiff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m\nindex e0a765fcb1..213233084d 100644\n--- a/hw/display/apple-gfx.m\n+++ b/hw/display/apple-gfx.m\n@@ -21,6 +21,7 @@\n #include \"system/address-spaces.h\"\n #include \"system/dma.h\"\n #include \"migration/blocker.h\"\n+#include \"system/memory.h\"\n #include \"ui/console.h\"\n #include \"apple-gfx.h\"\n #include \"trace.h\"\n@@ -596,6 +597,35 @@ void apple_gfx_common_init(Object *obj, AppleGFXState *s, const char* obj_name)\n /* TODO: PVG framework supports serialising device state: integrate it! */\n }\n \n+@interface PGDeviceDescriptor (IOSurfaceMapper)\n+@property (readwrite, nonatomic, copy, nullable) PGMemoryMapDescriptor* memoryMapDescriptor;\n+@end\n+\n+bool apple_gfx_register_memory_cb(Int128 start, Int128 len,\n+ const MemoryRegion *mr,\n+ hwaddr offset_in_region, void *opaque) {\n+ PGGuestPhysicalRange_t range;\n+ PGMemoryMapDescriptor *memory_map_descriptor = opaque;\n+ if (memory_access_is_direct(mr, true, MEMTXATTRS_UNSPECIFIED)) {\n+ range.physicalAddress = start;\n+ range.physicalLength = len;\n+ range.hostAddress = memory_region_get_ram_ptr(mr);\n+ [memory_map_descriptor addRange:range];\n+ }\n+ return false;\n+}\n+\n+static void apple_gfx_register_memory(AppleGFXState *s,\n+ PGDeviceDescriptor *desc)\n+{\n+ PGMemoryMapDescriptor* memoryMapDescriptor = [PGMemoryMapDescriptor new];\n+\n+ FlatView* fv = address_space_to_flatview(&address_space_memory);\n+ flatview_for_each_range(fv, apple_gfx_register_memory_cb, memoryMapDescriptor);\n+\n+ desc.memoryMapDescriptor = memoryMapDescriptor;\n+}\n+\n static void apple_gfx_register_task_mapping_handlers(AppleGFXState *s,\n PGDeviceDescriptor *desc)\n {\n@@ -763,7 +793,16 @@ bool apple_gfx_common_realize(AppleGFXState *s, DeviceState *dev,\n \n desc.device = s->mtl;\n \n- apple_gfx_register_task_mapping_handlers(s, desc);\n+ /* \n+ * The legacy memory management interface doesn't allow for\n+ * vGPU sandboxing. As such, always use the new interface\n+ * on macOS 15.4 onwards. \n+ */\n+ if (@available(macOS 15.4, *)) {\n+ apple_gfx_register_memory(s, desc);\n+ } else {\n+ apple_gfx_register_task_mapping_handlers(s, desc);\n+ }\n \n s->cursor_show = true;\n \n", "prefixes": [ "RFC", "v7", "1/7" ] }