Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2219883/?format=api
{ "id": 2219883, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2219883/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260405072857.66484-4-scottjgo@gmail.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260405072857.66484-4-scottjgo@gmail.com>", "list_archive_url": null, "date": "2026-04-05T07:28:47", "name": "[RFC,03/10] vfio: Allow building on Darwin hosts", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "66c5182bd62c6e5610d4ab3e73e45f0180de4da8", "submitter": { "id": 93060, "url": "http://patchwork.ozlabs.org/api/1.2/people/93060/?format=api", "name": "Scott J. Goldman", "email": "scottjgo@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260405072857.66484-4-scottjgo@gmail.com/mbox/", "series": [ { "id": 498765, "url": "http://patchwork.ozlabs.org/api/1.2/series/498765/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=498765", "date": "2026-04-05T07:28:44", "name": "vfio: PCI device passthrough on Apple Silicon Macs", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498765/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2219883/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219883/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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=jQnvhuDB;\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 4fpPJL3QGbz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 17:30:42 +1000 (AEST)", "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 1w9HvL-0003vV-1o; Sun, 05 Apr 2026 03:29:35 -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 <scottjgo@gmail.com>)\n id 1w9HvJ-0003uk-I6\n for qemu-devel@nongnu.org; Sun, 05 Apr 2026 03:29:33 -0400", "from mail-dy1-x1332.google.com ([2607:f8b0:4864:20::1332])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <scottjgo@gmail.com>)\n id 1w9HvH-0007Fx-Jg\n for qemu-devel@nongnu.org; Sun, 05 Apr 2026 03:29:33 -0400", "by mail-dy1-x1332.google.com with SMTP id\n 5a478bee46e88-2b4520f6b32so3154571eec.0\n for <qemu-devel@nongnu.org>; Sun, 05 Apr 2026 00:29:30 -0700 (PDT)", "from localhost.localdomain ([2601:645:8200:47:41e4:ff2b:ff70:4d75])\n by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2cb92ea0ef1sm7636502eec.21.2026.04.05.00.29.28\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Sun, 05 Apr 2026 00:29:28 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775374169; x=1775978969; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=lhuQFBcbzpwqAcvo/lQJH+U4zsmLQEc/b+KbhHOCZWI=;\n b=jQnvhuDBJDXIXon65tRLtAoto8ZxK6xMOn0vwFTEGZ3F94fgATA9iw727JOWBX/Tkt\n YXlImx+ak1lpLRoMnLxGGVTzjVhI9Rmzn3XB5MJl6Km6vorZcjOHWYcI+sbpRyFogk3q\n C8LLZJ3VZ1mE5xFLzBcDkHi7/0iOb+UvgcjeA4pS6bYRju+txpGNf+q5nZxOoa7V2s/I\n 7hgqnsgPMr1VK78CNcOf0ZEkGIBkDXDFQBwEKf9k7z11g2ywLU/3++6YLIY7IzkzDVcX\n PmOXOO52w8Ri0c8YQtFrXPQvjJwploabUTNDPkKMXaeBKtjK/LauK/XYeQrGq2zfQeuu\n RtNQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775374169; x=1775978969;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=lhuQFBcbzpwqAcvo/lQJH+U4zsmLQEc/b+KbhHOCZWI=;\n b=jRBXxrxhGvv2cQNEVVrlkA9ANSG9m8ZnhDGGiDMDazFR0JgYFNGvC58QsYX/Zm71at\n TCufHv91y/KKSTBMxqpUWltQWdzfDcH+sD2V5H8NevBzIVxQJKp3A/X1S+VPefT8zunY\n D1b9ln7+ljFe4D/yrPXOZa8b2Yp8dsqT5lagjeJYkwAqNpybpE10LtRCVNfKG3R2Cw65\n rXfrHOHrgt1/LaccD/lELOK+MC7SDxZ1vAcMVJyKn8gwCRoshMI9BBdh4e4+jjiaCRb9\n OrRwyQycqcn+vKEjAKza2MEzc4HnbRTp2mVTjNuJIpBLC+y/p/d+lMNso758IypoRANq\n ftCA==", "X-Gm-Message-State": "AOJu0Yw5u8EAYcTJym+EMYeNfWI327LSHMZ1XGexhghVui24Z7NzEqLE\n rO16bQIcCW4iMMbd6MDm5HHAHnm/9kpCjtHMgrBxr5Z/SbyHrlN2hDw8E/TuhvlVOjs=", "X-Gm-Gg": "AeBDies1NH6Fbo589dfxPjTDFxtjrhd3NA/1QSYu78JXaxjmSUaUqcOd5tQ4Ce6iOn0\n N1CYD/IXcgwrS7Co5OI3ZMHWK9oN7UqjxQOqk3ovpPZa2zq9z3kfc/oo1zpR+X3z5Otzlkthdhm\n pbDzUmTQpV01aWYNRMGpOTBNl895oAE2N2S7mcUHVH4cTZjgW2XNhi3gIKrden+c2y0Xp7861vB\n YNApBfiEtLp78RB36VWHyQkGJMTTHDRxMrFSjd4ZKIFb2mnBD7MqJ4tAN58iAF0XdDRfp+evWas\n qWIefy6hoVYBtRZUjVvvsy8fFa4nWaTccLsreXzdQ61pecD5oTxgaPD9nzxdbTavm/Wh6pSTMnB\n luWRSOzv1BQ+0d84n0EOeAjIme7ePKPBmCnz8V8+xPPpQPdMQmwQi+pgiVpTORBvqt7MTu+lisM\n JIub7JN0ME5VmqTDq6Z6k+9ZVxw+3dQmBjWC6FoaDqsY7GmfJHxIvnQife3djXB052GVz7O5IbC\n 5fEZel/b0jGGvFSHmAY5l7nWt8=", "X-Received": "by 2002:a05:7300:641a:b0:2c8:7172:3b8d with SMTP id\n 5a478bee46e88-2cbf99ef517mr3990367eec.2.1775374169387;\n Sun, 05 Apr 2026 00:29:29 -0700 (PDT)", "From": "\"Scott J. Goldman\" <scottjgo@gmail.com>", "To": "qemu-devel@nongnu.org", "Cc": "alex@shazbot.org, clg@redhat.com, pbonzini@redhat.com, rbolshakov@ddn.com,\n phil@philjordan.eu, mst@redhat.com, john.levon@nutanix.com,\n thanos.makatos@nutanix.com, qemu-s390x@nongnu.org,\n \"Scott J. Goldman\" <scottjgo@gmail.com>", "Subject": "[RFC PATCH 03/10] vfio: Allow building on Darwin hosts", "Date": "Sun, 5 Apr 2026 00:28:47 -0700", "Message-ID": "<20260405072857.66484-4-scottjgo@gmail.com>", "X-Mailer": "git-send-email 2.50.1", "In-Reply-To": "<20260405072857.66484-1-scottjgo@gmail.com>", "References": "<20260405072857.66484-1-scottjgo@gmail.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2607:f8b0:4864:20::1332;\n envelope-from=scottjgo@gmail.com; helo=mail-dy1-x1332.google.com", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 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, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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": "Enable the VFIO subsystem to compile on macOS/Darwin in addition to\nLinux. This is build infrastructure only — no Apple-specific device\ncode is added yet.\n\nKey changes:\n- Add CONFIG_DARWIN Kconfig symbol and propagate it through the build\n system so that VFIO and VFIO_PCI are selectable on Darwin hosts.\n- Provide minimal <linux/types.h> and <linux/ioctl.h> shim headers\n under include/compat/ so the Linux UAPI VFIO headers parse on macOS.\n- Widen CONFIG_LINUX guards to CONFIG_LINUX || CONFIG_DARWIN in the\n VFIO device, helpers, and migration headers.\n- Make container-legacy.c (the Linux /dev/vfio ioctl container) build\n only on Linux, and restrict IOMMUFD to Linux in Kconfig.\n- Remove the CONFIG_EVENTFD guard around event_notifier_init_fd() so\n pipe-based EventNotifiers can be initialized on Darwin.\n- Mark vfio-pci as not user-creatable on Darwin since the Linux VFIO\n kernel driver is not available; the Apple-specific device type will\n be added in a subsequent commit.\n\nSigned-off-by: Scott J. Goldman <scottjgo@gmail.com>\n---\n Kconfig.host | 3 +++\n backends/Kconfig | 2 +-\n hw/vfio/Kconfig | 4 ++--\n hw/vfio/meson.build | 4 +++-\n hw/vfio/pci.c | 3 +++\n hw/vfio/vfio-helpers.h | 2 +-\n hw/vfio/vfio-migration-internal.h | 4 ++--\n include/compat/linux/ioctl.h | 2 ++\n include/compat/linux/types.h | 26 ++++++++++++++++++++++++++\n include/hw/vfio/vfio-device.h | 4 ++--\n meson.build | 10 +++++++++-\n util/event_notifier-posix.c | 5 ++---\n 12 files changed, 56 insertions(+), 13 deletions(-)\n create mode 100644 include/compat/linux/ioctl.h\n create mode 100644 include/compat/linux/types.h", "diff": "diff --git a/Kconfig.host b/Kconfig.host\nindex 933425c74b..bb2780293c 100644\n--- a/Kconfig.host\n+++ b/Kconfig.host\n@@ -5,6 +5,9 @@\n config LINUX\n bool\n \n+config DARWIN\n+ bool\n+\n config LIBCBOR\n bool\n \ndiff --git a/backends/Kconfig b/backends/Kconfig\nindex d3dbe19868..d1be4148d3 100644\n--- a/backends/Kconfig\n+++ b/backends/Kconfig\n@@ -2,7 +2,7 @@ source tpm/Kconfig\n \n config IOMMUFD\n bool\n- depends on VFIO\n+ depends on VFIO && LINUX\n \n config SPDM_SOCKET\n bool\ndiff --git a/hw/vfio/Kconfig b/hw/vfio/Kconfig\nindex 27de24e4db..a409483c34 100644\n--- a/hw/vfio/Kconfig\n+++ b/hw/vfio/Kconfig\n@@ -2,14 +2,14 @@\n \n config VFIO\n bool\n- depends on LINUX\n+ depends on LINUX || DARWIN\n \n config VFIO_PCI\n bool\n default y\n select VFIO\n select EDID\n- depends on LINUX && PCI\n+ depends on (LINUX || DARWIN) && PCI\n \n config VFIO_CCW\n bool\ndiff --git a/hw/vfio/meson.build b/hw/vfio/meson.build\nindex 82f68698fb..1ee9c11d5b 100644\n--- a/hw/vfio/meson.build\n+++ b/hw/vfio/meson.build\n@@ -4,9 +4,11 @@ vfio_ss = ss.source_set()\n vfio_ss.add(files(\n 'listener.c',\n 'container.c',\n- 'container-legacy.c',\n 'helpers.c',\n ))\n+if host_os == 'linux'\n+ vfio_ss.add(files('container-legacy.c'))\n+endif\n vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))\n vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(\n 'pci-quirks.c',\ndiff --git a/hw/vfio/pci.c b/hw/vfio/pci.c\nindex ee1a42e7e0..5a1c2d8c2e 100644\n--- a/hw/vfio/pci.c\n+++ b/hw/vfio/pci.c\n@@ -3862,6 +3862,9 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)\n #endif\n dc->vmsd = &vfio_cpr_pci_vmstate;\n dc->desc = \"VFIO-based PCI device assignment\";\n+#ifdef CONFIG_DARWIN\n+ dc->user_creatable = false;\n+#endif\n pdc->realize = vfio_pci_realize;\n \n object_class_property_set_description(klass, /* 1.3 */\ndiff --git a/hw/vfio/vfio-helpers.h b/hw/vfio/vfio-helpers.h\nindex 54a327ffbc..2afb360797 100644\n--- a/hw/vfio/vfio-helpers.h\n+++ b/hw/vfio/vfio-helpers.h\n@@ -9,7 +9,7 @@\n #ifndef HW_VFIO_VFIO_HELPERS_H\n #define HW_VFIO_VFIO_HELPERS_H\n \n-#ifdef CONFIG_LINUX\n+#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN)\n #include <linux/vfio.h>\n \n extern int vfio_kvm_device_fd;\ndiff --git a/hw/vfio/vfio-migration-internal.h b/hw/vfio/vfio-migration-internal.h\nindex 814fbd9eba..566cd6a871 100644\n--- a/hw/vfio/vfio-migration-internal.h\n+++ b/hw/vfio/vfio-migration-internal.h\n@@ -9,7 +9,7 @@\n #ifndef HW_VFIO_VFIO_MIGRATION_INTERNAL_H\n #define HW_VFIO_VFIO_MIGRATION_INTERNAL_H\n \n-#ifdef CONFIG_LINUX\n+#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN)\n #include <linux/vfio.h>\n #endif\n \n@@ -62,7 +62,7 @@ bool vfio_device_state_is_precopy(VFIODevice *vbasedev);\n int vfio_save_device_config_state(QEMUFile *f, void *opaque, Error **errp);\n int vfio_load_device_config_state(QEMUFile *f, void *opaque);\n \n-#ifdef CONFIG_LINUX\n+#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN)\n int vfio_migration_set_state(VFIODevice *vbasedev,\n enum vfio_device_mig_state new_state,\n enum vfio_device_mig_state recover_state,\ndiff --git a/include/compat/linux/ioctl.h b/include/compat/linux/ioctl.h\nnew file mode 100644\nindex 0000000000..2c789fefc6\n--- /dev/null\n+++ b/include/compat/linux/ioctl.h\n@@ -0,0 +1,2 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/* empty Darwin shim - ioctl macros not needed */\ndiff --git a/include/compat/linux/types.h b/include/compat/linux/types.h\nnew file mode 100644\nindex 0000000000..d6620aaf7f\n--- /dev/null\n+++ b/include/compat/linux/types.h\n@@ -0,0 +1,26 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Darwin shim for <linux/types.h>\n+ *\n+ * The Linux UAPI headers that QEMU copies into linux-headers/ expect\n+ * these typedefs from <linux/types.h>. Provide the small subset we\n+ * need so those headers parse on macOS.\n+ */\n+#ifndef COMPAT_LINUX_TYPES_H\n+#define COMPAT_LINUX_TYPES_H\n+\n+#include <stdint.h>\n+\n+typedef uint8_t __u8;\n+typedef uint16_t __u16;\n+typedef uint32_t __u32;\n+typedef uint64_t __u64;\n+typedef int8_t __s8;\n+typedef int16_t __s16;\n+typedef int32_t __s32;\n+typedef int64_t __s64;\n+typedef int64_t loff_t;\n+\n+typedef __u64 __aligned_u64 __attribute__((aligned(8)));\n+\n+#endif /* COMPAT_LINUX_TYPES_H */\ndiff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h\nindex 828a31c006..17c5db369c 100644\n--- a/include/hw/vfio/vfio-device.h\n+++ b/include/hw/vfio/vfio-device.h\n@@ -23,7 +23,7 @@\n \n #include \"system/memory.h\"\n #include \"qemu/queue.h\"\n-#ifdef CONFIG_LINUX\n+#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN)\n #include <linux/vfio.h>\n #endif\n #include \"system/system.h\"\n@@ -171,7 +171,7 @@ VFIODevice *vfio_get_vfio_device(Object *obj);\n typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList;\n extern VFIODeviceList vfio_device_list;\n \n-#ifdef CONFIG_LINUX\n+#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN)\n /*\n * How devices communicate with the server. The default option is through\n * ioctl() to the kernel VFIO driver, but vfio-user can use a socket to a remote\ndiff --git a/meson.build b/meson.build\nindex daa58e46a3..b12466b730 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -764,7 +764,14 @@ if 'objc' in all_languages\n add_project_arguments(objc.get_supported_arguments(qemu_common_flags + warn_flags),\n native: false, language: 'objc')\n endif\n-if host_os == 'linux'\n+if host_os == 'darwin'\n+ # linux-headers/linux/vfio.h includes <linux/types.h> and <linux/ioctl.h>\n+ # which are system headers on Linux but absent on macOS. Point at the\n+ # static shims in include/compat/\n+ add_project_arguments('-isystem', meson.current_source_dir() / 'include/compat',\n+ language: all_languages)\n+endif\n+if host_os in ['linux', 'darwin']\n add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers',\n '-isystem', 'linux-headers',\n language: all_languages)\n@@ -3282,6 +3289,7 @@ host_kconfig = \\\n (have_vhost_kernel ? ['CONFIG_VHOST_KERNEL=y'] : []) + \\\n (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \\\n (host_os == 'linux' ? ['CONFIG_LINUX=y'] : []) + \\\n+ (host_os == 'darwin' ? ['CONFIG_DARWIN=y'] : []) + \\\n (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : []) + \\\n (vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=y'] : []) + \\\n (hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=y'] : []) + \\\ndiff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c\nindex 83fdbb96bb..0e05e81aca 100644\n--- a/util/event_notifier-posix.c\n+++ b/util/event_notifier-posix.c\n@@ -20,10 +20,10 @@\n #include <sys/eventfd.h>\n #endif\n \n-#ifdef CONFIG_EVENTFD\n /*\n * Initialize @e with existing file descriptor @fd.\n- * @fd must be a genuine eventfd object, emulation with pipe won't do.\n+ * On hosts without eventfd(), callers can still restore a single descriptor\n+ * for cases that only need eventfd-like semantics.\n */\n void event_notifier_init_fd(EventNotifier *e, int fd)\n {\n@@ -31,7 +31,6 @@ void event_notifier_init_fd(EventNotifier *e, int fd)\n e->wfd = fd;\n e->initialized = true;\n }\n-#endif\n \n int event_notifier_init(EventNotifier *e, int active)\n {\n", "prefixes": [ "RFC", "03/10" ] }