#
…

2021-04-06

00:43raster has quit [Quit: Gettin' stinky!]
01:13HannaM has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
02:05phiologe has quit [Ping timeout: 250 seconds]
02:06phiologe has joined #asahi
02:31odmir has quit [Remote host closed the connection]
03:03phiologe has quit [Ping timeout: 250 seconds]
03:03phiologe has joined #asahi
03:07marvin24 has quit [Ping timeout: 245 seconds]
03:08marvin24 has joined #asahi
06:01klaus has quit [Ping timeout: 260 seconds]
06:56jeffmiw_ has joined #asahi
06:56ephe_meral1 has joined #asahi
07:00jeffmiw_ has quit [Ping timeout: 252 seconds]
07:09francisstokes has joined #asahi
07:37francisstokes has quit []
07:37fstokesman[m] has joined #asahi
08:26vimal has quit [Ping timeout: 260 seconds]
08:29raster has joined #asahi
08:31luca020400 has quit [Read error: Connection reset by peer]
08:31luca020400 has joined #asahi
08:35vimal has joined #asahi
08:38furkan has quit [Ping timeout: 240 seconds]
08:46furkan has joined #asahi
09:00Augur[m] has quit [Quit: Idle for 30+ days]
09:11furkan has quit [Ping timeout: 268 seconds]
09:14furkan has joined #asahi
09:56pg12_ has quit [Quit: pg12_]
09:57pg12 has joined #asahi
10:04pg12 has quit [Remote host closed the connection]
10:06pg12 has joined #asahi
10:15choozy has joined #asahi
10:52furkan has quit [Ping timeout: 268 seconds]
11:02odmir has joined #asahi
11:06odmir has quit [Ping timeout: 240 seconds]
11:09furkan has joined #asahi
11:53choozy has quit [Ping timeout: 250 seconds]
13:21robhermarcan: We generally try to not have lists of registers. That fine grained is hard to get both right and complete.
13:25marcanrobher: how do you handle things like bootloader-trained memory timing configs? that's a similar kind of issue
13:25marcanI want to avoid most of it by initializing in m1n1, but I think some of it will have to happen in the kernel
13:26marcanit might be possible to just hardcode this stuff in the kernel like AMD for some cases, but that loses generality (and means upstreaming, to some extent, blobs; copyright-wise I don't think register lists have an issue, but it seems a waste not to use the ones in the Apple device tree, which would be more general and avoid the distribution question entirely)
13:27arndmarcan: what do those registers do? Is this for suspend-to-ram or something else?
13:28marcanit's init stuff; right now one fairly short set is the PCIe root port configs that need to be set after a PCIe reset, and I think for *that* one we can turn it into higher-level driver logic
13:28marcanbut, I want to know how to approach this if it comes up again
13:28kettenis_marcan: I don't think we can
13:29arndI fear we have to look at each one individually.
13:29marcansuspend-to-ram will be a whole separate can of worms, but I don't want to think about that until we have most drivers working to begin with and I can start testing real power consumption
13:29arndFor PCIe init, I would hope that can be done in m1n1 before loading the OS
13:29kettenis_these are pci config space tweaks that are (presumably) model-dependent
13:29marcanit depends on what they do
13:29marcanI need to check all 3 models and compare
13:30marcanbut if we need model-specifity there is probably some saner way of describing that than a blob of pokes
13:31marcanarnd: apparently these need to be applied after PCIe reset, so doing it in m1n1 means the kernel isn't allowed to do a reset
13:31marcankettenis_: right?
13:31arndmarcan: can you read back the registers from config space during boot and remember the current values?
13:32marcanthat might work
13:32kettenis_sure, but how do you tell which registers are affected?
13:32marcanif it's always the same stuff...
13:32marcanI mean e.g. it was mostly turning some features off and the link speed stuff, right?
13:32marcanthat all didn't seem terribly hard to understand
13:33kettenis_yes, but in my opinion building logic in the OS driver (and duplicating it in various OSes and U-Boot) isn't sane
13:33arndmarcan: have you checked if the registers match up with one of the common PCIe implementations (dwc, cadence, mobiveil, ...)?
13:34arndmaybe we already have code that understands them
13:34marcanbbiab, got a pizza waiting :)
13:34marcanbut yeah, I'm not trying to come up with the answer to this case so much as get an idea for what the right direction for the DT is if we wind up having to pass this kind of stuff after all
13:35svenfwiw, i suspect that usb will also need quite a few tunables to get usb3 working. some of them for the PHY but i believe there are also quite some in the drd node
13:35kettenis_it doesn't match up with anything I'm familliar with
13:35svenbut i'll have to take a closer look at those and see if they are known registers
13:35marcanyeah, if stuff is applied during mode switching there's no way around that one
13:35marcanalso, I expect dragons in the TB stuff
13:35marcanthere's no way TB can't have dragons
13:35marcanand that's all hotplug so it complicates things
13:38marcanas in here be dragons
13:45arndmarcan: I looked at the known PCIe controllers but see no particular resemblance. Even if it's one of the ones we already support, it's likely that the tuning registers are Apple's add-on
13:46arndmost of the registers looks like they could be abstracted into a phy driver to keep them out of the base PCIe code, but that doesn't really help the question of how that driver knows the correct values
13:48marvin24 has quit [Ping timeout: 276 seconds]
13:48kettenis_arndb: so most of the various pcie-related tunables can be applied by m1n1 and "stick" even if you then disable/enable clock gating or reset the PHY
13:48kettenis_those can be applied in m1n1
13:49kettenis_but the config space ones I listed on the wiki page that marcan quoted require significant more bringup of the PCIe controller and don't survive a PERST
13:50kettenis_not sure if Linux ever wants to do a PERST
13:52kettenis_but if m1n1 takes stuff out of PERST, U-boot and/or the OS need to be careful about doing it again
13:52marvin24 has joined #asahi
14:12arndkettenis_: looking through a few Linux drivers that trigger a PERST, I see that most of them do it only during the initial probe, though the Mediatek driver also does it when resuming from suspend
14:13arndI don't think there is any generic way to trigger a PERST from outside the host controller driver
14:13kettenis_ok, so maybe we don't need to pass this information through to Linux
14:15kettenis_as long as m1n1 or u-boot applies these fixups that is
14:17kettenis_for u-boot we'd still need to pass the information in the device tree
14:20arndkettenis_: what is the tradeoff for having the PCIe init code in m1n1 vs u-boot?
14:21arndIf it's in m1n1, u-boot wouldn't care about the registers either, right?
14:22kettenis_there is quite a bit complexity, and I've already implemented that for u-boot
14:23kettenis_needs some gpio, pinctrl and mailbox stuff
14:25kettenis_maybe it is possible to bring the RC ports out of reset and let u-boot take care of the more complicated stuff
14:25kettenis_out of reset in m1n1 I mean
14:26arndbus scanning and resource assignment probably makes sense to keep in u-boot, since that is complicated and u-boot has platform independent code for it
14:27arndunless m1n1 wants to support booting from a PCIe attached device (network, usb storage, ...) itself
14:27arndnot sure what marcan's long-term plan is for the scope of what to support in m1n1
14:30kettenis_sven already wrote the code for dwc3 usb support for m1n1
14:30kettenis_that is for the type-C ports
14:31kettenis_full pcie support would bring support for the type-A ports and Ethernet
14:31kettenis_but that is only present on the mini, not on the laptops
14:31svenmy code is only device-mode fwiw. it emulates a cdc acm serial device
14:32svenbut usb host mode is just xhci
14:32sven(and a slightly different magic phy init sequence)
14:33odmir has joined #asahi
14:34svennot sure what marcan's plans are but bringing in a full pcie + usb ethernet to m1n1 feels just a little bit overkill to me ;)
14:34svenu-boot already supports those with your patches, doesn't it?
14:35kettenis_haven't tested usb ethernet myself, but that must be what maz is using to netboot ;)
14:35svennice :)
14:36HannaM has joined #asahi
14:36kettenis_I think marcan's plans include nvme support to access some of the firmware blobs
14:36mazkettenis_: yeah, some bog-standard ASIX adapter.
14:36frode_0xa has quit [Quit: leaving]
14:36sventhat makes sense
14:37frode_0xa has joined #asahi
14:37kettenis_but that doesn't need pcie
14:37arndI think u-boot has a port of the Linux USB network drivers, so it can support a lot of hardware
14:37kettenis_so I think pcie support in m1n1 would be fairly low priority
14:38frode_0xa has quit [Client Quit]
14:38odmir has quit [Ping timeout: 260 seconds]
14:38arndThe main use that I could see would be USB keyboard and mass storage support on the Type A ports
14:38frode_0xa has joined #asahi
14:39jeffmiw_ has joined #asahi
14:40sventrue. and if we wanted those we could first add support for those on the type c ports which doesn't require pcie bringup and then later just re-use that code.
14:43jeffmiw_ has quit [Ping timeout: 260 seconds]
14:43frode_0xa has quit [Quit: leaving]
14:45frode_0xa has joined #asahi
14:47Stary has joined #asahi
14:47Stary has quit [Changing host]
14:49robherarnd, marcan: Looks like designware controller to me.
14:49robher$ git grep -E '(8a8|890)' -- drivers/pci/controller/
14:49robherdrivers/pci/controller/dwc/pcie-tegra194.c:#define GEN3_EQ_CONTROL_OFF 0x8a8
14:49robherdrivers/pci/controller/dwc/pcie-tegra194.c:#define GEN3_RELATED_OFF 0x890
14:52robherThose are only Tegra194 specific registers because we don't have a second user, but 0x8xx registers are DWC port logic registers. One of the extended cap registers lines up with what we used to hard code (I got rid of all the hardcoded offsets recently).
14:53arndrobher: ah, nice. I had not looked in the soc specific dwc files, so I missed that
14:55kettenis_well spotted
14:56kettenis_GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK
14:56kettenis_the tunables that mess around with that have "shadow" in their name
14:57robherIf there's enough memory space for ECAM, then put all the PCIe setup in bootloader. Unless you want power management...
14:58kettenis_robher: looks like there is enough ECAM space
14:59robher'shadow' may refer to the port logic registers having writable versions of PCI config registers.
14:59robher...of read-only PCI config registers, that is.
15:03kettenis_robher: what is the policy for documenting devicetree that the Linux kernel wouldn't care about but that we need to pass information from m1n1 to u-boot?
15:12odmir has joined #asahi
15:14robherkettenis_: bindings should be documented. Who is the consumer should be mostly irrelevant.
15:18robherkettenis_: To look at it another way, for every node in a dts there should be a schema covering it and all the properties. At least that's the goal of where we want to get to with schemas.
15:21marcanarnd, sven, kettenis_: with u-boot I see no reason to put pcie init in m1n1, at least not in the core or in normal builds. having proxyclient scripts to do it anyway may make sense for experiments.
15:21marcanwe don't need to pull any blobs from m1n1
15:21marcanI expect us to either do that directly in linux (with APFS support) at runtime, or copy them at install time from 1TR
15:22marcanso far only wifi needs that treatment
15:23mazI'd be surprised if tg3 didn't need some firmware too.
15:23marcanisn't that standard though?
15:23marcanthe problem with wifi is only apple uses these chips
15:23mazno idea.
15:23marcantg3 would probably run with linux-firmware stuff, I'm guessing
15:23kettenis_tg3 runs fine without firmware
15:24mazI guess something gets fed to it early on.
15:24mazor it has a ROM of some sort.
15:25marcanI should diff the wlan firmware against other broadcom stuff. wouldn't be surprised at all if it's the same silicon, just rebranded for apple, as some common part
15:25marcanand the common firmware would work sans apple features (AirDrop)
15:26marcangood find on the designware tidbit
15:27kettenis_the broadcom wifi needs a "nvram.txt" file with settings that are specefic to how the chip is integrated
15:28marcanyeah, but that one is probably not copyrightable
15:29marcanalso, I can tell you from experience that using a generic one on a new device works pretty often :)
15:31kettenis_yeah, it might not fully meet the regulation for RFI, but as long as you stay away from our radio telescopes I ewon't complain
15:33marcanradio telescopes run on ISM bands? that must *suck+
15:41kettenis_difficult to build a broadband receiver without running into the ISM bands
15:41marcanright...
15:42kettenis_and difficult to build a transmatter for those bands that doesn't spill over into the neighbouring spectrum
15:43marcanyeah, I was going to ask if it was mostly a harmonics thing
15:50kettenis_anyway, back on topic, I'm going to play a bit more with having m1n1 doing some of the RC port initialization and having u-boot do the remainder
15:51arndThe tg3 driver has code to load firmware from user space, but it's only 3 to 7 KB, and apparently many variants have that in the builtin eeprom
15:52arndThis is old hardware, the driver has (c) 2001
15:54svenlooks like the ADT even tells us the topology for the gated clocks :) UART1 --> UART_P --> SIO --> SIO_BUSIF; I2C0 --> SIO --> SIO_BUSIF; etc.
15:55arndthe last time new tg3 PCI IDs were added was in 2013
16:00PedroArajo[m] has quit [Quit: Idle for 30+ days]
16:11HannaM has quit [Read error: Connection reset by peer]
16:17vimal has quit [Remote host closed the connection]
16:17vimal has joined #asahi
16:53odmir has quit [Remote host closed the connection]
17:27VinDuv has joined #asahi
17:37amonakov has left #asahi [#asahi]
17:52marvin24 has quit [Ping timeout: 245 seconds]
17:53marvin24 has joined #asahi
18:24wicast has quit [Ping timeout: 260 seconds]
18:26wicast has joined #asahi
19:46ephe_meral1 has quit [Ping timeout: 260 seconds]
20:10choozy has joined #asahi
20:14Bublik_ has joined #asahi
20:16Bublik has quit [Ping timeout: 240 seconds]
20:44VinDuv has quit [Quit: Leaving.]
21:04raster has quit [Quit: Gettin' stinky!]
21:12rjeffman has quit [Ping timeout: 260 seconds]
21:52jeffmiw_ has joined #asahi
21:56jeffmiw_ has quit [Ping timeout: 246 seconds]
21:59raster has joined #asahi
22:49raster has quit [Quit: Gettin' stinky!]
22:59riker77 has quit [Quit: Quitting IRC - gone for good...]
22:59riker77 has joined #asahi
…