Cover Letter Detail
Show a cover letter.
GET /api/1.2/covers/2219879/?format=api
{ "id": 2219879, "url": "http://patchwork.ozlabs.org/api/1.2/covers/2219879/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/cover/20260405072857.66484-1-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-1-scottjgo@gmail.com>", "list_archive_url": null, "date": "2026-04-05T07:28:44", "name": "[RFC,00/10] vfio: PCI device passthrough on Apple Silicon Macs", "submitter": { "id": 93060, "url": "http://patchwork.ozlabs.org/api/1.2/people/93060/?format=api", "name": "Scott J. Goldman", "email": "scottjgo@gmail.com" }, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/cover/20260405072857.66484-1-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/covers/2219879/comments/", "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=I98jHri6;\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 4fpPHg0zJLz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 17:30:05 +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 1w9HvH-0003tr-CR; Sun, 05 Apr 2026 03:29:31 -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 1w9HvF-0003tA-2B\n for qemu-devel@nongnu.org; Sun, 05 Apr 2026 03:29:29 -0400", "from mail-dy1-x1334.google.com ([2607:f8b0:4864:20::1334])\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 1w9HvD-0007EN-2G\n for qemu-devel@nongnu.org; Sun, 05 Apr 2026 03:29:28 -0400", "by mail-dy1-x1334.google.com with SMTP id\n 5a478bee46e88-2cc4c693d59so4544047eec.1\n for <qemu-devel@nongnu.org>; Sun, 05 Apr 2026 00:29:26 -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.21\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Sun, 05 Apr 2026 00:29:22 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775374164; x=1775978964; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=vACLg16/EFfu3BZP15AOnO+ZvPMtlxDVglLIgvx0zIE=;\n b=I98jHri6BAua5+B93P00vhTFfCMge3TK3UBkUN6JOVR/ypFSoVVMS0hYO0zirh0kIU\n oEeE061qRlFGwtGC4RYbJ+gBbTrxJYBVcPTVdbv6pu+afLaq7NrgcL3XO67JwaEf+orc\n 4HEG+Kc+4mW9gzhaAbb5W/5B5fNQX4CBcw6mmNkPLWHcnTUVZ7YwY6QX2Y4y484wBEgW\n tipyzklWiDxmmf4samfMgRi6+Fg37gfZM3hVPmP5NBVGk6OKnEi/WkBQEVNVEIbLkZ1o\n EOXM4vM6yTAyNfjiY5RTPRmOHqcgSEd4nM0TwrNVOrB0mIj/1gOoMnlCWyaxAVknYz5I\n Ap2w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775374164; x=1775978964;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=vACLg16/EFfu3BZP15AOnO+ZvPMtlxDVglLIgvx0zIE=;\n b=LVf5m0zMKmXJetZX66lUpmQlp1aeyc6+213E3MH5PvF9uiqh6XaSQg+r7qjYInhPry\n r/kYZc1BQsuP4Aj7VSEWob1eXScybNnpsGglJWZHZMd2k3gsub7w+tFFTvDKkyBxIh48\n 4k04qzytvCs8SUiQrVI33cC+vzvj0hLfb/BOcfg8lGBSxoA7XISmmYnljrG9cA11JjfG\n /PrlVM2fprXl5FBIuNuRV6zXT39iqcYVpT1L9j6xdXAFSh7evobKW4+DE8bOp9tkXeCO\n cG2bmWOrply/LJ5ViZaCXG9Bz4LBjpVhOlOUgnVHGZA/7tVTOyD8m90EQOhcpebzgPJ3\n 8RvA==", "X-Gm-Message-State": "AOJu0YzXYZjb9V+f8Jjgw+eyEOtcsoGrTMIx2FNLbfquT4CRcfCDN+sj\n 3t0XQBRlQ4FvI5GIyU5DR6Ouau1ECJSY+3XYmgHgTMZOR1QguGSqJgwpKhqw4v6/uA4=", "X-Gm-Gg": "AeBDiesQXPyJBlYIfox8JzmbOSL+nz7Vx/cc7JwtATN8DMvjpf6SGAmWNhAMeKPeuBk\n Do2exulUxkLS6keMshFU/8xv3hbF4ZUssYeYx7trFl3tixFmVjMVomLJtZw3bATk9x/iQ5532TH\n A14xuPZzPEGS3Vg1qqo1HjQiBC1cpL360B0GA4rMc+eIpjYgJ3QAL8fcf6guTFsrkns27Xe6x0Z\n t9P27PiMTWGSrauF9MuKQW+VsyXk/usASdbEWcbNzF3+QwU+EHMguJ/knmbPn6ebEvscQnLyhuM\n 3M6bTo/GoOlpQFU8CE+RklThrremP3iOqR8wmi+afICq3IrCn3ap9LLlOUFzGFImrmNhDPjwK2S\n SYEE4SX27c6SuUyIqE1/yKTPTSK0fHMC9zH1lwYBLoFt4lzgIrqw+H0LRRckN6xpLjtrgpsd+BR\n M6GX+IhCRJMrxKurdJ3C+lw2HBQrep+GZTj7xrY/tai+cdHeqrszkZiQkG8bJVj1NVM1y9wnRox\n vdiDnRvvDhMhcXk0OyMdBmu9gI=", "X-Received": "by 2002:a05:7300:a944:b0:2c0:e404:8b08 with SMTP id\n 5a478bee46e88-2cbfc764974mr4685621eec.29.1775374164412;\n Sun, 05 Apr 2026 00:29:24 -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 00/10] vfio: PCI device passthrough on Apple Silicon Macs", "Date": "Sun, 5 Apr 2026 00:28:44 -0700", "Message-ID": "<20260405072857.66484-1-scottjgo@gmail.com>", "X-Mailer": "git-send-email 2.50.1", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2607:f8b0:4864:20::1334;\n envelope-from=scottjgo@gmail.com; helo=mail-dy1-x1334.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=ham 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": "This series adds VFIO PCI device passthrough support for Apple Silicon\nMacs running macOS, using a DriverKit extension (dext) as the host\nbackend instead of the Linux VFIO kernel driver.\n\nI'm sending this as an RFC because I'd like feedback before investing\nfurther in upstreaming. The code is functional. I've tested it with\nan NVIDIA RTX 5090 in a Thunderbolt dock on an M4 MacBook Air. GPU\ngaming works but is slow (~30 fps on high settings in Cyberpunk 2077\n[1]), likely due to the BAR access penalty described below. AI\ninference workloads appear less affected. Ollama with Qwen 3.5\ngenerates around 140 tok/sec on the same setup [2].\n\nHow it works:\n\nOn Linux, VFIO relies on kernel-managed IOMMU groups and /dev/vfio\nfor device access and DMA mapping. On macOS, there is no equivalent\nkernel interface. Instead, a userspace DriverKit extension\n(VFIOUserPCIDriver) mediates access to the physical PCI device through\nIOKit's IOUserClient and PCIDriverKit APIs.\n\nThe series keeps the existing VFIOPCIDevice model and reuses QEMU's\npassthrough infrastructure. A few ioctl callsites are refactored into\nio_ops callbacks, the build system is extended for Darwin, and the\nApple-specific backend plugs in behind those abstractions.\n\nThe guest sees two PCI devices: the passthrough device itself\n(vfio-apple-pci, which subclasses VFIOPCIDevice) and a companion\nDMA mapping device (apple-dma-pci). On the QEMU side, an\nAppleVFIOContainer implements the IOMMU backend, and a C client\nlibrary wraps the IOUserClient calls to the dext for config space,\nBAR MMIO, interrupts, reset, and DMA.\n\nDMA limitations:\n\nThis is the biggest platform constraint. Unlike a typical IOMMU\nmapping operation where the caller specifies the IOVA, the\nPCIDriverKit API (IODMACommand::PrepareForDMA) returns a\nsystem-assigned IOVA. There is no way to request a specific address.\nThis means the guest's requested DMA addresses cannot be used\ndirectly. The guest kernel module must intercept DMA mapping calls\nand forward them through the companion device to get the actual\nhardware IOVA.\n\nThere are also hard platform limits: approximately 1.5 GB total\nmapped memory and roughly 64k concurrent mappings. Not all\nworkloads will fit within these limits, though GPU gaming and LLM\ninference have worked in practice.\n\nBAR access has performance issues as well. HVF does not expose\ncontrols to map device memory as cacheable in the guest, creating a\nsignificant performance penalty on BAR MMIO. Uncached mappings work\ncorrectly but slowly compared to what the hardware could do.\n\nWhat works:\n- PCI config space passthrough\n- BAR MMIO via direct-mapped device memory\n- MSI/MSI-X interrupts via async notification from the dext\n- Device reset (FLR with hot-reset fallback)\n- DMA mapping for guest device drivers\n\nWhat doesn't work:\n- Expansion ROM / VBIOS passthrough\n- PCI BAR quirks\n- VGA region passthrough\n- Migration and dirty page tracking\n- Hot-unplug\n\nQuestions for reviewers:\n\n1. Is this something the VFIO maintainers would consider carrying\n upstream? The refactoring patches (3-6) are benign, but the Apple\n backend is a new platform with real limitations. That said, if Apple\n lifts some of the DART/HVF restrictions in a future macOS release, the\n code changes to take advantage would likely be minor. I'd like to\n understand whether this is in scope before doing the work to\n address review feedback on the full series.\n\n2. The apple-dma-pci companion device: should this be a virtio device\n instead? I went with a simple custom PCI device because the virtio\n infrastructure didn't buy much for what is essentially a {map, unmap}\n register interface, but if virtio is preferred, what is the process\n for allocating a device ID? If a custom PCI device is the right\n approach, I've tentatively allocated 1b36:0015. Is there a process\n for reserving a device ID under the Red Hat PCI vendor, or is\n claiming it in pci-ids.rst sufficient? The guest-side kernel module\n hooks all DMA mapping functions for passed-through devices, which is\n unusual enough that I'm not sure it's upstreamable in the Linux\n kernel. I can maintain it out of tree if needed.\n\n3. Should the macOS host-side DriverKit extension live in the QEMU\n tree? It's not included in this series and requires Apple code\n signing. I'm happy to keep it out of tree if that's preferred,\n or include the source if reviewers want it co-located.\n\n4. The existing VFIO code includes <linux/vfio.h> from the\n linux-headers/ tree, which is intended to track upstream Linux\n UAPI headers. To make this compile on macOS, I added minimal\n stub headers (include/compat/linux/types.h and linux/ioctl.h)\n so the existing vfio.h parses on macOS without modification. An\n alternative would be to move an approximation of vfio.h into\n standard-headers/, but that felt against the spirit of tracking\n the latest upstream headers, and the standard-headers import\n process strips ioctls which the VFIO code relies on. I felt\n the stub approach was the least invasive, but I'm open to\n changing it if there's a preferred way to handle this.\n\n[1] https://imgur.com/a/xoRS9kT\n[2] https://imgur.com/a/ui4pYF0\n\nScott J. Goldman (10):\n vfio/pci: Use the write side of EventNotifier for IRQ signaling\n accel/hvf: avoid executable mappings for RAM-device memory\n vfio: Allow building on Darwin hosts\n vfio: Prepare existing code for Apple VFIO backend\n vfio: Add region_map and region_unmap callbacks to VFIODeviceIOOps\n vfio: Add device_reset callback to VFIODeviceIOOps\n vfio/apple: Add DriverKit dext client library\n vfio/apple: Add IOMMU container and PCI device\n vfio/apple: Add apple-dma-pci companion device\n docs: Add vfio-apple documentation and MAINTAINERS entry\n\n Kconfig.host | 3 +\n MAINTAINERS | 11 +\n accel/hvf/hvf-all.c | 10 +-\n backends/Kconfig | 2 +-\n docs/specs/pci-ids.rst | 3 +\n docs/system/device-emulation.rst | 1 +\n docs/system/devices/vfio-apple.rst | 160 +++++\n hw/vfio-user/device.c | 16 +-\n hw/vfio/Kconfig | 4 +-\n hw/vfio/ap.c | 4 +-\n hw/vfio/apple-device.c | 945 +++++++++++++++++++++++++++++\n hw/vfio/apple-dext-client.c | 681 +++++++++++++++++++++\n hw/vfio/apple-dext-client.h | 253 ++++++++\n hw/vfio/apple-dma.c | 540 +++++++++++++++++\n hw/vfio/apple.h | 74 +++\n hw/vfio/ccw.c | 2 +-\n hw/vfio/container-apple.c | 241 ++++++++\n hw/vfio/device.c | 42 ++\n hw/vfio/meson.build | 12 +-\n hw/vfio/migration.c | 5 +-\n hw/vfio/pci.c | 50 +-\n hw/vfio/pci.h | 1 +\n hw/vfio/region.c | 108 ++--\n hw/vfio/types.h | 2 +\n hw/vfio/vfio-helpers.h | 2 +-\n hw/vfio/vfio-migration-internal.h | 4 +-\n hw/vfio/vfio-region.h | 4 +\n include/compat/linux/ioctl.h | 2 +\n include/compat/linux/types.h | 26 +\n include/hw/pci/pci.h | 1 +\n include/hw/vfio/vfio-container.h | 1 +\n include/hw/vfio/vfio-device.h | 40 +-\n meson.build | 10 +-\n util/event_notifier-posix.c | 5 +-\n 34 files changed, 3197 insertions(+), 68 deletions(-)\n create mode 100644 docs/system/devices/vfio-apple.rst\n create mode 100644 hw/vfio/apple-device.c\n create mode 100644 hw/vfio/apple-dext-client.c\n create mode 100644 hw/vfio/apple-dext-client.h\n create mode 100644 hw/vfio/apple-dma.c\n create mode 100644 hw/vfio/apple.h\n create mode 100644 hw/vfio/container-apple.c\n create mode 100644 include/compat/linux/ioctl.h\n create mode 100644 include/compat/linux/types.h" }