public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: host-generic: Avoid reporting incorrect "missing "reg" property" error
@ 2026-01-19  5:06 Jess
  2026-01-19 16:49 ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Jess @ 2026-01-19  5:06 UTC (permalink / raw)
  To: will, lpieralisi, kwilczynski, mani, robh, bhelgaas, linux-pci; +Cc: Jess

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

This commit gets rid of the confusing error message.

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 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index c473e7c03bac..04e1fef70c9c 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -31,10 +31,8 @@ struct pci_config_window *pci_host_common_ecam_create(struct device *dev,
 	struct pci_config_window *cfg;
 
 	err = of_address_to_resource(dev->of_node, 0, &cfgres);
-	if (err) {
-		dev_err(dev, "missing \"reg\" property\n");
+	if (err)
 		return ERR_PTR(err);
-	}
 
 	bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
 	if (!bus)
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] PCI: host-generic: Avoid reporting incorrect "missing "reg" property" error
  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   ` [PATCH v2] " Jess
  0 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2026-01-19 16:49 UTC (permalink / raw)
  To: Jess; +Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, linux-pci

On Mon, Jan 19, 2026 at 06:06:45PM +1300, Jess wrote:
> 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
> 
> This commit gets rid of the confusing error message.
> 
> 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 | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
> index c473e7c03bac..04e1fef70c9c 100644
> --- a/drivers/pci/controller/pci-host-common.c
> +++ b/drivers/pci/controller/pci-host-common.c
> @@ -31,10 +31,8 @@ struct pci_config_window *pci_host_common_ecam_create(struct device *dev,
>  	struct pci_config_window *cfg;
>  
>  	err = of_address_to_resource(dev->of_node, 0, &cfgres);
> -	if (err) {
> -		dev_err(dev, "missing \"reg\" property\n");
> +	if (err)
>  		return ERR_PTR(err);
> -	}

Maybe it would be better to print something more useful rather than removing
it entirely and leaving the poor luser guessing why their PCI isn't working?

How about one of:

	"missing or malformed \"reg\" property\n"
	"failed to parse ECAM base address from device-tree\n"
	"failed to get ECAM resource\n"

Will

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] PCI: host-generic: Avoid reporting incorrect "missing "reg" property" error
  2026-01-19 16:49 ` Will Deacon
@ 2026-01-20  0:44   ` Jess
  2026-01-20 11:22     ` Will Deacon
  2026-02-06 22:49     ` Bjorn Helgaas
  0 siblings, 2 replies; 5+ messages in thread
From: Jess @ 2026-01-20  0:44 UTC (permalink / raw)
  To: will; +Cc: bhelgaas, jess, kwilczynski, linux-pci, lpieralisi, mani, robh

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] PCI: host-generic: Avoid reporting incorrect "missing "reg" property" error
  2026-01-20  0:44   ` [PATCH v2] " Jess
@ 2026-01-20 11:22     ` Will Deacon
  2026-02-06 22:49     ` Bjorn Helgaas
  1 sibling, 0 replies; 5+ messages in thread
From: Will Deacon @ 2026-01-20 11:22 UTC (permalink / raw)
  To: Jess; +Cc: bhelgaas, kwilczynski, linux-pci, lpieralisi, mani, robh

On Tue, Jan 20, 2026 at 01:44:44PM +1300, Jess wrote:
> 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

Couldn't have put it better myself :p

Acked-by: Will Deacon <will@kernel.org>

Will

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] PCI: host-generic: Avoid reporting incorrect "missing "reg" property" error
  2026-01-20  0:44   ` [PATCH v2] " Jess
  2026-01-20 11:22     ` Will Deacon
@ 2026-02-06 22:49     ` Bjorn Helgaas
  1 sibling, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2026-02-06 22:49 UTC (permalink / raw)
  To: Jess; +Cc: will, bhelgaas, kwilczynski, linux-pci, lpieralisi, mani, robh

On Tue, Jan 20, 2026 at 01:44:44PM +1300, Jess wrote:
> 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>

Applied to pci/controller/generic for v6.20, thanks!

> ---
>  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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-06 22:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [PATCH v2] " Jess
2026-01-20 11:22     ` Will Deacon
2026-02-06 22:49     ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox