Skip to contentSkip to conversation

pci: ecm generic: use dev_read_() interface

PATCH In review Mayuresh Chitale 3 participants 6 messages Feb 18, 2023 – Nov 10, 2023 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: ecm generic: use dev_read_() interface

Use dev_read_() api instead of the fdtdec API to fetch the host controller's reg property value. This is similar to the other host controller drivers such as Sifive, Rockchip etc. Without this change, enabling CONFIG_OF_LIVE breaks the PCIe enumeration on Qemu Risc-V virt machine. The issue is described in the link below:

---
 drivers/pci/pcie_ecam_generic.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/pci/pcie_ecam_generic.c +8 -13
index 1a9f9aec2e..f0effe0001 100644
@@ -132,19 +132,14 @@ static int pci_generic_ecam_write_config(struct udevice *bus, pci_dev_t bdf,
 static int pci_generic_ecam_of_to_plat(struct udevice *dev)
 {
 	struct generic_ecam_pcie *pcie = dev_get_priv(dev);
-	struct fdt_resource reg_res;
-	DECLARE_GLOBAL_DATA_PTR;
-	int err;
-
-	err = fdt_get_resource(gd->fdt_blob, dev_of_offset(dev), "reg",
-			       0, &reg_res);
-	if (err < 0) {
-		pr_err("\"reg\" resource not found\n");
-		return err;
-	}
-
-	pcie->size = fdt_resource_size(&reg_res);
-	pcie->cfg_base = map_physmem(reg_res.start, pcie->size, MAP_NOCACHE);
+	fdt_addr_t addr;
+	fdt_size_t size;
+
+	addr = dev_read_addr_size(dev, "reg", &size);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+	pcie->size = size;
+	pcie->cfg_base = map_physmem(addr, pcie->size, MAP_NOCACHE);
 
 	return 0;
 }
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Mayuresh Chitale

Use dev_read_() api instead of the fdtdec API to fetch the host controller's reg property value. This is similar to the other host controller drivers such as Sifive, Rockchip etc. Without this change, enabling CONFIG_OF_LIVE breaks the PCIe enumeration on Qemu Risc-V virt machine. The issue is described in the link below:

Quoted 5 lines
---
 drivers/pci/pcie_ecam_generic.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
#2 lore raw
In reply to Mayuresh Chitale
Quoted 6 lines · Mayuresh Chitale

Use dev_read_() api instead of the fdtdec API to fetch the host controller's reg property value. This is similar to the other host controller drivers such as Sifive, Rockchip etc. Without this change, enabling CONFIG_OF_LIVE breaks the PCIe enumeration on Qemu Risc-V virt machine. The issue is described in the link below:

Quoted 6 lines
---
 drivers/pci/pcie_ecam_generic.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

This breaks some platforms such as qemu_arm at a minimum.

Signature · 1 line
Tom
#3 lore raw
Quoted 9 lines · Tom Rini
Quoted 6 lines · Mayuresh Chitale

Use dev_read_() api instead of the fdtdec API to fetch the host controller's reg property value. This is similar to the other host controller drivers such as Sifive, Rockchip etc. Without this change, enabling CONFIG_OF_LIVE breaks the PCIe enumeration on Qemu Risc-V virt machine. The issue is described in the link below:

Quoted 8 lines
Quoted 6 lines
---
 drivers/pci/pcie_ecam_generic.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

This breaks some platforms such as qemu_arm at a minimum.

Ok. How do I reproduce the issue?

Quoted 3 lines

--
Tom

#4 lore raw
Quoted 17 lines · Mayuresh Chitale
Quoted 16 lines · Tom Rini
Quoted 12 lines · Mayuresh Chitale

Use dev_read_() api instead of the fdtdec API to fetch the host controller's reg property value. This is similar to the other host controller drivers such as Sifive, Rockchip etc. Without this change, enabling CONFIG_OF_LIVE breaks the PCIe enumeration on Qemu Risc-V virt machine. The issue is described in the link below:

---
 drivers/pci/pcie_ecam_generic.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
Quoted 3 lines
Quoted 1 line

This breaks some platforms such as qemu_arm at a minimum.

Ok. How do I reproduce the issue?

Right, sorry. So the failure log is:
https://source.denx.de/u-boot/u-boot/-/jobs/622397
And https://u-boot.readthedocs.io/en/latest/develop/py_testing.html
talks about running the pytest suite outside of CI and
https://u-boot.readthedocs.io/en/latest/develop/ci_testing.html about how to trigger CI yourself. One thing that's not documented well enough is that you'll likely want
https://source.denx.de/u-boot/u-boot-test-hooks as well as you can just use as-is the "travis-ci" directories (legacy name, used by both gitlab and azure as-is) as the configuration hooks for your system as well and then the network tests will run easily, locally.

Signature · 1 line
Tom
#5 lore raw

Hi,

Quoted 23 lines · Tom Rini
Quoted 17 lines · Mayuresh Chitale
Quoted 16 lines · Tom Rini
Quoted 12 lines · Mayuresh Chitale

Use dev_read_() api instead of the fdtdec API to fetch the host controller's reg property value. This is similar to the other host controller drivers such as Sifive, Rockchip etc. Without this change, enabling CONFIG_OF_LIVE breaks the PCIe enumeration on Qemu Risc-V virt machine. The issue is described in the link below:

---
 drivers/pci/pcie_ecam_generic.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
Quoted 3 lines
Quoted 1 line

This breaks some platforms such as qemu_arm at a minimum.

Ok. How do I reproduce the issue?

Quoted 11 lines

Right, sorry. So the failure log is:
https://source.denx.de/u-boot/u-boot/-/jobs/622397
And https://u-boot.readthedocs.io/en/latest/develop/py_testing.html
talks about running the pytest suite outside of CI and
https://u-boot.readthedocs.io/en/latest/develop/ci_testing.html about how to trigger CI yourself. One thing that's not documented well enough is that you'll likely want
https://source.denx.de/u-boot/u-boot-test-hooks as well as you can just use as-is the "travis-ci" directories (legacy name, used by both gitlab and azure as-is) as the configuration hooks for your system as well and then the network tests will run easily, locally.

Any update on this one? It is:

https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/1

Regards,
Simon