#
…

2021-08-25

00:33suricato has quit [Ping timeout: 480 seconds]
01:17uralj has joined #asahi-dev
01:17alyssa has joined #asahi-dev
01:17alyssapipcet[m]: ooh, I just got a black screen on boot
01:18alyssa1/3 boots failed tonight .. probably there's a race
01:43riker77_ has joined #asahi-dev
01:46riker77 has quit [Ping timeout: 481 seconds]
01:46riker77_ is now known as riker77
02:19msmith12[m]sounds like gstremer
02:38phiologe has joined #asahi-dev
02:41PhilippvK has quit [Ping timeout: 480 seconds]
03:42yuyichao has quit [Quit: Konversation terminated!]
07:20jeffmiw has joined #asahi-dev
07:25bps has quit [Ping timeout: 480 seconds]
07:48aleasto has joined #asahi-dev
07:57bps has joined #asahi-dev
08:17jeffmiw has quit [Ping timeout: 480 seconds]
08:18suricato has joined #asahi-dev
09:57pipcet[m]alyssa: do you have timing info on your printks? on my system, the time between enabling the disp dart and switching the FB was perilously close to 1/60 s
10:28phiologe has quit [Ping timeout: 480 seconds]
11:36sirn has quit [Quit: ZNC 1.8.2 - https://znc.in]
11:41sirn has joined #asahi-dev
11:55aleasto has quit [Quit: Konversation terminated!]
12:18al3xtjames0 has joined #asahi-dev
12:21al3xtjames has quit [Ping timeout: 480 seconds]
12:21al3xtjames0 is now known as al3xtjames
12:30chadmed has quit [Remote host closed the connection]
12:30chadmed has joined #asahi-dev
12:41uralj has left #asahi-dev [WeeChat 3.2]
12:49alyssatbh i'm sort of hoping the raciness goes away when i switch to usin the DCP
12:49alyssaOtherwise we need to preserve the initial framebuffer and uh
12:52bisko has joined #asahi-dev
13:05yuyichao has joined #asahi-dev
13:06aleasto has joined #asahi-dev
14:47pipcet[m]I've beaten up my Digital Crash Processor a bit more and I really don't think we should mix the interfaces if we can avoid it. I also don't like the current page table stealing hacks and am hoping you guys come up with something way better...
14:49gladiac has quit [Read error: Connection reset by peer]
14:49gladiac has joined #asahi-dev
14:53gladiac is now known as Guest5380
14:53Guest5380 has quit [Read error: Connection reset by peer]
14:53gladiac has joined #asahi-dev
14:59svendo you want to keep the mappings or start over with a clean pagetable for a locked dart?
15:01svenif you want to keep them: in attach_dev first create the io-pgtbl as usual. then walk the Apple pagetable and just ->map everything they mapped. then do a u64-by-u64 copy from the first level io-pgtbl to the first level Apple pagetable. then finally swap the ttbrs in io-pgtbl and set a flag that there are not managed by linux
15:01alyssasven: are you talking to me or to pipcet[m] ?
15:02sventhen write a custom free function for io-pgtbl that only frees the top-level if that flag isn't set
15:02svenalyssa: dunno, both of you i guess? :)
15:02pipcet[m]honestly I think sven is Mr DART and both options sound like work :P
15:03alyssasven: 😅
15:03svenand you'll also need some changes to ensure to that get_group function to ensure that you can't mix a locked DART with any other DART
15:04svenoh, and probably to get_default_domain to force DMA domains for locked DARTs
18:40svenalright, finally confirmed how mac os knows about new usb devices connected to usb-c ports: it's the SMC
18:41svenwriting 0x1 to NTAP enables notifications, and then you get a message from it
18:41sven0x7020000000000018: 0x18 = notification, 0x70 = "system state" and 0x20... is a bitmask for individual events
18:41j_eysven: writing 1 to NTAP? whats NTAP?
18:41sventhat 0x20... is event_name-bit41: USB2_plug according to the ADT
18:42svenj_ey: your guess is a good as mine. if i write 0x0 it disables notifications, and if i write 0x1 it enables then.
18:42svenhaven't tested anything else yet
18:42pipcet[m]"notify Application Processor"
18:42pipcet[m]I would guess
18:42sventhat would certainly fit
18:42j_eysven: I mean, how do you write to that?
18:42svenj_ey: oh, it's a key inside the SMC
18:42svenyou write 0x1 to that shared memory location
18:43svenand then send er... let me find it again
18:43pipcet[m]I've been using NTAP for a while and I think it's on the wiki :-)
18:43svenugh. should've taken a look at the wiki then instead of finding that from tracing macOS :D
18:44pipcet[m]no, mea culpa, never put it on the wiki :-/
18:45pipcet[m]sven: IIRC it's the first thing it does, and tracing macos is good for you! builds moral fibre!
18:45pipcet[m]anyway, my fault for not documenting it properly :-(
18:46j_eysven: so the usb phy driver will need to talk to the smc/mailbox too?
18:46pipcet[m]oh. there's a file called smc.wiki in my home directory which I never uploaded because my net was down
18:46alyssaj_ey: everybody talks to everybody
18:46alyssait's not very socially distanced :'(
18:47svenj_ey: it needs to somehow be hooked up to the SMC driver. maybe SMC will be an interrupt-controller as well or something
18:47svenno idea yet
18:47alyssasven: SMC really doesn't fit into any one driver class on linux
18:47j_eyalyssa: linux is vaxxed
18:48svenalyssa: drivers/soc/apple :>
18:48alyssasven: yeah, was going to say
18:48alyssamaybe like you did for rtkit
18:48j_eysoc = everything else :P
18:48svensoc = sven's ugly hacks
18:48j_eysoc = sven's odd code
18:48svenbut yeah, smc is gonna be annoying
18:49pipcet[m]sven: I tried the interrupt controller thing and another mailbox controller, didn't like either very much :-/
18:49svenj_ey: :D
18:49pipcet[m]sven: we need payload data so that's hard to do with interrupts
18:50svenwhat payload data do we need?
18:50pipcet[m]power button goes through it, and the battery indicator payloads changed when I upgraded macOS yesterday...
18:51pipcet[m]power button, lid switch, charging notifications, usb notifications, who knows what else...
18:51pipcet[m]otoh, just do an interrupt for usb and ignore the rest for now?
18:51alyssaeach of those could be a setup interrupt..?
18:51svenwe just need to identify individual interrupts, don't we? so something like interrupts = <&smc 0x70 0x20....>; for the usb phy might work
18:51alyssaseparate
18:51alyssabut now you have a virtual interrupt controller and this is getting into sandcastle level hacks
18:52svenyeah, i dunno
18:52svengpio usually does chained interrupts fwiw
18:52svenpci as well i guess. but this is slightly different
18:53pipcet[m]I tihnk I just heard someone volunteer to rewrite the mailbox driver code so it's actually usable and handles stuff like this!
18:54alyssapipcet[m]: I heard sven say that too! 😋
18:55svenuh, why mailbox? if this chained/whatever irq controller makes sense this would be aic -> mailbox -> rtkit -> smc -> usb phy. the length of that chain makes me uncomfortable though.
18:56alyssaTBF every link there is forced by Apple, not us.
18:56sveni'm still annoyed that they didn't consider hooking up the usb connected/disconnected line to dwc3
18:57alyssaI do still wonder if "SMC as a library" makes more sense than "SMC as a driver"
18:57pipcet[m]sven: you did hear my "the SMC snoops the PD chips' interrupt lines to know when to kick the battery charging circuitry" theory?
18:57svenuh... no
18:57pipcet[m]I'm pretty sure it does.
18:57sventhat sounds insane. but at this point it would also only surprise me a little bit
18:58pipcet[m]setting the intmask over i2c means no more notifications from the SMC, plus charging doesn't work. You're right it's insane.
18:58svendoesn't m1n1 set the intmask by default these days?
19:00alyssasupposing that theory is right-- how does charging work if the machine is off?
19:00svenhttps://github.com/AsahiLinux/m1n1/blob/main/src/usb.c#L281 so i think m1n1 should disable all interrupts by default
19:00svenand i definitely get notifications after that
19:01svenor is it just specific notifications that are missing?
19:01alyssais the SMC always-on? in that case, wouldn't a dead battery brick a macbook?
19:02pipcet[m]the SMC does stay on normally, but the tps chip also has a dead-battery mode to recover from that scenario
19:02pipcet[m]there's a CL?? property that says how long it's been running :-)
19:02svenbut that's only called once m1n1 exits
19:03sveni get notifications from the SMC inside m1n1 using shell.py
19:03pipcet[m]0x71 notifications or 0x70 ones?
19:03sveni think i've seen 0x70, 0x71 and 0x72
19:03svenbut i can check again
19:04pipcet[m]it would be wonderful if the firmware upgrade fixed this and I'll formally call in doubt my theory, then, but until yesterday I needed to enable intmasks for charging to work.
19:05pipcet[m]well, as long as it's getting less weird with every upgrade....
19:06svenmy firmware is rather old fwiw
19:06svenbut this is also on a man mini
19:06pipcet[m]which version?
19:06svenuhh... let's see
19:06pipcet[m]oh! I was talking about the macbook, sorry.
19:06sven11.5 20G5033c i think
19:07pipcet[m]if you have code I can try in (vanilla, I promise) m1n1 I'll be glad to :-)
19:07sveni can clean the mess that i have right now up tomorrow or so
19:08pipcet[m]sure, no worries
19:08aleasto has quit [Remote host closed the connection]
19:09svenbut i think most of what i have should be in m1n1 already
19:09pipcet[m]I, uh, may have manually toggled gP0d using read64 and write64 the other day :P
19:09svenit's really just the common rtkit bootstrap code + asc.send(0x4e54415000013011, 0x20) and then asc.recv()
19:09alyssagPod? we've come full circle
19:10pipcet[m]you're at offset 0x30 in the SMC SRAM?
19:11sventhis is taken straight from the hv trace
19:12pipcet[m]oh, the corellium driver, and my variation on it, always have the second-lowest byte set to 0, which means it always starts at the beginning of the SRAM. macOS advances (I have no idea why because you can't get concurrency anyway)
19:14pipcet[m](maybe it's wear levelling ;-) )
19:55Mary has quit [Quit: The Lounge - https://thelounge.chat]
19:55Mary has joined #asahi-dev
20:36Mary has quit [Quit: The Lounge - https://thelounge.chat]
22:48yuyichao has quit [Quit: Konversation terminated!]
23:12suricato has quit [Ping timeout: 480 seconds]
…