[Bug 220479] New: [regression 6.16] mvebu: no pci devices detected on turris omnia
Klaus Kudielka
klaus.kudielka at gmail.com
Tue Sep 2 02:09:47 PDT 2025
On Thu, 2025-08-21 at 02:45 +0200, Jan Palus wrote:
>
> Relevant fragment of mvebu_get_tgt_attr() in mentioned commit:
>
> + u32 slot = upper_32_bits(range.bus_addr);
>
> - if (DT_FLAGS_TO_TYPE(flags) == DT_TYPE_IO)
> + if (DT_FLAGS_TO_TYPE(range.flags) == DT_TYPE_IO)
> rtype = IORESOURCE_IO;
> - else if (DT_FLAGS_TO_TYPE(flags) == DT_TYPE_MEM32)
> + else if (DT_FLAGS_TO_TYPE(range.flags) == DT_TYPE_MEM32)
> rtype = IORESOURCE_MEM;
> else
> continue;
>
> if (slot == PCI_SLOT(devfn) && type == rtype) {
>
As far as I understand the situation, of_pci_range_parser_one() inherently uses bus->get_flags()
aka of_bus_pci_get_flags() to determine range.flags (see drivers/of/address.c).
And of_bus_pci_get_flags() does essentially the same thing as the code above in mvebu_get_tgt_attr().
So, now the translation logic is applied twice - which probably was not intended.
To restore the original behaviour, I think the determination of rtype from range.flags must be
completely removed, and rtype must be replaced by range.flags.
Something like this on top of mainline - completely untested, but maybe worth a try.
diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
index 755651f338..3fce4a2b63 100644
--- a/drivers/pci/controller/pci-mvebu.c
+++ b/drivers/pci/controller/pci-mvebu.c
@@ -1168,9 +1168,6 @@ static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
return devm_ioremap_resource(&pdev->dev, &port->regs);
}
-#define DT_FLAGS_TO_TYPE(flags) (((flags) >> 24) & 0x03)
-#define DT_TYPE_IO 0x1
-#define DT_TYPE_MEM32 0x2
#define DT_CPUADDR_TO_TARGET(cpuaddr) (((cpuaddr) >> 56) & 0xFF)
#define DT_CPUADDR_TO_ATTR(cpuaddr) (((cpuaddr) >> 48) & 0xFF)
@@ -1189,17 +1186,9 @@ static int mvebu_get_tgt_attr(struct device_node *np, int devfn,
return -EINVAL;
for_each_of_range(&parser, &range) {
- unsigned long rtype;
u32 slot = upper_32_bits(range.bus_addr);
- if (DT_FLAGS_TO_TYPE(range.flags) == DT_TYPE_IO)
- rtype = IORESOURCE_IO;
- else if (DT_FLAGS_TO_TYPE(range.flags) == DT_TYPE_MEM32)
- rtype = IORESOURCE_MEM;
- else
- continue;
-
- if (slot == PCI_SLOT(devfn) && type == rtype) {
+ if (slot == PCI_SLOT(devfn) && type == range.flags) {
*tgt = DT_CPUADDR_TO_TARGET(range.cpu_addr);
*attr = DT_CPUADDR_TO_ATTR(range.cpu_addr);
return 0;
More information about the linux-arm-kernel
mailing list