#
✕ nick:marcan
#asahi · 2021-02-10 09:51
marcanwait, isn't that modified addr thing *another* bug?
#asahi · 2021-02-10 09:45
marcanlooks like it was there from the beginning, probably safe to remove unless there are broken DTs out there that rely on that
#asahi · 2021-02-10 09:44
marcanyeah, that doesn't work right now :) (but it would if we just remove that memset, I wonder where that came from...)
#asahi · 2021-02-10 09:43
marcanthat would then preserve any high cells
#asahi · 2021-02-10 09:43
marcanthat memset needs to be, well, removed AFAICT, since it's already setting the translated address cells anyway
#asahi · 2021-02-10 09:43
marcanof_bus_default_translate is broken for this AFAICT; it currently zeroes out the entire destination address
#asahi · 2021-02-10 09:35
marcanand then we have the issue of what PCI does, because if we use 3-cell form suddenly now the PCI nodes need to do 3->3, and some resources are going to be IORESOURCE_IO
#asahi · 2021-02-10 09:34
marcanhowever, here we'd be mapping "one magic address encoding info" to "an address completely devoid of info" and setting some flags behind the scenes
#asahi · 2021-02-10 09:34
marcanbut then this seems somewhat magic; in PCI we start with knowledge of the type, and this gets mapped to plain MMIO, but those MMIO ranges implicitly encode the type (for any given soc), the IORESOURCE_ flags seem mostly ancillary? only the IO/MEM distinction and the PREFETCH flag apply
#asahi · 2021-02-10 09:32
marcanI may not quite understand your suggestion yet, I thought this is what you were suggesting
#asahi · 2021-02-10 09:31
marcan(unless we add a sub-bus to translate back to 1 or 2 cells)
#asahi · 2021-02-10 09:30
marcan(in its regs)
#asahi · 2021-02-10 09:30
marcanhere, there is no "PCI code", child nodes are just devices. so if we do the same thing, then every subnode needs to specify posted/nonposted as the top cell
#asahi · 2021-02-10 09:29
marcanwhat PCI does is map 3->2, and then the PCI code knows what type it needs and supplies the necessary info when requesting resources via the OF translation code
#asahi · 2021-02-10 09:28
marcanbut stepping back, assuming we do it this way, let me get it straight
#asahi · 2021-02-10 09:27
marcanand so do *all* the MEM_ flags
#asahi · 2021-02-10 09:27
marcanit predates git at least
#asahi · 2021-02-10 09:27
marcanthis file dates back to... I don't even want to know :)
#asahi · 2021-02-10 09:25
marcanthough this seems to be clearly a subtype of MEM
#asahi · 2021-02-10 09:25
marcantrue
#asahi · 2021-02-10 09:24
marcanin that section
#asahi · 2021-02-10 09:24
marcanwe could fit in a IORESOURCE_MEM_NONPOSTED in as the *last* available bit
#asahi · 2021-02-10 09:23
marcanso the flags for pci are mapped to IORESOURCE_ constants, which is quite... congested
#asahi · 2021-02-10 09:21
marcanthough DTs can still specify stuff to assign configuration to otherwise dynamically discovered, devices, right?
#asahi · 2021-02-10 09:19
marcanright
#asahi · 2021-02-10 09:16
marcanand then the map function looks at that
#asahi · 2021-02-10 09:16
marcanof_bus_pci_translate just skips the first cell of the address, then goes through the default code which indeed just truncates things implicitly
#asahi · 2021-02-10 09:14
marcanright, and that gets handled by pci bus-specific translation in of/address.c
#asahi · 2021-02-10 09:13
marcanit certainly assumes max 64 bits of address, since it uses u64 for everything
#asahi · 2021-02-10 09:11
marcanalso I thought I read mapping code in linux that assumed address-cells was always 2 or 1
#asahi · 2021-02-10 09:11
marcanwhich is why it has address-cells=<3>
#asahi · 2021-02-10 09:11
marcanso it maps <io type, addr> -> <addr>
#asahi · 2021-02-10 09:10
marcani.e. it maps 3 to 2
#asahi · 2021-02-10 09:10
marcanpci is backwards afaict
#asahi · 2021-02-10 09:09
marcanand ranges maps 2 -> 3, and the top cell defines the mode
#asahi · 2021-02-10 09:08
marcanand then the bus can be <2>
#asahi · 2021-02-10 09:08
marcanwait, wouldn't the *root* have to be address-cells=<3>?
#asahi · 2021-02-10 09:06
marcanbut wait, that'd make all the child addresses 3-cell too?
#asahi · 2021-02-10 09:06
marcanhah
#asahi · 2021-02-10 09:02
marcanif we had a separate cell for that it would be ideal, but then we need a bool to signal it, and it would break forwards compat of newer DTs with older kernels
#asahi · 2021-02-10 09:01
marcanwhat bugs me about that one is overloading the top bits, which is fine until someone comes along with 64-bit PAs
#asahi · 2021-02-10 08:57
marcanbut that feels icky
#asahi · 2021-02-10 08:57
marcanthough I guess a dummy bus could be introduced
#asahi · 2021-02-10 08:57
marcanbut if it only applies to children, it wouldn't be usable to set the mode for a single device that needs it
#asahi · 2021-02-10 08:56
marcanif it applies to the current node and children, that would make it impossible to declare an MMIO mode for a PCI controller but not the actual, dynamically-discovered PCI devices (assuming the PCI code eventually grows support for this too, which isn't in scope for v2 since the default works there)
#asahi · 2021-02-10 08:56
marcanmaz, arnd: so thinking about the DT binding for the MMIO map mode... should it apply to the current node, or only children?
#asahi · 2021-02-09 17:41
marcanI only wrote the irq and timer drivers
#asahi · 2021-02-09 17:41
marcanmodwizcode: I dunno, I was bored one evening, it's not like it was serious
#asahi · 2021-02-09 11:08
marcanyou certainly shouldn't rely on it, but it absolutely helps
#asahi · 2021-02-09 11:08
marcanit's why X1 took months to break, instead of 30 minutes

plus ›