#asahi · 2021-05-31 20:08
svenno, i'm building on a remote vm#asahi · 2021-05-31 20:07
svenor just temporarily upgrade the build vm to 16 cores ;)#asahi · 2021-05-31 20:00
svenugh.. i forgot that i have to recompile essentially the entire kernel when switching page sizes#asahi · 2021-05-31 19:39
sveni must've reverted that by accident when rebasing/squashing#asahi · 2021-05-31 19:38
svenneeds to be readl_poll_timeout_atomic#asahi · 2021-05-31 19:38
svenreadl_poll_timeout calls some usleep-variant iirc#asahi · 2021-05-31 19:36
svenyou're not suppoed to do that ;)#asahi · 2021-05-31 19:36
sventhe issue is that i used to call usleep in a held spinlock#asahi · 2021-05-31 19:36
svenyeah, looks like i messed up some rebase/squash session and reverted that back#asahi · 2021-05-31 19:35
svenshould be readl_poll_timeout_atomic in there iirc#asahi · 2021-05-31 19:35
svener... did i manage to revert that back by accident?#asahi · 2021-05-31 19:19
svenif only i knew what triggered it :D#asahi · 2021-05-31 19:13
svenwow. i just kernel panic'd my macbook by doing something strange to usb#asahi · 2021-05-31 17:41
svenhow did i mess that up :D#asahi · 2021-05-31 17:41
svenhuh#asahi · 2021-05-31 17:41
svenpanic(cpu 0 caller 0xfffffe00143af0f8): "ApplePMGR: virtual void ApplePMGR::initDriver(IOService *):1557 REQUIRE failed: id != kIDReserved"#asahi · 2021-05-31 16:27
svenhm. now that i'm reading that code again it shouldn't be too hard to just make it work with a different granule#asahi · 2021-05-31 16:21
sveni'm not sure the maintainers would be very happy with me if i replace that with some special-case DART code though ;)#asahi · 2021-05-31 16:20
svenand that iommu layer is the one that manages the entire iova space#asahi · 2021-05-31 16:20
sventhat's one layer up from the dart driver in linux. iirc it's called dma_ops there#asahi · 2021-05-31 16:13
svenbut the linux iommu api manages the entire iova space. the dart driver just gets told "please map iova range [x,x+sz] to paddr range [y,y+sz]#asahi · 2021-05-31 16:13
svenor, well. not really. we could map 4k aligned pages to one of [iova],[iova+4k],[iova+8k],[iova_12k] or something like that#asahi · 2021-05-31 16:12
sven(or even things smaller than 4k)#asahi · 2021-05-31 16:12
svenwith this we could map 4k pages to 16k aligned iovas#asahi · 2021-05-31 16:11
svenbut i think the issue is that the top level api in linux so far guarantees that you can map any page-aligned things to any page aligned iova#asahi · 2021-05-31 16:11
sveni'd have to write my own pagetable code#asahi · 2021-05-31 16:11
svenhave you already made thunderbolt work? :D#asahi · 2021-05-31 16:09
svenhaven't figured out the exact details because using usb to look into the iova space is a little bit annoying#asahi · 2021-05-31 16:09
sveniirc in the PTE bit 1 needs to be cleared and then the top bits become [12 bit start offset][12 bit end offset] or something like that#asahi · 2021-05-31 16:07
svenas as long as the iovas are 16k aligned you can probably also only map 4k#asahi · 2021-05-31 16:07
svendart has some sub-page protection support fwiw#asahi · 2021-05-31 15:14
svenand we could also hack this by creating a fake-bypass mode with static pagetables + swiotlb#asahi · 2021-05-31 15:12
sventhere's already some support for small allocation by using swiotlb#asahi · 2021-05-31 15:11
svenit's not impossible to support that, but it'd be annoying to implement#asahi · 2021-05-31 15:10
svenyes, but the kernel currently assumes that cpu page size >= iommu page size#asahi · 2021-05-31 14:54
svensounds good to me#asahi · 2021-05-31 14:52
sveni'm fine with only supporting 16k/64k pages *shrug*#asahi · 2021-05-31 14:51
svenfine with me ;)#asahi · 2021-05-31 14:51
svenwell... i mean.. we could build some hacked bypass support for 4k pages but uh#asahi · 2021-05-31 14:50
svenlol#asahi · 2021-05-31 14:42
svenwhich probably explains why we couldn't get bypass to work there#asahi · 2021-05-31 14:42
sventhat bit isn't set for the pcie darts#asahi · 2021-05-31 14:41
svenkettenis: i just briefly looked at the DART kext to confirm that we can't switch page sizes and stumbled across a method called "dartSupportsFullBypass". looks like bypass mode is only supported if bit 0 in register 0x04 is set #asahi · 2021-05-31 12:43
svenand i'd rather spend that time reading/writing code :)#asahi · 2021-05-31 12:42
svenyeah, i'd have to setup all that stuff before i could even start streaming#asahi · 2021-05-31 12:41
svennow i wanna see if i can somehow get this to at least boot with a 4k pagesize as well#asahi · 2021-05-31 12:40
svenkettenis: yeah, i think the iommu seems to work fine#asahi · 2021-05-31 12:37
svenso that's what i've assumed as well. maybe something is broken with MSIs then#asahi · 2021-05-31 12:36
sveni think it does. at least very slowly#asahi · 2021-05-31 12:33
svenj_ey: that sounds like effort. you'd also only get to watch me reading linux code which is not very interesting