ChanServ changed the topic of #asahi-re to: Asahi Linux: porting Linux to Apple Silicon macs | Hardware / boot process / firmware interface reverse engineering | WARNING: this channel (only) may contain binary reverse engineering discussion | RE policy: https://alx.sh/re (MANDATORY READ) | GitHub: https://alx.sh/g | Wiki: https://alx.sh/w | Logs: https://alx.sh/l/asahi-re
skipwich has joined #asahi-re
quarkyalice has quit [Ping timeout: 480 seconds]
chadmed has joined #asahi-re
chadmed has quit [Remote host closed the connection]
phiologe has joined #asahi-re
austriancoder has quit [Read error: Connection reset by peer]
austriancoder has joined #asahi-re
PhilippvK has quit [Ping timeout: 480 seconds]
<marcan> alyssa: so actually what that rt bandwidth thing does is call function-bw_req_interrupt0 from the ADT (which is a link to elsewhere)
<marcan> then I think most of the structure is actually just uninitialized garbage
<marcan> but there are three physmem pointers returned, to registers
<marcan> I think one is actually reg + bit
<marcan> this is good, I thought this was going to be some mess involving Mathβ„’
<marcan> looks like it's just telling it about some IRQ or something
<alyssa> Fun
<marcan> turns out it was 90% uninitialized memory bullshit
<marcan> it's just telling DCP about some registers
<alyssa> rock on !
<marcan> I expect the bit will change for dispext, need to see where that comes from
<alyssa> though err
<alyssa> why can't the dcp use sr_map_device_memory for that
<marcan> probably because the bit or something? this is calling out to some other RTBandwidth service
<alyssa> `but
<marcan> look, don't try to make sense of this
<alyssa> actually you know what i'm done trying to apply logic to this pile of hacks
<marcan> we know it's a mess :p
<alyssa> jinx
<marcan> it's our job to stick it to apple and make the linux version orders of magnitude more beautiful ;)
<alyssa> I want to say the mess I've produced is not that
<marcan> it's okay, review will take care of that :D
<alyssa> then again i can only imagine what dcp.kext looks like πŸ˜‹
<alyssa> 14 files changed, 1684 insertions(+), 18 deletions(-)
<alyssa> ^ that gets us to "hello KMS" on the DCP
<marcan> :D
<marcan> nice!
<alyssa> Tomorrow will be ~~cleaning up the pile of hacks~~ adding more hacks so I get 4k@60 on linux
<marcan> you really care about your 4K don't you :p
<alyssa> Look my chromebook is 2400x1600 on a laptop screen
<alyssa> so no I am not putting up with 1080 on a 27" monitor
<marcan> :p
<alyssa> forefront on the pile of hacks is the mess of a DT i've made
<marcan> ha
<alyssa> I uhhh
<alyssa> have a DCP driver and a KMS driver and they are independent modules with mutual references in their private structs it's not good
<marcan> heh
<marcan> they should probably be a single driver tbh :p
<alyssa> this is a kludge to workaround linux only allowing a device to have a single IOMMU
<alyssa> because why would a single device need multiple independent IOMMUs? :v
<marcan> well, you can still have different devices from Linux's point of view, managed by one driver
<alyssa> sven linked me to your clock gate thing as an example..?
<marcan> that's kind of different, that's multiple devices sharing one register mapping
<alyssa> the KMS driver needs to "own" disp0 stream 0, so that way framebuffer memory can be allocated by the DRM core and be automatically mapped with no driver twiddling
<marcan> but I mean, you can have different drivers in one module that just happen to know about each other and share all kinds of private data
<alyssa> on the other hand, the DCP module needs to "own" the DCP dart so the rtkit crap can just do dma_alloc_coherent properly
<alyssa> Hum, alright. That seems sane
<alyssa> in the DT is that modeled as sibling nodes or as parent/child?
<marcan> sibling nodes with a reference, like interrupt-parent and such
<alyssa> Okay, that's what I have now
<marcan> so pick one that will be the "parent" driver that kicks everything off, then that defers probing until everything else is probed
<alyssa> although then I needed deferred probe nonsense --- yeah
<marcan> yeah I think this is all kosher
<alyssa> alright, won't worry so much then
<marcan> this is how apple does it anyway so...
<marcan> there's prior art there too :p
<marcan> (just they make a mess of it)
<alyssa> Snrkt
<alyssa> + /* XXX: need to validate the DCP is allowed to access */
<alyssa> oh meant to ask about this
<marcan> for mappings?
<alyssa> map_physical, the DCP only calls it with disp0 regs, yeah?
<alyssa> (Obviously letting a copro map whatever memory it wants defeats the purpose of having an IOMMU)
<marcan> it only call it right after sr_mapDeviceMemoryWithIndex(PROV, 4, 256, 0x23b3d0000, 0x4000)
<marcan> which is looking up disp0, yes
<marcan> so we should just check that it's one of the disp0 ranges I guess
<marcan> possibly a subset
<alyssa> πŸ‘
<marcan> in this case it's disp0 index 4, though for us that might be a different index, in which case we'd want a mapping table anyway
<alyssa> that's what I assumed but am trying to check my assumptions off you since you complained I don't ask enough questions πŸ˜‹
<marcan> good :)
<alyssa> I see no reason not to just include the regs in Apple order in the DT
<marcan> depends on what they do and what sense they make
<alyssa> since AFAIK we have no reason to touch those registers ourselves ever
<marcan> apple do some insane stuff with reg ranges
<marcan> like mapping pmgr stuff in every goddamn device
<alyssa> Grumble
<marcan> also we *might* end up doing hacks on disp0 regs eventually
<marcan> but for now you can just use the same ranges, sure
<marcan> eventually I'd probably want a mapping table
<marcan> like {4, <reference to what we call that range>} and then the map call can just check that what is being mapped is something in that table (resolved)
<alyssa> <reference> being a reference to a DT name/index/handle/whatever?
<alyssa> (so the regs are still in the DT, not hardcoded)
<marcan> yeah, however we choose to represent it
<marcan> could just be an offset from disp0 base or some disp0 subrange or whatever
<marcan> yes
<alyssa> of the disp0 regs only suspicious one is
<alyssa> addr = 0x0000000071800000
<alyssa> size = 0x0000000000800000, Container:
<marcan> I don't see that in disp0?
<alyssa> oh er that was dispext0 i'm tired
<alyssa> addr = 0x0000000031800000
<alyssa> size = 0x0000000000800000, Container:
<marcan> 0x231800000.... is DCP
<marcan> 0x230000000..... is disp0
<marcan> see the big comment at the top of dcp.py
<marcan> I did some snooping on the reg ranges
<marcan> see what I said about the regs being a mess?
<marcan> apple seriously doesn't care, they have drivers poking other devices' registers *everywhere*
<alyssa> ....I feel better about my own code now
<marcan> bbl, lunch :p
<alyssa> \o
<alyssa> bbl sleep :p
thunfisch has quit [Quit: frrrp!]
thunfisch has joined #asahi-re
Emantor has quit [Quit: ZNC - http://znc.in]
Emantor has joined #asahi-re
jbowen has joined #asahi-re
yuyichao has quit [Ping timeout: 480 seconds]
PhilippvK has joined #asahi-re
phiologe has quit [Ping timeout: 480 seconds]
X-Scale has joined #asahi-re
skoobasteeve_ has joined #asahi-re
skoobasteeve has quit [Ping timeout: 480 seconds]
phiologe has joined #asahi-re
PhilippvK has quit [Ping timeout: 480 seconds]
PhilippvK has joined #asahi-re
phiologe has quit [Ping timeout: 480 seconds]
riker77_ has joined #asahi-re
riker77 has quit [Ping timeout: 480 seconds]
riker77_ is now known as riker77