ChanServ changed the topic of #asahi-dev to: Asahi Linux: porting Linux to Apple Silicon macs | General development | GitHub: https://alx.sh/g | Wiki: https://alx.sh/w | Logs: https://alx.sh/l/asahi-dev
daftfrog[m] has joined #asahi-dev
bngs[m] has joined #asahi-dev
blazra[m] has joined #asahi-dev
svenpeter[m] has joined #asahi-dev
svenpeter[m] is now known as Guest2146
doggkruse has joined #asahi-dev
emilazy has joined #asahi-dev
fluffypup[m] has joined #asahi-dev
digitalfx[m] has joined #asahi-dev
SocioProphet[m] has joined #asahi-dev
mmlb[m] has joined #asahi-dev
samfromspace[m] has joined #asahi-dev
s-urabe[m] has joined #asahi-dev
mofux[m] has joined #asahi-dev
yuyichao_ has joined #asahi-dev
IvanMaksimovic[m] has joined #asahi-dev
perigoso[m] has joined #asahi-dev
RowanGoemans[m] has joined #asahi-dev
DanielHuisman[m] has joined #asahi-dev
brentr123[m] has joined #asahi-dev
lockna has joined #asahi-dev
ted[m]1 has joined #asahi-dev
ella-0[m] has joined #asahi-dev
psydroid has joined #asahi-dev
CristianMgheruan-Stanciu[m] has joined #asahi-dev
dnjmis[m] has joined #asahi-dev
doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AkihikoOdaki[m] has joined #asahi-dev
arnidg[m] has joined #asahi-dev
davay[m] has joined #asahi-dev
user1tt[m] has joined #asahi-dev
xerpi[m] has joined #asahi-dev
nilsi[m] has joined #asahi-dev
___nick___ has joined #asahi-dev
simjnd[m] has joined #asahi-dev
ar88kk[m] has joined #asahi-dev
doggkruse has joined #asahi-dev
Bastian[m] has joined #asahi-dev
PhilippvK has joined #asahi-dev
phiologe has quit [Ping timeout: 480 seconds]
<alyssa> this seems to be a net negative for codebase quality :|
<alyssa> certainly the internal api is nicer
<alyssa> but god the preprocessor is icky
<alyssa> curious if you have ideas for ways to manage the stupid.
<alyssa> (That doesn't involve code generators etc.)
pg12_ has quit [Remote host closed the connection]
pg12_ has joined #asahi-dev
doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
doggkruse has joined #asahi-dev
kov has quit [Quit: Coyote finally caught me]
abilash1994[m] has joined #asahi-dev
ah-[m] has joined #asahi-dev
psykose has quit [Read error: Connection reset by peer]
psykose has joined #asahi-dev
al3xtjames0 has joined #asahi-dev
al3xtjames has quit [Remote host closed the connection]
al3xtjames0 is now known as al3xtjames
spot[m] has joined #asahi-dev
alexanderwillner[m] has joined #asahi-dev
chadmed has quit [Quit: Konversation terminated!]
h_ro[m] has joined #asahi-dev
chadmed has joined #asahi-dev
chadmed has quit [Quit: Konversation terminated!]
chadmed has joined #asahi-dev
tophevich[m] has joined #asahi-dev
Amey has joined #asahi-dev
rethematrix[m] has joined #asahi-dev
Eighth_Doctor has joined #asahi-dev
msmith12[m] has joined #asahi-dev
TellowKrinkle[m] has joined #asahi-dev
chadmed has quit [Remote host closed the connection]
chadmed has joined #asahi-dev
aleasto has joined #asahi-dev
<arnd> alyssa: I'd try to avoid the ## concatenation. While that does involve passing both (almost identical) identifiers in the DCP_THUNK_*() call, it does become possible to grep afterwards, which helps readers understand where the calls actually go.
_alice has joined #asahi-dev
DarkShadow44 has quit [Quit: ZNC - https://znc.in]
DarkShadow44 has joined #asahi-dev
maxim[m] has joined #asahi-dev
chadmed has quit [Remote host closed the connection]
chadmed has joined #asahi-dev
etsukata[m] has joined #asahi-dev
kdrag0n[m] has joined #asahi-dev
cgv[m] has joined #asahi-dev
alicela1n has joined #asahi-dev
doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
HayashiEsme[m] has joined #asahi-dev
gamble[m] has joined #asahi-dev
peerp[m] has joined #asahi-dev
joerosenberg[m] has joined #asahi-dev
ryanhrob[m] has joined #asahi-dev
rowang077[m] has joined #asahi-dev
ghantaz[m] has joined #asahi-dev
rkjnsn[m] has joined #asahi-dev
<alyssa> arnd: Alright
jevinskie[m] has joined #asahi-dev
ograff has joined #asahi-dev
<alyssa> arnd: https://rosenzweig.io/fixed.diff <-- like that?
thebrinkoftomorrow[m] has joined #asahi-dev
<arnd> alyssa: yes, exactly
<alyssa> 👍
<alyssa> I still think this preprocessor dance is ugly as hell
<alyssa> Then again, it can live in its own file and then I can forget about it
<alyssa> and it makes the actual driver a lot easier to follow
<alyssa> and if it saves me from the upstream flamewar of modifying the build... sure, why not
AnushervonTabarov[m] has joined #asahi-dev
ybk[m] has joined #asahi-dev
sajattack[m] has joined #asahi-dev
zbotpath[m] has joined #asahi-dev
izzyisles[m] has joined #asahi-dev
bastilian[m] has joined #asahi-dev
yuyichao_ has quit [Ping timeout: 480 seconds]
King_In5 has quit [Remote host closed the connection]
yuyichao_ has joined #asahi-dev
landscape15[m] has joined #asahi-dev
HaoYanQi[m] has joined #asahi-dev
King_InuYasha has joined #asahi-dev
yuyichao_ has quit [Quit: Konversation terminated!]
yuyichao has joined #asahi-dev
povik has joined #asahi-dev
doggkruse has joined #asahi-dev
shaman_br[m] has joined #asahi-dev
foxlet has joined #asahi-dev
facez[m] has joined #asahi-dev
happy-dude[m] has joined #asahi-dev
JuniorJPDJ has joined #asahi-dev
YichaoYu[m] has joined #asahi-dev
yuyichao_ has joined #asahi-dev
yuyichao has quit [Ping timeout: 480 seconds]
gladiac has quit [Quit: k thx bye]
gladiac has joined #asahi-dev
<povik> the audio dma triggers audio faults like this
<povik> [ 8229.443188] apple-dart 235004000.iommu: translation fault: status:0x82010001 stream:2 code:0x1 (NO TTBR FOR IOVA) at 0xfff86a00
<povik> but i know for a fact the iova in question is mapped
<povik> looking at dart.dump_device(2) if i pause in hypervisor
<povik> ideas?
<sven> yup, welcome to the DAPF!
<povik> tell more
<sven> it sits 0x4000 bytes after the DART and is some kind of additional address filter
<sven> i have some old notes but i think marcan looked into that one a bit during one of his streams
<sven> that was the same issue i had with the aes engine fwiw
<sven> "NO TTBR FOR IOVA" is a dead giveaway. for some reason the DART isn't able to read the base pagetable
<sven> (the other explanation is that you have the wrong streamid, but i kinda doubt that :-))
<povik> hm
<povik> can i simply set BYPASS_DAPF and it will go away?
<sven> nope
<povik> how come
<sven> only BYPASS_DAPF | BYPASS_DART works
<sven> no idea :D
<povik> ahhh
<povik> let's look at the stream then
<sven> you can switch the iommu to bypass mode if the audio hardware supports 64bit addresses
<sven> but... that's only a temporary solution
<marcan> we should add that DAPF stuff, it looked pretty simple when I looked at it but I never did experiments
<sven> yeah, exactly
<sven> it seems to be very simple
<marcan> also stream #15 smelled like a stage 2 thing
<sven> i just haven't had any good reason to look into it
<marcan> lol
<marcan> fine
<marcan> remind me if you have aes test code?
<sven> uh... somewhere
<sven> let me find it again
<povik> sven: it should support 64bit, but that is not a satisfactory outcome of course
<povik> would you know roughly when marcan looked into it in stream?
<povik> *on stream
<j_ey> sven: marcan
<sven> ah, yup
<sven> usual disclaimer: no idea if that ever worked, probably doesn't work anymore these days
<marcan> ack, thanks
<sven> let's see if i can still find my notes
doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<sven> but IIRC it had fields like sid mask, some flags, start, end
<sven> (or maybe sid instead of sid mask, don't remember)
<marcan> povik: it's just the page after the DART regs, and it's a little table with from/to/size type mappings, and some magic flags, some of which seem related to whether the mapping gets used for the DART PTs themselves
<marcan> that's as much as you'd see on the stream anyway
<povik> ah okay
<marcan> if you dump a DAPF that is properly configured you'll see it
<povik> let
<marcan> I think DCP had it? or another one? I forget
<sven> and you may or may not need to set the DART stream 15 to bypass mode
<povik> *let's look into this then
<marcan> and yeah, 15 to bypass seems to be a thing
<sven> the sio dart which is used for the aes engine and apparently also audio
<sven> i guess macos configures that one at some point
<sven> maybe
<sven> or maybe setting stream 15 to bypass is enough
<povik> you mean like this?
<povik> dart.regs.TCR[15].set(BYPASS_DART=1,BYPASS_DAPF=1)
<sven> i guess
<sven> i haven't done this before either :D
<povik> yeah no luck there
<sven> probably requires the DAPF to be setup then
<povik> interesting the proof of concept driver does not run into this issue
* sven happily accepts patches to make the DART driver support DAPF :>
<sven> that's odd indeed
<sven> maybe it goes through but triggers the interrupt which the poc ignores? but that would be very strange
<povik> but then... it works
<povik> strange
<sven> so the DART driver resets all streams i think
<sven> maybe stream 15 is already correctly configured and gets messed up?
<povik> is there a dart instance where 15 is a regular stream?
<sven> no idea
<kettenis> all DART instances seem to have subtle differences
<kettenis> PCIe ones don't support bypass; the Thunderbolt ones have 64 stream IDs
<sven> DCP one is locked *sigh*
<kettenis> (or did I misremember that last bit?)
<sven> sounds about right
<marcan> wouldn't the poc driver be using bypass mode?
<povik> no, it actually maps iovas
<sven> depends on how povik wrote it. but i think he actually maps memory through dart
<sven> povik: maybe try just DART_BYPASS without DAPF_BYPASS for stream 15
<povik> see here
<povik> sven: behaves the same
<sven> :(
<povik> okay, first step: try to put iovas in poc driver as high as they are in linux
<sven> so apparently the aperture given in the ADT is 0x0021c000 with a size of 0xfbde4000
<kettenis> which dart is this (in the ADT)?
<sven> but for other darts that was a lie
<povik> kettenis: dart-sio
<povik> high iovas still work
<sven> okay. so the aperture is also a lie for that dart :D
<povik> strange
<povik> i rebooted and now speaker emits sounds
<povik> from linux!
<povik> (although not the correct sounds)
<sven> uhhh....
<alyssa> povik: do not disregard "it's faulting nonstop in m1n1 but there's no IRQ handler checking" as a possibility ;-p
<alyssa> OB(for the PoC)
<povik> but that would a fault with data still going through
<povik> *would be a fault
<povik> i dont know what changed between the two tries
<povik> i run the poc driver a few times and then booted linux in hypervisor again
<povik> maybe that's it
<povik> i didnt reboot before starting the hypervisor
<sven> doesn't make much sense though :/
<povik> could be there's some left-over state from poc driver that makes it work
<sven> in the DART?
<povik> i dont know, somewhere
<povik> let me reproduce
<sven> if it works again, do you do anything special when setting up the DART?
<povik> not at all
<povik> dart.initialize and that's it
<povik> okay, ran linux hypervisor after fresh reboot and am back to dart faults and no sound
<povik> let's try running poc driver, then linux with no reboot
<sven> hm... dart_initialize does self.regs.ENABLED_STREAMS.val = 0 and then later self.regs.ENABLED_STREAMS.val |= self.enabled_streams which my driver doesn't do
<povik> no faults and sound now
<sven> unless not all streams are enabled after a fresh boot
<povik> let me put a comma in there
<povik> no faults, and sound now
<sven> ugh
<sven> can you try write32(u.adt["/arm-io/dart-sio"].get_reg(0)[0] + 0xfc, 0xffff) before booting linux?
<povik> whatever the m1n1 dart driver does, it has a positive influence
<povik> sure
<sven> it looks like the sio dart starts with the first three streams disabled *sigh*
<povik> it does seem to do the trick
<povik> let me try again with no interference from other things i did
<sven> lol
<sven> so for some reason something (iboot?) disabled streams 0,1 and 2 in the sio dart
<povik> sven: yeah, that's it
<povik> will cherish that poke now
<povik> also that incorrect sound i talked about
<povik> it's just clipped
<povik> it almost works
<sven> \o/
<sven> let's see if the aes engine also works after that poke :D
<sven> hrm, no. that one still seems to be broken
<povik> bet it's the speaker amp part that is configured differently
<povik> that should be easy to override from hypervisor shell
doggkruse has joined #asahi-dev
<povik> and... there it is
<povik> it's clean now
<sven> nice!
<povik> so... *that's* how the song sounds in the original
<povik> should debug with something i know next time
<povik> (that's what it was)
<povik> that beats at the beginning, clipped, confused me at first
<povik> thought it is underflowing periodically
doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
povik has quit [Remote host closed the connection]
___nick___ has quit [Ping timeout: 480 seconds]
yuyichao_ has quit [Ping timeout: 480 seconds]
doggkruse has joined #asahi-dev
<marcan> 02:51:37 < sven> hm... dart_initialize does self.regs.ENABLED_STREAMS.val = 0 and then later self.regs.ENABLED_STREAMS.val |= self.enabled_streams which my driver doesn't do
<marcan> ah yes, I noticed that while making PMP work
<marcan> that's when I added that code
<marcan> it's definitely required for a bunch of DARTs :)
<marcan> (PMP is funny btw, the reg property in the adt is actually a pile of MMIO ranges you're supposed to map *for* it in the DART, then on startup you give it a table of DVAs and some other stuff from the ADT)
aleasto has quit [Quit: Konversation terminated!]
yuyichao_ has joined #asahi-dev