All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jess <jess@jessie.cafe>
To: will@kernel.org
Cc: bhelgaas@google.com, jess@jessie.cafe, kwilczynski@kernel.org,
	linux-pci@vger.kernel.org, lpieralisi@kernel.org,
	mani@kernel.org, robh@kernel.org
Subject: [PATCH v2] PCI: host-generic: Avoid reporting incorrect "missing "reg" property" error
Date: Tue, 20 Jan 2026 13:44:44 +1300	[thread overview]
Message-ID: <20260120004444.191093-1-jess@jessie.cafe> (raw)
In-Reply-To: <aW5gmRDAlqR0Ii5S@willie-the-truck>

When the function pci_host_common_ecam_create() calls
of_address_to_resource() it assumes all errors from that callsite are due
to a missing "reg" property in the device tree node.

This can manifest when running the qemu "virt" board, with a 32-bit kernel
and `highmem=on`.

After the following calls:
of_address_to_resource()
  -> __of_address_to_resource()
  -> __of_address_resource_bounds()

this overflow check can fail due to PCI being out of range:
if (overflows_type(start, r->start))
	return -EOVERFLOW;

This leads to the very confusing error message:
pci-host-generic 4010000000.pcie: host bridge /pcie@10000000 ranges:
pci-host-generic 4010000000.pcie:       IO 0x003eff0000..0x003effffff -> 0x0000000000
pci-host-generic 4010000000.pcie:      MEM 0x0010000000..0x003efeffff -> 0x0010000000
pci-host-generic 4010000000.pcie:      MEM 0x8000000000..0xffffffffff -> 0x8000000000
pci-host-generic 4010000000.pcie: missing "reg" property
pci-host-generic 4010000000.pcie: probe with driver pci-host-generic failed with error -75

Make the error message more generic.

Link: https://www.qemu.org/docs/master/system/arm/virt.html
Signed-off-by: Jess <jess@jessie.cafe>
---
 drivers/pci/controller/pci-host-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index c473e7c03bac..d6258c1cffe5 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -32,7 +32,7 @@ struct pci_config_window *pci_host_common_ecam_create(struct device *dev,
 
 	err = of_address_to_resource(dev->of_node, 0, &cfgres);
 	if (err) {
-		dev_err(dev, "missing \"reg\" property\n");
+		dev_err(dev, "missing or malformed \"reg\" property\n");
 		return ERR_PTR(err);
 	}
 
-- 
2.51.2


  reply	other threads:[~2026-01-20  0:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19  5:06 [PATCH] PCI: host-generic: Avoid reporting incorrect "missing "reg" property" error Jess
2026-01-19 16:49 ` Will Deacon
2026-01-20  0:44   ` Jess [this message]
2026-01-20 11:22     ` [PATCH v2] " Will Deacon
2026-02-06 22:49     ` Bjorn Helgaas

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=20260120004444.191093-1-jess@jessie.cafe \
    --to=jess@jessie.cafe \
    --cc=bhelgaas@google.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.