#
…

2021-10-08

00:03daftfrog[m] has joined #asahi-dev
00:03bngs[m] has joined #asahi-dev
00:03blazra[m] has joined #asahi-dev
00:09svenpeter[m] has joined #asahi-dev
00:09svenpeter[m] is now known as Guest2146
00:18doggkruse has joined #asahi-dev
00:21emilazy has joined #asahi-dev
00:30fluffypup[m] has joined #asahi-dev
00:32digitalfx[m] has joined #asahi-dev
00:39SocioProphet[m] has joined #asahi-dev
00:41mmlb[m] has joined #asahi-dev
00:41samfromspace[m] has joined #asahi-dev
00:42s-urabe[m] has joined #asahi-dev
00:42mofux[m] has joined #asahi-dev
00:42yuyichao_ has joined #asahi-dev
00:45IvanMaksimovic[m] has joined #asahi-dev
00:52perigoso[m] has joined #asahi-dev
00:53RowanGoemans[m] has joined #asahi-dev
01:04DanielHuisman[m] has joined #asahi-dev
01:06brentr123[m] has joined #asahi-dev
01:11lockna has joined #asahi-dev
01:23ted[m]1 has joined #asahi-dev
01:27ella-0[m] has joined #asahi-dev
01:28psydroid has joined #asahi-dev
01:29CristianMgheruan-Stanciu[m] has joined #asahi-dev
01:40dnjmis[m] has joined #asahi-dev
01:50doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
01:51AkihikoOdaki[m] has joined #asahi-dev
01:52arnidg[m] has joined #asahi-dev
01:52davay[m] has joined #asahi-dev
01:53user1tt[m] has joined #asahi-dev
01:53xerpi[m] has joined #asahi-dev
01:56nilsi[m] has joined #asahi-dev
01:59___nick___ has joined #asahi-dev
02:01simjnd[m] has joined #asahi-dev
02:05ar88kk[m] has joined #asahi-dev
02:06doggkruse has joined #asahi-dev
02:13Bastian[m] has joined #asahi-dev
02:29PhilippvK has joined #asahi-dev
02:33phiologe has quit [Ping timeout: 480 seconds]
02:35alyssathis seems to be a net negative for codebase quality :|
02:36alyssacertainly the internal api is nicer
02:36alyssabut god the preprocessor is icky
02:42alyssacurious if you have ideas for ways to manage the stupid.
02:42alyssa(That doesn't involve code generators etc.)
02:56pg12_ has quit [Remote host closed the connection]
02:56pg12_ has joined #asahi-dev
03:02doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
03:12doggkruse has joined #asahi-dev
03:25kov has quit [Quit: Coyote finally caught me]
03:40abilash1994[m] has joined #asahi-dev
03:43ah-[m] has joined #asahi-dev
03:56psykose has quit [Read error: Connection reset by peer]
03:56psykose has joined #asahi-dev
04:04al3xtjames0 has joined #asahi-dev
04:05al3xtjames has quit [Remote host closed the connection]
04:05al3xtjames0 is now known as al3xtjames
04:14spot[m] has joined #asahi-dev
04:20alexanderwillner[m] has joined #asahi-dev
04:27chadmed has quit [Quit: Konversation terminated!]
04:32h_ro[m] has joined #asahi-dev
04:34chadmed has joined #asahi-dev
04:51chadmed has quit [Quit: Konversation terminated!]
04:55chadmed has joined #asahi-dev
05:07tophevich[m] has joined #asahi-dev
05:11Amey has joined #asahi-dev
05:20rethematrix[m] has joined #asahi-dev
05:46Eighth_Doctor has joined #asahi-dev
06:13msmith12[m] has joined #asahi-dev
06:27TellowKrinkle[m] has joined #asahi-dev
06:45chadmed has quit [Remote host closed the connection]
06:46chadmed has joined #asahi-dev
06:51aleasto has joined #asahi-dev
07:00arndalyssa: 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.
07:01_alice has joined #asahi-dev
07:11DarkShadow44 has quit [Quit: ZNC - https://znc.in]
07:11DarkShadow44 has joined #asahi-dev
07:12maxim[m] has joined #asahi-dev
07:25chadmed has quit [Remote host closed the connection]
07:25chadmed has joined #asahi-dev
07:59etsukata[m] has joined #asahi-dev
08:05kdrag0n[m] has joined #asahi-dev
08:13cgv[m] has joined #asahi-dev
08:20alicela1n has joined #asahi-dev
08:22doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
08:23HayashiEsme[m] has joined #asahi-dev
09:30gamble[m] has joined #asahi-dev
09:39peerp[m] has joined #asahi-dev
09:46joerosenberg[m] has joined #asahi-dev
11:04ryanhrob[m] has joined #asahi-dev
11:10rowang077[m] has joined #asahi-dev
11:23ghantaz[m] has joined #asahi-dev
11:24rkjnsn[m] has joined #asahi-dev
11:56alyssaarnd: Alright
12:02jevinskie[m] has joined #asahi-dev
12:06ograff has joined #asahi-dev
12:07thebrinkoftomorrow[m] has joined #asahi-dev
12:09arndalyssa: yes, exactly
12:11alyssaI still think this preprocessor dance is ugly as hell
12:11alyssaThen again, it can live in its own file and then I can forget about it
12:11alyssaand it makes the actual driver a lot easier to follow
12:22alyssaand if it saves me from the upstream flamewar of modifying the build... sure, why not
12:44AnushervonTabarov[m] has joined #asahi-dev
13:00ybk[m] has joined #asahi-dev
13:02sajattack[m] has joined #asahi-dev
13:27zbotpath[m] has joined #asahi-dev
13:38izzyisles[m] has joined #asahi-dev
13:46bastilian[m] has joined #asahi-dev
13:47yuyichao_ has quit [Ping timeout: 480 seconds]
14:02King_In5 has quit [Remote host closed the connection]
14:14yuyichao_ has joined #asahi-dev
14:21landscape15[m] has joined #asahi-dev
14:23HaoYanQi[m] has joined #asahi-dev
14:28King_InuYasha has joined #asahi-dev
14:30yuyichao_ has quit [Quit: Konversation terminated!]
14:31yuyichao has joined #asahi-dev
14:41povik has joined #asahi-dev
14:46doggkruse has joined #asahi-dev
15:02shaman_br[m] has joined #asahi-dev
15:05foxlet has joined #asahi-dev
15:16facez[m] has joined #asahi-dev
15:25happy-dude[m] has joined #asahi-dev
15:51JuniorJPDJ has joined #asahi-dev
16:10YichaoYu[m] has joined #asahi-dev
16:17yuyichao_ has joined #asahi-dev
16:21yuyichao has quit [Ping timeout: 480 seconds]
16:32gladiac has quit [Quit: k thx bye]
16:33gladiac has joined #asahi-dev
17:09povikthe audio dma triggers audio faults like this
17:09povik[ 8229.443188] apple-dart 235004000.iommu: translation fault: status:0x82010001 stream:2 code:0x1 (NO TTBR FOR IOVA) at 0xfff86a00
17:09povikbut i know for a fact the iova in question is mapped
17:10poviklooking at dart.dump_device(2) if i pause in hypervisor
17:10svenyup, welcome to the DAPF!
17:10poviktell more
17:10svenit sits 0x4000 bytes after the DART and is some kind of additional address filter
17:10sveni have some old notes but i think marcan looked into that one a bit during one of his streams
17:11sventhat was the same issue i had with the aes engine fwiw
17:11sven"NO TTBR FOR IOVA" is a dead giveaway. for some reason the DART isn't able to read the base pagetable
17:11sven(the other explanation is that you have the wrong streamid, but i kinda doubt that :-))
17:12povikcan i simply set BYPASS_DAPF and it will go away?
17:13povikhow come
17:13svenonly BYPASS_DAPF | BYPASS_DART works
17:13svenno idea :D
17:13poviklet's look at the stream then
17:13svenyou can switch the iommu to bypass mode if the audio hardware supports 64bit addresses
17:13svenbut... that's only a temporary solution
17:13marcanwe should add that DAPF stuff, it looked pretty simple when I looked at it but I never did experiments
17:14svenyeah, exactly
17:14svenit seems to be very simple
17:14marcanalso stream #15 smelled like a stage 2 thing
17:14sveni just haven't had any good reason to look into it
17:14marcanremind me if you have aes test code?
17:14svenuh... somewhere
17:14svenlet me find it again
17:15poviksven: it should support 64bit, but that is not a satisfactory outcome of course
17:15povikwould you know roughly when marcan looked into it in stream?
17:15povik*on stream
17:16j_eysven: marcan
17:16svenah, yup
17:16svenusual disclaimer: no idea if that ever worked, probably doesn't work anymore these days
17:16marcanack, thanks
17:17svenlet's see if i can still find my notes
17:17doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
17:17svenbut IIRC it had fields like sid mask, some flags, start, end
17:17sven(or maybe sid instead of sid mask, don't remember)
17:17marcanpovik: 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
17:17marcanthat's as much as you'd see on the stream anyway
17:17povikah okay
17:17marcanif you dump a DAPF that is properly configured you'll see it
17:18marcanI think DCP had it? or another one? I forget
17:18svenand you may or may not need to set the DART stream 15 to bypass mode
17:18povik*let's look into this then
17:18marcanand yeah, 15 to bypass seems to be a thing
17:18sventhe sio dart which is used for the aes engine and apparently also audio
17:18sveni guess macos configures that one at some point
17:19svenor maybe setting stream 15 to bypass is enough
17:19povikyou mean like this?
17:19povikdart.regs.TCR[15].set(BYPASS_DART=1,BYPASS_DAPF=1)
17:20sveni guess
17:20sveni haven't done this before either :D
17:20povikyeah no luck there
17:21svenprobably requires the DAPF to be setup then
17:22povikinteresting the proof of concept driver does not run into this issue
17:22* svenhappily accepts patches to make the DART driver support DAPF :>
17:22sventhat's odd indeed
17:24svenmaybe it goes through but triggers the interrupt which the poc ignores? but that would be very strange
17:24povikbut then... it works
17:24povikstrange
17:25svenso the DART driver resets all streams i think
17:25svenmaybe stream 15 is already correctly configured and gets messed up?
17:25povikis there a dart instance where 15 is a regular stream?
17:25svenno idea
17:26kettenisall DART instances seem to have subtle differences
17:27kettenisPCIe ones don't support bypass; the Thunderbolt ones have 64 stream IDs
17:27svenDCP one is locked *sigh*
17:27kettenis(or did I misremember that last bit?)
17:27svensounds about right
17:27marcanwouldn't the poc driver be using bypass mode?
17:28povikno, it actually maps iovas
17:28svendepends on how povik wrote it. but i think he actually maps memory through dart
17:28svenpovik: maybe try just DART_BYPASS without DAPF_BYPASS for stream 15
17:29poviksee here
17:29poviksven: behaves the same
17:35povikokay, first step: try to put iovas in poc driver as high as they are in linux
17:37svenso apparently the aperture given in the ADT is 0x0021c000 with a size of 0xfbde4000
17:37ketteniswhich dart is this (in the ADT)?
17:38svenbut for other darts that was a lie
17:38povikkettenis: dart-sio
17:39povikhigh iovas still work
17:40svenokay. so the aperture is also a lie for that dart :D
17:42povikstrange
17:42poviki rebooted and now speaker emits sounds
17:42povikfrom linux!
17:42povik(although not the correct sounds)
17:43svenuhhh....
17:43alyssapovik: do not disregard "it's faulting nonstop in m1n1 but there's no IRQ handler checking" as a possibility ;-p
17:43alyssaOB(for the PoC)
17:44povikbut that would a fault with data still going through
17:44povik*would be a fault
17:44poviki dont know what changed between the two tries
17:45poviki run the poc driver a few times and then booted linux in hypervisor again
17:45povikmaybe that's it
17:45poviki didnt reboot before starting the hypervisor
17:45svendoesn't make much sense though :/
17:46povikcould be there's some left-over state from poc driver that makes it work
17:46svenin the DART?
17:46poviki dont know, somewhere
17:46poviklet me reproduce
17:47svenif it works again, do you do anything special when setting up the DART?
17:47poviknot at all
17:47povikdart.initialize and that's it
17:49povikokay, ran linux hypervisor after fresh reboot and am back to dart faults and no sound
17:50poviklet's try running poc driver, then linux with no reboot
17:51svenhm... 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
17:51povikno faults and sound now
17:51svenunless not all streams are enabled after a fresh boot
17:52poviklet me put a comma in there
17:52povikno faults, and sound now
17:53svencan you try write32(u.adt["/arm-io/dart-sio"].get_reg(0)[0] + 0xfc, 0xffff) before booting linux?
17:53povikwhatever the m1n1 dart driver does, it has a positive influence
17:54svenit looks like the sio dart starts with the first three streams disabled *sigh*
17:55povikit does seem to do the trick
17:55poviklet me try again with no interference from other things i did
17:56svenso for some reason something (iboot?) disabled streams 0,1 and 2 in the sio dart
17:57poviksven: yeah, that's it
17:57povikwill cherish that poke now
18:01povikalso that incorrect sound i talked about
18:01povikit's just clipped
18:01povikit almost works
18:02svenlet's see if the aes engine also works after that poke :D
18:05svenhrm, no. that one still seems to be broken
18:07povikbet it's the speaker amp part that is configured differently
18:07povikthat should be easy to override from hypervisor shell
18:08doggkruse has joined #asahi-dev
18:09povikand... there it is
18:09povikit's clean now
18:10povikso... *that's* how the song sounds in the original
18:10povikshould debug with something i know next time
18:11povik(that's what it was)
18:12povikthat beats at the beginning, clipped, confused me at first
18:12povikthought it is underflowing periodically
18:18doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
19:26povik has quit [Remote host closed the connection]
21:24___nick___ has quit [Ping timeout: 480 seconds]
21:33yuyichao_ has quit [Ping timeout: 480 seconds]
22:35doggkruse has joined #asahi-dev
22:50marcan02: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
22:50marcanah yes, I noticed that while making PMP work
22:50marcanthat's when I added that code
22:50marcanit's definitely required for a bunch of DARTs :)
22:52marcan(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)
23:35aleasto has quit [Quit: Konversation terminated!]
23:49yuyichao_ has joined #asahi-dev
…