2023-09-10
00:06jovahd has joined #asahi-dev
00:38jovahd has quit [Quit: WeeChat 4.0.4]
00:58jeisom has joined #asahi-dev
01:01as400 has quit [Remote host closed the connection]
01:03as400 has joined #asahi-dev
01:21sawyer has quit [Quit: sawyer]
01:51ourdumbfuture has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
02:00gabuscus has quit []
02:04chadmed has quit [Remote host closed the connection]
02:20jeisom has quit [Ping timeout: 480 seconds]
02:23lena6 has joined #asahi-dev
02:40gabuscus has joined #asahi-dev
02:52malfunction54 has joined #asahi-dev
03:19tristan2_ has joined #asahi-dev
03:21tristan2 has quit [Ping timeout: 480 seconds]
04:24Graypup__ has quit [Quit: meow]
04:24Graypup_ has joined #asahi-dev
04:35marcanjannau: with my genpd defer patches, it should work if you don't give the genpd to simpledrm as long as dcp owns it and *it* knows how to handle it. however, if you remove DCP from the device tree, just simpledrm will break without explicit multi pd handling.
04:44Graypup_ has quit [Quit: meow]
04:44Graypup_ has joined #asahi-dev
04:46jannauit will not be a problem for dcp in the final state as the phy will get it's own node and everything has a single power-domain
04:54jannauadding the code to simpledrm shouldn't be a problem. it has already code to handle multiple clocks and regulators
05:07faustine has joined #asahi-dev
05:21chadmed has joined #asahi-dev
05:24chadmed has quit []
05:24chadmed has joined #asahi-dev
05:25faustine has quit [Quit: Lost terminal]
05:39crabbedhaloablut has joined #asahi-dev
06:01marcanin a future where m1n1 can do atcphy stuff and point the display at multiple places, it probably makes sense for it to add the relevant PDs to the framebuffers dynamically
06:34jannauwhy is t602x' ps_dptx_phy_ps always-on? is it not blocked on t602x laptops and disabling it breaks the display? If that's the case we should either add it to dcp's or the panel's power-domain
07:00ellyq has quit [Read error: Connection reset by peer]
07:10mps has quit [Quit: leaving]
07:23compassion1785 has quit [Ping timeout: 480 seconds]
07:27compassion1785 has joined #asahi-dev
07:47eiln has joined #asahi-dev
07:47mps has joined #asahi-dev
08:22marcanjannau: probably yes, back when I did bringup on that I assume I saw it was breaking the display and did the quick fix.
09:06marcanmaz: so we have another fun challenge now. turns out running x86 games in a 4K VM on a 16K host is actually doable and already proven to work well. that neatly sidesteps the whole 4K kernel pain for us, and might easily be the way to go at this point.
09:07marcanbut, that means we need TSO for KVM. right now it's a prctl on the host (not sure if you saw that patch) and I assume it would work as-is to enable TSO globally in the VM if KVM just keeps that state untouched from process context.
09:08marcanbut of course it would be more efficient to only have TSO in the VM where needed, which would mean forwarding that control to the guest. in principle, AIUI the guest can directly twiddle that bit without any VM exits, but we have to explicitly allow that and it would be IMPDEF of course.
09:08marcanalternatively we could have higher level hypervisor calls to forward this to prctl without dropping all the way to qemu or whatever, since I assume a vm exit (or more) to qemu for every context switch in the guest is a really bad idea
09:22marcanactually I'm not sure if the guest ACTLR behaves as intended already, since apple came up with an IMPDEF ACTLR_EL12... I feel like I looked into this already but I'm not sure any more. it might be that right now EL1 always gets default ACTLR (ACTLR_EL12) even if EL2 set something in its ACTLR_EL2, regardless of what is enabled in HACR_EL2.
09:23marcanso we might at the very least need to copy ACTLR_EL12 (impdef) <= ACTLR_EL2 to make the prctl work "automatically" for kvm host processes
09:25marcan(I know you're not going to like any of this, but I hope we can come up with at least a least-horrible solution because, really, using TSO is non-negotiable here, the perf boost for x86 emu is major)
09:26marcanI'd be happy with enabling TSO globally in the VM (Apple already do this for Rosetta on Linux VMs on macOS anyway), we just need to signal it to the guest somehow so FEX can pick it up.
09:28eiln has quit [Quit: WeeChat 4.0.4]
09:28eiln has joined #asahi-dev
09:59hightower3 has joined #asahi-dev
10:05hightower4 has quit [Ping timeout: 480 seconds]
10:15cy8aer has quit [Remote host closed the connection]
10:39roxfan has joined #asahi-dev
10:39cy8aer has joined #asahi-dev
10:57mazmarcan: the one thing I don't want to create is some new form of ABI at the userspace or hypercall level upstream. I know you went down that way in the Asahi tree, and that's fine by me as long as you keep it there. *how* you make it work is interesting though. If you have a bit of a spec/write-up that describes the various controls in the AUX regs at both ELs.
10:58jeisom has joined #asahi-dev
11:10eilnmarcan: I thought unk_size was firmware size too, but 0x180000 worked on 13.5 (0x100000). turns out unk_size only has to be greater than the current size, which the 0x180000 unknowingly covered.
11:11eilnsorry I wasn't clear. it doesn't have to alloc bottom-up anymore. but it'd be helpful (for me) to leave as is until we confirm the firmware boot mess across all variants. I also haven't checked vm_size for all dts. (rightfully) moving to iova.c is trivial, and I'll handle it right after
11:12marcanmaz: I mean, eventually this should be upstreamed in *some* form. Especially if we're going down the VM route, it will be incredibly silly to require downstream patches on the guest kernel when hardware support is otherwise not an issue.
11:13marcanI'm not particularly keen on the "this will be downstream forever because upstream won't take it in any form" outcome :/
11:19eiln has quit [Quit: WeeChat 4.0.4]
11:19marcanre ACTLR, I just realized I do know how this works with EL1 since obviously I've tested this in m1n1 HV. I'll write a quick spec.
11:21eiln has joined #asahi-dev
11:43marcanso basically, for VM-wide TSO, we need to poke ACTLR_EL12 (e.g. copy it from ACTLR_EL2 to inherit whatever the host configured for that process, or something else)
11:44marcanand then ideally signal the VM somehow, so software running in the guest can know it's in a TSO environment
11:44marcanfor exposing TSO to the VM dynamically, we either disable trapping that reg (and AIDR) and signal it somehow, or we provide some kind of hypercall to poke it.
11:47marcanthere are some other ACTLR bits described here: https://github.com/AsahiLinux/docs/wiki/HW:ARM-System-Registers#actlr_el1-arm-standard-not-standard
11:49marcannot sure what the rest of the bits do exactly. those 3 are the ones we care about for x86 emu, and TSO is by far the most important one.
12:05marcanah, it's in NZCV bits 26-27 and then save/restore on exceptions is via ASPSR_EL1 bits 1-2 (which is also IMPDEF).
12:06marcanwhich I think apple actually calls APSTATE_EL1? so maybe it's not exceptions? let me check...
12:06mazif you don't need the dynamic flip of TSO inside the guest, then it 's pretty easy to do, and we could probably stick that in a module -- just hook whatever you need to do in the arch-specific vcpu_load/vcpu_put helpers (the module interface itself is to be created).
12:08marcanmaz: well, we all know how stable the Linux kernel APIs are and how sustainable modules are long-term...
12:10marcansure, but I think it's fair to say if you start enabling IMPDEF features migration is fscked
12:12marcanone thing to keep in mind is that if we ever enable the APFLG feature especially, that one *definitely* has to be exposing this impdef stuff to EL0, and there's no trapping this
12:13marcanwhich means if we're doing that we might as well do what apple intended here, and just expose this raw to the guest and let it deal with it the same way my patch already does on bare metal
12:14marcanhow are CPU implementors passed to the guest right now? is there passthrough mode or is it always some qemu thing?
12:15mazMIDR values as seen as the host's, directly from KVM. which means that if your vcpu thread migrates from one type to another, you see it.
12:18marcanthat means my ACTLR code right now will... actually break. because KVM is claiming to be an Apple CPU that supports Apple IMPDEF features, but it doesn't.
12:18marcanat the very least we need to zero out AIDR_EL1 in KVM to make the current state of things not weirdly broken...
12:19marcanwell yes, but if you're claiming to be a specific CPU and then not supporting its features, that's kind of broken isn't it :)
12:20marcanlook I know this sucks for everyone involved but I'm just trying to make this all work in the least shitty way for everyone involved
12:22marcanmaz: anyway, I need to get dinner, but I assume we're not going to have a straight answer for this all anyway at this point so... let's say I want to just implement this in KVM the "apple way" with the features and context switching and everything. re context switching, does this affect the userspace interface and/or how hard is it to add to that without breaking the world? or can I just ignore ...
12:22ourdumbfuture has joined #asahi-dev
12:25mazwell, I'm willing to help. but I'm also not going to turn KVM upside down for that. my proposal is to allow a module to change the IMPDEF state at load/put time. for stuff such as AIDR, we could either expose it as writable to userspace, or trap it and forward that trap to userspace.
12:27mazthat will give you the possibility to save/restore the state as long as there is an EL12 accessor.
12:45marcanif the IMPDEF state is in a module, keep in mind we also need somewhere to *save* that state
12:46jeisom has quit [Ping timeout: 480 seconds]
12:47marcanwe're going to have downstream kernels for hwe anyway, and I'm not sure maintaining a kernel patchset vs a module with an unstable API/ABI makes much difference, and for users it also doesn't really make a difference whether they install a module or a whole separate kernel...
13:18chadmed has quit [Read error: Connection reset by peer]
13:19chadmed has joined #asahi-dev
14:01marcan[ 1.937063] apple-isp 384000000.isp: [isp_firmware_boot_stage1] never received first magic number from firmware
14:01marcan[ 1.939041] apple-isp 384000000.isp: [isp_firmware_boot] failed firmware boot stage 1: -19
14:02marcanwhat's the status of this one? is it supposed to work? should I start looking through macOS traces? :p
14:05eilnthat means the asc hasn't even booted, likely an err in ctrr setup. I patched src/isp.c to add the heap to the phandle so of_iommu can find it. is that there? ah-'s t6000 booted before
14:08j`eymarcan: https://oftc.irclog.whitequark.org/asahi-dev/2023-09-07#32465776 some patches from ah- here
14:13eilnit didnt for me. I just rebased on asahi-wip. can you print apple_dart_setup_resv_locked to see if it's getting mapped?
14:17marcan[ 4.001998] apple-isp 384000000.isp: IO: failed to send OPCODE 0x0004: [0xe0f140, 0xc, 0xc]
14:17marcan[ 4.004636] apple-isp 384000000.isp: [isp_firmware_boot] failed to start command processor: -62
14:18marcan[ 22.841068] apple-dart 3860e8000.iommu: translation fault: status:0x80000404 stream:0 code:0x404 (unknown) at 0x3045c00
14:19eilnnothing hardware yet, opcode 0x004 is PRINT_ENABLE. only 0xe00000 vs t8103 0x1800000 is suspicious though.
14:23hightower4 has joined #asahi-dev
14:27marcanjannau: we didn't need anything special in USB for this right? the iommu code just handes multiple IOMMUs?
14:29hightower3 has quit [Ping timeout: 480 seconds]
14:31jannauthat is/will be the easy solution for multiple display output. the display-subsystem node will just list all dart-disp*s, that requires no code in the device drivers
14:34marcaninstead of just instantiating the hardware multiple times, which is actually what is going on here
14:36sventhe dart driver only supports two right now, I think you can just change a define to make that three
14:53eilnmy understanding is that they are not real darts. and initing them as separate iommus might erase the special tunables
14:54marcanthis is just Apple being very, very stupid in how they represent things in their device tree
14:54marcanI believe the underlying reason for the multiple DARTs is performance or perhaps different configurations, where they connect different hardware memory initiators to different DARTs so it doesn't bottleneck on one
14:55marcanwith USB we could see certain kinds of requests wind up on one DART or the other (ask sven about that)
14:58marcan[ 0.323231] apple-dart 22c0e8000.iommu: DART [pagesize 4000, 16 streams, bypass support: 1, bypass forced: 0, locked: 0, AS 32 -> 36] initialized
14:58marcan[ 0.324633] apple-dart 22c0f4000.iommu: DART [pagesize 4000, 16 streams, bypass support: 0, bypass forced: 0, locked: 0, AS 32 -> 36] initialized
14:58marcan[ 0.326037] apple-dart 22c0fc000.iommu: DART [pagesize 4000, 16 streams, bypass support: 0, bypass forced: 0, locked: 0, AS 32 -> 36] initialized
15:02mazmarcan: well, if you only plan to hit upstream after a few *years*, that's probably not something I should be concerned about, and you'll have to convince other people than me!
15:06mazand on a completely unrelated note, I've finally tagged CS v3.2. no significant change with the state of the v3-dev branch, only silkscreen and LCSC reference updates.
15:09marcanbecause unlike Apple, our DART driver actually knows how to initialize stuff without relying on random hardcoded register pokes in the device tree
15:14marcanI'm so sorry you got caught up in this mess and I/we didn't catch it earlier and tell you what it's about :(
15:15marcanbut yeah our DART driver knows how to share page tables and everything, it literally just works... (other than that inconsistent bypass thing I had to patch)
15:31svenall of device mode and half of host most goes through the first and the other half of host mode through the second one
15:32mps has quit [Quit: leaving]
15:33svenand, uh, maybe I misremember but I though k mentioned this a while ago when we discussed dapf. maybe I should’ve put more emphasis on just how much of a hack the adt can be
15:39roxfan has quit [Ping timeout: 480 seconds]
15:41eilnISPASC: ASSERT: ./h10isp/common/misc/H13/CSystemConfiguratorConnectivityH13Jade.cpp, 472: 0
15:46ellyq has joined #asahi-dev
15:47marcaneiln: the dsid stuff looks wrong at first glance; the memory controller is laid out very differently on t6k, so those can't be right I think
16:17mps has joined #asahi-dev
16:28hightower4 has quit [Ping timeout: 480 seconds]
16:33hightower2 has joined #asahi-dev
16:41Guest2157 has quit [Quit: Bridge terminating on SIGTERM]
16:41rhysmdnz has quit [Quit: Bridge terminating on SIGTERM]
16:42Jamie has joined #asahi-dev
16:42Jamie is now known as Guest2417
16:43hightower2 has quit [Ping timeout: 480 seconds]
16:43rhysmdnz has joined #asahi-dev
16:47jlco has joined #asahi-dev
17:01marcan[ 2.504945] apple-isp 384000000.isp: ch 0: unsupported sensor. Please file a bug report with hardware info & dmesg trace.
17:02completenoob has joined #asahi-dev
17:09eilnhere's a really proto extraction script if you want better video https://pastebin.com/j0LpYLWv
17:13lena6 has quit [Ping timeout: 480 seconds]
17:15ChaosPrincessdoes m1n1 have a convenient way to diff a large memory range?
17:15ChaosPrincessin other news, ave firmware finally talks to me: "FW Cfg: prod, tag: AppleAVE2FW-6040.2.1, SHA: f5fece645"
17:23completenoob has quit [Ping timeout: 480 seconds]
17:24ChaosPrincessmarcan: didn't you have something on stream that showed pretty coloured hexdump diffs?
17:26marcanthe various m1n1 shells have a hook where if a "mon" variable exists, it'll call mon.poll() after every input
17:26ourdumbfuture has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
17:26faustine has joined #asahi-dev
17:30eilnChaosPrincess: you built on the isp stuff right? the ipc code can nearly be shared. the TERMINAL channel outputs the logs w/o having to memdiff
17:31ChaosPrincesseiln: not directly on top of isp, but using isp as reference, terminal outputs the logs, yes, but the channel table is different, the iovas are 0xffffffff, i am diffing to find out how exactly the current channel position is signalled
17:33roxfan has joined #asahi-dev
17:33marcanif code can be shared here, it might make sense to have some kind of libispfw or something, especially since both of these drivers are in media/ (ane OTOH, not sure, depends on how different it ends up being)
17:34ChaosPrincessim still in the "huge piles of hardcoded register pokes" phase
17:35eilnthey handle memory really, really weird. the firmware iova starts at ipc_iova and is masked by 0x80000000.
17:35eilnalso echo "1 2 hi" > /tmp/ave_log.cfg gets the userspace driver to talk a lot. I'm fairly certain this is a scanf CVE
17:36hightower2 has joined #asahi-dev
17:36ChaosPrincesseiln: yes, the firmware sends the address it wants the kernel to add to iovas
17:37ChaosPrincessalso, thats fw ver?
17:38eilnthere's a firmware bug causing an irq hang (preventing more logs). It should be as chatty as ISP. I was trying to patch the instruction, but apparently since ventura we can't write to segment-ranges anymore, hence I was downgrading earlier
17:44ourdumbfuture has joined #asahi-dev
17:52jacksonchen666 has quit [Ping timeout: 480 seconds]
17:54faustine has quit [Quit: Lost terminal]
17:54ourdumbfuture has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
17:59ourdumbfuture has joined #asahi-dev
18:08eiln has quit [Ping timeout: 480 seconds]
18:29Retr0id has quit [Read error: Connection reset by peer]
18:29Retr0id has joined #asahi-dev
18:35roxfan has quit [Read error: Connection reset by peer]
18:42midou has quit [Ping timeout: 480 seconds]
18:50amarioguy has joined #asahi-dev
18:50jeisom has joined #asahi-dev
18:51amarioguyquick question, how exactly do you probe for the PCIe XHCI host controller BAR (or in U-boot terms, the "HCCR"/"HCOR")
18:51amarioguytrying to follow the u-boot and linux code that probes for it has not exactly been the easiest lol, is it just a read from the ECAM region?
18:55amarioguy(long story short, trying to upload XHCI controller fw in my edk2 fork lol, was trying to follow u-boot code beforehand)
18:55amarioguyyea that tracks, bus0 seems to just be all the root bridges (w/devices behind those bridges)
18:55crabbedhaloablut has quit []
18:56amarioguymarcan: yeah i'm pretty sure it does, i'm probably just being dumb and not seeing smth obvious lol
18:56svenyeah, I’d try to avoid writing that code myself. That uboot and Linux code is partly hard to follow because the whole setup is a bit tricky
18:57sven(maybe not for the apple case where you know about all devices but to do it correctly for the general case of arbitrary pcie busses)
19:01ellyq has quit [Read error: Connection reset by peer]
19:02jannauif not trying you could try https://github.com/AsahiLinux/m1n1/pull/329/commits/598659fe070df237fd4a87a3b18f6d22fc4af743
19:04ellyq has joined #asahi-dev
19:26amarioguyjannau: i just ended up blowing away the install and reinstalling 12.3.1 lol, wasn't really using the ventura or sonoma partitions too much anyways
19:27midou has joined #asahi-dev
19:33deflated8837_ has quit [Remote host closed the connection]
19:48darkapex2 has quit [Remote host closed the connection]
19:48darkapex2 has joined #asahi-dev
20:42deflated8837 has joined #asahi-dev
23:20abd has joined #asahi-dev
23:34jovahd has joined #asahi-dev
23:47systwi has joined #asahi-dev
23:50systwi_ has quit [Ping timeout: 480 seconds]