#asahi-dev · 2025-09-05 14:22
alexalteagood point re tomeu vizoso, thank you!#asahi-dev · 2025-09-05 14:22
alexalteayes, I was planning to work on ane userspace after having a working driver that doesn't kpanic :D#asahi-dev · 2025-09-05 14:19
chaos_princessmaybe reach out to tomeu vizoso about how to approach the whole matmul accelerators space correctly#asahi-dev · 2025-09-05 14:18
chaos_princessane is very difficult imo, there is no userspace for it#asahi-dev · 2025-09-05 14:18
alexalteayep, that's the better question. I have honestly no idea. I've emailed eiln about that, since I'd really like to get ane into an upstreamable state#asahi-dev · 2025-09-05 14:17
chaos_princessi might be wrong, but, why is it touching darts directly, that is not how you are supposed to write drivers#asahi-dev · 2025-09-05 14:11
alexalteathe question is: would you recommend copy-pasting code from `/drivers/iommu/apple-dart.c` into the ANE drivers? And if not, is there any better way to dealing with different dart models when writing a driver?#asahi-dev · 2025-09-05 14:09
alexaltea.select, .command, .invalidate are hardcoded with offsets for M1 darts, adding M2 dart support will require significant refactoring since command submission is also quite different: https://gitlab.com/fedora-asahi/kernel-asahi/-/blob/fedora-asahi-6.16/drivers/iommu/apple-dart.c#L535-547#asahi-dev · 2025-09-05 14:07
alexaltea@jannau: apologies, here's the code: https://github.com/eiln/ane/blob/main/ane/src/ane_drv.c#L41-L54#asahi-dev · 2025-09-05 14:06
jannaualexaltea: can you point to the specific code. I don't quite follow what you're asking#asahi-dev · 2025-09-05 13:59
alexalteai was wondering if we have any other drivers making use of the 0x4000-sized dart regs, just to see clean examples that I could follow to avoid code duplication#asahi-dev · 2025-09-05 13:59
alexaltea@sven i'm trying to get m2 (t8112) support on eiln's ane drivers. right now the dart code is a bit messy (hardcoded stream select/cmd/invalidate offsets for m1)#asahi-dev · 2025-09-04 21:45
svenI always have to go through it step by step to not mess up #asahi-dev · 2025-09-04 21:44
jannauas usual I was tripped up by negation and &&#asahi-dev · 2025-09-04 21:44
jannauI'm not sure I just noticed that I added 'dma-coherent;' only to the t60xx device trees. But I was never sure if that's needed at all#asahi-dev · 2025-09-04 21:39
svenwe should be dma coherent so kmalloc_safe should be true so !true && whatever should always be false #asahi-dev · 2025-09-04 21:39
jannaui.e. if the size is smaller than 128 or the cache line size#asahi-dev · 2025-09-04 21:36
jannauit is not or? "return !dma_kmalloc_safe(dev, dir) && !dma_kmalloc_size_aligned(size);"#asahi-dev · 2025-09-04 21:32
sventhat kmalloc thing should always be false for us, shouldn’t it?#asahi-dev · 2025-09-04 21:30
svenNot sure I see how #asahi-dev · 2025-09-04 21:29
jannauit uses swiotlb if the size is not page alligned: https://elixir.bootlin.com/linux/v6.16.3/source/drivers/iommu/dma-iommu.c#L595#asahi-dev · 2025-09-04 21:26
svenessentially their external-facing equivalent #asahi-dev · 2025-09-04 21:25
svenyeah, that’s from acpi I think #asahi-dev · 2025-09-04 21:25
jannauwhich is x86 only#asahi-dev · 2025-09-04 21:24
jannaubased on arch_pci_dev_is_removable()#asahi-dev · 2025-09-04 21:23
jannauI haven't looked where/how untrusted is set#asahi-dev · 2025-09-04 21:22
jannaupci code has external_facing and untrusted#asahi-dev · 2025-09-04 21:20
svenand that can only happen with external-facing afaict#asahi-dev · 2025-09-04 21:20
svenbut i don't understand how it can ever reach that path unless untrusted is true#asahi-dev · 2025-09-04 21:19
svenit's aligning the size to full page in swiotlb i think#asahi-dev · 2025-09-04 21:19
svenhm... not sure that's true looking at the code. #asahi-dev · 2025-09-04 21:15
svenweird#asahi-dev · 2025-09-04 21:15
jannauthe size is 16384 so it's page aligned#asahi-dev · 2025-09-04 21:13
svenno idea why it would try to use swiotlb then :/#asahi-dev · 2025-09-04 21:13
sveni think that's it#asahi-dev · 2025-09-04 21:12
jannaunot sure how we would do that. there is the obvious "external-facing" which we don't use#asahi-dev · 2025-09-04 21:05
svenbut i don't think we marked the internal pci bus as unsafe#asahi-dev · 2025-09-04 21:04
svene.g. anything that uses dma_map_sg to directly map buffers instead of using the coherent api to allocate buffers#asahi-dev · 2025-09-04 21:04
sven*aligned#asahi-dev · 2025-09-04 21:04
sveni thought it also forces anything that's not paged alined through swiotlb #asahi-dev · 2025-09-04 21:03
jannaudoesn't external/untrusted just disable bypass?#asahi-dev · 2025-09-04 20:58
sveni don't remember if that forces swiotlb#asahi-dev · 2025-09-04 20:58
svenuh.. is the bus marked as untrusted?#asahi-dev · 2025-09-04 20:56
jannauthe iommu group with wifi/bt is type DMA#asahi-dev · 2025-09-04 20:50
jannauhuh, why is brcmfmac using swiotbl? https://paste.debian.net/1394943/#asahi-dev · 2025-09-04 16:57
nickchan-at this point keeping the dt binding changes are less confusing#asahi-dev · 2025-09-04 11:50
chaos_princessty#asahi-dev · 2025-09-04 11:50
jannauI guess I'll keep the sent dt-bindings + driver changes to avoid confusion due to the back and forth#asahi-dev · 2025-09-04 11:48
jannauchaos_princess: no runtime PM in the gpu driver. firmware does internal power management but that not full power-gating