#
…

2021-12-18

01:02tpw_ruleshm, that sure seems to be the case. bizarre
01:10bpye has joined #asahi-dev
01:11skipwich has quit [Quit: DISCONNECT]
01:12skipwich has joined #asahi-dev
01:14bpye4 has joined #asahi-dev
01:14skipwich has quit []
01:14marcansven: that would be a cute hack, if we can just have the kmutil m1n1 chainload something from AuxKC :D
01:16tpw_rulesmarcan: btw i fixed the issues with the device tree. u-boot has a hook to essentially do a merge of the device tree it loads with its own device tree
01:18marcantpw_rules: it works if you haven't fully initialized rtkit yet
01:18marcanit's weird
01:18marcanwe don't know why it doesn't work if you do a full init
01:19rwhitby has joined #asahi-dev
01:19marcanthe reset thing
01:19bpye has quit [Ping timeout: 480 seconds]
01:20tpw_rulesoh. well i'm not sure if what u-boot is doing a full init. do you remember exactly how you tested that function?
01:20tpw_rulesi mean my whole problem is it's not initialized enough i can get it to shut back down
01:20tpw_rulesso maybe i'm just not testing the reset properly
01:21bpye has joined #asahi-dev
01:22rwhitby has quit []
01:22alyssa has quit [Quit: leaving]
01:26bpye4 has quit [Ping timeout: 480 seconds]
01:45Dcow_ has joined #asahi-dev
02:20Emantor has quit [Quit: ZNC - http://znc.in]
02:20Emantor has joined #asahi-dev
02:23marcantpw_rules: the reset seems to work if you have it crash init by not setting up SART properly. IIRC
02:23marcanbut if it progresses beyond that it stops working
02:23marcanI've also seen it half-work; you get the first message from RTKit, then it hangs
02:23yuyichao has joined #asahi-dev
02:49tpw_ruleshm, it seems not setting up SART at all is not enough to let it be resettable
02:53riker77_ has joined #asahi-dev
02:58riker77 has quit [Ping timeout: 480 seconds]
02:58riker77_ is now known as riker77
03:44kov has quit [Quit: Coyote finally caught me]
03:44kov has joined #asahi-dev
03:52skoobasteeve has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
04:01PhilippvK has joined #asahi-dev
04:01skoobasteeve has joined #asahi-dev
04:04phiologe has quit [Ping timeout: 480 seconds]
04:33Dcow_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
04:37Dcow has quit [Ping timeout: 480 seconds]
04:39Dcow has joined #asahi-dev
04:44amarioguy has quit [Ping timeout: 480 seconds]
04:46Dcow_ has joined #asahi-dev
04:51Dcow has quit [Ping timeout: 480 seconds]
05:09Jamie[m]1does anyone have a convenient method for syncing up events in MMIO traces to the thing that caused it (i.e. a way to get a marker to show up in the trace from macOS userland?)
05:21marcanJamie[m]1: you could use the m1racles register :D
05:22marcanhv_exc.c has a handler for it, you could have that emit an event
05:22marcanand then read/write that register to trigger events; you get a whole two bits for writes (though macOS writes zeroes to it all the time, so you need to filter that out either by value or EL1)
05:23marcanthough since this is trapped, you can use the full 64 bits of data
05:23marcanor indeed as many registers as you want, treating it as a weirdo hypercal
05:23marcanI'd actually been meaning to implement this for this use case, especially for the GPU stuff, just haven't gotten there yet
05:24marcananother option would be a debug break; I think we trap brks unconditionally right now (and lower them automatically since a patch I sent some time ago), at least from EL1 but presumably EL0 too
05:25Glanzmann has joined #asahi-dev
05:25Glanzmanntpw_rules: I'm your beta tester.
05:30Jamie[m]1haha sounds good
05:32skipwich has joined #asahi-dev
05:37tpw_ruleskettenis: i fixed u-boot. my shower thought is that the addresses you give to rtkit should probably be 16k aligned
05:37tpw_rulesand doing that fixed it it seems. i'll actually like clean up and test it tomorrow
05:38tpw_rulesanyway night
07:20skipwich has quit [Quit: DISCONNECT]
07:38amarioguy has joined #asahi-dev
08:15amarioguy has quit [Ping timeout: 480 seconds]
08:33the_lanetly_052 has joined #asahi-dev
08:46ChaosPrincess has quit [Quit: WeeChat 3.3]
08:46thunfisch has quit [Remote host closed the connection]
08:47thunfisch has joined #asahi-dev
09:00l3k[m] has joined #asahi-dev
09:00Sebhl[m] has joined #asahi-dev
09:01thunfisch has quit [Ping timeout: 480 seconds]
09:24svenHmmm… iirc SART should allow anything aligned to 4K
09:25svenim still baffled SART can be skipped and nvme then still works :/
09:27aleasto has joined #asahi-dev
09:30thunfisch has joined #asahi-dev
09:33Glanzmanns/the/the last/
09:34j`eyand the next mac's will also be easier than the current gen!
09:34j`ey(hopefully :))
09:34svenM1 pro/Max was already simple even though they changed a lot
09:35kettenissven: I can confirm that if I provide memory blocks that are 16K aligned, I do see the final APPLE_RTKIT_MGMT_SET_AP_PWR_STATE message
09:36svenbut good to know
09:36kettenisbut then nvme in u-boot hangs, presumably because I'm not acking syslog messages
09:36svenso I guess only the syslog thread hangs then if you don’t setup the SART buffers correctly
10:45ChaosPrincess has joined #asahi-dev
11:09amarioguy has joined #asahi-dev
11:45amarioguy has quit [Ping timeout: 480 seconds]
12:02PhilippvK has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
12:06phiologe has joined #asahi-dev
12:46Dcow has joined #asahi-dev
13:20VinDuv has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
13:57Dcow has quit [Quit: Textual IRC Client: www.textualapp.com]
14:17Dcow has joined #asahi-dev
14:30yuyichao has quit [Quit: Konversation terminated!]
14:31yuyichao has joined #asahi-dev
14:48aeadio has joined #asahi-dev
14:48aead has quit [Remote host closed the connection]
14:48MajorBiscuit has joined #asahi-dev
15:15MajorBiscuit has quit [Quit: WeeChat 3.3]
15:15MajorBiscuit has joined #asahi-dev
15:21Dcow has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:25VinDuv has joined #asahi-dev
15:26m42uko has quit [Ping timeout: 480 seconds]
15:31MajorBiscuit has quit [Ping timeout: 480 seconds]
15:35Dcow has joined #asahi-dev
15:38m42uko has joined #asahi-dev
15:44Dcow has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:55Dcow has joined #asahi-dev
15:55amarioguy has joined #asahi-dev
16:04Dcow has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
16:15tdmm has joined #asahi-dev
16:24tpw_rulessven: the problem is specifically giving rtkit non 16k aligned addresses. sart doesn't seem to care
16:25svenyes, I just refer to them as SART buffers as opposed to NVMMU buffers used for most nvme data
16:26svenI guess rtkit runs with 16k pages as well and just doesn’t want to map non aligned buffers for those
16:26svenSART should only require 4K alignment or so
16:43Dcow has joined #asahi-dev
16:50tdmm has left #asahi-dev [#asahi-dev]
16:53aleasto has quit [Ping timeout: 480 seconds]
17:01the_lanetly_052 has quit [Ping timeout: 480 seconds]
17:05amarioguy has quit [Ping timeout: 480 seconds]
17:11amarioguy has joined #asahi-dev
17:11kettenissven: so if I don't start the syslog endpoint nvme works in u-boot and in OpenBSD
17:12svenhrm, so that one isn't mandatory after all then
17:12svenlet me try that with the firmware i have
17:12tpw_rulesare you able to shut the processor down?
17:13kettenisno, because I have no way to verify that I can start it back up again
17:15kettenisand if I start the syslog endpoint I run into isses
17:16kettenisI can make u-boot work if I poll the mailbox
17:16kettenisand afterwards I can use nvme on the mini which boots from usb
17:17kettenisbut on the macbook pro (which boots from nvme) OpenBSD hangs
17:17tpw_ruleswell let me see if i can shut it down then. for whatever reason i don't actually get any syslog messages besides that 0xb type response
17:18svenyou'll only get syslog messages once you start bringing up nvme
17:21kettenisI see the syslog messages if I start the endpoint now
17:21svenfeels like we have different firmware then :D
17:21tpw_rulesmaybe i am not checking for them in the right place then
17:21sveniirc the first message for me comes when the admin queue is set up
17:22kettenisthe messages start appearing when I start initializing the nvme stuff
17:22svenah ok, i just misunderstood then
17:22kettenisnot sure if that is when the admin queue is set up
17:26tpw_rulesno, it seems if i never initialize syslog, then the management interface doesn't respond to anything
17:26sventhat sounds like what happened when i tried to boot without syslog originally
17:28svenmaybe we should define what we mean by "enable syslog". could be "send start ep for the syslog endpoint" but could also be "send this 0xb command which we thought was syslog_init"
17:28tpw_rulesi just tried that first thing
17:33kettenisthat is what happens if I don't enable syslog
17:34tpw_rulesand trying that second thing, the management interface still does respond to the shutdown messages. and uboot is able to reinitialize rtkit, but hangs trying to reinitialize the nvme itself
17:35svenhm... so i know that the syslog thread in the rtkit firmware registers a callback for "power state changes" (i.e. that 0xb) command. so maybe that just gets stuck if the endpoint isn't initialized?
17:35tpw_rulesalthough now that i think about it, my shutdown code does not try to shut down the nvme. so maybe i need to do that better
17:36wCPO has joined #asahi-dev
17:42tpw_ruleswell, maybe linux knows how to do that
17:45tpw_ruleshm, it sure seems to... let me garbage collect my setup and make sure this works for real
17:45tpw_rulessven: good call on not sending that 0xb command
17:51svenso the thing is if you send 0xb ("set AP power state") twice with the same power state RTKit panics
17:52svenif you never send 0xb with 0x20 as the argument the power state remains at 0x10
17:52svenand that's also the thing you have to send to shut it down
17:53tpw_rulesi'm sending 0x01 to shut it down
17:53tpw_rulesbut 0x10 with message type 6 ("set IOP power state")
17:54svenhrm, i might've confused those two
17:54svenbut they are modeled after what iBoot does anyway
17:55svenso if RTKit thinks the AP power state is 0x01 and you send it 0xb with 0x01 again it'll just panic
17:55tpw_rulesthat's rude of it
17:55svenyup. and what's even worse is that flipping that reset bit can't revive the co-processor after a panic
17:56tpw_rulesbut probably explains why earlier experiments were having linux tell me it crashed
17:56sventhe code in nvme/dev parses the crashlog it sends fwiw
17:56svenit would've complained about something like "Invalid AP Power" there
17:58tpw_rulesi never quite figured out how to actually dump them for that to pars
17:58sventhe crashlog is just written to the buffer it requested originally
17:59tpw_rulesoh, you mean the linux branch
17:59tpw_rulesi thought you were talking about m1n1
17:59svenm1n1 also has a crashlog parser somewhere
17:59tpw_rulesyeah but it just accepts a file on the hard disk, which i'm not sure how to get
17:59svenjust open("crashlog.b", "w").write(iface.readmem(crashlog_addr, 0x8000)) or something like that
18:08MajorBiscuit has joined #asahi-dev
18:09MajorBiscuit has quit []
18:14tpw_ruleshm, i think i made a mistake when testing because i can't get it to work now. it just crashes in linux again. but i will try the parser out
18:16kettenisfwiw, i pushed some fixes to the u-boot branch
18:16kettenisincluding the hack to not start the syslog endpoint
18:22aleasto has joined #asahi-dev
18:28tpw_rulesah, simply not sending the 0xb command to shut it down seems to solve the problem for good
18:28tpw_rulesbut kettenis i assume you are not interested in having uboot shut nvme down yet because that will break openbsd
18:33nabaiste^ has joined #asahi-dev
18:36kettenisI need to add the code to start things back up to OpenBSD first
18:48MajorBiscuit has joined #asahi-dev
19:01Glanzmann has quit [Quit: EOF]
19:06Major_Biscuit has joined #asahi-dev
19:07MajorBiscuit has quit [Ping timeout: 480 seconds]
19:21yamii has quit [Quit: WeeChat 3.3]
19:22yamii has joined #asahi-dev
19:41Dcow has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
19:49aeadio has quit [Quit: ZNC - https://znc.in]
20:06aead has joined #asahi-dev
20:10MajorBiscuit has joined #asahi-dev
20:11jannausigh, I still don't understand how sio is set up but at least I can now read the SPI transfers through RegMonitor
20:15jannauthe dma buffers are unfortunately not at constant offsets in SIO's memory
20:15MajorBiscuit has quit []
20:16Major_Biscuit has quit [Ping timeout: 480 seconds]
20:16jannaubut the devive provides the information available in ioreg
20:16jannaui.e. product and vendor id's and strings
20:17kettenisI suppose using gpiola to decode the transfers is a bit too involved...
20:17svenhrm, doesn't it just map buffers in DART and then send the points as messages?
20:18sven*pointers
20:20svenyou can also pass smartio_debug=0xff and make XNU more verbose
20:21MajorBiscuit has joined #asahi-dev
20:29jannauI can't spot pointer in the messages
20:29aleasto has quit [Remote host closed the connection]
20:30svenhm.. so what i remember from looking at it very briefly was that there were a lot of setup messages at the beginning
20:30svenoh... i think the pointer was shifted
20:30svenand it was at the beginning of the IOVA space iirc
20:31jannauyes, there are a couple of setup messages
20:31sventhose already should have pointers to IOVA space in them
20:31MajorBiscuit has quit [Quit: WeeChat 3.3]
20:32MajorBiscuit has joined #asahi-dev
20:32* svenshould've taken notes :(
20:35svensio_dart_tracer.dart.iotranslate(0x388<<12) that's still in my m1n1_history
20:47jannauignore the identifiers except for CHANNEL I have no evidence for anything
21:00jannauit might write the address I'm interested in at a fixed offset from the adresse of one setup message
21:05svenhm... i never got to the actual DMA packets fwiw
21:06svencould also be that it just allocates a ringbuffer at the beginning and then just keeps reusing that somehow
21:10jannaufor spi3 it appears to be a fixed rx and a fixed tx buffer
21:24ey3ball[m] has joined #asahi-dev
21:25povik21:20 < sven> you can also pass smartio_debug=0xff and make XNU more verbose
21:25povikdon't tell me sio stands for smartio
21:29sven ioreg | grep -i smartio
21:29sven | | | | +-o AppleSmartIO <class AppleSmartIO, id 0x100000499, registered, matched, active, busy 0 (17 ms), retain 6>
21:29sven | | | | +-o sio-dma <class AppleSmartIODMANub, id 0x100000189, registered, matched, active, busy 0 (14 ms), retain 8>
21:29sven | | | | +-o IODMAController0000008A <class AppleSmartIODMAController, id 0x1000004be, registered, matched, active, busy 0 (3 ms), retain 11>
21:29svenpovik: ^--
21:35povikthat strikes me as ironic given what we suspect the sio coprocesor does/is :-p
21:36svenits firmware is ~1MB or so. assuming that most of that is rtkit it shouldn't be too hard to confirm how smart it actually is :)
22:12svenhuh. i just shutdown nvme after writing a lot of data and it seems that remove_sq/cq actually flushed some more data because it took a few seconds to complete. and that was after a flush already
22:28MajorBiscuit has quit [Quit: WeeChat 3.3]
22:34Glanzmann has joined #asahi-dev
22:35MajorBiscuit has joined #asahi-dev
22:49psykose has quit [Ping timeout: 480 seconds]
22:49psykose has joined #asahi-dev
23:34MajorBiscuit has quit [Quit: WeeChat 3.3]
23:36Dcow has joined #asahi-dev
23:46MajorBiscuit has joined #asahi-dev
…