#
✕ nick:marcan
#asahi · 2021-02-11 13:36
marcanyeah, it's in pretty small pieces
#asahi · 2021-02-11 13:22
marcanmaz, kettenis, arnd, robher & co: still working on v2 as a whole, but the first take of the nGnRnE story is in the last 7 commits here if you want to take a look: https://github.com/AsahiLinux/linux/commits/upstream-bringup-v2-wip
#asahi · 2021-02-11 02:33
marcandavidrysk[m]: on other CPUs, I assume
#asahi · 2021-02-10 15:53
marcansounds good
#asahi · 2021-02-10 15:35
marcanrobher: if that kind of thing works for you I can give it a whirl for v2
#asahi · 2021-02-10 15:10
marcanposted-io; nonposted-io;
#asahi · 2021-02-10 15:10
marcanyeah, that kind of thing would work
#asahi · 2021-02-10 14:59
marcan*turned on at a higher level
#asahi · 2021-02-10 14:59
marcanso it can't just be an empty flag property
#asahi · 2021-02-10 14:59
marcane.g. on the pci controllers
#asahi · 2021-02-10 14:59
marcanrobher: what I'm saying is that if we do more than the immediate parent, we need some way of turning off the setting if it was turned off at a higher level
#asahi · 2021-02-10 14:49
marcan(not just an empty bool)
#asahi · 2021-02-10 14:48
marcansince we need to be able to override it, if it's recursive, it should be a property with actual values then
#asahi · 2021-02-10 14:45
marcanlooking it up recursively, or just the immediate parent?
#asahi · 2021-02-10 14:44
marcan(sorry, got confused by dma-ranges)
#asahi · 2021-02-10 14:44
marcanah, so not actually a ranges definition, just a flag property but picked up from buses?
#asahi · 2021-02-10 14:39
marcan(but also nearby are pci IOMMUs and related things)
#asahi · 2021-02-10 14:38
marcan(in particular the pci controllers themselves)
#asahi · 2021-02-10 14:36
marcanwell, pci is logically nested within nGnRnE-requiring buses I think
#asahi · 2021-02-10 14:35
marcanso defining the ranges and access types within that bus?
#asahi · 2021-02-10 14:33
marcanyeah, somewhat spammy, though I don't mind personally for our DT
#asahi · 2021-02-10 14:30
marcangood point
#asahi · 2021-02-10 14:26
marcanthis is one reason why going the other way is easier, because non-PCI drivers are less likely to use plain ioremap, and there is a limited set of them we care about
#asahi · 2021-02-10 14:25
marcanthere are two options there: either change every PCI driver to not use ioremap() (so we can actually do something about it), or register the PCI address ranges into ioremap() somehow so it can find out that way
#asahi · 2021-02-10 14:18
marcanrobher: so how do you suggest signaling in the DT what attributes are required for a given mapping? per device?
#asahi · 2021-02-10 14:17
marcan(including linux to some extent as we found)
#asahi · 2021-02-10 14:17
marcanyeah, the extra cell is definitely going to cause pain for code that (not unreasonably) assumes #address-cells is always <= 2
#asahi · 2021-02-10 10:29
marcanactually, as long as size-cells <= 2, we're pretty much safe modulo wrapping into the upper bits, which isn't something any of the current code handles properly anyway
#asahi · 2021-02-10 10:26
marcan*the memset
#asahi · 2021-02-10 10:26
marcani.e. without having to introduce >64-bit math, it would probably cover all use cases of those higher cells for flags/info, as long as any such high cells are not grouped together (mapping a range >2**64 to cover multiple flag types would be wrong, however leaving those default mapped would be fine)
#asahi · 2021-02-10 10:24
marcanjust removing the memcpy, fixing the broken pci/isa translation, and changing the default map function to just compare any higher cells would make this all work with >64-bit intermediate addresses, as long as ranges/offsets do not cross a 64-bit boundary
#asahi · 2021-02-10 10:18
marcanAFAICT the bug has been in there from the beginning; d1405b869 added this code
#asahi · 2021-02-10 10:13
marcanbut you said that codepath isn't used, right?
#asahi · 2021-02-10 10:13
marcanand of_bus_isa_translate / of_bus_pci_translate are broken; they are skipping the top cell of the *parent* output address array, which is already correcly sized; those buses use an extra cell in the *child* address but that is not what translate() deals with
#asahi · 2021-02-10 10:12
marcanso the memset is superfluous; all it does is corrupt the upper part of the parent's base address to 0
#asahi · 2021-02-10 10:11
marcanof the 64bit portions
#asahi · 2021-02-10 10:11
marcanit gets called with the *offset*
#asahi · 2021-02-10 10:03
marcani.e. (1,0,0) will currently match a range for (0,0,0)
#asahi · 2021-02-10 10:03
marcanhowever, `map` right now ignores the top cell for (p)na=3, so there is no matching on that
#asahi · 2021-02-10 10:02
marcanI think it's fine with 'pna', as the translation is via an offset anyway; this is assuming we accept that the top cells are not getting treated as "proper ranges"
#asahi · 2021-02-10 09:59
marcan(as right now the translation isn't correct anyway, even if nothing relies on the upper cells surviving)
#asahi · 2021-02-10 09:59
marcanarnd: this ought to be submittable completely out of band from that series, right? the pci bugfix in particular, probably also removing the memset? the latter just seems generically useful
#asahi · 2021-02-10 09:56
marcananyway, the fix is to remove the -1 (actually to just get rid of the pci-specific translation function, just call the default directly) and then remove the memset so that it doesn't clobber any upper cells >2
#asahi · 2021-02-10 09:56
marcanunless I'm misreading the code, this is broken
#asahi · 2021-02-10 09:55
marcanthe PCI one translates one fewer cell than it needs, in 64b cases, and works practically by accident in 32b cases; in the latter case, addr is an invalid pointer to the *end* of the parent address buffer, wait, how does this work again? :)
#asahi · 2021-02-10 09:54
marcanthe default translation function right now *zeroes* the entire target address before writing back the translated address to the last one or two cells
#asahi · 2021-02-10 09:53
marcanignoring PCI for a second; the generic code first turns the range into an offset, then memcpies the parent address from the range into addr, then calls the translation function, which is supposed to add the offset into the range
#asahi · 2021-02-10 09:52
marcanthat means the pci code is not properly translating addresses crossing a 4GB boundary
#asahi · 2021-02-10 09:52
marcanpci does 3 -> 2; pna should already be 2 here
#asahi · 2021-02-10 09:51
marcanit's supposed to be *pna*

plus ›