#
…

2021-08-10

00:00quarkyalice_ has joined #asahi
00:00quarkyalice has quit [Remote host closed the connection]
00:08quarkyalice_ has quit [Remote host closed the connection]
00:16yuyichao has quit [Ping timeout: 480 seconds]
00:39amwsven: Just a note, dart/dev rev 6756bb246de5, very dangerous to run. It reliable corrupts my USB drive I use for rootfs
00:40amwHappens on first boot and so bad I have to wipe, remake the partition
00:40amwIt was confusing so I added a brief note to Wiki: https://github.com/AsahiLinux/docs/wiki/SW:Linux#nvme--usb
01:00amwGood news is that the devel branch worked - two times in a row so far ...
01:20amwdevel did corrupt USB drive after running about 10mins and then shutdown. Unrecoverable fail to recover on next boot
01:23yuyichao has joined #asahi
01:56chadmedarnd: bit of a necro i know but re the thing about the spi drivers all being the same, convergent hardware design might actually be worth a long term research project. in biology, convergent evolution happens when multiple species evolve the same trait in response to a common environmental pressure
01:58chadmedin computer hardware design im all but certain that this has happened also due to the influence of ubiquitous software like linux, where you see hardware start to be designed around better support/ease of development for a particular software solution, rather than the software solution conforming to a set of hardware
01:59chadmeda good example of this (though not specifically convergent) would be the addition of specific SQL query acceleration logic to fujitsu's most recent SPARC chips, or the integration of FPUs to x86 SoCs in the 90s as more and more people were using the PC platform for multimedia tasks that required fast floating point arithmetic
02:18PhilippvK has joined #asahi
02:21phiologe has quit [Ping timeout: 480 seconds]
03:00skipwich has quit [Quit: DISCONNECT]
03:01skipwich has joined #asahi
03:11marvin24 has joined #asahi
03:14marvin24_ has quit [Ping timeout: 480 seconds]
04:11quarkyalice has joined #asahi
04:20quarkyalice has quit [Quit: Leaving]
05:17quarkyalice has joined #asahi
06:12svenamw: uh.. so dart/devel wouldn't surprise me since that one has that 4k pagesize shenanigans
06:13svenj_ey: probably not, that was just a hack i tried
06:16svenamw: 4k pages or 16k pages? and is the iommu in DMA or in bypass mode?
06:17sorearquestion about the split iommu pagesize thing. Does AGX require the IOMMU to be configured per-process to control what memory each shader has access to, or is that handled somewhere else in the stack? (My relevant knowledge is limited to one AMD HSA slide deck a few years ago)
06:18svenapple loves IOMMU *so* much that they have at least four different ones
06:18svenAGX uses something called GART which we don't know much about yet
06:18svenbut presumably it'll need some per-process mappings
06:19sorearso AGX doesn't need to be treated by DART as an "untrusted device" using the terminology of the thread, but only because AGX is out of scope for DART entirely?
06:20svenAGx wouldn't be untrusted anyway
06:20svenuntrusted in the kernel means "external facing device that can act as a DMA master"
06:20sveni.e. thunderbolt
06:21sven(and we'll make the broadcom wifi untrusted too)
06:21sorearif user-provided shaders could tell it to access arbitrary memory in the device address space, and if DART was the only line of defense against that, it would quack a lot like an untrusted device (vfio/VM PCI passthrough being the other interesting case but that's much further down the road)
06:22svenah, good point
06:22sventhere's no DART but probably the same "issues" apply to GART
06:22svenbut GART may not be part of the iommu in the end
06:23sven(please don't let it be part of that framework. i really don't want to also implement multiple iommu per bus support in there)
06:23amwsven: CONFIG_ARM64_PAGE_SHIFT=14 - don't know how to tell about iommu - is it DT setting?
06:24sventhat's 16k, so should be fine
07:24arisn't "GART" is what iommu for gpus used to be called ages ago (as in, gpus in agp slot era)? i find it funny they've reused the name, though it kinda makes sense
07:26chadmedyeah lmao the driver for it in linux is still called agpgart
07:31marcanchadmed: SPI hardware isn't all the same because linux, it's all the same because SPI is a stupid simple protocol and there is effectively one obvious way to do it
07:31j_eyall the same, but all subtly different
07:32marcanif vendors were actually trying to help linux the worst thing they could do is exactly what they do, design an incompatible variant for no reason
07:39chadmedyeah perhaps an spi controller, being (relatively) simple and dumb, is a poor example of what i was trying to describe. of course, i dont for a second think that these companies are trying to "help" linux, but moreso just take advantage of the fact that these code paths exist and only add enough voodoo such that you still need _their_ driver, but that driver can be mostly copy-pasted or otherwise adapted from
07:39chadmedsomewhere else
07:44eichin has quit [Read error: Connection reset by peer]
07:44eichin has joined #asahi
07:44eric_engestrom has quit [Read error: Connection reset by peer]
07:44steev has quit [Read error: No route to host]
07:44eric_engestrom has joined #asahi
07:44steev has joined #asahi
07:50kettenis_ has joined #asahi
07:50kettenis has quit [Read error: Connection reset by peer]
07:52j_eyi'm ready
07:53pipcet[m]I'd follow the streams, but no audio on the M1 yet ;-) (seriously, haven't seen them but I think it's a great idea!)
08:13j_eyfingers crossed
08:13chadmedi do not recall the last time i had a positive experience with a broadcom chip
08:15chadmedi think ive only ever had a good experience with their DSL chipsets since theyre more stable on long phone lines
08:16JTLmarcan: Don't know if you got the memo, but GitHub now allows enabling "one time donations" for sponsorship
08:17tophevich[m]JTL: AFAIK they don't take a cut, right?
08:18amwHelp appreciated on debugging why platform drivers are not called - I cherry-picked the corellium pinctrl/gpio/keyboard drivers got them compiling but they are never probed!
08:19j_eyamw: added to the dt too?
08:19amwI have appropriate looking device tree - must be something very fundamental
08:19j_eyamw: added the CONFIG_ options?
08:19JTLtophevich[m]: not sure
08:19j_eyoh nvm you got them compiling
08:19pipcet[m]amw: got a link to your DT somewhere?
08:19amwDidn't take corellium nvme stuff
08:20j_eysorry nvm = nevermind
08:20j_eyamw: can you make a branch with your changes? I can look, I got this working yesterday, but cant share it immediately
08:24j_eysame lnk
08:25j_eyamw: for the delay thing replace it with 'ndelay(spi_delay_to_ns(&t->delay, t));' dont delete it
08:28amwok - I thought the proper call was the line below -
08:28marvin24_ has joined #asahi
08:30j_eyamw: and you've enabled all the CONFIGs? PINCTRL_APPLE_GPIO, SPI_APPLE_MC, KEYBOARD_APPLESPI?
08:31amwI believe so - those all say =y
08:31marvin24 has quit [Ping timeout: 480 seconds]
08:32amwThat last one was a pain until I added CONFIG_LEDS_CLASS - completely ignored until that is set!
08:33amwMade no difference
08:34amwI think I have to plaster the platform probing stuff with prints until I can figure out why nothing is probed.
08:34pipcet[m]you don't have a clk driver, is that correct?
08:35amwYep - I didn't try to take that as I don't really understand that code...
08:35j_eyamw: Add PMGR power-state based clock gates for Apple SoCs.
08:35j_eyyeah you need that commit ^
08:36amwI figured it would just complain in the probe when it asked for it - not totally non-probe ....
08:36j_eyamw: also pass clk_ignore_unused on the kernel command line
08:37jeffmiw has joined #asahi
08:49amwOk - now I'm probing! ... Get's an SError in clk_apple_pmgr_gate_disable - but that I can investigate
08:50j_eyamw: did you pass ^?
08:50pipcet[m]it shouldn't get there if you're passing clk_ignore_unused, should it?
08:50amwOk - thanks very much j_ey and pipcet[m] - was really getting frustrated with no output
08:50amwpipcet[m]: Yep I did pass that in the CMDLINE config
08:51j_eyoh weird
08:51j_eybut ignoring the unused clocks makes that patch not needed
08:52amwOk - I have to go now - but I'm not surprised my raw patches crash - at least the code is being run now....
08:52amwThanks again - much happier now!
08:53j_eyamw: cool, but as pipcet[m] said.. that probably shouldnt be called. double check youre getting "clk: Not disabling unused clocks" in dmesg
08:55amwj_ey: The stack trace shows it's called from clk_disable_unused from do_one_initcall() - so it's not happy
08:56j_eyyeah, so that option isnt being set properly
08:56pipcet[m]does the m1n1 command line override the built-in one or add to it?
08:57pipcet[m]i.e. is CONFIG_CMDLINE_FROM_BOOTLOADER or CMDLINE_FORCE enabled?
08:58amwpipcet[m]: Good call! - That was it - it's now booting up...
09:00amwOk - falling over trying to get an interrupt - but I was expecting something like that - didn't try to take that stuff
09:01j_eyamw: hm, which bits didnt you take?
09:01amwI was thinking trying to get polling working rather than work through all the interrupt stuff I'm not not familar with
09:01pipcet[m]amw: I had polling working at some point, but I don't remember which of the seventeen branches it's in :(
09:02amwLiterally just the pinctrl + spi + keyboard .... - that plus ignorance and hope :-)
09:03j_eyamw: oh, do you mean failing to get an interrupt during probe?
09:03j_eylike the platform_get_irq stuff?
09:04amwj_ey: Yep - just ignored anything related to the interrupts....
09:05j_eyweird, that just worked for me
09:06pipcet[m]amw: ignored as in removed or ignored as in left it alone?
09:07amwpipcet[m]: As in just took the whole DT entry for those spi/keyboard with the IRQ but didn't take any code patches for the IRQs
09:09j_eythe irq code is in the patches you took
09:09j_eyunless you removed it
09:28phiologe has joined #asahi
09:31PhilippvK has quit [Ping timeout: 480 seconds]
09:40jeffmiw has quit [Quit: Konversation terminated!]
09:45amwDidn't remove anything from the patches I took - didn't take b8ecd5924678 "SMP on Apple M1" or "Support for Apple Interrupt Controller (AIC)" but perhaps that's ok
09:47j_eyamw: yeah mainline has the aic already
09:47amwOk - apple-gpio-pinctrl 23c100000.pinctrl: Apple GPIO must have at least one IRQ
09:48j_eyoh one sec
09:49j_eyyou need interrupt-parent = <&aic>;
09:49j_eyamw: on both pinctrls and the spi3
09:51j_eyI think that fixes that
09:51pipcet[m]I'm confused-are you trying to poll the keyboard or get interrupts to work?
09:51amwj_ey: Hmm on the corellium they put the interrupt-parent in the keyboard section
09:52amwpipcet[m]: I'm just going shortest path at the moment (very long one it seems though :-()
09:53j_eyamw: yeah but you need one for pinctrls and spi3 too
10:09amwj_ey: now crashing SError in spi probe on the clk_enable - I might try commenting it out of the DT
10:10j_eyamw: do you see "clk: Not
10:10j_ey disabling unused clocks" in dmesg?
10:11amwj_ey: No - but I am passing that disable command line option via linux.py
10:11j_eyI dont think its working then
10:12j_eyin drivers/clk/clk.c try force it by writing: if (1 || clk_ignore_unused) {
10:12amwMay be I point the spi3 DT entry to refclk24mhz: or something safer?
10:13j_eytry the above first
10:15j_eyor try the patch I posted a bit ago
10:18amwNope - I think it is trying to enable it because it is used?
10:19j_eyNope meaning, you tried hardcoding it to be true in clk.c and it still didnt work?
10:20amwThat's correct
10:20j_eyI had a bunch of SErrors but they went away after I forced that option to be true
10:23amwok - my fixed refclk stopped it crashing but it's now winging about IRQ index 0 not found...
10:25amwj_ey: Here's the dmesg snippet - https://paste.debian.net/1207139/
10:28j_eyamw: can you repush your branch?
10:29amwok - done
10:30j_eyamw: //interrupt-parent = <&nub_gpio>; put this back
10:31j_ey(and remove the aic one for the keyboard)
10:32j_ey(and then probably change the clock back to &spi3_clk, but maybe it doesnt matter..)
10:34amwj_ey: Hmm - that seems like everything? - 3 changed files and 8 additionas and 3 deletions?
10:35j_eymaybe it didnt link properly, i mean change the keyboard@'s interrupt parent back to the nub_gpio again
10:35amwThat change allowed it to boot up - but I can try it again
10:37j_eyoh wait, you dont have on interrupt-parent = <&aic>; on spi3
10:37j_eyaic on spi3, nub_gpio on keyboard (for the interrup parents)
10:40amwHmm - weird - that made no difference - it booted up and the spi failed with the same IRQ index 0 not found
10:43amwThanks j_ey I better pick this up tomorrow though
10:44amwIt's in a state where I can edit the code and debug things now though which is much better
10:44j_eyamw: ok, push again, I might test later
10:46amwj_ey: Sure - done
10:46j_eyyeah you still need an interrupt parent on spi3, line 290
11:43yrlf is now known as Guest3798
11:43yrlf has joined #asahi
11:45jelly-hme has joined #asahi
11:45minecrell has quit [Quit: Ping timeout (120 seconds)]
11:46minecrell has joined #asahi
11:49Guest3798 has quit [Ping timeout: 480 seconds]
11:49jelly has quit [Ping timeout: 480 seconds]
12:14kov has joined #asahi
12:22amwj_ey: That was it - keyboard now *WORKS* !!!!
12:22j_eyamw: woot!
12:24pipcet[m]amw: so what's the next step? replacing all the corellium code one driver at a time? :-)
12:24amwI'll push it - now I guess we have to work out what to rip out / re-write ...
12:25pipcet[m]first things first, let's add fn+esc as sysrq and fn+1234 as F1, F2, F3, F4 to the hardcoded translation table ;-)
12:25pipcet[m](function-key challenged MBP user here)
12:26j_eyamw: are you on air or mbp?
12:29amwmacbook air
12:29amwwith 16G Ram - :-)
12:30j_eynice, mine was a gift so I had no choice to upgrade, I have the 8GB model. but my other main machine has 4GB sooo
12:31amwI got a 10y gift from work which I was able to influence (and paid the difference)
12:31j_eynice :D
12:33amwj_ey: Still don't understand all where and why all those interrupt parent things are needed - so glad you could put it all together!
12:34j_eyamw: I just pieced it together from the corellium code
12:35j_eyI assume this is also in the apple ADT, but I haven't looked at that for a while
12:35opticroncongrats on the functioning keyboard!
12:36pipcet[m]amw: ooh, any chance you could test whether the keyboard backlight works the same on MBA as it does on MBP?
12:36amwpipcet[m]: You probably know this but drivers/input/keyboard/applespi.c has Function keys and such already
12:36j_eypipcet[m]: amw doesnt have your backlight patches
12:37chadmed$100 to the person who can find a reason to name an iommu either SHART or FART
12:37amwpipcet[m]: You could "push a pull request" to https://github.com/amworsley/AsahiLinux/tree/asahi-keyboard
12:37pipcet[m]amw: the MBP doesn't have physical function keys, just the touchbar, so I had to add those.
12:38amwDoesn't the touchbar require those nasty co-processor/mailbox thingies?
12:39pipcet[m]it's an SPI device that responds nonsensically until you complete a lengthy initialization sequence, when it sends lots of data that needs to be interpreted...
12:39amwAhh - so long hours on the hypervisor...
12:39chadmedim disheartened that the rumours of them yeeting the touchbar turned out to be untrue
12:39j_eyamw: btw do you see a corrupt packet from the keyboard on boot? (in dmesg)
12:39pipcet[m]that's for input. For output there's a display controller behind its own dart, plus the phy driver
12:41amwj_ey: Yep - I get "applespi spi0.0: Received corrupted packet (invalid packet length 2357)"
12:41pipcet[m]I see that too, though usually it's a CRC error...
12:41j_eysame, wonder what that is about
12:41j_eypipcet[m]: I get that exact message ^
12:42pipcet[m][ 3.759822] applespi spi1.0: Received corrupted packet (crc mismatch)
12:42pipcet[m][ 3.793436] applespi spi1.0: Received corrupted packet (invalid message length 8 - num-fingers 0, tp-len 48)
12:43pipcet[m]amw: oh, any chance you could check your ADT first? I don't feel good about just writing to MMIO that I really have no reason to believe is there or does the same thing on MBA...
12:43j_eyIm Sure Its The Same(tm)
12:44amwHmm there are exactly 4 of those corrupted packet messages in the keyboard driver : git grep "corrupted packet" drivers/input/keyboard/applespi.c
12:45amwpipcet[m]: What am I looking for - I have an adt.txt file extract via m1n1 adt.py script
12:49pipcet[m]I suspect the initial message is just the weird boot mode the keyboard is in. It also sends an interrupt when the first key is hit, even when there is no driver.
12:54amwThat address matches something in my adt.txt - https://paste.debian.net/1207146/
12:56pipcet[m]j_ey was right, it's the same (is it possible the macbook pro is really just an overpriced mba without function keys? ;-) )
12:56amwDo I need to change the interrupt-parent/AAPL,phandle ?
12:56pipcet[m]nah, we're not using the interrupts
12:57pipcet[m]just make sure you use the right dtb if you test.
12:58pipcet[m](it's called t8103-j293, but it's just t8103-j274 plus the keyboard backlight)
12:59amwI need to enable PWM_APPLE_M1 and recompile ?
12:59pipcet[m]PWM_SYSFS too
13:00pipcet[m](there's another patch which exposes the PWM as a brightness control for an LED, but that's just DT magic)
13:07jelly-hme is now known as jelly
13:12amwpipcet[m]: I get applespi spi0.0: Error getting backlight level from EFI vars: -22
13:13pipcet[m]that's okay, that's the SPI keyboard backlight code in the applespi driver, for intel macs
13:13amwWhat am I suppose to do to enable it? A /sysfs entry ?
13:14pipcet[m]you should see a device in /sys/class/pwm; cd to /sys/class/pwm/pwmchip0; echo 0 > export; then a directory shows up with "enable", "duty_cycle" and so on. You can play with those (units in nanoseconds) :-)
13:15pipcet[m]though now I look at it, the missing clk gate might get you
13:16amwHmm echo 1 > enable => Invalid argument
13:16pipcet[m]did you set duty cycle and period first? if the duty cycle is longer than the period the pwm code will fail to enable.
13:17j_eyoh right, I disabled CONFIG_EFI, thats why I didnt see that. but this untested patch might fix it https://paste.gg/p/anonymous/e6649fe2f74f4c028adfa27aebfabfc2
13:18j_eyamw: you could try apply that to remove the EFI vars err at some point
13:18amwOh that wasn't so good : echo 100 > period gave SError and stack trace... no keyboard working ...
13:19pipcet[m]yeah, the clk gate. you can enable that in m1n1, I think.
13:19pipcet[m]no clock -> nothing decoding the MMIO address -> SErr
13:20amwok - guess those clocks are important for something :-)
13:21pipcet[m]pmgr_adt_clocks_enable("arm-io/fpwm") in the shell, I think.
13:23pipcet[m](that's part of the reason I'm trying to push the fpwm driver: it actually needs a clock and will do something visibly wrong if it's disabled while it's on)
13:28amwpipcet[m]: Can you enable it in a driver or something?
13:29pipcet[m]you can enable it with memtool if you know the address...
13:30pipcet[m]it's 0x23b7001e0 here, I think, though I'd enable the gate before and after that just to be sure.
13:31pipcet[m]that would be "memtool mw 0x23b7001d8 0xf 0xf 0xf", which I'm going to try here...
13:32amwok - enabled clock and booted it back up and no crashes - so far - but no backliht that I can see?
13:32pipcet[m]what did you set the duty cycle to?
13:32amwI did echo 100 > period; echo 30 > duty_cycle; echo 1 > enable
13:33pipcet[m]er, it's nanoseconds, try 100000 and 30000?
13:34amwok - yep that's working!
13:37pipcet[m]thank you very much, that's great. One last thing before I shut up; can you test a period of 1000000000 (that's a US billion) and a duty_cycle of half a US billion and see whether it flashes once per second, roughly?
13:39amwYep it's flashing - about .5s on and .5s off....
13:39amwlooks pretty weird :-)
13:44amwIf you wanted to go really gaudy you could try updating the Asahi Wiki with that and see if it displays the flashing keyboard ...
13:46j_eynow make it do RGB :D
13:50yuyichao has quit [Ping timeout: 480 seconds]
13:59pipcet[m]nope, displays the alt text. Maybe my browser doesn't understand your fancy new mp4s :-)
14:00pipcet[m]oh, btw, and this is a lot simpler, does the caps lock LED work? that gives us a grand total of two user-controllable LEDs!
14:01floxf5[m] has joined #asahi
14:01alyssapipcet[m]: once marcan and i bring up dcp that'll give another few million "LCDs" ;)
14:02pipcet[m]in my day, that's all we needed to get a system up and running, but now you kids have fancy frame buffers and all that
14:02pipcet[m]all that graphics nonsen...hi, alyssa, how's the DCP work going?
14:08alyssai have a full time job and it's not this
14:33svenamw: can you elaborate on that corruption? do you get any error messages? does this usb drive work with other machines? 'cause i've been using that branch for a while without issues so far
14:42jeffmiw has joined #asahi
15:21yuyichao has joined #asahi
16:59chadmed has quit [Remote host closed the connection]
17:00chadmed has joined #asahi
17:16WhyNotHugo_ has joined #asahi
17:17DarkShadow44 has quit [Quit: ZNC - https://znc.in]
17:20WhyNotHugo has quit [Ping timeout: 480 seconds]
17:20WhyNotHugo_ is now known as WhyNotHugo
17:29quarkyalice has quit [Remote host closed the connection]
17:32WhyNotHugo has quit [Ping timeout: 480 seconds]
17:35DarkShadow44 has joined #asahi
17:35WhyNotHugo has joined #asahi
17:36quarkyalice has joined #asahi
17:45quarkyalice has quit [Remote host closed the connection]
17:49quarkyalice has joined #asahi
17:50quarkyalice has quit [Remote host closed the connection]
17:52quarkyalice has joined #asahi
18:27quarkyalice has quit [Remote host closed the connection]
18:29quarkyalice has joined #asahi
19:17quarkyalice has quit [Ping timeout: 480 seconds]
19:32quarkyalice has joined #asahi
20:25quarkyalice has quit [Ping timeout: 480 seconds]
21:47bps has quit [Ping timeout: 480 seconds]
22:11jn has quit [Remote host closed the connection]
22:14riker77_ has joined #asahi
22:14jn has joined #asahi
22:16riker77 has quit [Ping timeout: 480 seconds]
22:16riker77_ is now known as riker77
22:49amwpipcet[m]: mplayer says '[H264] 1920x1080 24bpp 120.000 fps 20315.1 kbps + aac audio' - just raw from the phone
22:50amwsven: The devel branch is much more stable but still has issues, files disappear and have wrong permissions
22:51amwI can often run fsck and mount them - but it never works to boot again. I just reformat it and copy over the image again and all is good.
22:52amwIt probably doesn't help that I can shutdown but it still doesn't power off the MBA
…