2021-09-23
00:09bgb has quit [Ping timeout: 480 seconds]
00:17bgb has joined #asahi
00:40bgb has quit [Ping timeout: 480 seconds]
00:43yuyichao has quit [Ping timeout: 480 seconds]
00:49bgb has joined #asahi
00:58bgb has quit [Ping timeout: 480 seconds]
01:07bgb has joined #asahi
01:15bgb has quit [Ping timeout: 480 seconds]
01:17___nick___ has quit []
01:19___nick___ has joined #asahi
01:22yuyichao has joined #asahi
01:24bgb has joined #asahi
02:29bgb_ has joined #asahi
02:31bgb has quit [Ping timeout: 480 seconds]
02:43phiologe has joined #asahi
02:47PhilippvK has quit [Ping timeout: 480 seconds]
03:14marvin24_ has joined #asahi
03:17marvin24 has quit [Ping timeout: 480 seconds]
03:38yuyichao has quit [Ping timeout: 480 seconds]
04:23yuyichao has joined #asahi
04:26chadmed has quit [Quit: Konversation terminated!]
04:51chadmed has joined #asahi
06:36marcanalright, might take a bit to set up, but let's see if I can do the teardown/USB debug stream today
07:02mazj_ey: this name is just a vague indication of where the interrupt is coming from, but is not meant to be a debug infrastructure. we have /sys/debug/irq for that.
07:25chadmed has quit [Quit: Konversation terminated!]
07:32j_eymaz: and the in-memory state thing, I started to try to remove, but decided it was better to get a first version on the mailing list first
07:40mazj_ey: fair enough. TBH, I don't think there is any major issue with this driver (we have far worse in the tree already).
07:40mazj_ey: I'm only trying to make sure that M1 is as clean as possible from an irqchip perspective so that I can point people at it and consider retiring.
07:45sventhere's still this interesting question of how to handle these 7 or so AIC interrupts that can be distributed freely to the GPIO pins.
07:46svenprobably doesn't matter for the first version (and maybe not at all because we'll only have to use like two or three gpio interrupts anyway)
07:48svenalyssa: so either this dwc3 has a quirk where you can't stop commands (ugh) or i have to actually start looking into this usb phy (ugh)
07:48mazsven: huh... doesn't the GPIO block expose a mux where any 32 pin can generate an interrupt that is then relayed by a single AIC interrupt?
07:49linearcannon has quit [Read error: Connection reset by peer]
07:49sventhis thing has 200+ pins and I thought you could assign any pin to any of its 7 AIC interrupts
07:50mazif the GPIO block actually implements a 1:1 mapping between a single pin and an AIC interrupt, then the driver is completely wrong.
07:51linearcannon has joined #asahi
07:54_jannau_each pin config has 3 bits for interrupt control. so each pin can mapped to one of the 7 aic irqs or no irq
07:55maz_jannau_: OK. and you have a status per output interrupt to find out which interrupt has fired, I guess.
07:57mazin which case, I don't the the harm in having the driver evenly spreading the input pins over the 7 output lines, unless we want to play the priority game...
07:58j_ey(and the "unused" variable unsigned irqgrp = 0;, is where we would change the value of the group)
08:11j_ey_jannau_: I wonder if you can ack by setting the group to 7 (assuming thats the no-irq), rather than setting the irq type in the register
08:13_jannau_I suppose you can mask via setting the group to no-irq, ack seeems to need a write in the irq status bit
08:17bgb_ has left #asahi [WeeChat 3.0.1]
08:43mazj_ey: I guess that by doing that, you'd lose the pending state for edge interrupts. bad idea.
08:54j_eymaz: the code currently sets the type-of-interrupt field in the register to OFF to mask the interrupt, so when unmasking it needs to know what the type previously was
08:56mazj_ey: I'm worried that this leads to lost interrupts. the expectations are that if an edge lands while the interrupt is masked, it fires on unmask.
08:57mazit is likely that setting it to OFF disables the latch, and you lose the edge that landed while masked.
08:59j_eymacOS seems to be handling it like this btw. and I'm not sure how I can test the edge behaviour :/
09:06mazbtw, the function you're looking for is irqd_get_trigger_type(), but you'll have to have use the corresponding setter in your set_type callback.
09:18sven(the plug/unplug interrupt is edge trigger, but that's for the interrupt controller inside the TI chip)
09:23nskl has joined #asahi
09:29nsklaus_ has quit [Ping timeout: 480 seconds]
09:34roxfan has quit [Ping timeout: 480 seconds]
09:43tophevich[m]marcan: looking at the clock, I'd guess your "teardown/USB debug" stream wont happen today right?
09:53linearcannon_ has joined #asahi
09:53linearcannon has quit [Read error: Connection reset by peer]
09:54linearcannon_ has quit [Read error: Connection reset by peer]
09:54linearcannon has joined #asahi
09:55linearcannon_ has joined #asahi
09:55linearcannon has quit [Read error: Connection reset by peer]
10:00linearcannon_ has quit [Read error: Connection reset by peer]
10:00linearcannon has joined #asahi
10:01linearcannon_ has joined #asahi
10:01linearcannon has quit [Read error: Connection reset by peer]
10:07tophevich[m]ifixit, or where do you order?
10:11marcanI'm going to scope out the USB lines to try to figure out the mystery of why the dwc3 thing locks up on internal hotplugs but not external ones
10:12arheh. i've seen the insides of the "devkit", and the pcb was the size of the intel mini, but almost all traces were on the inside layers of the pcb
10:28marcananyway, the screwdrivers should arrive tomorrow... though tomorrow I have some stuff to do, so I'm not so sure if I'll have time, we'll see
11:02nskli was wondering, are you folks expecting the wifi driver on macbookpro m1 to be especialy tricky to create ? or on the opposite, are you expecting it to be a relatively straightforward to do ? (like, for example, if it's well documented, or somehow similar chip being already well supported on linux ?)
11:04nsklwill there be many steps needed to grab relevant blobs to import from macos to linux side ?
11:05nskli mean beside the wifi stuff you've just pointed out, will there be more firmware to get and import ? is it a one shot -kind of overall general all encompassing firware to grab- or will it be many little separated ones ?
11:06marcanit just needs some patches due to some custom apple silliness and slight silicon differences
11:06marcancorellium already did that ages ago, someone just needs to go through and clean up the mess and submit it
11:07marcanas for the firmware, I'll probably make the installer grab it from the running OS and put it somewhere for the installed OS to use
11:08svenyeah, the corellium patch probably just needs to be split from a single commit to three or four of them and it needs additional code i think to grab the mac address from the device tree
11:08nskli thought corelium port had no wifi, and no internal ssd support too, requiring us to use an external drive, among a few other shrtcoming, but maybe it was their first release and since then things improved that i didn't know about.
11:10marcanthe main problem with the corellium port is that it was a PoC port made with no intention of upstreaming, they just wanted a validation guest for their proprietary hypervisor
11:10marcanso they got lots of things to work, but lots of it in crazy ways that needed to be redone
11:11nsklthat's the impression i had too, that's also why i stayed away from it, prefering to wait for asahi and proper port
11:11marcanthere's a whole pile of drivers on the review pipeline already, I should send pmgr soon too
11:11marcanmight see about writing the cpufreq thing tonight if I have nothing else to do, seeing as the hardware hacking stream was foiled by Apple's screws
11:12svenyeah, and since heikki prefers that separate interrupt for the apple chip it also became a bit simpler imho
11:14marcansven: can you describe the phy/xhci fail in a bit more detail? just want to have the info before I bring out the scope
11:15svenin gadget mode: if you disconnect the cable dwc3 never submits an USBDisconnected event and if you plug it in again you also get no USBReset or USBConnectionDone event
11:15svenin xhci mode: if you disconnect the cable xhci sees a disconnected event but never gets another cable connected event. the port status indicates that the correct cable status though
11:15svenif I use a dumb usb-c -> usb-a adapter and i disconnect the usb-a everything works (in host mode)
11:17svenit also usually gets fixed with a partial phy reset (i.e. not what mac os, but just setting two reset bits)
11:17marcanI'm going to do a quick check on the usb pins with a scope externally on my normal M1, see what happens there
11:18svenmacos always pulls the entire PHY into reset when a cable is disconnected and tears down xhci completely
11:22tophevich[m]marcan: you could say you were apple "screwed"
11:29alyssamarcan: in that one case, one would hope Apple could fix that in the SMC firmware and not the OS..
11:36Guest512 is now known as svenpeter[m]
11:38svenpeter[m]I disabled the interrupts for the smc and it still didn’t work fwiw
11:38svenpeter[m]Did it work again afterwards?
11:38svenpeter[m]Because at least in m1n1 hot plugging works exactly once
11:44svenpeter[m]Never worked more than once for me
12:19marcanif I disconnect CC, then D+/D-, then reconnect D+/D-, then reconnect CC, it works fine as expected (since once CC drops it'll detach the data pins from the PHY, so how could it do anything?)
12:25marcanhere's the thing: when I disconnect the data side, one of the lines goes up as expected (gadget pullup)
12:26marcanthe thing is, the ti chip has some kind of "protection" crap; I've seen it cancel modes for me when I drew too much current and such
12:26marcanit's possible that it sees the pullup voltage and hates it for some reason (maybe because it considers vbus not ready yet?)
12:27marcanand the whole phy/dwc3 reset dance? all just to turn the pullups off and on again enough for tipd to not hate it.
12:27marcanif I'm right, I'm going to say apple themselves haven't debugged this properly, and are convinced it's a dwc/phy problem, and are doing all that shit for nothing
12:27marcan(consider: software people figured out how to make this work and never talked to hardware people)
12:28j_eymarcan: well if you're right, lets see what happens in the macOS release after this is posted to LKML :P
12:30yuyichao has quit [Quit: Konversation terminated!]
12:31yuyichao has joined #asahi
12:44yuyichao has quit [Quit: Konversation terminated!]
12:45marcanthe other half of the story is what about host mode; that uses pull-*downs* so what's up with that?
12:45yuyichao has joined #asahi
12:47sveni originally thought that host mode was broken because i didn't setup the phy correctly for that fwiw (or, to put it different: i was very surprised when dwc just worked in host mode without any additional phy pokes)
12:49marcanah, but this is interesting. if I set it to SuperSpeed mode it turns off the pull-ups, but still wedges
12:50marcani.e. if I replug, then switch to high-speed mode without a reset (which normally does turn on the pullups immediately), it doesn't
12:51yuyichao_ has joined #asahi
12:51yuyichao has quit [Remote host closed the connection]
12:54aleasto has joined #asahi
13:22marcanok, so the thing is, if the repeater gets reset, which I bet it does when the TI part detects a hotplug... the phy needs to know about that
13:23marcanif so, then we don't have much choice, though we might be able to get away without a big hammer reset and do something more surgical (e.g. that poke I mentioned for gadget mode)
13:32alyssait's ugly as hell, but... if macOS does it that way at minimum we know it interacts fine with all the other type-C port drama (particularly displayport and thunderbolt crossbar)
13:32alyssaon that note, does macOS do even more big reset hammer shenanigans when hotplugging dp/tb before/after usb?
14:02yuyichao_ has quit [Ping timeout: 480 seconds]
14:18jbowen has joined #asahi
14:22yuyichao_ has joined #asahi
14:23yuyichao_ has quit []
14:24yuyichao has joined #asahi
14:41nsklyou probably already thought about it, but, will it be possible to have this install scenario: format everything clean. do initial macos install on _an external_ drive, then proceed installing asahi on the internal drive, it would grab all the needed stuffs from macos on the external drive, then once everything is installed, remove external drive and enjoy single os linux install on
14:47nsklaus has joined #asahi
14:51marcanyou *do* need to have had a certain minimum macos version installed; if you haven't, you can just upgrade the stock macos first before wiping it, or do it on an external drive.
14:51nsklausmarcan: but, would it be possible at all to get rid of the recovery partition and have linux only stuff on the internal drive ?
14:51marcanno, that's like saying would it be possible to remove the UEFI firmware from a PC and have linux only on the drive
14:52marcanrecovery mode is part of system firmware, and starting with macOS 12.x you also need an additional copy of recoveryOS for each installed OS, Linux or otherwise
14:52marcantechnically you *could* wipe some of this stuff after installing linux, but you would end up with a half broken system that e.g. cannot use the boot picker
14:53nskl has quit [Ping timeout: 480 seconds]
14:53nsklausi see .. i enjoy mac M1, low power consumption, good cpu, gfx and all, but that few gigabytes bios like uefi partition always seemed to me like waste of space
14:55marcanthere's no way around it, wipe recoveryOS and you lose the boot picker. it's literally deleting part of the boot UI.
14:58marcanon the plus side, these machines are probably *the* most secure user-controllable secureboot systems available to end-users today
14:58marcanif you want a machine running your own OS that can withstand an evil maid attack, these are your best bet
14:58marcanthey are practically the only system designed with a "physical access is not enough" philosophy
14:59marcan(at least you will be able to do it properly once we support the SEP for storage encryption and such)
14:59nsklauswait until someday apple get the brillant idea to pull the plug and remove third party OS option .. you never know with them what strange decision they could come up with all of sudden
15:00marcansony did that on the ps3 because they're incompetent and can't actually build a secure system, so they chickened out when geohot found a silly glitch thing
15:01marcanin fact, as far as I know they are the only secureboot system that offers *per-OS* security modes
15:01marcanwhich allows you to do things like run full-DRM macOS with Netflix and iOS apps and all that walled garden stuff, *and* Linux, dual-boot
15:03nsklausi see there might be advantage too to their big blob 6gb bios. thanks for pointing it out, that's also reassuring to hear they probably won't suddenly change their mind about allowing third party os to run on their hardware
15:03marcanit's not just a third party OS, the "official" reason for all this is to run self-built versions of the macOS kernel
15:04marcanand either way, as long as they allow third-party drivers, it's basically the same security-wise
15:04marcanthat's *why* they spent all the time on this; Apple management didn't make it like this for us (but I'm sure Apple engineers were thinking of it).
15:06marcanthere's even a blob written by (presumably) Apple engineers explaining how all that works: https://kernelshaman.blogspot.com/
15:12nsklaus'xnu' is the name apple gave to their kernel, is that right ? so it is necessary to build a custom macos kernel to allow to boot linux on m1 ?
15:13marcanit's the same way m1n1 boots "linux" kernels but it can boot u-boot which happens to be built in the same format as a linux kernel; it doesn't have to care that what it's booting is not linux
15:16marcanthat blog is very helpful for understanding how things are supposed to work, but the only part that is the same for us is the bit that mentions `kmutil configure-boot` near the end
15:17ar170426 <@marcan> so there is no good way they could lock all this down without hurting macOS developers
15:18marcanand they're not going to throw it away for M1X/M2, and we're fast enough that by M3 things will be awesome and they'll have to think very hard about the PR hit if they actually try to make the next generation truly locked down like iOS ;)
15:19nsklausin worst case scenario we could do like the jailbreak tools do, and warn users to not update to certain macos version (to get incompatible, updated firmware)
15:19marcanat most they might decide to drop the feature in a future generation, but that's years away if it ever happens
15:23nsklausif someday linux on M1 allow users to run 32/64bits x86_64 apps, and eventualy virtualize macos too, you might have a better macos macos experience running it through linux instead. that should raise some eyebrows ;)
15:25nsklausi tested quickly fex_emu in a vm, and that worked quite nicely already (my test is from a few months ago)
15:33marcanvirtualizing macos is a bit of an issue, you'd have to run the vmkernel version of macos at least and GPU support requires writing a Metal implementation
15:35marcanOTOH running *Linux* in a VM on Linux should already be faster than running it on macOS, since we use the M1's vGIC and they don't ;)
15:40mazmarcan: very close to N1, and that's only running on the small cores (until you give me that cpufreq driver).
16:01marcanalso the strange thing is I'm not setting any bits in those registers... they're all already set for me
16:06mazj_ey: yup. fully automated install from scratch (boot from EFI, install everything reboot into the created guest, power-off).
16:17marcanmacOS 12.x does not touch it and even rewriting the same value to the register causes brokenness for me, so maybe it's a one-shot deal
16:38marcanah, are you on the second USB port? I noticed something weird about chainloading over that today, on my existing installed m1n1 (but after a chainload it's fine, so whatever it is I fixed it I guess?)
17:47nsklaus_ has joined #asahi
17:47nsklaus has quit [Read error: Connection reset by peer]
18:10artemist0 has joined #asahi
18:10artemist has quit [Remote host closed the connection]
18:58yuyichao has quit [Quit: Konversation terminated!]
19:00yuyichao has joined #asahi
19:24jlkjlk has joined #asahi
20:04jlkjlk has quit []
20:34Retr0id has quit [Read error: Connection reset by peer]
20:35Retr0id has joined #asahi
22:19psykose has quit [Remote host closed the connection]
22:20psykose has joined #asahi
22:36aleasto has quit [Quit: Konversation terminated!]
23:06___nick___ has quit [Ping timeout: 480 seconds]
23:11phiologe has quit [Ping timeout: 480 seconds]
23:24phiologe has joined #asahi
23:40yuyichao has quit [Ping timeout: 480 seconds]