#
✕ nick:scottjg
#asahi-re · 2026-03-27 00:47
scottjgthat project until apple can add support to the platform
#asahi-re · 2026-03-27 00:47
scottjgfor my project, the biggest issue is that if i map device memory with the hvf api into the vm, i get a host kernel panic when the memory is accessed, so that really restricts the speed i can write to the BARs, since every write is a VMEXIT. that dwarfs any other performance issue for me. so that might be the end of the line on improving perf for
#asahi-re · 2026-03-27 00:44
scottjgok so now i'm a little confused, there's definitely a noticeable improvement in performance even on m2 macs when you map memory with kIOMapWriteCombineCache. that was what was suspected to be not supported right?
#asahi-re · 2026-03-27 00:43
scottjgPCR = kIOMapPostedCombinedReordered (macOS)
#asahi-re · 2026-03-27 00:43
scottjgPost = kIOMapPostedWrite (macOS)
#asahi-re · 2026-03-27 00:43
scottjgDflt = kIOMapDefaultCache (macOS)
#asahi-re · 2026-03-27 00:43
scottjgWC = ioremap_wc / kIOMapWriteCombineCache
#asahi-re · 2026-03-27 00:43
scottjgInhib = ioremap / kIOMapInhibitCache
#asahi-re · 2026-03-27 00:43
scottjg--------------------------------------------------------
#asahi-re · 2026-03-27 00:43
scottjg VFIOUserHostApp
#asahi-re · 2026-03-27 00:43
scottjgM2 Mac mini 8M 4 22 427 46 46 418
#asahi-re · 2026-03-27 00:43
scottjg VFIOUserHostApp
#asahi-re · 2026-03-27 00:43
scottjgM4 MacBook Air 8M 4 46 391 46 46 407
#asahi-re · 2026-03-27 00:43
scottjgMachine Win Pass Inhib WC Dflt Post PCR
#asahi-re · 2026-03-27 00:43
scottjg Linux pci-cache-probe.ko
#asahi-re · 2026-03-27 00:43
scottjg--------------------------------------------------------
#asahi-re · 2026-03-27 00:43
scottjg2018 Mac mini 16M 8 49 372 - - -
#asahi-re · 2026-03-27 00:43
scottjgPCI BAR1 Sequential Write Benchmark (MiB/s)
#asahi-re · 2026-03-26 21:27
scottjgfwiw the performance of writing to the BAR when you map it in writecombine mode is almost exactly the same on x86 vs m4
#asahi-re · 2026-03-26 21:20
scottjgi'm trying to get a baseline for what the performance is on x86 since egpu is known to work on x86 linux
#asahi-re · 2026-03-26 21:20
scottjgmy early tests seem to indicate that the performance of writing to the larger BAR on the egpu with a 2018 mac mini has similar performance to my m4, i'm still trying to get the test working on my m1 to see if it's slower to prove that something actually changed
#asahi-re · 2026-03-26 21:18
scottjgi'm still collecting data... i have an m1 air and and m4 air, if i find something interesting, i think the next things i'd ask for help is if anyone has an m2 or m3 based machine with macos they can run some tests on
#asahi-re · 2026-03-25 03:32
scottjgthat's on my m4 macbook air. it seems like WriteCombine might be supported now? if i'm interpreting the results correctly...
#asahi-re · 2026-03-25 03:32
scottjg"benchmark-result" = "BAR1 bytes=0x800000 passes=4 def->Default(0x0) 690193750ns 46MiB/s WC->WriteCombine(0x400) 85862875ns 372MiB/s PW->PostedWrite(0x600) 689997083ns 46MiB/s PCR->PostedCombinedReord(0x900) 89610208ns 357MiB/s"
#asahi-re · 2026-03-25 03:32
scottjggot a kext going that maps BAR1 in different modes to see if they do anything:
#asahi-re · 2026-03-25 00:15
scottjgmaybe something on the macos host in `ioreg`?
#asahi-re · 2026-03-25 00:08
scottjgthere's basically two patches i have on the driver, one is a "dma shim" that sends dma mapping calls to the host... and there was this other issue where if it wants to use a 2MB aligned page for performance and asserts if you get an unaligned iova back from dma map. i just basically just made it use 4k pages
#asahi-re · 2026-03-25 00:07
scottjgthis is the proper nvidia "open" driver
#asahi-re · 2026-03-25 00:07
scottjgshort of getting a scope on the thunderbolt cable, is there a straightforward way to test and see if it maybe has?
#asahi-re · 2026-03-25 00:00
scottjgthis would also explain why there's a 25s soft lockup when the X session initializes
#asahi-re · 2026-03-24 23:57
scottjgoh well. maybe it'll be a funny blog post at least.
#asahi-re · 2026-03-24 23:49
scottjgi wonder if in practice it might not be a huge deal? like for ai inference there's not a ton of bandwidth needed after the model is loaded. it seems to perform ok at that point. not sure what games do.. maybe it just becomes a lot slower to load textures when the games start?
#asahi-re · 2026-03-24 23:48
scottjgoh ok, so that's gonna really hurt the perf
#asahi-re · 2026-03-24 23:31
scottjg the pcidriverkit apis, not mapping BARs directly). i'm mainly trying to understand at the system level what the restrictions are that might make this impractical?
#asahi-re · 2026-03-24 23:31
scottjg map the thunderbolt memory on apple silicon and i was wondering if anyone knew more about that? the main issue i run into now is host os restrictions (i can't map more than 1.5gb because of os enforced limits, can't control dma map alignment because of OS library interfaces), but that doesn't seem like a hardware restriction per-say. mmios are also very slow, but that seems like an issue with my prototype (i proxy the writes to
#asahi-re · 2026-03-24 23:31
scottjgthis isn't exactly specific to asahi, but it's apple silicon reverse engineering question. hope that's ok. i've been working on a prototype that can do some limited form of pci passthrough for a thunderbolt device on a macos host with a linux guest on qemu. so far i have the basics working on my m4 macbook air (see: https://imgur.com/a/li7j7wm ). in the past i had seen marcan say that there was some issue with being able to