On Sun, Sep 7, 2025 at 4:42 PM Jan Palus <jpalus@xxxxxxxxxxxx> wrote: > > On 07.09.2025 12:21, Klaus Kudielka wrote: > > The blamed commit simplifies code, by using the for_each_of_range() > > iterator. But it results in no pci devices being detected anymore on > > Turris Omnia (and probably other mvebu targets). > > > > Issue #1: > > > > To determine range.flags, of_pci_range_parser_one() uses bus->get_flags(), > > which resolves to of_bus_pci_get_flags(). That function already returns an > > IORESOURCE bit field, and NOT the original flags from the "ranges" > > resource. > > > > Then mvebu_get_tgt_attr() attempts the very same conversion again. > > But this is a misinterpretation of range.flags. > > > > Remove the misinterpretation of range.flags in mvebu_get_tgt_attr(), > > to restore the intended behavior. > > > > Issue #2: > > > > The driver needs target and attributes, which are encoded in the raw > > address values of the "/soc/pcie/ranges" resource. According to > > of_pci_range_parser_one(), the raw values are stored in range.bus_addr > > and range.parent_bus_addr, respectively. range.cpu_addr is a translated > > version of range.parent_bus_addr, and not relevant here. > > > > Use the correct range structure member, to extract target and attributes. > > This restores the intended behavior. > > > > Signed-off-by: Klaus Kudielka <klaus.kudielka@xxxxxxxxx> > > Fixes: 5da3d94a23c6 ("PCI: mvebu: Use for_each_of_range() iterator for parsing "ranges"") > > Reported-by: Bjorn Helgaas <helgaas@xxxxxxxxxx> > > Closes: https://lore.kernel.org/r/20250820184603.GA633069@bhelgaas/ > > Reported-by: Jan Palus <jpalus@xxxxxxxxxxxx> > > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220479 > > --- > > v2: Fix issue #2, as well. > > > > drivers/pci/controller/pci-mvebu.c | 21 ++++----------------- > > 1 file changed, 4 insertions(+), 17 deletions(-) > > Confirmed the patch applied on top of 6.16.5 fixes all the issues > introduced with 5da3d94a23c6. > > Tested-by: Jan Palus <jpalus@xxxxxxxxxxxx> > Sorry, should have said: Tested on these Marvell Kirkwood SoC boards: Cloudengine Pogoplug Series 4 (88F6192), ZyXEL NAS325 (88F6282), and Synology DS112 (88F6282) running kernel 6.16.5. All the best, Tony