2022-08-29
00:02e1eph4nt has quit [Ping timeout: 482 seconds]
00:28e1eph4nt has joined #asahi-dev
00:37e1eph4nt has quit [Ping timeout: 480 seconds]
00:46e1eph4nt has joined #asahi-dev
00:54e1eph4nt has quit [Ping timeout: 480 seconds]
01:20e1eph4nt has joined #asahi-dev
01:24riker77 has quit [Ping timeout: 480 seconds]
01:24riker77 has joined #asahi-dev
01:28e1eph4nt has quit [Ping timeout: 480 seconds]
01:29benpoulson has joined #asahi-dev
01:37benpoulson has quit [Ping timeout: 480 seconds]
01:57e1eph4nt has joined #asahi-dev
02:51goombado[m] has joined #asahi-dev
03:01e1eph4nt has quit [Ping timeout: 480 seconds]
03:08pyropeter2 has joined #asahi-dev
03:10pyropeter1 has quit [Ping timeout: 480 seconds]
03:19nicolas17 has quit [Quit: Konversation terminated!]
03:27e1eph4nt has joined #asahi-dev
03:36e1eph4nt has quit [Ping timeout: 480 seconds]
03:44e1eph4nt has joined #asahi-dev
04:41benpoulson has joined #asahi-dev
04:46hays has quit [Remote host closed the connection]
04:48hays has joined #asahi-dev
04:49benpoulson has quit [Ping timeout: 480 seconds]
04:53e1eph4nt has quit [Ping timeout: 480 seconds]
04:57e1eph4nt has joined #asahi-dev
05:20cste005 has quit [Quit: Leaving]
05:53maxkofler has joined #asahi-dev
05:58maxkofler has quit [Quit: Quit]
06:07the_lanetly_052__ has joined #asahi-dev
06:22mps has joined #asahi-dev
06:27bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
06:40TristenNollman[m] has joined #asahi-dev
06:50SergioLopez[m] has joined #asahi-dev
06:57marcanchadmed: the python firmware thing is relevant, but doesn't need to be automagic for gentoo IMO
06:57marcanso just package it as a python package and maybe add a python-exec wrapper to run it with the right arguments by default
07:00marcansven: two streams per dispext almost implies 2 monitors on M1, or MST? which would be unheard of for Apple but...
07:00marcanone theory I have is that maybe dcpext can route the two planes to different outputs? so you lose one plane per output but you get two
07:00marcanbut I didn't really see anything sane in the current firmware API to imply it actually supports doing this sanely, though who knows
07:03marcanbut can you route *separate* DISPEXTs to the same USB4 PHY? I mean that has to work, right? (especially for t6k)
07:03sveni could also configure the atcphy0 crossbar to dispext0,0 and the atcphy1 crossbar to dispext0,1
07:11e1eph4nt has quit [Ping timeout: 480 seconds]
07:13marcanha, AppleDCPDPTXProxy has strings which imply this matrix of routes: die[01]:dispext[0123]:core[01] -> atc[0123]:{dptx,lpdptx}:{dpphy,dpin[01]}
07:13marcanI wonder if that implies they can route DP streams across dies in t6002, that would be neat
07:16marcanif you look at DCPs on the die shot though, they clearly have two symmetric halves, so that supports the "two cores" idea too
07:18marcanI think DCPLink is the main DCP thing, so maybe there's somehow a whole separate instance per core?
07:23svenhuh, also DCP itself needs to know to which atc its stream is routed? ("core%u -> atc%u,%u (supportsHPD=%u)")
07:23_jannau_but why would apple not support that? no resources for fixing issues/testing it properly
07:25marcanI have a feeling that Apple have this thing where sometimes they can't ship certain hardware features because the software isn't ready on time, and they're too proud to admit to it or add it back in later, so they just don't
07:26marcanbut everyone is clamoring for multiple monitor support, and it's *bizarre* they didn't ship it with M2 at least if it can do it
07:26sveni kinda hope this actually works. would be a fun tweet. "Here's my M1 macbook air with two external screen running Asahi Linux" :D
07:33e1eph4nt has joined #asahi-dev
07:34_jannau_I have problems reading it different than "low power" as synonym for eDP but I'm confused what thta has to do with the dp-xbar routing
07:35svenfor dpphy the mux control has two fields, DPPHY_SELECT0 = 23, 20, E_DISPEXT and DPPHY_SELECT1 = 11, 8, E_DISPEXT
07:36svenit's unfortunately one of the few registers where they don't just give us the name/fields in debug strings
07:39benpoulson has joined #asahi-dev
07:41e1eph4nt has quit [Ping timeout: 480 seconds]
07:41svenhrm, so if DCP.bin knows about core0/1 the firmware should have sone support for it, shouldn’t it?
07:45marcanthere's unused bits in the DCP message bitfield, I could see them sneaking a pipe ID in there...
07:47benpoulson has quit [Ping timeout: 480 seconds]
07:48jakebot60 has quit [Quit: The Lounge - https://thelounge.chat]
07:50e1eph4nt has joined #asahi-dev
07:53jakebot60 has joined #asahi-dev
07:55hir0pro has joined #asahi-dev
07:58e1eph4nt has quit [Ping timeout: 480 seconds]
08:06e1eph4nt has joined #asahi-dev
08:11the_lanetly_052__ has quit [Ping timeout: 480 seconds]
08:15e1eph4nt has quit [Ping timeout: 480 seconds]
08:24e1eph4nt has joined #asahi-dev
08:58veloek_ is now known as veloek
09:16hir0pro has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
09:18hir0pro has joined #asahi-dev
09:32e1eph4nt has quit [Ping timeout: 480 seconds]
09:56e1eph4nt has joined #asahi-dev
09:57DmitrySharshakov[m]jannau: how's audio routed into DCP? I couldn't find its way inside the driver
10:02DmitrySharshakov[m]I mean DP audio
10:02DmitrySharshakov[m]You answered this probably
10:03DmitrySharshakov[m]Understood, thanks
10:04sventhat also reminds me that I wanted to look at that firmware to see if it's literally a co-processor that polls HW regs to pretend that they actually support DMA
10:04e1eph4nt has quit [Ping timeout: 480 seconds]
10:08_jannau_https://github.com/AsahiLinux/m1n1/blob/a47b590776b65f7a3531b1b0b51fd736d1ab3cb4/proxyclient/hv/trace_dcp.py#L726
10:15e1eph4nt has joined #asahi-dev
10:17shorneHello, I am jumping right into s2idle suspend stuff and compiling the kernel with CONFIG_SUSPEND (it seems onts not enabled on asahi by default)
10:18shorneSOme general questions, if I am not reverse englineering (yet) do I need to care about m1n1?
10:22shorneOh, its 2 different things. One is just compiling and internalling the kernel, not questions about that.
10:23bisko has joined #asahi-dev
10:30svenhttps://github.com/AsahiLinux/docs/wiki/Tethered-Boot-Setup-%28For-Developers%29 that's probably a good start for how to quickly launch new kernels
10:30svenyou'll want https://github.com/AsahiLinux/docs/wiki/SW%3AHypervisor for running macos under the hv
10:31svenyeah, so mostly just follow those guides then. they should explain everything that's required
10:41benpoulson has joined #asahi-dev
10:49benpoulson has quit [Ping timeout: 480 seconds]
10:59j`eyshorne: if you just want to run linux and not macos under the HV, the asahi-installer is a place to start
11:08derzahl has quit [Ping timeout: 480 seconds]
11:16hir0pro has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
11:23e1eph4nt has quit [Ping timeout: 480 seconds]
11:47e1eph4nt has joined #asahi-dev
11:56e1eph4nt has quit [Ping timeout: 480 seconds]
12:04e1eph4nt has joined #asahi-dev
12:13hir0pro has joined #asahi-dev
12:24c10l4 has joined #asahi-dev
12:24c10l has quit [Read error: Connection reset by peer]
12:24c10l4 is now known as c10l
12:56hir0pro has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
13:04Gaspare has joined #asahi-dev
13:09derzahl has joined #asahi-dev
13:12e1eph4nt has quit [Ping timeout: 480 seconds]
13:13Race has quit [Ping timeout: 480 seconds]
13:36e1eph4nt has joined #asahi-dev
13:40bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
13:45e1eph4nt has quit [Ping timeout: 480 seconds]
13:46Gaspare has quit [Quit: Gaspare]
13:47kaprests has joined #asahi-dev
13:53e1eph4nt has joined #asahi-dev
13:54kaprests_ has quit [Ping timeout: 480 seconds]
14:01e1eph4nt has quit [Ping timeout: 480 seconds]
14:03hir0pro has joined #asahi-dev
14:04bisko has joined #asahi-dev
14:14e1eph4nt has joined #asahi-dev
14:35gabuscus has quit [Ping timeout: 480 seconds]
14:39gabuscus has joined #asahi-dev
14:40Gaspare has joined #asahi-dev
14:52bluetail21 has quit []
14:55bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
14:56mini0n has joined #asahi-dev
14:57CellularDuck[m] has joined #asahi-dev
14:57CellularDuck[m] has left #asahi-dev [#asahi-dev]
15:07svenhttps://f.svpe.de/3be6aa094d28445bc10642f1946472a8bba0b64d8e183085478cc9175444742d_atc_dpxbar.py those should be all crossbar regs
15:08svencan somehow maybe run a tracer with that while connecting two displays via a single usb4 dock?
15:08sveni'm pretty sure I know what will happen (PCLK1/2 get enabled and then two dispexts are routed to dpin0/1) but I'd like to confirm that
15:23e1eph4nt has quit [Ping timeout: 480 seconds]
15:32e1eph4nt has joined #asahi-dev
15:32hir0pro has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:33hir0pro has joined #asahi-dev
15:45e1eph4nt has quit [Ping timeout: 480 seconds]
15:54e1eph4nt has joined #asahi-dev
15:55Gaspare has quit [Read error: No route to host]
16:01hir0pro has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
16:16hir0pro has joined #asahi-dev
16:21hir0pro has quit []
17:01e1eph4nt has quit [Ping timeout: 480 seconds]
17:04jannauI think my thinkpad docking station is not compatible with other devices (physically). maybe with an usb cable which shouldn't exist
17:10sven[cpu4] [XBarTracer@/arm-io/atc1-dpxbar] MMIO: W.4 OUT_N_CLK_EN = 0x110 (DPIN0=0, DPIN1=1, DPPHY=1)
17:11svenmarcan: ^-- can you maybe try to connect two external screens via a single usb4 dock on the pro/max and trace the crossbar?
17:17svenbut i'm mostly interested in what happens on pro/max with two display streams going over a single atcphy port
17:19Bastian[m]may be a dumb question, would this be something different than these adapter things https://www.amazon.com/dp/B09N6R91DZ do to get dual monitor support?
17:19dottedmagI have 5K LG UltraFine monitor (5120x2880) that is definitely multi-stream and it works with M1.
17:19dottedmagIf this is an interesting configuration I can set it up in a ~week's time for tracing.
17:21svenit's just a usb3 device that needs a driver which sends the framebuffer over some proprietary protocol
17:22dottedmagI know this LG is multi-stream because I saw how utterly broken it is under Linux on Intel + GNOME or sway. It was funny seeing GNOME using two parts of displays as two outputs, and even somewhat usable.
17:22ardisplaylink is cursed. i had a docking station for a work laptop based on that a couple jobs ago, and it was very bad experience
17:23Bastian[m]I love that the answers start with yes and no :D thank you
17:23dottedmagMe too. Maybe that's the reason why Apple does not advertise two-monitors support for M1: it would be too hard to tell apart which combinations would work and which ones won't.
17:26e1eph4nt has joined #asahi-dev
17:26svenhrm, so looking at the spec from display port it seems that 5k should be possible even with a single stream
17:26svenso maybe that display just supports the higher bandwidth DP modes and linux just messes up and tries to use MST instead?
17:27marcanmaz: this isn't released/merged anywhere yet, but feel free to merge/cherry pick bits/150-xhci-firmware
17:27sveneither way, let me know once you're that monitor again. i'd like to see a full atcphy + crossbar trace
17:28marcanyou need https://github.com/lzfse/lzfse (lzfse.so in your ld path) and then clone asahi-installer and run `python -m asahi_firmware.update /boot/efi/asahi /boot/efi/vendorfw/firmware.tar /boot/efi/vendorfw/manifest.txt && /usr/bin/update-vendor-firmware`
17:29marcansven: apple historically had 5K displays in tiled mode (e.g. the one in my iMac, which doesn't work, so I'm stuck at 4K)
17:29marcandelegate: parsed tiled display topology (%s): singleEnclosure: %s bezelInfoPresent: %s incompleteTiledBehavior: %u singleTileBehavior: %u tileTopology: (%u,%u) tileLocation: (%u,%u) tileSize: %ux%u bezelInfo: (t: %u, b: %u, r: %u, l: %u) identifier: Vendor: %02x-%02x
17:30nicolas17 has joined #asahi-dev
17:34e1eph4nt has quit [Ping timeout: 480 seconds]
17:34sventhe top level handler is display-crossbar0 and there's also only a single one in the t6x ADTs which contains all dispexts and all atcs
17:38svenyup. also makes our lives easier since we can mix and match dcpexts to atcphys however we want :-)
17:39sventhe type-c phy that sits behind each usb c port and handles all the magic low-level physical stuff
17:42DmitrySharshakov[m]Essentially a multiplexer which can connect Type-C pins to either DisplayPort, Thunderbolt, USB 3 or some debug stuff probably
17:42DmitrySharshakov[m]Btw does atc support 2x2 scheme where you give 2 lanes for DP and 2 for USB 3 link?
17:43DmitrySharshakov[m]Of course that works with TB, but that should be a variant for the DP altmode as well IIRC
17:43DmitrySharshakov[m]marcan: It uses SBU?
17:45DmitrySharshakov[m]marcan: Ah, alright, quite a lot more complex thing
17:46sventhere's just some weird interaction if you switch the SS lanes to USB3 and try to use USB2 at the same time without bringing up the USB3 PHY
17:48svenso one way to break everything is to enable the CIO clock/power-domain/whatever without having powered up ATCPHY first
17:49sventhen there's what's likely the CIO watchdog which resets the SoC after ~30 seconds if you bring up ATCPHY and then enable the CIO power-domain/whatever but don't boot CIO
17:50sventhere's another way to reset everything as well if you misconfigure some of the lanes even without involving CIO
17:53nicolas17in theory could we tell the AMCC to make the kernel code pages permanently read-only like XNU does? and does that have a chance of getting upstreamed?
17:55benpoulson has joined #asahi-dev
17:55marcanalso, Lina told me the other day she figured out it breaks huge pages covering the read-only region, which is ridiculous
17:57marcanapparently that's why she'd been getting faults trying to read GPU firmware for crash dumps... Apple started setting CTRR for the firmware region, and m1n1 uses huge pages when it can
17:58marcanin recent firmwares you can't use huge pages for lowmem, it throws up an address size fault (!)
17:59e1eph4nt has joined #asahi-dev
17:59nicolas17well there's security models where the Linux kernel and its modules are signed and root can't load new modules at runtime, which is quite Apple-like and could allow for KTRR, but if it breaks other things... eh
17:59marcanI guess they implement CTRR in the MMU/TLB, and since they can't get the proper granularity if you use 32M pages, it just... forbids them in/overlapping the region
17:59marcanthankfully there is no 32M region that overlaps user RAM and the CTRR region, so this only affects special-purpose memory
18:00marcannicolas17: loading modules at all is unlikely to work, the way Apple does things, all the modules are pre-linked and all the text sections combined and made contiguous
18:05benpoulson has quit [Remote host closed the connection]
18:06nicolas17https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aefcf2f4b58155d27340ba5f9ddbe9513da8286d ah this is what I was thinking ("lockdown mode")
18:06nicolas17and no it doesn't prevent loading modules from userland, it requires them to be signed
18:07DmitrySharshakov[m]Lockdown is just signature verification and many other rules enforced
18:07DmitrySharshakov[m]x86 does not have hardware RO memory (well, maybe somewhere in the SMM...)
18:07DmitrySharshakov[m]So lockdown mode does not make kernel image immutable to itself
18:08DmitrySharshakov[m]Yes, but kernel has to write parts of its memory to link a module in
18:08nicolas17if you don't use lockdown mode and intend to allow root to load arbitrary modules, then you surely can't use KTRR anyway :)
18:09DmitrySharshakov[m]However I guess some parts of the kernel might be extra hardened, at least some code which is never touched while module loads
18:10DmitrySharshakov[m]This will lock us out of kexec and kpatch
18:11DmitrySharshakov[m]Idk if we can lock some generally immutable parts and will it make any sense if something will have to be RO for modules to load
18:11DmitrySharshakov[m]nicolas17: It does restrict it to SecureBoot, doesn't it&
18:11DmitrySharshakov[m]s/&/?/
18:14marcanit doesn't make sense to lock only part of it. the whole thing only makes sense from the premise that *all* of the kernel is locked down and the CPU is locked down so it can *only* execute from that region.
18:15DmitrySharshakov[m]Well yes, since if something in between entrance and exit of higher EL is RW to evil forces, they can make it call outside of the secure area
18:15nicolas17DmitrySharshakov[m]: there was significant opposition from Torvalds and others against tying lockdown and secureboot, so the patch that was ultimately merged makes them independent
18:20DmitrySharshakov[m]Well how does XNU load its kexts? Or doesn't it do that at all on aarch64?
18:20nicolas17the arguments were "lockdown without secure boot will instill a false sense of security, since the lockdown can be circumvented by attacking the boot chain" and "a kernel that supports secure boot without lockdown can be compromised after boot to run untrusted code in kernel mode"; that argument lost and they were made independent :)
18:21nicolas17DmitrySharshakov[m]: afaik there's a monolithic "kernel cache" that is basically the kernel and the modules pre-linked, and it gets loaded as a single unit
18:21marcanand there is an "AuxKC" that contains all third-party kexts, which is also pre-provisioned and that must happen in recovery mode
18:21DmitrySharshakov[m]Yes, so all other devices are handled by userspace drivers since they aren't in kc?
18:22DmitrySharshakov[m]marcan: Do end-users ever use this kind of thing?
18:22nicolas17DmitrySharshakov[m]: in Apple's ideal world, all other devices are DriverKit (userspace), but kexts are "unfortunately" still a thing so there's the "AuxKC" as marcan said
18:23nicolas17but Apple has been progressively making it more of a pain in the ass to load kexts for many years now
18:24DmitrySharshakov[m]Well, so looks like there's no practical use of mainlining such a feature. It could be done for special occasions though I guess
18:24DmitrySharshakov[m]Building modules in to make a monolithic kc-like kernel without module support and then locking kernel memory into RO
18:26DmitrySharshakov[m]Might be useful for some people if internal parts + USB common classes are embedded this way. However, as I mentioned, that monolithization of the kernel would be certainly not upstreamable
18:27DmitrySharshakov[m]Well, and tun, and wireguard etc. Non-modular Linux is as possible as kext-free macOS is, but not really decent for most cases
18:29tpw_ruleswould it be possible to pre-load all modules into memory but not actually call them unless necessary?
18:29DmitrySharshakov[m]Possible, but not feasible
18:30DmitrySharshakov[m]Just recalled Logitech input is also a kernel module on Linux (at least rich functions). Having tons of userspace drivers isn't great, so that's not a good way to go
18:31DmitrySharshakov[m]tpw_rules: Their size I guess
18:31tpw_rules"Yes, but kernel has to write parts of its [code] memory to link a module in" does this go beyond actually loading the module into kernel space?
18:31DmitrySharshakov[m]kernelcache has essential drivers (parts of the Mac itself and basic externals)
18:32DmitrySharshakov[m]tpw_rules: Probably not
18:32DmitrySharshakov[m]But I couldn't imagine having all the modules built in
18:36DmitrySharshakov[m]Imagine we only can have USB pluggable devices. There's just a ton of them
18:37benpoulson has joined #asahi-dev
18:38DmitrySharshakov[m]However, somebody has to calculate that
18:41DmitrySharshakov[m]Well, `/lib/modules/<ver>/kernel` contains xz-ed modules, they could be counted (including un-xz-ing them)
18:53sveni don’t know how exactly Linux module loading works but I’d expect that you’d need some major changes to make it put all text in a region it’ll never have to write to
18:53bluetail21 has joined #asahi-dev
18:55DmitrySharshakov[m]Dumping a lot of drivers out of Fedora's aarch64 modules package yielded 160 MiB with not all drivers decompressed
18:55DmitrySharshakov[m]Why is contiguous text region necessary for this thing?
18:56DmitrySharshakov[m]I guess it can be achieved when linking modules in (config Y), which essentially produces the same thing as kernelcache
18:56DmitrySharshakov[m]cannot kernel executable code be protected as well?
18:57nicolas17if you protect the kernel's core executable pages with KTRR, now you used up your single region, and modules are still writable
18:57DmitrySharshakov[m]I guess kernel will be around 150 MB if compiled with all modules for builtin devices and whatever can be hotplugged. Quite a lot for kernel image
18:58DmitrySharshakov[m]Builtin modules should be in the same region
18:59DmitrySharshakov[m]nicolas17: I mean protecting the kernel _with_ modules
18:59DmitrySharshakov[m]With them being statically linked together
18:59nicolas17you mean not building them as modules to begin with, but inside the kernel? that may be possible yeah
19:00DmitrySharshakov[m]Exactly
19:00DmitrySharshakov[m]Just like kc, a single monolith
19:02DmitrySharshakov[m]What's the largest kernel image ever built and what could possibly stop it from working when tons of unused modules are linked in?
19:02nicolas17I guess the other problem is that putting "an attacker gets arbitrary write in kernel mode" into your threat model, that opens a big can of worms even if you protect code with KTRR :P
19:05DmitrySharshakov[m]Yes. So we're left with the only approach to enabling ktrr: evict everything from the kernel land and make them use VFIO to implement their PCIe card drivers in userspace and libusb for usb ofc
19:06e1eph4nt has quit [Ping timeout: 480 seconds]
19:06DmitrySharshakov[m]Someone has to try building everything needed in and enable the thing
19:06DmitrySharshakov[m]Gentoo users will definitely enjoy the concept of building a moduleless kernel
19:16e1eph4nt has joined #asahi-dev
19:20bisko has joined #asahi-dev
19:21DmitrySharshakov[m]Well, if somebody cares, that could be a kernel build-time option, which implies nothing can be built as a module. This would open a way for some really special scenarios where people can easily do a custom monolithic kernel build
19:24e1eph4nt has quit [Ping timeout: 480 seconds]
19:33e1eph4nt has joined #asahi-dev
19:38cuolin^ has joined #asahi-dev
19:42e1eph4nt has quit [Ping timeout: 480 seconds]
19:44benpoulson has quit [Remote host closed the connection]
19:50e1eph4nt has joined #asahi-dev
19:57benpoulson has joined #asahi-dev
20:14cuolin^ has quit [Ping timeout: 480 seconds]
20:18cuolin^ has joined #asahi-dev
20:57e1eph4nt has quit [Ping timeout: 480 seconds]
21:06e1eph4nt has joined #asahi-dev
21:14e1eph4nt has quit [Ping timeout: 480 seconds]
21:22e1eph4nt has joined #asahi-dev
21:27benpoulson has quit [Remote host closed the connection]
21:30e1eph4nt has quit [Ping timeout: 480 seconds]
21:55e1eph4nt has joined #asahi-dev
21:55chengsun has joined #asahi-dev
21:57chengsun_ has quit [Ping timeout: 480 seconds]
23:03e1eph4nt has quit [Ping timeout: 480 seconds]
23:19e1eph4nt has joined #asahi-dev
23:28e1eph4nt has quit [Ping timeout: 480 seconds]
23:37e1eph4nt has joined #asahi-dev
23:48jluthra_ has quit [Remote host closed the connection]
23:48jluthra_ has joined #asahi-dev