#
…

2021-06-06

00:22al3xtjames has quit [Quit: Ping timeout (120 seconds)]
00:23al3xtjames has joined #asahi
00:27bloomI need dev tools on here grumble
00:27bloomdual booting..
01:00DragoonAethis has quit [Quit: hej-hej!]
01:00DragoonAethis has joined #asahi
01:09hspak has quit [Quit: bye]
01:12hspak has joined #asahi
01:12bgb_ has joined #asahi
01:39bgb_ has quit [Ping timeout: 480 seconds]
02:01bgb_ has joined #asahi
02:09bgb_ has quit [Ping timeout: 480 seconds]
02:15PhilippvK has joined #asahi
02:17bgb_ has joined #asahi
02:18phiologe has quit [Ping timeout: 480 seconds]
02:30bgb_ has quit [Ping timeout: 480 seconds]
02:55bgb_ has joined #asahi
03:03bgb_ has quit [Ping timeout: 480 seconds]
03:29bgb_ has joined #asahi
03:34ihaveamac has quit [Quit: fail]
03:36ihaveamac has joined #asahi
03:38bgb_ has quit [Ping timeout: 480 seconds]
04:02marvin24_ has joined #asahi
04:05marvin24 has quit [Ping timeout: 480 seconds]
05:12VinDuv has joined #asahi
05:42marcansven: that multiple table stuff sounds like the extra registers I found...
05:43marcan32 bits is enough for access perms for just userspace, without GL
05:44marcansven: ascwrap-v4 is their general "sub cpu" thing
05:44marcanapple system coprocessor? (wild guess)
05:50marcanso it sounds like we can probably expect the GPU to share the CPU page tables, and have its own SPRR reg to do remapping
05:50marcanbloom: do you know if Linux supports this kind of thing? IIRC the PS4 does it like this with their OS, but I don't know if the linux amdgpu driver could ever do that
05:51marcanseems like it would save a ton of management/overhead for unified memory systems if the GPU can just outright use the userspace page tables
06:15malvo has quit [Ping timeout: 480 seconds]
06:15malvo has joined #asahi
08:20svenpeter[m]Ohh… makes sense
08:21svenpeter[m]I wonder how it selects the user space table then
08:21svenpeter[m]And the GPU just reusing the page tables would also explain why there’s no DART in front of it
08:53jannaumac os doesn't seem to be happy with the usb-pd controller. it writes [0x00], [0x14] and reads [0x0b 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00] all over after short initialisation
08:54pipcet[m]is the interrupt that the two usb-pd controllers share firing?
08:55svenlooks like it's reading register 0x14 which is IntEvent1
08:55jannauno, at least the aic interrupt of the first cell (106) is not firing. I'm not convinced that it is actually a aic interrupt
08:55pipcet[m]since the IRQ line is shared, it's probably trying to handle the interrupt for the PD chip that m1n1 stole.
08:56sventhe IRQ comes from the gpio controller
08:56svenand what pipcet[m] said would explain all of this
08:57svenit constantly thinks it sees an irq but there isn't one on that chip
08:57svenso it tries to handle it over and over again
08:57pipcet[m]sven: when you steal the usb port, do you initialize the irq mask of the chip?
08:57sventhe currentl m1n1 doesn't touch that chip at all
08:57svenand the PR i have open just sends the SPSS command
08:58svenjannau: you can try to take my PR and write 8 times 0x00 to address 0x16
08:58sventhat should disable interrupts for that chip. i think.
08:59pipcet[m]sven: that's what I'm doing in Linux for the "stolen" power port
08:59pipcet[m](which I just ignore since touching it still breaks charging)
08:59sventhat's... weird
09:00svenif you boot a linux kernel with just a dwc3 node charging on both ports still works
09:00pipcet[m]I've been meaning to look into that, yes :-)
09:00sven(well, except for the usual don't replug the port or everything breaks issue)
09:01pipcet[m]yes, that's the issue I meant. if you keep power plugged in from boot everything is fine, if I come home and re-plug power it breaks.
09:01svenyeah, but that's also true for the data connection
09:02pipcet[m]I believe that's correct, yes. Charging is more of an annoyance because you get a spontaneous reboot when the battery's empty.
09:02pipcet[m]but if you don't touch the port, unplugging/replugging power on it works fine.
09:03svennot sure if you saw, but set32(0x502a90004, 3); clear32(0x502a90004, 3) fixes it as well
09:03sveni just don't have any irq to trigger that so far
09:04pipcet[m]oh, wow, thanks, I've got to try that.
09:04svenfound that yesterday thanks to jannau's mmiotrace :)
09:07pipcet[m]so macos resets the port once in a while and we don't know what triggers it?
09:07pipcet[m]s/port/phy/
09:08sven"once in a while" = when the device is unplugged
09:08svenwell, or if it's replugged. i think mac os actually goes through the whole phy init sequence
09:08svenbut that reset sequence above seems to be enough at least for usb2
09:09pipcet[m]and we can detect when a device is unplugged from the physical port but we cannot detect when a device is removed from an adapter connected to the port, right?
09:09svenno idea
09:09sveni can't detect unplugging in device mode but the linux xhci driver seems to get disconnect events
09:09svenbut i don't know enough yet to figure out a sane way to handle this in linux
09:11pipcet[m]there has got to be an irq or status register somewhere, just relying on the xhci driver to disconnect isn't good enough.
09:12svenyeah, i'm pretty sure about that
09:12svencould be the usb pd i2c interrupt
09:12pipcet[m]yes, we need to mask IRQs and see whether that helps.
09:12svenhow would masking irqs help?
09:12svenoh.. you mean in mac os and see if replugging breaks then as well?
09:13pipcet[m]mask the IRQs for the m1n1 uart, then get another mmiotrace in macos to see whether it's the PD IRQ
09:13jannausven: writing 8 time 0x00 to 0x16 doesn't seem to help
09:14pipcet[m]jannau: there's a second int mask at 0x17, we might have to clear that too
09:15svenhm... and then we might also need to ack the irqs once
09:15svenso maybe also write 0xff 0xff 0xff... to 0x18 and 0x19? :D
09:15pipcet[m]I really really hate Apple for sharing that IRQ line
09:18sveni think the 16k iommu issue is worse ;)
09:18pipcet[m]jannau: probably obvious, but you are writing 0x16 for the other port, right, not for the one we're mmiotracing?
09:20jannauwriting all zeros to 0x16/0x17 and all ones to 0x18/0x19 doesn't seem to help
09:20svenstrange
09:21pipcet[m]can you read 0x14/0x15 to see whether anything's pending?
09:35jannauprobably user error
09:36jannauyes, looks much better now
09:38jannaumac os startup is also much faster now with one usb-c port enabled
09:38svenguess it was spamming the i2c bus the whole time ;)
09:39ar/42/42
09:40jannauno i2c traffic though on usb-c plug events
09:40sveni'm out of ideas now :D
09:41svenso it's none of the drd irqs, it's not the i2c irq and the phy itself as not interrupts
09:41pipcet[m]maybe another GPIO pin?
09:41thunfisch has quit [Quit: frrrp!]
09:41sventhat should be in the adt then
09:42thunfisch has joined #asahi
09:42jannauI would expect a gpio irq, and then a read of gpio pin 106
09:44jannauthere is something if I disconnect the usb-c to usb-a connector
09:47pipcet[m]disconnect which side?
09:49jannauthere's nothing if I disconnect the just the USB-A device
09:57jannauwithout usb-drd1 mmiotrace though
09:59yuyichao has joined #asahi
10:02bps has joined #asahi
10:03yuyichao_ has quit [Ping timeout: 480 seconds]
10:05adamcstephens is now known as Guest1032
10:05adamcstephens has joined #asahi
10:08pugguu has joined #asahi
10:08pugguu has quit []
10:08pugguu has joined #asahi
10:09bgb_ has joined #asahi
10:09Guest1032 has quit [Ping timeout: 480 seconds]
10:17ohdamn[m] has quit []
10:21bgb_ has quit [Ping timeout: 480 seconds]
10:31bgb_ has joined #asahi
10:34choozy has joined #asahi
10:41go4godvin has joined #asahi
10:45jannauusb-c cable plugs are signalled through gpio irqs. on disconnect mac os starts reading from gpio_base + 0x800 until it finds bit 106 set at offset 0x80c
10:46marvin24_ has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
10:46marvin24 has joined #asahi
10:47marvin24 has quit []
10:47marvin24 has joined #asahi
10:47jannauit rewrites pin 106's config then and acknowledges the irq and starts communicating with the tps6598x
10:48svenok. so then we'll probably have to do the phy reset sequence whenever we heard from that tps chip as well
10:49svendamnit. i hoped we could ignore most of the usb phy for now inside the kernel
10:54svenoh well.. we first need gpio/pinctrl and then i2c upstreamed anyway
11:01pugguu has quit [Read error: Connection reset by peer]
11:30bps has quit [Remote host closed the connection]
11:30bps has joined #asahi
11:56bgb_ has quit [Ping timeout: 480 seconds]
12:20bgb_ has joined #asahi
12:28bgb_ has quit [Ping timeout: 480 seconds]
12:33bloomsven: Yeah, the lack of DART for the GPU is odd
12:33bloomit does have its own iommu-mapper in the ADT, but.. not DART
12:33bloomI started mmiotracing and looking at ADT etc
12:33bloomAs hinted by the compatible, gfx-asc is just exposing IOP mailbox
12:34bloomNot too much interesting here most of the time, rather than just a "there is new work for you GPU, wake the f up"
12:34bloomsgx is the GPU itself but even less MMIO poking here
12:35bloomI did a little digging on IOP, and that's normal -- it's meant to be low bandwidth, with shared memory used for high bandwidth transaction.
12:35bloomSo then the question is where does that shmem come from?
12:36bloomPossibly the IOP mailbox itself.
12:41bloomas well as, what's inside the shmem? is it just the buffer prepared by userspace passed through unmodified? would be convenient, but seems unlikely.
12:42jannaucreating pull requests for pull requests now
12:45svenbloom: would it make sense if the GPU has just the same view of memory as the userspace app?
12:45sventhat's what that gxf/sprr patent sorta hints at
12:49bloomsven: what's this about sprr?
12:50bloomI don't read patents, sorry.
12:50bloomWhat are those? 🙃
12:50svenit mainly talks about sprr/gxf but it also mentions that the gpu may reuse the same pagetables as the cpu
12:51bgb_ has joined #asahi
12:51bloomI wonder how that works with FairPlay stuff using the GPU
12:53bloomsven: I'm not sure I buy this.
12:53bloomFrom userspace's PoV, stuff in GPU memory has very different CPU vs GPU virtual addresses.
12:54bloomthere's at least two MMUs in there.
12:55svenalright.. so we're looking for another hidden iommu for the gpu then
12:57bloomit's right there in the ADT as iommu-mapper/gfx or something
12:57bloombut it's /not/ a DART node, unlike every other iommu in the ADT
12:58bloom compatible = [iommu-mapper,gfx]
12:58bloom mapper-gfx-asc {
12:59bgb_ has quit [Ping timeout: 480 seconds]
12:59svenlooks like it's a bespoke iommu for the gpu then
13:01bloomi guess
13:07bloomsven: note gfx-asc has iommu-parent = 217 = mapper-gfx-asc
13:08bloom gfx-shared-region-base = 42949378048
13:08bloom gfx-shared-region-size = 262144
13:09bloom^ That's in the sgx node.
13:09bloomMore intriguing is
13:09bloom rtkit-private-vm-region-base = 18446743523953737728
13:09bloom rtkit-private-vm-region-size = 137438953472
13:09bloomNothing else in the ADT has rtkit-private-* fields, despite a half dozen coprocessors running RTKit.
13:12sventhat's probably the region it's allowed to allocate from
13:12svendarts somtimes have similar -region-base properties
13:15VinDuv has quit [Quit: Leaving.]
13:21bgb_ has joined #asahi
13:29bgb_ has quit [Ping timeout: 480 seconds]
13:56bgb_ has joined #asahi
14:01marcanbloom: I'm pretty sure GPUs designed to share the CPU pagetables exist
14:02marcanthe shared-region stuff is just a physical address afaik
14:02marcantop of RAM, outside the OS-exposed RAM region
14:04bloomyeah, figured
14:05bgb_ has quit [Ping timeout: 480 seconds]
14:31bgb_ has joined #asahi
14:39bgb_ has quit [Ping timeout: 480 seconds]
14:40VinDuv has joined #asahi
15:07bgb_ has joined #asahi
15:07bisko has joined #asahi
15:08bps has quit [Remote host closed the connection]
15:08bps has joined #asahi
15:15bgb_ has quit [Ping timeout: 480 seconds]
15:19zorun has quit [Ping timeout: 480 seconds]
15:19bisko has quit [Read error: Connection reset by peer]
15:25klaus has quit [Ping timeout: 480 seconds]
15:27klaus has joined #asahi
15:29bps has quit [Ping timeout: 480 seconds]
15:35bisko has joined #asahi
15:35bisko has quit []
15:39bgb_ has joined #asahi
15:48bgb_ has quit [Ping timeout: 480 seconds]
15:48hspak4 has joined #asahi
15:50klaus1 has joined #asahi
15:50klaus has quit [Ping timeout: 480 seconds]
15:52hspak has quit [Ping timeout: 480 seconds]
15:52hspak4 is now known as hspak
16:45bloom☁️ On air - https://twitch.tv/asahigpu ☁️
17:09marvin24 has quit [Quit: marvin24]
17:09marvin24 has joined #asahi
18:13jannaudoes wifi work in mac os with m1n1's hypervisor? trying to see which AIC irq it (the gpio controller) uses but it doesn't seem to work
18:14svendoes wifi use gpio?
18:14sventhe main irq should just be a MSI in the pcie controller
18:14jannaumight be related to mmio/irq tracing
18:14pipcet[m]jannau: IIRC macos wifi was sensitive to timing things, so when my code ran too slowly it wouldn't work...
18:15jannausven: wlan node uses the gpio controller as interrupt-parent
18:16Nspace has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
18:16svenhrm, how strange
18:17kettenisthe wifi controller definitely works with using a normal MSI
18:18kettenisthere is an SMC "gpio" involved in powering the thing up
18:18kettenisand I suspect wifi can wake up the system as well
18:26jannaueven without mmio/irq tracing no wlan or bluetooth but probably still slower than usual
18:28bloomsilly question but is the power button a regular gpio?
18:28bloomor an SMC "gpio" or..?
18:28pipcet[m]it's an SMC property
18:28pipcet[m]and it also sends an SMC message when pressed.
18:28jannauwlan works now after switching it on and off a couple of times
18:29jannauworks == find networks
18:29pipcet[m]I haven't figured out how to decode that message yet, but essentially you get an interrupt from the SMC mailbox, discard the message, and you can check whether the power button was pressed, and whether it's currently pressed.
18:30pipcet[m]oh wait, sorry, all that's on the MBP, might be totally different on the mini
18:31sveni think there's a good chance it's the same on the mini
18:34jannauI would assume so two. why develop a different solution just because the mini misses a couple of keys
18:36pipcet[m]does the mini have an AOP?
18:37pipcet[m]I ran down the battery on my MBP once, and it was very very unhappy.
18:40pipcet[m]anyway, the SMC has a large number of four-character keys, most of which will need to be decoded at some point. I wonder which of those the mini has.
18:40pipcet[m](I assume it has no lid switch)
18:42jannauno irq activity on scanning or joining networks. might it be used when the pcie link is powered down?
18:43jannaupipcet[m]: user facing there is just the power button and maybe the headphone jack
18:46jannausaving the network preferences crashed mac os
19:30pugguu has joined #asahi
19:38pugguu has quit [Read error: Connection reset by peer]
19:39pugguu has joined #asahi
20:05pugguu has quit [Ping timeout: 480 seconds]
20:11VinDuv has quit [Quit: Leaving.]
20:38bps has joined #asahi
21:12svenpeter[m]The “normal” interrupts will be the pcie MSIs. That gpio must be something else
21:13svenpeter[m]Possibly waking up the machine like kettenis suggested
21:18klaus2 has joined #asahi
21:24klaus1 has quit [Ping timeout: 480 seconds]
21:29bsandro has joined #asahi
21:42klaus3 has joined #asahi
21:43klaus3 is now known as klaus
21:46klaus is now known as nsklaus
21:47klaus2 has quit [Ping timeout: 480 seconds]
21:50choozy has quit [Remote host closed the connection]
21:52jannaumakes sense. based on the pin config I don't think the second cell codes the AIC interrupt
21:53jannauit also doesn't make that much sense since the OS can read that from the pin config
21:54eta has quit [Remote host closed the connection]
21:57eta has joined #asahi
22:00yrlf has quit [Quit: The Lounge - https://thelounge.chat]
22:01yrlf has joined #asahi
22:02pipcet[m]jannau: also wouldn't make much sense to hardcode that in the ADT so you'd have to change the device tree to flip IRQ priorities
22:02nsklaus has quit [Quit: WeeChat 3.1]
22:02klaus has joined #asahi
22:03klaus has quit []
22:04nsklaus has joined #asahi
…