2021-08-09
01:06skipwich has joined #asahi
01:07pinskia has quit [Read error: Connection reset by peer]
01:09amwIt would be nice to have a linux with nvme, dart and a fresher upstream update as a basis for new work
01:09pinskia has joined #asahi
01:27_whitelogger has joined #asahi
01:28lethalbit has quit [Read error: Connection reset by peer]
01:29chadmed has quit [Ping timeout: 480 seconds]
01:30chadmed has joined #asahi
02:06null has quit [Quit: oh no.]
02:06null has joined #asahi
02:19phiologe has joined #asahi
02:23PhilippvK has quit [Ping timeout: 480 seconds]
03:14marvin24_ has joined #asahi
03:17marvin24 has quit [Ping timeout: 480 seconds]
06:04marvin24 has joined #asahi
06:08marvin24_ has quit [Ping timeout: 480 seconds]
06:28svenyeah, and i think it's also nice to be able to do some kind of early internal review while we still iterate. we can probably catch lots of common gotcha long before we need to annoy maintainers on the mailing lists ;)
06:49DarkShadow4444 has quit [Ping timeout: 480 seconds]
06:56DarkShadow44 has joined #asahi
07:00marvin24_ has joined #asahi
07:03marvin24 has quit [Ping timeout: 480 seconds]
07:24phofe has joined #asahi
07:35DarkShadow44 has quit [Quit: ZNC - https://znc.in]
07:35DarkShadow44 has joined #asahi
07:45DarkShadow44 has quit [Quit: ZNC - https://znc.in]
07:46DarkShadow44 has joined #asahi
07:46DarkShadow44 has quit []
07:47DarkShadow44 has joined #asahi
10:29marcanthat should be implemented together with mapping adoption from the bootloader, since the two problems kind of go together
10:30sveni think there are more important things i want to do first (do asc/rproc in a sane way, nvme, 4k/16k dma-iommu, pcie, usb-phy)
10:33marcanso clearly they're trying to protect DCP from the AP to some extent, much like DART protects the AP from DCP
10:33svenand that #15 stream... for some reason it seems to be set to bypass to that other DART (sio i think) which also has a DAPF as well
10:34sveneven more weird: that SIO DART cannot even read its first level pagetable. so maybe somehow that stream #15 is also involved in that
10:35svenif i setup the SIO DART as i usually would i get a fault with the "no ttbr" (and another unknown) error bit set on any access
10:36svenso somehow that DART cannot even read the pagetable. that DART/DAPF is also not locked so we can play around with it
10:36svenand it has the AES engine behind it which should make peeking into the device address space painless
10:38marcanwild idea: this is a VM thing and #15 is meant for a hypervisor to set up 2-stage DART translations
10:39svenwaaaaiit... the thunderbolt DARTs also have #15 set to bypass. so.. uh... maybe to give the thunderbolt ports to a guest?
10:40marcanis there a DART features bit that just happens to be set on these DARTs (and not others)?
10:43svenyeah, and as i said: the AES engine is behind SIO. let's see if i can dig up my old code to drive that one
10:44sveni never could get it to work without enable DART and DAPF bypass back then. but i didn't try much
11:06svenmarcan: https://f.svpe.de/70fb5357bea78c2e50f0017f563907ebe775cd731861d37751346a1eb8ad61c9_aes.py that's my very old aes code
11:23arndmarcan: do you have any DT updates for 5.15 that you can send? This week would be great so I don't have to queue it into a 'late' branch. I haven't kept track of which drivers got merged since the original version that would need DT nodes
12:07marcanarnd: I *think* with DART that means USB should work, but there was a PHY binding thing, I think sven knows more
12:08marcanalso I might have to prioritize the clock stuff because even though nobody cares it's kind of important for DT correctness :)
12:08marcanI've been doing all the fun DCP/HV/etc reversing and alyssa wants me to look into graphics ASAP, but I think I need to spend some time getting all the non-fun stuff done for a change :p
12:15arndOk, good. Having USB working would already turn it from barely working into something one can actually play around with on an upstream kernel. I was originally hoping we could get PCI and NVMe in 5.15, but since NVMe certainly isn't getting in this time, I guess it will be 5.16 at the earliest for a mostly functioning system
12:16arndhttp://phb-crystal-ball.org/ tells me that 5.15 is the next LTS kernel that next year's distros will ship
12:19marcantbh I think it's wishful thinking to expect much from distros this early, but if we can get things in real nice shape for the *next* LTS, that's definitely something to aim for... :-)
12:21arndright, even if we had basic functionality in the kernel, there is not much point if distros don't come with an working installation method for the machine
12:21svenUSB would work, but just once per port because dwc3 only sees a single "device connected" event. to use a port twice we need to hook up something from SMC or the USB-PD chip to the not-yet-existing usb phy driver to issue a reset there :/
12:22marcanarnd: how important is it to get the DT updates in for this round for whatever works so far, vs waiting until the other pieces fall in place a bit better?
12:23marcankeep in mind we have a backwards compat break ahead of us anyway in the power/clock driver stuff, which is why I really should push for that
12:24marcanwhich is probably another reason why we shouldn't worry too much about distros shipping 5.15, too late for that
12:24arndmarcan: it's not important to me to have it in there now, I'm mainly interested in not getting a large pull request just before the merge window
12:24marcanI'd rather get back in kernel mode and start putting together pieces, maybe write a few drivers
12:27marcanalright, if nobody else wants to take those, after I get the installer PoC done I'll get in kernel mode for a while and work on that
12:28marcanwe've had enough chitchat, time to throw implementations at people and figure out if they stick
12:29svenhttps://github.com/AsahiLinux/linux/tree/i2c/dev that's what i had for i2c. iirc i wasn't happy with that yet
12:30marcandid we ever figure out if spi is a thing that already has a similar driver? IIRC it was "samsung stuff" but I wonder if it's like UART or not
12:31sveniirc there are two kexts: samsung and apple. no idea if the apple is just a new variant of the samsung one or a completely new thing
12:34marcanstrings suggests it does dma, but there's no DART... I'm going to assume they don't actually use that here
12:41chadmedwhen i said the other day that we should "force" everyone to just use gentoo, i was only half joking. it might be a good idea to try and get gentoo's arm team on board wrt testing and general liason work. it's an easy starting point since rn the only userspace changes needed would be to add an "agx" VIDEO_CARDS flag for mesa
12:42marcanthat driver has a bunch of fake FIQ DMA stuff we are definitely not using, and doesn't mention FIFOs which apple's controller has, so this might be a good case for writing a new driver rather than trying to shoehorn apple mode into that one
12:43chadmed"blessing" of a big distro and the eyes of the arm maintainers might encourage the binary titans to sit down at the table sooner too
12:49chadmedyeah but its like calling android linux. sure, it uses the linux kernel but its pretty philosophically incompatible with what one would call a linux system
12:51chadmedchromeos might use portage or whatever but do you really have all the tools and power at your disposal that distinguishes gentoo from any other distro? i would argue that having those tools in the first place would be ridiculous on a chromebook, building a vanilla gentoo install with plasma is sad enough on a pi4 8gb let alone a chromebook
12:53archadmed: it might be an unpopular opinion here, but I'm kinda glad I no longer use gentoo (despite using it for ~15 years)
12:54chadmedyeah its not for everyone, and most would probably become fatigued by it. fwiw samba's hard dependency on libunwind still breaks my clang-only portage setup every time i sync the repos, meaning i have to manually edit the ebuild to accept llvm-libunwind at least once a week :P
12:55ari recently even considered trying gentoo out again, but then i learned that on a friends pc that's mostly similiar to mine in terms of specs, chrome still (or rather, again) takes a bit over an hour to compile
12:56chadmedthree things a certain in life; death, taxes, and chrome taking over an hour to build from source
12:58tophevich[m]how long for firefox?
12:59aron a 5950x i have now, i'd expect it to still take around 10-15 minutes, because huge parts of the firefox build don't parallelize well
13:00tophevich[m]can't live without chrome? or why take that compile time penalty all the time?
13:02chadmedyea idk youd willingly use chrome let alone build it but such is the beauty of gentoo, the "to each his own" principle taken to comical heights
13:26pipcet[m]alyssa: FWIW, with the asahi/devel branch I have both a usb gadget console and a usb keyboard now, simultaneously. was it just eem that was broken?
13:34jeff_miw has joined #asahi
13:38jeff_miwmarcan: regarding spi and i2c, I'll be happy to help with some guidance, I need to catch-up to bring something useful. Is the devel branch the right one to start from ?
13:41jeff_miw has quit [Remote host closed the connection]
13:51amwBut I found the keyboard uses large 256 byte, crc'ed messages so it's quite a lot of work to get some keyboard input via that
13:52amwI was just trying to use info in the corellium drivers and I think it was kind of talking to the spi3 and possibly pinctrl - no interrupts
13:53amwFor what it is worth I have pasted some very hacky notes at https://paste.debian.net/?show=1207032;lines=0
13:54amwPretty useless mess at the moment, but with a few more days of work might do some non-interrupt driven transfers, proof concept
13:55amwI don't really understand how to get the interrupts to report under shell.py so I ignored them - but that might be a good way to check things are working
14:02Andalu30 has joined #asahi
14:02yuyichao has quit [Ping timeout: 480 seconds]
14:20arndmarcan: for the spi driver, I see some resemblance between its registers and both the s3c24xx and s3c64xx drivers, but it does seem different enough to need a third driver.
14:21yuyichao has joined #asahi
14:21arndIf someone wants to push corellium's driver, that might actually work in this case, it seems well written, and fairly simple, much smaller than the two samsung drivers that implement DMA mode
14:43arndI just looked at all the other spi drivers to see if there was a closer match: it looks like half the drivers in the kernel have roughly the same design, with config/status/transmit/receive registers in that order, but they all have them at slightly different offsets, and with slightly different bit definitions, so the similarity to the s3c driver may just be coincidence
14:44skipwich has quit [Quit: DISCONNECT]
14:44skipwich has joined #asahi
15:02Andalu30 has quit [Remote host closed the connection]
15:06Andalu30 has joined #asahi
15:20skipwich has quit [Ping timeout: 480 seconds]
15:22Raito_Bezarius has quit [Ping timeout: 480 seconds]
15:30Raito_Bezarius has joined #asahi
15:31skipwich has joined #asahi
15:36Andalu30 has quit [Ping timeout: 480 seconds]
15:48DarkShadow44 has quit [Quit: ZNC - https://znc.in]
15:50DarkShadow44 has joined #asahi
15:51DarkShadow44 has quit []
15:51DarkShadow44 has joined #asahi
15:53DarkShadow44 has quit []
15:54arndsven: well, duplicating that nvme driver at least makes it easier to get the initial version merged
15:54DarkShadow44 has joined #asahi
15:54arndI guess you can start with a copy of the code you already have, and then remove everything that isn't currently getting used.
15:55DarkShadow44 has quit []
15:55DarkShadow44 has joined #asahi
15:58svenyeah. the bigger issue is probably that i'm not really sure how to handle that mailbox part yet.
15:58svenand then most of these sub-processors have some shared endpoints (management to boot them, syslog, etc.). the code to handle that doesn't seem to really fit into drivers/mailbox
16:02svenand because that's not fun enough these endpoints require shared memory buffers that sometimes go through a DART IOMMU, other times through a simple DMA address filter Apple calls SART (that's where these HMB buffers are configured) and other times the shared memory is just exposed on the MMIO bus
16:04jeffmiw has joined #asahi
16:06svenin my current hack those endpoints are just implemented in my mailbox driver and that 0x20 channel i request in the nvme code is a lie
16:13jeffmiwjust lost a couple of hours fixing my python install to get correct python 3.9 and latest construct module ... to chainload latest m1n1 mainly because I'm using an old ubuntu 18.04 distrib :). I thought it is a good time to ask: which distrib are you using for your dev for M1 ?
16:48marcanthose abstractions are only useful when they either provide enough useful primitives to reduce code, or existing higher level drivers can hook into the interface
16:48Andalu30 has joined #asahi
16:50svenSEPOS uses the same dumb mailbox HW but not the RTKit stuff. and iirc acio or something uses a slightly different dumb mailbox interface but the same RTKit stuff again
16:51svenso it might make sense to reuse the mailbox interface but build some custom abstraction for the RTKit stuff, but dunno
16:52marcanlike, we can have the core mailbox/ep handling stuff, that is instantiated by downstream drivers that actually handle devices like DCP
16:56pipcet[m]I think a basic (tiny) mailbox driver exposing the dumb 128-bit mailbox still makes sense, marcan's library or whatever can talk to that.
16:58svenpipcet[m]: maybe, but i'm not 100% convinced about that. the mailbox driver implements a fifo and is usually used for even dumber mailboxes. apple's hw at least has a HW fifo that's 16 messages or so deep
16:58j_eymarcan: wow, i seem to be doing really dumb stuff all the time. earlier I was passing the uncompressed initramfs, now I was passing: Image dtb dtb-from-m1n1 initramfs, and getting very confused why none of my dtb changes were doing anything :||
16:59svenand the mailbox driver also assumes that all endpoints are separate, but on the m1 they all go to the same FIFO anyway. now that can all be worked around and maybe that's worth it
17:01pipcet[m]my driver only queues one message at a time at the hw level, I'm not sure it's worth it to do something more complicated.
17:03pipcet[m]so then the FIFO becomes useful because it makes writing the library easier, as long as MBOX_TX_QUEUE_LENGTH is greater than the number of endpoints used in parallel.
17:03DarkShadow44 has quit [Quit: ZNC - https://znc.in]
17:05svenbut then we always need to wait for an interrupt to deliver every single message, don't we?
17:05DarkShadow44 has joined #asahi
17:28Andalu30 has quit [Ping timeout: 480 seconds]
17:46marcanalso, if it's instantiated separately, that still leaves the issue of the cpu boot and other things we might need to do, which might end up outside of the mailbox driver's API
17:47marcanpipcet[m]: is there any case where we need to know that message transmission is done? that sounds wrong.
17:47pipcet[m]they should, yes. this just takes away the tiny part that we have a good abstraction for, but it's a clear fit
17:48arndthe mailbox framework is a little strange in the way it works, but for this particular use case it actually sounds like a good fit to me, just exposing a fixed-length message fifo
17:49arndthe main advantage of the mailbox framework is that there is an existing DT binding to describe how the various endpoints related to the shared mailbox driver
17:50pipcet[m](I'm also hoping for some debug features to make their way into the mailbox framework.)
17:50marcanif we want separate drivers for this, which we might, that will have to be our own thing with another layer
17:52marcanso that might be a good argument for a bespoke driver, if we actually want to have this be a DT node with multiple clients, the same way apple does it
17:52pipcet[m]marcan: well, what I did, but you're going to hate it and I haven't decided whether I do, is have a funnelling driver that provides one mailbox per endpoint and consumes the single-channel mailbox (with its two different implementations), providing infallible FIFO'd mailboxes to the endpoint drivers.
17:58pipcet[m]the main point for me is not to hide in the DT the fact that communication uses a piece of hardware clearly identified as a mailbox, which behaves like a mailbox. The secondary aspect is that the mailbox abstraction might evolve to actually be useful, by including debug facilities.
17:59pipcet[m]and for debugging and performance analysis, we need to know when a message has arrived at the ASC end...
18:05svenfwiw, it's also not too bad to have the mailbox driver already correctly expose the channels and mux them into the single fifo
18:06svenregarding debug feature for the mailbox framework: i used tracepoints because i was sick of spamming dmesg with every single message and that worked out quite nicely
18:06svenand either way i'd move the cpu control register (which is like a page or so away from the mailbox regs) out of that mailbox driver
18:10svenliterally just "take this message, get the endpoint from the client priv data, stuff it to the fifo"
18:10marcananyway, I'm talking out of my ass right now since I haven't even looked at any of the code
18:10marcanonce I get a look at that mailbox framework I might have to start shouting the right answer :p
18:11pipcet[m]marcan: good night, then, and thank you. I think you've actually convinced me with the rtkit library stuff :-)
18:12tophevich[m]marcan: Have a good refreshing night sleep, vax side-effects all gone?
18:13pipcet[m]sven: speaking of mailboxes (not dumb ones though) and queue depth, how many PRs does it make sense to keep open on asahi/devel at once? I'm not planning to open more unless you explicitly request it
18:14svendunno, but i think that first one could actually be sent to the 'real' upstream at this point
18:15marcanand we can have a stupid fixes branch if we need one for things that don't fit nicely anywhere else
18:15tophevich[m]"asahi-next"
18:17marcan(which *grumble* is going to involve a stupid webhook reflector hosted on my server, because github seems to have no way to point webhooks at itself, nor to have actions run *without* the workflow file in the current branch)
18:18svenmaybe i should actually open one with the dumb mailbox with N channels things so that we have some actual code to discuss and see how things fit
18:19svenyeah, it's like 1 fix for the aic-irqchip (if you disable irq N while you're in the handler for N you can never enable it again) + 300 lines of code or so
18:20sven(as in, i haven't traced through all the code to know why it works. i just have a good guess)
18:20pipcet[m]marcan: I started writing pseudocode and stopped when I ended up with a working brightness backlight driver, but it's, uhm, prototype quality code at best and totally faked its way around the dcp dart.
18:21tophevich[m]marcan: any plans to stream your endeavours again in the near future? (Your streams are currently my fav. procrastination excuse, and I feel like I need that or a holiday :D)
18:22tophevich[m]nice, I'm gonna watch out for it, realy enjoing those!
18:23marcanI'm still amazed people like watching me hmm and haw while spending hour trying to make stuff work :-)
18:24j_eytalking about marcans streams, is there a way to increase the font size on the simple-framebuffer?
18:25tophevich[m]you are good at narrating, and thus it makes it realy nice to follow along your workflow/thinking. also you have a good narration voice :)
18:27pipcet[m]oh, you meant the linux framebuffer, sorry. For the kernel just compile in a large font and you'll be fine, it's what my .config does.
18:27svenhttps://github.com/AsahiLinux/linux/pull/6 so that's essentially the mailbox thing that just exposes N endpoints and muxes them to the single FIFO + some (maybe) hack to the mailbox core to introduce a fast-path for submission
18:32j_eywhen I try `bt` I never get an actual backtrace :/ even after loading the system map and setting the pac mask, I always get _end. amw have you had any recent success with bt?
18:32JTL> 18:23 <@marcan> I'm still amazed people like watching me hmm and haw while spending hour trying to make stuff work :-)
18:32tophevich[m]marcan: your streams are very educational and also are most likely very good for growing a support for the project, I think SerenityOS and Zig (lang) are good examples of projects, where (main) contributers streaming/showing of the work gives the project a nice "human face" that gives supporters a greater (closer) sense of community.
18:32tophevich[m]Also they give ppl confidence to try stuff they thought impossible, as they see them being done infront of their eyes. If you see that mount of work only as a finished product, it seems impossible.
18:33marcanalso I don't know about my voice, but at least I can be reasonably proud of my audio quality :p
18:33DarkShadow44 has quit [Remote host closed the connection]
18:34DarkShadow44 has joined #asahi
18:35tophevich[m]good night
18:40tophevich[m]alyssa: Btw. I enjoy your streams also quite a lot. Wouldn't mind to see you stream more often. Also very educational, good at narrating along, plus a good sense of humor :)
18:44marcan has left #asahi [#asahi]
18:44marcan has joined #asahi
18:58alyssa has joined #asahi
18:58marcanit happens sometimes with IRC clients, especially with a bouncer in the way to muck things up
19:00krbtgti like the fact there's videos for audiovisual people but i do like projects with like a good progress report too
19:01krbtgtas someone who doesnt want to watch a video zig and serenity putting out videos is harder for me
19:06tophevich[m]yes, yes she is xD
19:07tophevich[m]marcan: sorry for the confusion, I was not looking if she is online, I was just counting on her reading it at some point
19:11pipcet[m]alyssa: https://gist.github.com/pipcet/0a12820ebf59e23ec430e9da72d976b3 is what I use.
19:16jixafter trying to stream coding (completely unrelated to asahi) myself, I have even more respect for both of you for your streams
19:22erincandescent has quit [Remote host closed the connection]
19:23erincandescent has joined #asahi
19:35jixthe coding part works for me... the debugging part also works for me... the "oh shit this approach won't work, I need to think about what to do instead" part doesn't work at all ^^
19:37j_eypipcet[m]: hmm I'm getting a data abort in gpio_set_reg, when i try to enable the keyboard :/
19:40pipcet[m](in the kernel command line .. this is where we all give marcan a hand for wanting to look at the clk stuff :-) )
19:42pipcet[m](I'm running pearl right now and it works, but then I booted through the .macho and the first thing that does is (try and fail to) enable all the clocks :-) )
19:49PhilippvK has joined #asahi
19:53phiologe has quit [Ping timeout: 480 seconds]
20:29quarkyalice has joined #asahi
20:42quarkyalice has quit [Remote host closed the connection]
20:42quarkyalice has joined #asahi
20:55skipwich has quit [Quit: DISCONNECT]
20:55skipwich has joined #asahi
21:12jeffmiw has quit [Ping timeout: 480 seconds]
21:18phiologe has joined #asahi
21:22PhilippvK has quit [Ping timeout: 480 seconds]
22:12amwYou can look at bt() in proxyclient/m1n1/hv.py around line 821 and try dumping out the registers it mentions
22:48j_eysven: are clocks meant to be parents of themselves? wondering about https://github.com/AsahiLinux/linux/commit/407d251adb55b121054031c8b3918c66e32ffd80#diff-ae02d08a2e0d474d5cb45d5c7e9de1c01cfd9b09e9af51fed5e4af64dc1551e4R192