Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Klaus Kudielka <klaus.kudielka@gmail.com>
To: Jan Palus <jpalus@fastmail.com>, Rob Herring <robh@kernel.org>
Cc: "Bjorn Helgaas" <helgaas@kernel.org>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Pali Rohár" <pali@kernel.org>,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
	regressions@lists.linux.dev
Subject: Re: [Bug 220479] New: [regression 6.16] mvebu: no pci devices detected on turris omnia
Date: Tue, 02 Sep 2025 11:09:47 +0200	[thread overview]
Message-ID: <1cc6781ea584aa00a8cda23db1fc8cd59f852a3d.camel@gmail.com> (raw)
In-Reply-To: <42rznc7krv3gdwmdzfz6o5nalnzleiwfg44yleqjet67cu4ijm@pwap3ph2n2u7>

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;



  reply	other threads:[~2025-09-02  9:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-220479-41252@https.bugzilla.kernel.org/>
2025-08-20 18:46 ` [Bug 220479] New: [regression 6.16] mvebu: no pci devices detected on turris omnia Bjorn Helgaas
2025-08-20 19:08   ` Jan Palus
2025-08-20 19:30     ` Bjorn Helgaas
2025-08-20 19:51       ` Jan Palus
2025-08-21  0:45   ` Jan Palus
2025-09-02  9:09     ` Klaus Kudielka [this message]
2025-09-02 10:33       ` Klaus Kudielka
2025-09-02 20:32   ` Pali Rohár
2025-09-03  1:35     ` Rob Herring
2025-09-03  7:35       ` Pali Rohár
2025-09-03  7:50         ` Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1cc6781ea584aa00a8cda23db1fc8cd59f852a3d.camel@gmail.com \
    --to=klaus.kudielka@gmail.com \
    --cc=helgaas@kernel.org \
    --cc=jpalus@fastmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pali@kernel.org \
    --cc=regressions@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox