2023-04-10
00:57deteg1337 has joined #asahi-dev
01:06zzywysm has joined #asahi-dev
01:07nsklaus has quit [Quit: ZZZzzz…]
01:09deteg1337 has quit [Ping timeout: 480 seconds]
01:42hightower3 has joined #asahi-dev
01:49hightower2 has quit [Ping timeout: 480 seconds]
01:58A_L_I_C_E has joined #asahi-dev
02:11amw has joined #asahi-dev
02:18maria28547 has joined #asahi-dev
02:19maria2854 has quit [Ping timeout: 480 seconds]
03:42deteg1337 has joined #asahi-dev
03:50deteg1337 has quit [Ping timeout: 480 seconds]
04:16i509vcb has quit [Quit: Connection closed for inactivity]
04:35Graypup__ has quit [Quit: meow]
04:35Graypup_ has joined #asahi-dev
04:49deteg1337 has joined #asahi-dev
04:58deteg1337 has quit [Ping timeout: 480 seconds]
04:59A_L_I_C_E has quit [Ping timeout: 480 seconds]
04:59chipxxx has quit [Remote host closed the connection]
05:00chipxxx has joined #asahi-dev
05:00A_L_I_C_E has joined #asahi-dev
05:05chipxxx has quit [Remote host closed the connection]
05:07chipxxx has joined #asahi-dev
05:08A_L_I_C_E has quit [Remote host closed the connection]
05:09chipxxx has quit [Remote host closed the connection]
05:10chipxxx has joined #asahi-dev
05:10Graypup_ has quit [Quit: meow]
05:11Graypup_ has joined #asahi-dev
05:52deteg1337 has joined #asahi-dev
06:00deteg1337 has quit [Ping timeout: 480 seconds]
06:07A_L_I_C_E has joined #asahi-dev
06:34rpirea has quit []
06:43deteg1337 has joined #asahi-dev
06:51deteg1337 has quit [Ping timeout: 480 seconds]
07:20___nick___ has joined #asahi-dev
07:47deteg1337 has joined #asahi-dev
07:54hightower3 has quit [Read error: Connection reset by peer]
07:56deteg1337 has quit [Ping timeout: 480 seconds]
08:52deteg1337 has joined #asahi-dev
09:00deteg1337 has quit [Ping timeout: 480 seconds]
09:14chadmed has quit [Remote host closed the connection]
09:33deteg1337 has joined #asahi-dev
09:38nsklaus has joined #asahi-dev
09:42deteg1337 has quit [Ping timeout: 480 seconds]
09:51marcanit might be the first one that has to work, since dwc3 as far as I know knows how to fall back to bypass?
09:55jannauok, that should fail then too and probably explains the SError OI saw yesterday on the m2 pro mini
09:59chadmed has joined #asahi-dev
10:02chipxxx has quit [Remote host closed the connection]
10:02chipxxx has joined #asahi-dev
10:07chipxxx has quit [Remote host closed the connection]
10:07chipxxx has joined #asahi-dev
10:09chipxxx has quit [Remote host closed the connection]
10:09jannauwe should take's the device's dma mask into account in apple_dart_finalize_domain(), I doubt we need more than 36-bit for most devices
10:09chipxxx has joined #asahi-dev
10:32deteg1337 has joined #asahi-dev
10:32A_L_I_C_E has quit [Remote host closed the connection]
10:34A_L_I_C_E has joined #asahi-dev
10:35___nick___ has quit []
10:37___nick___ has joined #asahi-dev
10:40___nick___ has quit []
10:42___nick___ has joined #asahi-dev
10:46deteg1337 has quit [Ping timeout: 480 seconds]
10:51marcan[ 5.730759] apple-dart 2a9808000.iommu: translation fault: status:0x90180000 stream:1 code:0x0 (unknown) at 0xfffffc040
10:52jannaukettenis_: problem is in the hypervisor, works after adding 0x6020 to 'elif chip_id in (0x6021,):'
11:12jannauchadmed: it trips over the unused pcie port 1. disabling that one is sufficient, enabling port 2 and 3 (ethernet and xhci) causes no issues
11:13gabuscus__ has quit []
11:13chadmedill play some more tomorrow, basically just waiting for DCP and id consider it useable rn tbh
11:13gabuscus has joined #asahi-dev
11:19A_L_I_C_E has quit [Remote host closed the connection]
11:20A_L_I_C_E has joined #asahi-dev
11:25MajorBiscuit has joined #asahi-dev
11:25MajorBiscuit has quit []
11:26MajorBiscuit has joined #asahi-dev
11:41marcan4-level DART works and MTP starts up, though the HID descriptors are borked (possibly some MTP firmware ABI change)
11:57cylm_ has joined #asahi-dev
12:51MajorBiscuit has quit [Ping timeout: 480 seconds]
13:03deteg1337 has joined #asahi-dev
13:11deteg1337 has quit [Ping timeout: 480 seconds]
13:15rashthedude has joined #asahi-dev
13:17rashthedudeHi everyone
13:17marcanthe HID descriptors look fine in the Python dump so I wonder what happened here, maybe just a bug
13:19Dementor1 has joined #asahi-dev
13:21Dementor3 has joined #asahi-dev
13:22ChaosPri1 has joined #asahi-dev
13:24Dementor2 has joined #asahi-dev
13:26Dementor has quit [Ping timeout: 480 seconds]
13:26Dementor2 is now known as Dementor
13:28Dementor1 has quit [Ping timeout: 480 seconds]
13:31jannausigh, no idea what "vm-base" is. in the m2 pro adt it looks more like ASC DRAM offset. I guess that still holds for the m2 except that it is so small that it already affects the iova in the dart
13:31Dementor3 has quit [Ping timeout: 480 seconds]
13:34marcanjannau: for MTP, macOS is using an offset but that doesn't work for me (it seems to put the full address through the DART). I think the DAPF config may be wrong in that case.
13:35ChaosPri1marcan: you told me to poke you about fpwm dts, so, if you have time, here is the poke :P
13:36ChaosPrincess has quit [Quit: WeeChat 1.9.1]
13:36ChaosPri1 is now known as ChaosPrincess
13:38ChaosPrincessalso, from yesterday, still wouldnt mind someone with a m1 mbp running this in m1n1 console and seeing if colors look right https://github.com/WhatAmISupposedToPutHere/m1n1/blob/f4517bdaf72cb36ac8999903a5d85aecddd0ed28/proxyclient/experiments/touchbar_rainbow.py
13:54rashthedude has quit [Remote host closed the connection]
14:06marcanlol, having nGnRnE issues with MTP, I thought we'd sorted that mess out a couple years ago...
14:10Thsf has joined #asahi-dev
14:31deteg1337 has joined #asahi-dev
14:35marcanit's kind of funny how I'm running into all these outright bugs that we just somehow never caught on M2
14:39deteg1337 has quit [Ping timeout: 480 seconds]
14:40jannausigh, dart management for dcp is annoying. every devices without iboot managed fb requires custom workarounds
14:42jannaumarcan: can I get a experiments/dart_dump.py {dart-dcp0,dart-disp0} from the macbook, only the pte are interesting
14:45jannauhttps://github.com/jannau/linux/tree/t602x/bringup has more complete j474s devicetree and a compile fix and limits the ias to what the devices can use. not yet sure about the last one
14:58MajorBiscuit has joined #asahi-dev
15:01kettenis_marcan: the performance_domain in arch/arm64/boot/dts/apple/t602x-common.dtsi is a typo isn't it?
15:05marcanthis is interesting, with the DART ias limit patch using that high bit in MTP addresses works,but not without it, but macOS does use ias=42 for this
15:22jannau0x100_0000_0000 fits into 42-bit ias, so you have map the memory at that offset. that seems to be what happens with dcp on m2
15:38marcanI know there's a thing in the dart, but is there one for the device? or should this be in the dart?
15:40marcanjannau: I get the feeling vm-base and vm-size are that (the VM range you're supposed to use for iovas/dvas), except when the dart IAS doesn't fit it the top bits just get truncated off
15:45marcanlooks like this is only settable at the iommu, so just like macOS, it has to go in the DART...
15:45jannauonly change in linux was to use the dart's ias and rely on linux to allocate iova from the top
15:48jannauif we want to deal with it properly in linux we have to set domain->geometry.aperture_{start,end} based on vm-base and vm-size
15:49marcanyeah, we could also use dma-ranges but that only works on buses and it feels like very much the wrong abstraction
15:51jannauat least vm-size seems to be only a suggestion, we have so far not encoutered a device which fails with top of address space iovas
15:53jannaubut most devices are limited to 32-bit. we have to update drivers to not use dma_set_mask...(32);
16:00jannauon linux side https://github.com/jannau/linux/tree/dcp-6.3-rc4-0_dcp-v13_2 merges without conflicts
16:08deteg1337 has joined #asahi-dev
16:10deteg1337 has quit [Remote host closed the connection]
16:11deteg1337 has joined #asahi-dev
16:11siglazin has joined #asahi-dev
16:17i509vcb has joined #asahi-dev
16:19deteg1337 has quit [Ping timeout: 480 seconds]
16:22siglazin has quit [Remote host closed the connection]
16:27deteg1337 has joined #asahi-dev
16:30deteg1337 has quit [Remote host closed the connection]
16:30deteg1337 has joined #asahi-dev
16:31deteg1337 has quit [Remote host closed the connection]
16:32deteg1337 has joined #asahi-dev
16:40deteg1337 has quit [Ping timeout: 480 seconds]
16:49deteg1337 has joined #asahi-dev
16:52marcanjannau: pushed and added an apple,dma-range thing, hopefully it does what you want for DCP and we can get rid of the DRAM mask story.
16:55marcanrobher: what's the best practice for DMA addresses in the DT? use the device cell sizes, or hardcode it to 64-bit always, or something else? (so kettenis_ doesn't hate me when we change the bindings when upstreaming)
16:55marcanthis is a property for IOMMU device nodes to specify the allowable DMA address range, I have it as two u64s <base size> right now.
16:56marcannot sure if it makes sense to make it generic, in principle other IOMMU drivers could easily support this but I'm not sure if they care
16:56marcanit's somewhat questionable whether this is a property of the IOMMU or the device, since it's really a property of how the IOMMU interacts with the device's view of memory (and we don't even know exactly how that is implemented)
16:57marcanApple puts it in the IOMMU and on Linux the IOMMU is the only easy place for this to be set, since that driver controls the aperture fully (devices can only set a DMA mask)
16:57marcanthere's the dma-ranges stuff that can also limit this, but that's for buses and this isn't a bus...
16:58marcanI think it also makes sense to put it in the IOMMU because we have a special case where that range can exceed the IOMMU's own input range, and in that case it is assumed the high bits are dropped
17:01deteg1337 has quit [Ping timeout: 480 seconds]
17:09deteg1337 has joined #asahi-dev
17:10marcanjannau: the problem is the device DMA mask is not set yet, so we get 32bit. the iommu stuff happens too early.
17:10marcanI don't think there's a solution for this, let's just drop that idea... setting the DMA range at the DART will already do the right thing wrt clamping IAS anyway.
17:19Dementor has quit [Remote host closed the connection]
17:19deteg1337 has quit [Ping timeout: 480 seconds]
17:20Dementor has joined #asahi-dev
17:21kettenis_./t600x-j375.dtsi:13.10-24.4: Warning (alias_paths): /aliases: aliases property name must include only lowercase and '-'
17:25Dementor has quit [Remote host closed the connection]
17:25Dementor has joined #asahi-dev
17:27marcanrobher: this codepath is getting called before the driver probes, so the DMA mask is unset, which means we end up limiting everything to 32bit. I see that if we set dma-ranges to a dummy single covering the entire 64bit AS, we'll probably get what we want... but is this what we're supposed to do?
17:29kettenis_I thought the default was that there are no dma restrictions unless there is a dma-ranges property
17:30marcanyeah, that'd make sense logically, which is why I think this is a workaround and this kernel codepath is just broken
17:32marcanrobher: the call chain here is really_probe -> platform_dma_configure -> of_dma_configure_id. that ends up pulling a default 32-bit DMA mask since the device driver probe() hasn't run yet. that seems wrong.
17:37marcanalso I think the reason nobody noticed this yet is that the subsequent arch_setup_dma_ops -> iommu_setup_dma_ops codepath only uses the size for a sanity check, it doesn't keep it anywhere. so it will pass as long as IOMMUs will at least *support* the 32-bit DMA range, and we're probably the first one that doesn't when we specify a restricted high aperture.
17:37marcanthe problem is not the default, it's that the OF code is running before that default can be overridden and then eventually that codepath ends up in a sanity check that we fail
17:37marcan(only, that's all the max is used for, which is why this hasn't actually broken everyone by *forcing* 32bit DMA for everything)
17:39marcanput another way: of_dma_configure_id() is doing something fairly silly, taking the device DMA mask as a default size (or 32bit if not set), then clamping the DMA mask to that again
17:39A_L_I_C_E has quit [Read error: Connection reset by peer]
17:39marcanIMO the default size in that function should be 64-bit on 64-bit platforms period; the actual dma_mask can remain 32-bit by default of course
17:40A_L_I_C_E has joined #asahi-dev
17:40robhermarcan: generally, if you want anything other than all 32bit or all 64bit, then you need to use dma-ranges.
17:41robherAs for the specifics in of_dma_configure_id(), that's a conversation to have with Robin who is not here.
17:41marcanbut also isn't that kind of backwards? what I want is drivers to be able to set their own DMA mask and OF not get in their way by clamping it further
17:43robherA device that supports >32bit should set their mask to what they support (at the device, ignoring bus level restrictions)
17:43deteg1337 has joined #asahi-dev
17:44marcanyes, but that isn't working because that OF codepath is calling arch_setup_dma_ops/iommu_setup_dma_ops with a 32bit mask *before* that can happen
17:44marcanand that breaks because those ops see that the device is asking for 32 bits and the IOMMU *cannot support that* (because its range is restricted to only a higher aperture than the low 32 bits)
17:46jannauI think we ought to set dma-ranges although it's counterintuitive since the iommu dt bindings say it will be ignored if we use the iommu
17:47marcanheh it's actually impossible to declare all 64-bit AS as dma-ranges because 1<<64 does not fit in a u64
17:48marcanand dma-ranges = <0 0 0 0 0xffffffff 0xffffffff>; does not work because it overflows then fails the zero check
17:51robhermarcan: Again, talk to Robin as he understands the IOMMU interaction much better than I do.
17:52deteg1337 has quit [Ping timeout: 480 seconds]
17:55deteg1337 has joined #asahi-dev
18:03deteg1337 has quit [Ping timeout: 480 seconds]
18:05deteg1337 has joined #asahi-dev
18:08linuxgemini13 has quit []
18:12linuxgemini13 has joined #asahi-dev
18:14deteg1337 has quit [Ping timeout: 480 seconds]
18:15c10l has quit [Quit: Bye o/]
18:16A_L_I_C_E has quit [Ping timeout: 480 seconds]
18:17c10l has joined #asahi-dev
18:23bcrumb has joined #asahi-dev
18:27linuxgemini13 has quit []
18:30linuxgemini13 has joined #asahi-dev
18:36bcrumb has quit [Ping timeout: 480 seconds]
18:37deteg1337 has joined #asahi-dev
18:38A_L_I_C_E has joined #asahi-dev
18:44Theincognitoman has joined #asahi-dev
18:45deteg1337 has quit [Ping timeout: 480 seconds]
18:46A_L_I_C_E has quit [Ping timeout: 480 seconds]
18:54deteg1337 has joined #asahi-dev
19:02deteg1337 has quit [Ping timeout: 480 seconds]
19:12deteg1337 has joined #asahi-dev
19:20deteg1337 has quit [Ping timeout: 480 seconds]
19:46deteg1337 has joined #asahi-dev
19:55kettenis_vendor "Broadcom", unknown product 0x4434 (class network subclass miscellaneous, rev 0x04) at pci1 dev 0 function 0 not configured
19:55deteg1337 has quit [Ping timeout: 480 seconds]
19:55kettenis_vendor "Broadcom", unknown product 0x5f72 (class network subclass miscellaneous, rev 0x04) at pci1 dev 0 function 1 not configured
19:55kettenis_vendor "Aquantia", unknown product 0x04c0 (class network subclass ethernet, rev 0x03) at pci2 dev 0 function 0 not configured
20:08___nick___ has quit [Ping timeout: 480 seconds]
20:12Theincognitoman has quit [Quit: Leaving]
20:21deteg1337 has joined #asahi-dev
20:30deteg1337 has quit [Ping timeout: 480 seconds]
20:50c10l has quit [Quit: Bye o/]
20:52MajorBiscuit has quit [Quit: WeeChat 3.6]
20:52c10l has joined #asahi-dev
20:55jannaufor backward compatibility: append the region and access it via reg-names. if it is absent compute a base from "rc" so that the offsets are equal
20:57deteg1337 has joined #asahi-dev
21:01cylm_ has quit [Ping timeout: 480 seconds]
21:06deteg1337 has quit [Ping timeout: 480 seconds]
21:31A_L_I_C_E has joined #asahi-dev
21:32deteg1337 has joined #asahi-dev
21:40deteg1337 has quit [Ping timeout: 480 seconds]
21:42siglazin has joined #asahi-dev
21:50jannaurichyliu2: work in progress. works as proof of concept. the main issue appears to be the integration with the typec framework and wonkyness of the dwc3 xhci part
22:01jannauvm-base for dcp/disp0 is not used by iboot/macos and the reserved regions / locked dart do not work with 4 levels so it's using an aperture of 0, vm-size (2**36)
22:05deteg1337 has joined #asahi-dev
22:13deteg1337 has quit [Ping timeout: 480 seconds]
22:22deteg1337 has joined #asahi-dev
22:30deteg1337 has quit [Ping timeout: 480 seconds]
22:34chadmed_ has joined #asahi-dev
22:38chadmed_marcan, kettenis_: oof sorry about that, i guess nothing complained about it when i booted because it wasnt wired up :p
22:54deteg1337 has joined #asahi-dev
22:59siglazin has quit [Remote host closed the connection]
23:02deteg1337 has quit [Ping timeout: 480 seconds]
23:26deteg1337 has joined #asahi-dev
23:35deteg1337 has quit [Ping timeout: 480 seconds]
23:43deteg1337 has joined #asahi-dev
23:52deteg1337 has quit [Ping timeout: 480 seconds]
23:58nsklaus has quit [Quit: ZZZzzz…]