#asahi-dev · 2023-04-10 17:30
marcanyeah, that'd make sense logically, which is why I think this is a workaround and this kernel codepath is just broken#asahi-dev · 2023-04-10 17:29
kettenis_I thought the default was that there are no dma restrictions unless there is a dma-ranges property#asahi-dev · 2023-04-10 17:27
marcanrobher: this codepath is getting called before the driver probes, so the DMA mask is unset, which means we end up limiting everything to 32bit. I see that if we set dma-ranges to a dummy single covering the entire 64bit AS, we'll probably get what we want... but is this what we're supposed to do?#asahi-dev · 2023-04-10 17:27
kettenis_there are a few more warnings, but those have less impact#asahi-dev · 2023-04-10 17:26
marcanyeah, though now I'm wondering if this really makes sense#asahi-dev · 2023-04-10 17:25
jannauyes#asahi-dev · 2023-04-10 17:24
kettenis_that needs a fix in m1n1 as well isn't it?#asahi-dev · 2023-04-10 17:24
jannaukettenis_: disp0_piodma. I'll fix it#asahi-dev · 2023-04-10 17:24
jannauthat suggests we should use "dma-ranges" see of_dma_configure_id()#asahi-dev · 2023-04-10 17:21
kettenis_that'll need to be fixed before it goes upstream#asahi-dev · 2023-04-10 17:21
kettenis_./t600x-j375.dtsi:13.10-24.4: Warning (alias_paths): /aliases: aliases property name must include only lowercase and '-'#asahi-dev · 2023-04-10 17:21
kettenis_btw:#asahi-dev · 2023-04-10 17:18
marcansame check, happening in the IOMMU core, similarly way too early#asahi-dev · 2023-04-10 17:17
marcanlovely...#asahi-dev · 2023-04-10 17:17
marcan[ 0.630506] specified DMA range outside IOMMU capability#asahi-dev · 2023-04-10 17:14
marcanyeah, I just dropped it and fixed the conflict#asahi-dev · 2023-04-10 17:12
jannauah, same problem for my patch to limit ias then. drop that as well#asahi-dev · 2023-04-10 17:10
marcanI don't think there's a solution for this, let's just drop that idea... setting the DMA range at the DART will already do the right thing wrt clamping IAS anyway.#asahi-dev · 2023-04-10 17:10
marcanjannau: the problem is the device DMA mask is not set yet, so we get 32bit. the iommu stuff happens too early.#asahi-dev · 2023-04-10 17:08
jannaulooks like it should work in principl, i.e. review of the intention#asahi-dev · 2023-04-10 17:02
marcanwait no I think I messed this up#asahi-dev · 2023-04-10 16:58
marcanthat wouldn't work properly if we fully decoupled it from the IOMMU driver#asahi-dev · 2023-04-10 16:58
marcanI think it also makes sense to put it in the IOMMU because we have a special case where that range can exceed the IOMMU's own input range, and in that case it is assumed the high bits are dropped#asahi-dev · 2023-04-10 16:57
marcanthere's the dma-ranges stuff that can also limit this, but that's for buses and this isn't a bus...#asahi-dev · 2023-04-10 16:57
marcanApple puts it in the IOMMU and on Linux the IOMMU is the only easy place for this to be set, since that driver controls the aperture fully (devices can only set a DMA mask)#asahi-dev · 2023-04-10 16:56
marcanit's somewhat questionable whether this is a property of the IOMMU or the device, since it's really a property of how the IOMMU interacts with the device's view of memory (and we don't even know exactly how that is implemented)#asahi-dev · 2023-04-10 16:56
marcannot sure if it makes sense to make it generic, in principle other IOMMU drivers could easily support this but I'm not sure if they care#asahi-dev · 2023-04-10 16:55
marcanthis is a property for IOMMU device nodes to specify the allowable DMA address range, I have it as two u64s <base size> right now.#asahi-dev · 2023-04-10 16:55
marcanrobher: what's the best practice for DMA addresses in the DT? use the device cell sizes, or hardcode it to 64-bit always, or something else? (so kettenis_ doesn't hate me when we change the bindings when upstreaming)#asahi-dev · 2023-04-10 16:53
marcanwill test DCP tomorrow#asahi-dev · 2023-04-10 16:53
marcanMTP works as intended now with the high DVAs#asahi-dev · 2023-04-10 16:53
marcanI really need to get some dinner and sleep now :)#asahi-dev · 2023-04-10 16:52
marcanjannau: pushed and added an apple,dma-range thing, hopefully it does what you want for DCP and we can get rid of the DRAM mask story.#asahi-dev · 2023-04-10 16:06
jannauworks here up to "apple-dcp 389c00000.dcp: dcp_hotplug: connected: 0"#asahi-dev · 2023-04-10 16:05
jannaumarcan: if you want to give dcp a spin ^^^#asahi-dev · 2023-04-10 16:05
jannaufor the macbook pros https://github.com/jannau/m1n1/tree/t602x-dcp is hopefully enough#asahi-dev · 2023-04-10 16:00
jannauon linux side https://github.com/jannau/linux/tree/dcp-6.3-rc4-0_dcp-v13_2 merges without conflicts#asahi-dev · 2023-04-10 15:58
jannaufinally, dcp works to the point where it detects the missing display#asahi-dev · 2023-04-10 15:53
marcanyeah#asahi-dev · 2023-04-10 15:53
jannaubut most devices are limited to 32-bit. we have to update drivers to not use dma_set_mask...(32);#asahi-dev · 2023-04-10 15:51
jannauat least vm-size seems to be only a suggestion, we have so far not encoutered a device which fails with top of address space iovas #asahi-dev · 2023-04-10 15:49
marcanlet's do that#asahi-dev · 2023-04-10 15:49
marcanyeah, we could also use dma-ranges but that only works on buses and it feels like very much the wrong abstraction#asahi-dev · 2023-04-10 15:48
jannauif we want to deal with it properly in linux we have to set domain->geometry.aperture_{start,end} based on vm-base and vm-size#asahi-dev · 2023-04-10 15:47
marcanyeah that's... not ideal :/#asahi-dev · 2023-04-10 15:45
jannauonly change in linux was to use the dart's ias and rely on linux to allocate iova from the top#asahi-dev · 2023-04-10 15:45
jannauI think I deal only explicitly in m1n1 with it#asahi-dev · 2023-04-10 15:45
marcanlooks like this is only settable at the iommu, so just like macOS, it has to go in the DART...#asahi-dev · 2023-04-10 15:40
marcan(both at its input and in the page tables of course)#asahi-dev · 2023-04-10 15:40
marcanjannau: I get the feeling vm-base and vm-size are that (the VM range you're supposed to use for iovas/dvas), except when the dart IAS doesn't fit it the top bits just get truncated off