#
…

2022-05-23

00:18jakebot has quit [Quit: Ping timeout (120 seconds)]
00:18jakebot has joined #asahi-dev
00:27jakebot has quit [Ping timeout: 480 seconds]
00:49dost^ has joined #asahi-dev
01:07jakebot has joined #asahi-dev
01:30Raqbit has quit [Ping timeout: 480 seconds]
01:44Raqbit has joined #asahi-dev
02:13dost^ has quit [Ping timeout: 480 seconds]
02:16dost^ has joined #asahi-dev
03:02PhilippvK has joined #asahi-dev
03:04phiologe has quit [Ping timeout: 480 seconds]
03:16derzahl has quit [Ping timeout: 480 seconds]
03:44winter has quit [Remote host closed the connection]
03:48winter has joined #asahi-dev
04:43conradev has quit [Quit: -]
04:44conradev has joined #asahi-dev
05:03derzahl has joined #asahi-dev
06:52derzahl has quit [Ping timeout: 480 seconds]
07:58bps has joined #asahi-dev
08:00the_lanetly_052 has joined #asahi-dev
08:22jluthra has quit [Remote host closed the connection]
08:22jluthra has joined #asahi-dev
09:14millenialhacker has joined #asahi-dev
09:15millenialhackerA fun story about Apple ISP. The IO IPC channel is used to send commands to ISP, that channel is 8 bytes wide, so they put the IOVA address of the CMD struct which is apparently 8 bytes wide too, but they never change the Address, they mostly use the same iova address and replace the contents of memory. Here's a couple of sessions I traced today: https://gist.github.com/kellermanrivero/c92aec82d59d6d0a4d27b3381d1038b7
09:16millenialhackerThe weird stuff is: Apple something uses IOVA address X and sometimes it uses X + 1
09:18millenialhackerIt's quite weird, maybe a bug? As long as ISP uses the address no matter if it is X or X+1, it will work, but I wonder why they have that little offset changing for some specific commands
09:19millenialhackerI still have no idea what those commands do, but after two samples, command stream looks quite the same in both samples.
09:20millenialhackerI'm learning a lot with this stuff btw
09:21the_lanetly_052__ has joined #asahi-dev
09:27the_lanetly_052 has quit [Ping timeout: 480 seconds]
09:31the_lanetly_052__ has quit [Ping timeout: 480 seconds]
09:41povikthe bottom bit could be a flag of some sorts, exploiting the fact that the address is always 4-aligned which frees the bottom two bits for auxiliary signalling
09:42Jamie[m]maybe it signifies thumb vs regular-arm ISP command struct encoding ;)
09:42povikthat goes in hand with the fact that the x+1 messages have their first non-zero byte at an offset in comparison to the x+0
09:43povikso you should actually always be reading the address clearing the bottom bits
09:51_jannau_marcan: do you have time this week to add mac studio support to the installer? there's liitle left I can do
09:52marcanI think so
09:52marcanlet me see if I can give it a shot tomorrow
09:52millenialhacker@povik, do you mean iova & 0xffffff00?
09:53povikwait no
09:53marcan0x..fffc
09:53marcanfor 4-byte alignment
09:53millenialhacker@povik, do you mean iova & 0xfffffffc?
09:56millenialhackerI wonder how I can guess what those commands do, any suggestion beside doing static RE on Apple KEXT?
09:56dost^ has quit [Remote host closed the connection]
09:56dost^ has joined #asahi-dev
10:07millenialhackerbtw, @povik and others thanks!
10:21dost^ has quit [Ping timeout: 480 seconds]
10:38kov has joined #asahi-dev
11:37the_lanetly_052 has joined #asahi-dev
12:59yunimillenialhacker: Because addresses are aligned, it's common not to store the bottom bits.
12:59yuniDepending on the required alignment, that could be up to 6 bits that aren't stored and are assumed to be zero.
13:00yuniThen, where you would otherwise have those zero bits, other pieces of data can be squeezed in.
13:01yuniLike the type of data that's being pointed to, or the length (itself divided by a power-of-two, only storing the high bits), or so on.
13:02yuniAs Jamie[m] correctly jokes, this scheme is used for instruction pointers on certain Arm CPUs.
13:03yuniWhere the bottom bit distinguishes the Thumb encoding from the regular encoding.
13:03yuniThe idea is also frequently used in page tables.
13:49Guest489 is now known as svenpeter[m]
14:29Gaspare has joined #asahi-dev
14:35millenialhacker has quit [Quit: Konversation terminated!]
14:39dost^ has joined #asahi-dev
14:47dost^ has quit [Remote host closed the connection]
14:48Gaspare has quit [Quit: Gaspare]
14:49Gaspare has joined #asahi-dev
14:49kaprests has quit [autokilled: Possible botnet activity. Mail support@oftc.net with questions. (2022-05-23 14:49:59)]
14:55kaprests has joined #asahi-dev
15:16derzahl has joined #asahi-dev
15:18the_lanetly_052 has quit [Remote host closed the connection]
15:20nicolas17 has joined #asahi-dev
15:32Gaspare has quit [Quit: Gaspare]
15:34j`eyin the adt, what section does clock-gates = [n] refer to? aka where do I look to see which n it is
15:36_jannau_pmgr, see src/pmgr.c
15:36j`eythanks
15:42Gaspare has joined #asahi-dev
15:57Gaspare has quit [Quit: Gaspare]
16:00j`eyhm, still SErrors after adding power-domains
16:01_jannau_which device?
16:02j`eyI added both ps_fpwm0 and ps_psm_fpwm0
16:02_jannau_using it from linux or m1n1?
16:03svenpeter[m]note that drivers that use more than one domain needs special support
16:03_jannau_you could try adding ps_pmp
16:03svenpeter[m]the core only handles a single domain automatically
16:03j`eyI also just tried adding always-on to the ps_fpwm0 and ps_psm_fpwm0 nodes
16:04j`eyI dont know which it actually needs yet, in the ADT is only has one thing in the clock-gates array
16:04svenpeter[m]that’s the one it should need
16:04j`ey(just trying a big hammer to get it working)
16:04svenpeter[m]does it work from m1n1?
16:05j`ey(ok, I found the id in the adt, it's just ps_fpwm0)
16:05_jannau_does it have notify_pmp in dump_pmgr?
16:05j`eynotify_pmp = False
16:06j`eylet me try remove the pms* power domain I added
16:08_jannau_last resort is removing power-domains and pmgr from the device tree
16:08j`eythat's a huge hammer!
16:21j`ey_jannau_: seems like that helped actually, just commented out all the fpwm/pms_fpwm pmgr nodes
16:26j`eyadding them all back, and making them all always-on works too
16:31caef^ has joined #asahi-dev
16:33jakebot has quit [Quit: The Lounge - https://thelounge.chat]
16:33jakebot has joined #asahi-dev
16:34marcanit could be a domain parenting issue
16:35marcanalternatively maybe those devices are kind of broken and need an actual reset to come back up after a power gate
16:35marcansomething to test from m1n1
16:37j`eypower-domains = <&ps_fpwm1>;, this works.. but unless Im reading the ADT wrong (likely), it should be ps_fpwm0
16:38j`eyohhh I am reading the ADT wrong
16:40j`eyit's not obvious if the name field is at the end or the start of a block https://paste.gg/p/anonymous/4c54a63688df4974ab69e1e53cfb6a67
16:40j`eyI read this as line 27 starting a block, with id=37 on line 51.. but name might be the last field in a block, so id=37 is actually fpwm1?
16:45svenpeter[m]yes, the block starts at Container and name is the last entry
16:46svenpeter[m]it’s a bit confusing because the output is just print(adt) and then however construct and Python decide to format it afaict
16:46j`eywell that solves that mystery, thanks! sorry for the noise!
16:47j`eythe name and the container on the same line "name = u'FPWM0' (total 5), Container:" makes it look like its naming the following container
16:47svenpeter[m]yeah, the “,” there separates the entries of the list(?)
16:47svenpeter[m]it’s rather confusing
16:48j`eyanyways I can toggle the kb backlight with "echo 1 > /sys/devices/platform/pwmleds/leds/kbd_backlight/brightness" now, so thats cool
17:04Gaspare has joined #asahi-dev
17:17jannauj`ey: \o/ - tools/dump_pmgr.py is more readable when you know what you're looking for
17:18povikso it looks like macos patches something in the preloaded AOP image before it kicks CPU_START
17:18povikthat is at least if /arm-io/aop[2] is a window into the AOP's program memory
17:19povikis there some prior art on this on some of the other coprocessors?
17:19povikthis is the patching it does: https://tpaste.us/JrL7
17:22povikit first picks up region start/size at aop[2]+0x224/+0x228
17:22povikthen reads the whole region and writes it back with those changes ^^
17:25freefiree has joined #asahi-dev
17:29jokerface has joined #asahi-dev
17:29jokerfacePlease join to my new channel on libera.chat if you like safari browser. The name of the channel of course is #safari
17:32caef^ has quit [Remote host closed the connection]
17:36jannauakick #asahi ADD jokerface
17:38jokerface was banned on #asahi-dev by ChanServ [*!~jokerface@85.194.207.61]
17:38jokerface was kicked from #asahi-dev by ChanServ [You are not permitted on this channel]
17:41nicolas17 has quit [Ping timeout: 480 seconds]
17:42nicolas17 has joined #asahi-dev
17:47freefiree has quit [autokilled: Please do not spam on IRC. Email support@oftc.net with questions. (2022-05-23 17:47:17)]
17:57povikha... and of course if i re-do the patching *and* fix a bug in setting up DAPF entries, AOP finally boots
18:00j`eywhat's this used for?
18:00povikAOP? it stands at the gate for microphones
18:02jnalways-on processor?
18:02povikyes, never misses a word you are saying :-p
18:03povik(actually not always on through)
18:03povik*though
18:09nicolas17j`ey: the AOP is "always on" as in "even when the main CPU is in deep sleep" (that aspect is mostly relevant on mobile I guess)
18:09j`eynicolas17: yeah, I was just wondering why povik was looking at it!
18:10nicolas17afaik a bunch of peripherals such as the microphone are hard-wired to the AOP, so you *have* to go through the AOP to get microphone on asahi
18:11poviknot really though ;)
18:11povikbypassing the AOP is a path i haven't ruled out
18:11povikstill, bringing up the AOP is useful even if for R/E only
18:11nicolas17povik: oh definitely
18:12nicolas17didn't know you can bypass it
18:12nicolas17ah I think audio on recent Intel Macs always goes through the T2, maybe I was mixing up with that
18:13svenpeter[m]povik: huh, interesting. I saw some section in the ANS firmware that very much looked as if it was supposed to be patched by iboot to pass some arguments iirc
18:14millenialhacker has joined #asahi-dev
18:16poviknicolas17: you can access its peripherals, some of which we already know (ADMAC,MCA) because the AP has its own copy of them
18:16poviksvenpeter[m]: yeah, here it looks like the arguments are obligatory...
18:16svenpeter[m]i think the same is true for ANS, but iboot has done that for us already
18:17povikmakes sense (ANS is for NVME right?)
18:24nicolas17I think there's *something* that is exclusively AOP?
18:24nicolas17maybe it's motion sensors and idk if Mac even has those
18:25povikwait those weird looking numbers in the argument section could be apple's favorite four-character keys
18:25poviknicolas17: it does have those and they are connected to AOP's SPI master IIRC
18:26povikbut we can access that one directly from AP too (if it isn't special, which is unlikely)
18:29bisko has quit [Ping timeout: 480 seconds]
18:30poviki guess they are four-char-keys, not that i like having to make sense of it: https://tpaste.us/8b46
18:30Gaspare has quit [Quit: Gaspare]
18:32bisko has joined #asahi-dev
18:33povikand macos seems to patch p0CE, laCn and tPOA
18:34povikof course: key, length, data
18:35Gaspare has joined #asahi-dev
19:37Glanzmann has joined #asahi-dev
20:06Glanzmann has quit [Quit: EOF]
20:10MajorBiscuit has joined #asahi-dev
21:11millenialhacker has quit [Quit: Konversation terminated!]
21:38Major_Biscuit has joined #asahi-dev
21:39MajorBiscuit has quit [Ping timeout: 480 seconds]
21:47Gaspare has quit [Quit: Gaspare]
22:08MajorBiscuit has joined #asahi-dev
22:10Major_Biscuit has quit [Ping timeout: 480 seconds]
22:35MajorBiscuit has quit [Ping timeout: 480 seconds]
23:12roxfanthese look almost like SMC keys
23:18lromwoo^ has joined #asahi-dev
…