PCI: intel-gw: Use use_parent_dt_ranges and clean up intel_pcie_cpu_addr_fixup()
RFC PATCH 1/1 PCI: intel-gw: Use use_parent_dt_ranges and clean up intel_pcie_cpu_addr_fixup()
Remove intel_pcie_cpu_addr_fixup() as the DT bus fabric should provide correct address translation. Set use_parent_dt_ranges to allow the DWC core driver to fetch address translation from the device tree.
---
This patches basic on
https://lore.kernel.org/imx/[email protected]/
I have not hardware to test and there are not intel,lgm-pcie in kernel tree.
Your dts should correct reflect hardware behavor, ref:
https://lore.kernel.org/linux-pci/[email protected]/T/#mb7ae78c3a22324b37567d24ecc1c810c1b3f55c5
According to your intel_pcie_cpu_addr_fixup()
Basically, config space/io/mem space need minus SZ_256. parent bus range convert it to original value.
Look for driver owner, who help test this and start move forward to remove cpu_addr_fixup() work.
---
Frank Li <[email protected]>
--- drivers/pci/controller/dwc/pcie-intel-gw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/pci/controller/dwc/pcie-intel-gw.c +1 -7
@@ -57,7 +57,6 @@ PCIE_APP_IRN_INTA | PCIE_APP_IRN_INTB | \ PCIE_APP_IRN_INTC | PCIE_APP_IRN_INTD) -#define BUS_IATU_OFFSET SZ_256M#define RESET_INTERVAL_MS 100struct intel_pcie {
@@ -381,13 +380,7 @@ static int intel_pcie_rc_init(struct dw_pcie_rp *pp)return intel_pcie_host_setup (pcie); } -static u64 intel_pcie_cpu_addr (struct dw_pcie *pcie,u64 cpu_addr) -{ -return cpu_addr +BUS_IATU_OFFSET ; -} -static const struct dw_pcie_ops intel_pcie_ops = { - .cpu_addr_fixup = intel_pcie_cpu_addr, };static const struct dw_pcie_host_ops intel_pcie_dw_ops = {
@@ -409,6 +402,7 @@ static int intel_pcie_probe(struct platform_device *pdev)platform_set_drvdata (pdev, pcie); pci = &pcie->pci; pci->dev = dev; + pci->use_parent_dt_ranges = true; pp = &pci->pp; ret =intel_pcie_get_resources (pdev);
---
base-commit: 1552be4855dacca5ea39b15b1ef0b96c91dbea0d
change-id: 20250305-intel-7c25bfb498b1
Best regards,
Quoted 5 lines · Frank Li
Remove
intel_pcie_cpu_addr_fixup()as the DT bus fabric should provide correct address translation. Setuse_parent_dt_rangesto allow the DWC core driver to fetch address translation from the device tree.Signed-off-by Frank Li <[email protected]>
Any update on this, Chuanhua?
I plan to merge v12 of Frank's series [1] for v6.15. We need to know ASAP if that would break intel-gw.
If we knew that it was safe to also apply this patch to remove intel_pcie_cpu_addr(), that would be even better.
I will plan to apply the patch below on top of Frank's series [1] for v6.15 unless I hear that it would break something.
Bjorn
[1] https://lore.kernel.org/r/[email protected]
Quoted 64 lines
---
This patches basic on
https://lore.kernel.org/imx/[email protected]/I have not hardware to test and there are not intel,lgm-pcie in kernel tree.
Your dts should correct reflect hardware behavor, ref:
https://lore.kernel.org/linux-pci/[email protected]/T/#mb7ae78c3a22324b37567d24ecc1c810c1b3f55c5According to your
intel_pcie_cpu_addr_fixup()Basically, config space/io/mem space need minus
SZ_256. parent bus range convert it to original value.Look for driver owner, who help test this and start move forward to remove
cpu_addr_fixup()work.
---
Frank Li <[email protected]>--- drivers/pci/controller/dwc/pcie-intel-gw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/pci/controller/dwc/pcie-intel-gw.c +1
-8@@ -57,7 +57,6 @@ PCIE_APP_IRN_INTA | PCIE_APP_IRN_INTB | \ PCIE_APP_IRN_INTC | PCIE_APP_IRN_INTD) -#define BUS_IATU_OFFSET SZ_256M#define RESET_INTERVAL_MS 100struct intel_pcie {@@ -381,13 +380,7 @@ static int intel_pcie_rc_init(struct dw_pcie_rp *pp)return intel_pcie_host_setup (pcie); } -static u64 intel_pcie_cpu_addr (struct dw_pcie *pcie,u64 cpu_addr) -{ -return cpu_addr +BUS_IATU_OFFSET ; -} -static const struct dw_pcie_ops intel_pcie_ops = { - .cpu_addr_fixup = intel_pcie_cpu_addr, };static const struct dw_pcie_host_ops intel_pcie_dw_ops = {@@ -409,6 +402,7 @@ static int intel_pcie_probe(struct platform_device *pdev)platform_set_drvdata (pdev, pcie); pci = &pcie->pci; pci->dev = dev; + pci->use_parent_dt_ranges = true; pp = &pci->pp; ret =intel_pcie_get_resources (pdev); ---base-commit:
1552be4855dacca5ea39b15b1ef0b96c91dbea0d
change-id: 20250305-intel-7c25bfb498b1Best regards,
Hi Bjorn,
I did a quick test with necessary change in dts. It worked, please move on.
Regards,
Chuanhua
________________________________________
From: Bjorn Helgaas <[email protected]>
Sent: Tuesday, March 18, 2025 1:59 AM
To: Frank Li <[email protected]>
Cc: Lei Chuan Hua <[email protected]>; Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Manivannan Sadhasivam <[email protected]>; Rob Herring <[email protected]>; Bjorn Helgaas <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH RFC NOT TESTED] PCI: intel-gw: Use use_parent_dt_ranges and clean up intel_pcie_cpu_addr_fixup()
Quoted 5 lines · Frank Li
Remove
intel_pcie_cpu_addr_fixup()as the DT bus fabric should provide correct address translation. Setuse_parent_dt_rangesto allow the DWC core driver to fetch address translation from the device tree.Signed-off-by Frank Li <[email protected]>
Any update on this, Chuanhua?
I plan to merge v12 of Frank's series [1] for v6.15. We need to know ASAP if that would break intel-gw.
If we knew that it was safe to also apply this patch to remove intel_pcie_cpu_addr(), that would be even better.
I will plan to apply the patch below on top of Frank's series [1] for v6.15 unless I hear that it would break something.
Bjorn
[1] https://lore.kernel.org/r/[email protected]
Quoted 64 lines
---
This patches basic on
https://lore.kernel.org/imx/[email protected]/I have not hardware to test and there are not intel,lgm-pcie in kernel tree.
Your dts should correct reflect hardware behavor, ref:
https://lore.kernel.org/linux-pci/[email protected]/T/#mb7ae78c3a22324b37567d24ecc1c810c1b3f55c5According to your
intel_pcie_cpu_addr_fixup()Basically, config space/io/mem space need minus
SZ_256. parent bus range convert it to original value.Look for driver owner, who help test this and start move forward to remove
cpu_addr_fixup()work.
---
Frank Li <[email protected]>--- drivers/pci/controller/dwc/pcie-intel-gw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/pci/controller/dwc/pcie-intel-gw.c +1
-8@@ -57,7 +57,6 @@ PCIE_APP_IRN_INTA | PCIE_APP_IRN_INTB | \ PCIE_APP_IRN_INTC | PCIE_APP_IRN_INTD) -#define BUS_IATU_OFFSET SZ_256M#define RESET_INTERVAL_MS 100struct intel_pcie {@@ -381,13 +380,7 @@ static int intel_pcie_rc_init(struct dw_pcie_rp *pp)return intel_pcie_host_setup (pcie); } -static u64 intel_pcie_cpu_addr (struct dw_pcie *pcie,u64 cpu_addr) -{ -return cpu_addr +BUS_IATU_OFFSET ; -} -static const struct dw_pcie_ops intel_pcie_ops = { - .cpu_addr_fixup = intel_pcie_cpu_addr, };static const struct dw_pcie_host_ops intel_pcie_dw_ops = {@@ -409,6 +402,7 @@ static int intel_pcie_probe(struct platform_device *pdev)platform_set_drvdata (pdev, pcie); pci = &pcie->pci; pci->dev = dev; + pci->use_parent_dt_ranges = true; pp = &pci->pp; ret =intel_pcie_get_resources (pdev); ---base-commit:
1552be4855dacca5ea39b15b1ef0b96c91dbea0d
change-id: 20250305-intel-7c25bfb498b1Best regards,
Quoted 3 lines · Lei Chuan Hua
Hi Bjorn,
I did a quick test with necessary change in dts. It worked, please move on.
What does this mean? By "move on", do you mean that I should merge the patch below (the removal of intel_pcie_cpu_addr())?
I do not want to merge a change that will break any existing intel-gw platform. When you say "with necessary change in dts", it makes me think the removal of intel_pcie_cpu_addr() forces a change to dts, which would not be acceptable. We can't force users to upgrade the dts just to run a newer kernel.
I assume 250318 linux-next, which includes Frank's v12 series, should work with no change to dts required. (It would be awesome if you can verify that.)
If you apply this patch to remove intel_pcie_cpu_addr() on top of 250318 linux-next, does it still work with no changes to dts?
If you have to make a dts change for it to work after removing intel_pcie_cpu_addr(), then we have a problem.
I do not see a .dts file in the upstream tree that contains "intel,lgm-pcie", so I don't know what the .dts contains or how it is distributed.
I do see the binding at Documentation/devicetree/bindings/pci/intel-gw-pcie.yaml, but the example there does not include anything about address translation between the CPU and the PCI controller, so my guess is that there are .dts files in the field that will not work if we remove intel_pcie_cpu_addr().
Quoted 95 lines
________________________________________
From: Bjorn Helgaas <[email protected]>
Sent: Tuesday, March 18, 2025 1:59 AM
To: Frank Li <[email protected]>
Cc: Lei Chuan Hua <[email protected]>; Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Manivannan Sadhasivam <[email protected]>; Rob Herring <[email protected]>; Bjorn Helgaas <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH RFC NOT TESTED] PCI: intel-gw: Useuse_parent_dt_rangesand clean upintel_pcie_cpu_addr_fixup()Quoted 5 lines · Frank Li
Remove
intel_pcie_cpu_addr_fixup()as the DT bus fabric should provide correct address translation. Setuse_parent_dt_rangesto allow the DWC core driver to fetch address translation from the device tree.Signed-off-by Frank Li <[email protected]>Any update on this, Chuanhua?
I plan to merge v12 of Frank's series [1] for v6.15. We need to know ASAP if that would break intel-gw.
If we knew that it was safe to also apply this patch to remove
intel_pcie_cpu_addr(), that would be even better.I will plan to apply the patch below on top of Frank's series [1] for v6.15 unless I hear that it would break something.
Bjorn
[1] https://lore.kernel.org/r/[email protected]
Quoted 64 lines
---
This patches basic on
https://lore.kernel.org/imx/[email protected]/I have not hardware to test and there are not intel,lgm-pcie in kernel tree.
Your dts should correct reflect hardware behavor, ref:
https://lore.kernel.org/linux-pci/[email protected]/T/#mb7ae78c3a22324b37567d24ecc1c810c1b3f55c5According to your
intel_pcie_cpu_addr_fixup()Basically, config space/io/mem space need minus
SZ_256. parent bus range convert it to original value.Look for driver owner, who help test this and start move forward to remove
cpu_addr_fixup()work.
---
Frank Li <[email protected]>--- drivers/pci/controller/dwc/pcie-intel-gw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/pci/controller/dwc/pcie-intel-gw.c +1
-8@@ -57,7 +57,6 @@ PCIE_APP_IRN_INTA | PCIE_APP_IRN_INTB | \ PCIE_APP_IRN_INTC | PCIE_APP_IRN_INTD) -#define BUS_IATU_OFFSET SZ_256M#define RESET_INTERVAL_MS 100struct intel_pcie {@@ -381,13 +380,7 @@ static int intel_pcie_rc_init(struct dw_pcie_rp *pp)return intel_pcie_host_setup (pcie); } -static u64 intel_pcie_cpu_addr (struct dw_pcie *pcie,u64 cpu_addr) -{ -return cpu_addr +BUS_IATU_OFFSET ; -} -static const struct dw_pcie_ops intel_pcie_ops = { - .cpu_addr_fixup = intel_pcie_cpu_addr, };static const struct dw_pcie_host_ops intel_pcie_dw_ops = {@@ -409,6 +402,7 @@ static int intel_pcie_probe(struct platform_device *pdev)platform_set_drvdata (pdev, pcie); pci = &pcie->pci; pci->dev = dev; + pci->use_parent_dt_ranges = true; pp = &pci->pp; ret =intel_pcie_get_resources (pdev); ---base-commit:
1552be4855dacca5ea39b15b1ef0b96c91dbea0d
change-id: 20250305-intel-7c25bfb498b1Best regards,
Quoted 17 lines
-----Original Message-----
From: Bjorn Helgaas <[email protected]>
Sent: Tuesday, 18 March 2025 11:32 pm
To: Lei Chuan Hua <[email protected]>
Cc: Frank Li <[email protected]>; Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Manivannan Sadhasivam <[email protected]>; Rob Herring <[email protected]>; Bjorn Helgaas <[email protected]>; linux- [email protected]; [email protected]
Subject: Re: [PATCH RFC NOT TESTED] PCI: intel-gw: Useuse_parent_dt_rangesand clean upintel_pcie_cpu_addr_fixup()This email was sent from outside of MaxLinear.
Quoted 8 lines
Quoted 3 lines · Lei Chuan Hua
Hi Bjorn,
I did a quick test with necessary change in dts. It worked, please
move on.
What does this mean? By "move on", do you mean that I should merge the patch below (the removal of
intel_pcie_cpu_addr())?
I mean you can merge the patch with removal of intel_pcie_cpu_addr()
Quoted 6 lines
I do not want to merge a change that will break any existing intel-gw platform. When you say "with necessary change in dts", it makes me think the removal of
intel_pcie_cpu_addr()forces a change to dts, which would not be acceptable. We can't force users to upgrade the dts just to run a newer kernel.
Actually, intel_pcie_cpu_addr() did the address translation, so in our case, Dts has to adapt to this change.
Quoted 4 lines
I assume 250318 linux-next, which includes Frank's v12 series, should work with no change to dts required. (It would be awesome if you can verify that.)
I will try 250318 linux-next and let you know the result once it is done.
Quoted 3 lines
If you apply this patch to remove
intel_pcie_cpu_addr()on top of 250318 linux-next, does it still work with no changes to dts?
I think we need to adapt dts change. Even this series patch has dts adaption part.
Quoted 3 lines
If you have to make a dts change for it to work after removing
intel_pcie_cpu_addr(), then we have a problem.
We can update the dts yaml file.
Quoted 10 lines
I do not see a .dts file in the upstream tree that contains "intel,lgm- pcie", so I don't know what the .dts contains or how it is distributed.
I do see the binding at
Documentation/devicetree/bindings/pci/intel-gw-pcie.yaml, but the example there does not include anything about address translation between the CPU and the PCI controller, so my guess is that there are .dts files in the field that will not work if we removeintel_pcie_cpu_addr().
This driver is for x86 atom platform, no upstream dts file even in arch/x86/boot Since upstream x86 platforms use acpi, even several platforms use dts, but never create dts directory in arch/x86/boot.
As I mentioned earlier, dts needs a minor change.
Quoted 126 lines
Quoted 15 lines
________________________________________
From: Bjorn Helgaas <mailto:[email protected]>
Sent: Tuesday, March 18, 2025 1:59 AM
To: Frank Li <mailto:[email protected]>
Cc: Lei Chuan Hua <mailto:[email protected]>; Lorenzo Pieralisi <mailto:[email protected]>; Krzysztof Wilczyński <mailto:[email protected]>; Manivannan Sadhasivam <mailto:[email protected]>; Rob Herring <mailto:[email protected]>; Bjorn Helgaas <mailto:[email protected]>; mailto:[email protected] <mailto:[email protected]>; mailto:[email protected] <mailto:[email protected]>
Subject: Re: [PATCH RFC NOT TESTED] PCI: intel-gw: Useuse_parent_dt_rangesand clean upintel_pcie_cpu_addr_fixup()Quoted 4 lines
Quoted 3 lines · Frank Li
Remove
intel_pcie_cpu_addr_fixup()as the DT bus fabric should provide correct address translation. Setuse_parent_dt_rangesto allow the DWC core driver to fetch address translation from thedevice tree.
Quoted 72 lines
Quoted 2 lines
Signed-off-by Frank Li <mailto:[email protected]>Any update on this, Chuanhua?
I plan to merge v12 of Frank's series [1] for v6.15. We need to know ASAP if that would break intel-gw.
If we knew that it was safe to also apply this patch to remove
intel_pcie_cpu_addr(), that would be even better.I will plan to apply the patch below on top of Frank's series [1] for v6.15 unless I hear that it would break something.
Bjorn
[1]
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
.kernel.org%2Fr%2F20250315201548.858189-1-helgaas%40kernel.org&data=05 %7C02%7Clchuanhua%40maxlinear.com%7C1612d73ded5741bbd37508dd66320100%7 Cdac2800513e041b882807663835f2b1d%7C0%7C0%7C638779087153570342%7CUnkno wn%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXa W4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aIuZWzwFy2r rzsJ5KfbxWKMx%2BPn1WHx2KvpSR0nxsl8%3D&reserved=0Quoted 47 lines
---
This patches basic on
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flo
re.kernel.org%2Fimx%2F20250128-pci_fixup_addr-v9-0-3c4bb506f665%40nx p.com%2F&data=05%7C02%7Clchuanhua%40maxlinear.com%7C1612d73ded5741bb d37508dd66320100%7Cdac2800513e041b882807663835f2b1d%7C0%7C0%7C638779 087153596851%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiI wLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C %7C%7C&sdata=mht19VSB24Znpvtz1pOlmtHYec%2BDBDH70zuLOZmwlSI%3D&reserv ed=0I have not hardware to test and there are not intel,lgm-pcie in kernel tree.
Your dts should correct reflect hardware behavor, ref:
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flo
re.kernel.org%2Flinux-pci%2FZ8huvkENIBxyPKJv%40axis.com%2FT%2F%23mb7 ae78c3a22324b37567d24ecc1c810c1b3f55c5&data=05%7C02%7Clchuanhua%40ma xlinear.com%7C1612d73ded5741bbd37508dd66320100%7Cdac2800513e041b8828 07663835f2b1d%7C0%7C0%7C638779087153612764%7CUnknown%7CTWFpbGZsb3d8e yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=DUsGCW%2FZpvx4whLteoIjYqw d6oOk9rXks%2BV40i5sovI%3D&reserved=0According to your
intel_pcie_cpu_addr_fixup()Basically, config space/io/mem space need minus
SZ_256. parent bus range convert it to original value.Look for driver owner, who help test this and start move forward to remove
cpu_addr_fixup()work.
---
Frank Li <mailto:[email protected]>--- drivers/pci/controller/dwc/pcie-intel-gw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/pci/controller/dwc/pcie-intel-gw.c +0
-0@@ -57,7 +57,6 @@PCIE_APP_IRN_INTA |PCIE_APP_IRN_INTB | \ PCIE_APP_IRN_INTC | PCIE_APP_IRN_INTD)Quoted 5 lines
drivers/pci/controller/dwc/pcie-intel-gw.c static int intel_pcie_rc_init(struct dw_pcie_rp
Quoted 5 lines
drivers/pci/controller/dwc/pcie-intel-gw.c +0
-1-#define BUS_IATU_OFFSET SZ_256M#define RESET_INTERVAL_MS 100struct intel_pcie {@@ -381,13 +380,7 @@ static int intel_pcie_rc_init(struct dw_pcie_rp*pp)
Quoted 11 lines
Quoted 11 lines
drivers/pci/controller/dwc/pcie-intel-gw.c +0
-6return intel_pcie_host_setup (pcie); } -static u64 intel_pcie_cpu_addr (struct dw_pcie *pcie,u64 cpu_addr) -{ -return cpu_addr +BUS_IATU_OFFSET ; -} -static const struct dw_pcie_ops intel_pcie_ops = { - .cpu_addr_fixup = intel_pcie_cpu_addr, };Quoted 2 lines
drivers/pci/controller/dwc/pcie-intel-gw.c static int intel_pcie_rc_init(struct dw_pcie_rp · line 393
Quoted 2 lines
drivers/pci/controller/dwc/pcie-intel-gw.c +0
-1static const struct dw_pcie_host_ops intel_pcie_dw_ops = { @@ -409,6 +402,7 @@ static int intel_pcie_probe(struct platform_device*pdev)
Quoted 14 lines
Quoted 14 lines
platform_set_drvdata(pdev, pcie); pci = &pcie->pci; pci->dev = dev; + pci->use_parent_dt_ranges = true; pp = &pci->pp; ret = intel_pcie_get_resources(pdev);---
base-commit:1552be4855dacca5ea39b15b1ef0b96c91dbea0d
change-id: 20250305-intel-7c25bfb498b1Best regards,
Quoted 61 lines · Lei Chuan Hua
Quoted 14 lines
-----Original Message-----
From: Bjorn Helgaas <[email protected]>
Sent: Tuesday, 18 March 2025 11:32 pm
To: Lei Chuan Hua <[email protected]>
Cc: Frank Li <[email protected]>; Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Manivannan Sadhasivam <[email protected]>; Rob Herring <[email protected]>; Bjorn Helgaas <[email protected]>; linux- [email protected]; [email protected]
Subject: Re: [PATCH RFC NOT TESTED] PCI: intel-gw: Useuse_parent_dt_rangesand clean upintel_pcie_cpu_addr_fixup()This email was sent from outside of MaxLinear.
Quoted 8 lines
Quoted 4 lines · Lei Chuan Hua
Hi Bjorn,
I did a quick test with necessary change in dts. It worked, please move on.
What does this mean? By "move on", do you mean that I should merge the patch below (the removal of
intel_pcie_cpu_addr())?I mean you can merge the patch with removal of
intel_pcie_cpu_addr()Quoted 5 lines
I do not want to merge a change that will break any existing intel-gw platform. When you say "with necessary change in dts", it makes me think the removal of
intel_pcie_cpu_addr()forces a change to dts, which would not be acceptable. We can't force users to upgrade the dts just to run a newer kernel.Actually,
intel_pcie_cpu_addr()did the address translation, so in our case, Dts has to adapt to this change.Quoted 3 lines
I assume 250318 linux-next, which includes Frank's v12 series, should work with no change to dts required. (It would be awesome if you can verify that.)
I will try 250318 linux-next and let you know the result once it is done.
Quoted 2 lines
If you apply this patch to remove
intel_pcie_cpu_addr()on top of 250318 linux-next, does it still work with no changes to dts?I think we need to adapt dts change. Even this series patch has dts adaption part.
Quoted 2 lines
If you have to make a dts change for it to work after removing
intel_pcie_cpu_addr(), then we have a problem.We can update the dts yaml file.
Quoted 9 lines
I do not see a .dts file in the upstream tree that contains "intel,lgm- pcie", so I don't know what the .dts contains or how it is distributed.
I do see the binding at
Documentation/devicetree/bindings/pci/intel-gw-pcie.yaml, but the example there does not include anything about address translation between the CPU and the PCI controller, so my guess is that there are .dts files in the field that will not work if we removeintel_pcie_cpu_addr().
Quoted 6 lines
This driver is for x86 atom platform, no upstream dts file even in
arch/x86/bootSince upstream x86 platforms use acpi, even several platforms use dts, but never create dts directory inarch/x86/boot.As I mentioned earlier, dts needs a minor change.
If there are end users that have a dts that must be changed before intel_pcie_cpu_addr() can be removed, we can't remove it because we can't force those users to upgrade their dts.
If this driver is only used internally to Intel, or if the hardware has never been shipped to end users, it's OK to remove intel_pcie_cpu_addr() and assume those internal users will update dts.
Quoted 126 lines
Quoted 126 lines
Quoted 15 lines
________________________________________
From: Bjorn Helgaas <mailto:[email protected]>
Sent: Tuesday, March 18, 2025 1:59 AM
To: Frank Li <mailto:[email protected]>
Cc: Lei Chuan Hua <mailto:[email protected]>; Lorenzo Pieralisi <mailto:[email protected]>; Krzysztof Wilczyński <mailto:[email protected]>; Manivannan Sadhasivam <mailto:[email protected]>; Rob Herring <mailto:[email protected]>; Bjorn Helgaas <mailto:[email protected]>; mailto:[email protected] <mailto:[email protected]>; mailto:[email protected] <mailto:[email protected]>
Subject: Re: [PATCH RFC NOT TESTED] PCI: intel-gw: Useuse_parent_dt_rangesand clean upintel_pcie_cpu_addr_fixup()Quoted 4 lines
Quoted 3 lines · Frank Li
Remove
intel_pcie_cpu_addr_fixup()as the DT bus fabric should provide correct address translation. Setuse_parent_dt_rangesto allow the DWC core driver to fetch address translation from thedevice tree.
Quoted 72 lines
Quoted 2 lines
Signed-off-by Frank Li <mailto:[email protected]>Any update on this, Chuanhua?
I plan to merge v12 of Frank's series [1] for v6.15. We need to know ASAP if that would break intel-gw.
If we knew that it was safe to also apply this patch to remove
intel_pcie_cpu_addr(), that would be even better.I will plan to apply the patch below on top of Frank's series [1] for v6.15 unless I hear that it would break something.
Bjorn
[1]
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
.kernel.org%2Fr%2F20250315201548.858189-1-helgaas%40kernel.org&data=05 %7C02%7Clchuanhua%40maxlinear.com%7C1612d73ded5741bbd37508dd66320100%7 Cdac2800513e041b882807663835f2b1d%7C0%7C0%7C638779087153570342%7CUnkno wn%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXa W4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aIuZWzwFy2r rzsJ5KfbxWKMx%2BPn1WHx2KvpSR0nxsl8%3D&reserved=0Quoted 47 lines
---
This patches basic on
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flo
re.kernel.org%2Fimx%2F20250128-pci_fixup_addr-v9-0-3c4bb506f665%40nx p.com%2F&data=05%7C02%7Clchuanhua%40maxlinear.com%7C1612d73ded5741bb d37508dd66320100%7Cdac2800513e041b882807663835f2b1d%7C0%7C0%7C638779 087153596851%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiI wLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C %7C%7C&sdata=mht19VSB24Znpvtz1pOlmtHYec%2BDBDH70zuLOZmwlSI%3D&reserv ed=0I have not hardware to test and there are not intel,lgm-pcie in kernel tree.
Your dts should correct reflect hardware behavor, ref:
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flo
re.kernel.org%2Flinux-pci%2FZ8huvkENIBxyPKJv%40axis.com%2FT%2F%23mb7 ae78c3a22324b37567d24ecc1c810c1b3f55c5&data=05%7C02%7Clchuanhua%40ma xlinear.com%7C1612d73ded5741bbd37508dd66320100%7Cdac2800513e041b8828 07663835f2b1d%7C0%7C0%7C638779087153612764%7CUnknown%7CTWFpbGZsb3d8e yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=DUsGCW%2FZpvx4whLteoIjYqw d6oOk9rXks%2BV40i5sovI%3D&reserved=0According to your
intel_pcie_cpu_addr_fixup()Basically, config space/io/mem space need minus
SZ_256. parent bus range convert it to original value.Look for driver owner, who help test this and start move forward to remove
cpu_addr_fixup()work.
---
Frank Li <mailto:[email protected]>--- drivers/pci/controller/dwc/pcie-intel-gw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/pci/controller/dwc/pcie-intel-gw.c +0
-0@@ -57,7 +57,6 @@PCIE_APP_IRN_INTA |PCIE_APP_IRN_INTB | \ PCIE_APP_IRN_INTC | PCIE_APP_IRN_INTD)Quoted 5 lines
drivers/pci/controller/dwc/pcie-intel-gw.c static int intel_pcie_rc_init(struct dw_pcie_rp
Quoted 5 lines
drivers/pci/controller/dwc/pcie-intel-gw.c +0
-1-#define BUS_IATU_OFFSET SZ_256M#define RESET_INTERVAL_MS 100struct intel_pcie {@@ -381,13 +380,7 @@ static int intel_pcie_rc_init(struct dw_pcie_rp*pp)
Quoted 11 lines
Quoted 11 lines
drivers/pci/controller/dwc/pcie-intel-gw.c +0
-6return intel_pcie_host_setup (pcie); } -static u64 intel_pcie_cpu_addr (struct dw_pcie *pcie,u64 cpu_addr) -{ -return cpu_addr +BUS_IATU_OFFSET ; -} -static const struct dw_pcie_ops intel_pcie_ops = { - .cpu_addr_fixup = intel_pcie_cpu_addr, };Quoted 2 lines
drivers/pci/controller/dwc/pcie-intel-gw.c static int intel_pcie_rc_init(struct dw_pcie_rp · line 393
Quoted 2 lines
drivers/pci/controller/dwc/pcie-intel-gw.c +0
-1static const struct dw_pcie_host_ops intel_pcie_dw_ops = { @@ -409,6 +402,7 @@ static int intel_pcie_probe(struct platform_device*pdev)
Quoted 14 lines
Quoted 14 lines
platform_set_drvdata(pdev, pcie); pci = &pcie->pci; pci->dev = dev; + pci->use_parent_dt_ranges = true; pp = &pci->pp; ret = intel_pcie_get_resources(pdev);---
base-commit:1552be4855dacca5ea39b15b1ef0b96c91dbea0d
change-id: 20250305-intel-7c25bfb498b1Best regards,
Quoted 87 lines
-----Original Message-----
From: Bjorn Helgaas <[email protected]>
Sent: Thursday, 20 March 2025 3:23 am
To: Lei Chuan Hua <[email protected]>
Cc: Frank Li <[email protected]>; Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Manivannan Sadhasivam <[email protected]>; Rob Herring <[email protected]>; Bjorn Helgaas <[email protected]>; linux- [email protected]; [email protected]
Subject: Re: [PATCH RFC NOT TESTED] PCI: intel-gw: Useuse_parent_dt_rangesand clean upintel_pcie_cpu_addr_fixup()Quoted 25 lines · Lei Chuan Hua
Quoted 14 lines
-----Original Message-----
From: Bjorn Helgaas <[email protected]>
Sent: Tuesday, 18 March 2025 11:32 pm
To: Lei Chuan Hua <[email protected]>
Cc: Frank Li <[email protected]>; Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Manivannan Sadhasivam <[email protected]>; Rob Herring <[email protected]>; Bjorn Helgaas <[email protected]>; linux- [email protected]; [email protected]
Subject: Re: [PATCH RFC NOT TESTED] PCI: intel-gw: Useuse_parent_dt_rangesand clean upintel_pcie_cpu_addr_fixup()This email was sent from outside of MaxLinear.
Quoted 8 lines
Quoted 4 lines · Lei Chuan Hua
Hi Bjorn,
I did a quick test with necessary change in dts. It worked, please move on.
What does this mean? By "move on", do you mean that I should merge the patch below (the removal of
intel_pcie_cpu_addr())?I mean you can merge the patch with removal of
intel_pcie_cpu_addr()Quoted 7 lines
Quoted 5 lines
I do not want to merge a change that will break any existing intel-gw platform. When you say "with necessary change in dts", it makes me think the removal of
intel_pcie_cpu_addr()forces a change to dts, which would not be acceptable. We can't force users to upgrade the dts just to run a newer kernel.Actually,
intel_pcie_cpu_addr()did the address translation, so inour case,
Quoted 7 lines
Dts has to adapt to this change.
Quoted 3 lines
I assume 250318 linux-next, which includes Frank's v12 series, should work with no change to dts required. (It would be awesome if you can verify that.)
I will try 250318 linux-next and let you know the result once it is
done.
Quoted 4 lines
Quoted 3 lines
If you apply this patch to remove
intel_pcie_cpu_addr()on top of 250318 linux-next, does it still work with no changes to dts?Quoted 10 lines
I think we need to adapt dts change. Even this series patch has dts adaption part.
Quoted 2 lines
If you have to make a dts change for it to work after removing
intel_pcie_cpu_addr(), then we have a problem.We can update the dts yaml file.
Quoted 2 lines
I do not see a .dts file in the upstream tree that contains "intel,lgm- pcie", so I don't know what the .dts contains or how it
is distributed.
Quoted 8 lines
Quoted 7 lines
I do see the binding at
Documentation/devicetree/bindings/pci/intel-gw-pcie.yaml, but the example there does not include anything about address translation between the CPU and the PCI controller, so my guess is that there are .dts files in the field that will not work if we removeintel_pcie_cpu_addr().Quoted 6 lines
This driver is for x86 atom platform, no upstream dts file even in
arch/x86/bootSince upstream x86 platforms use acpi, even several platforms use dts, but never create dts directory inarch/x86/boot.As I mentioned earlier, dts needs a minor change.
Quoted 7 lines
If there are end users that have a dts that must be changed before
intel_pcie_cpu_addr()can be removed, we can't remove it because we can't force those users to upgrade their dts.If this driver is only used internally to Intel, or if the hardware has never been shipped to end users, it's OK to remove
intel_pcie_cpu_addr()and assume those internal users will update dts.
This driver is only used for internally to Maxlinear. Internal users will update dts Accordingly. Anyway, we will take linux-next-20250318 to run the test with dts adaptation Internally on the hardware board.
Quoted 168 lines
Quoted 168 lines
Quoted 168 lines
Quoted 19 lines
________________________________________
From: Bjorn Helgaas <mailto:[email protected]>
Sent: Tuesday, March 18, 2025 1:59 AM
To: Frank Li <mailto:[email protected]>
Cc: Lei Chuan Hua <mailto:[email protected]>; Lorenzo Pieralisi <mailto:[email protected]>; Krzysztof Wilczyński <mailto:[email protected]>; Manivannan Sadhasivam <mailto:[email protected]>; Rob Herring <mailto:[email protected]>; Bjorn Helgaas <mailto:[email protected]>; mailto:[email protected] <mailto:[email protected]>; mailto:[email protected] <mailto:[email protected]>
Subject: Re: [PATCH RFC NOT TESTED] PCI: intel-gw: Useuse_parent_dt_rangesand clean upintel_pcie_cpu_addr_fixup()Quoted 4 lines
Quoted 3 lines · Frank Li
Remove
intel_pcie_cpu_addr_fixup()as the DT bus fabric should provide correct address translation. Setuse_parent_dt_rangesto allow the DWC core driver to fetch address translation from thedevice tree.
Quoted 108 lines
Quoted 2 lines
Signed-off-by Frank Li <mailto:[email protected]>Any update on this, Chuanhua?
I plan to merge v12 of Frank's series [1] for v6.15. We need to know ASAP if that would break intel-gw.
If we knew that it was safe to also apply this patch to remove
intel_pcie_cpu_addr(), that would be even better.I will plan to apply the patch below on top of Frank's series [1] for
v6.15 unless I hear that it would break something.Bjorn
[1]
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lore%2F&data=05%7C02%7Clchuanhua%40maxlinear.com%7C1c7a4180ddc340f 2399308dd671b6e6a%7Cdac2800513e041b882807663835f2b1d%7C0%7C0%7C638 780089712963723%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIl YiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D %7C0%7C%7C%7C&sdata=ESUTIdyb342xMYwUhzwj%2BXsKoNQzth86rV3dfis5dn0% 3D&reserved=0 .kernel.org%2Fr%2F20250315201548.858189-1-helgaas%40kernel.org&dat a=05 %7C02%7Clchuanhua%40maxlinear.com%7C1612d73ded5741bbd37508dd663201 00%7 Cdac2800513e041b882807663835f2b1d%7C0%7C0%7C638779087153570342%7CU nkno wn%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiO iJXa W4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aIuZWzw Fy2r
rzsJ5KfbxWKMx%2BPn1WHx2KvpSR0nxsl8%3D&reserved=0Quoted 71 lines
---
This patches basic on
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%
2Flo%2F&data=05%7C02%7Clchuanhua%40maxlinear.com%7C1c7a4180ddc34 0f2399308dd671b6e6a%7Cdac2800513e041b882807663835f2b1d%7C0%7C0%7 C638780089712987168%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRy dWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoy fQ%3D%3D%7C0%7C%7C%7C&sdata=PguxNdlqlw4e%2FqmgY4aM67UarmNDwx7RCV 69x0myXJc%3D&reserved=0 re.kernel.org%2Fimx%2F20250128-pci_fixup_addr-v9-0-3c4bb506f665% 40nx p.com%2F&data=05%7C02%7Clchuanhua%40maxlinear.com%7C1612d73ded57 41bb d37508dd66320100%7Cdac2800513e041b882807663835f2b1d%7C0%7C0%7C63 8779 087153596851%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlY iOiI wLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C 0%7C %7C%7C&sdata=mht19VSB24Znpvtz1pOlmtHYec%2BDBDH70zuLOZmwlSI%3D&re serv
ed=0I have not hardware to test and there are not intel,lgm-pcie in kernel tree.
Your dts should correct reflect hardware behavor, ref:
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%
2Flo%2F&data=05%7C02%7Clchuanhua%40maxlinear.com%7C1c7a4180ddc34 0f2399308dd671b6e6a%7Cdac2800513e041b882807663835f2b1d%7C0%7C0%7 C638780089713001616%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRy dWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoy fQ%3D%3D%7C0%7C%7C%7C&sdata=DyXeezC8qsW2cdRg37sKVq2AH82vCV7L7YJ% 2FtgH6jU0%3D&reserved=0 re.kernel.org%2Flinux-pci%2FZ8huvkENIBxyPKJv%40axis.com%2FT%2F%2 3mb7 ae78c3a22324b37567d24ecc1c810c1b3f55c5&data=05%7C02%7Clchuanhua% 40ma xlinear.com%7C1612d73ded5741bbd37508dd66320100%7Cdac2800513e041b 8828 07663835f2b1d%7C0%7C0%7C638779087153612764%7CUnknown%7CTWFpbGZsb 3d8e yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOI joiT WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=DUsGCW%2FZpvx4whLteoI jYqw
d6oOk9rXks%2BV40i5sovI%3D&reserved=0According to your
intel_pcie_cpu_addr_fixup()Basically, config space/io/mem space need minus
SZ_256. parent bus range convert it to original value.Look for driver owner, who help test this and start move forward to remove
cpu_addr_fixup()work.
---
Frank Li <mailto:[email protected]>--- drivers/pci/controller/dwc/pcie-intel-gw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/pci/controller/dwc/pcie-intel-gw.c +0
-0@@ -57,7 +57,6 @@PCIE_APP_IRN_INTA |PCIE_APP_IRN_INTB | \ PCIE_APP_IRN_INTC | PCIE_APP_IRN_INTD)Quoted 6 lines
Quoted 6 lines
drivers/pci/controller/dwc/pcie-intel-gw.c +0
-1-#define BUS_IATU_OFFSET SZ_256M#define RESET_INTERVAL_MS 100struct intel_pcie {@@ -381,13 +380,7 @@ static int intel_pcie_rc_init(struct
dw_pcie_rp*pp)
Quoted 11 lines
Quoted 11 lines
return intel_pcie_host_setup(pcie); }-static u64
intel_pcie_cpu_addr(struct dw_pcie *pcie, u64 cpu_addr)-{drivers/pci/controller/dwc/pcie-intel-gw.c +0
-4-return cpu_addr +BUS_IATU_OFFSET ; -} -static const struct dw_pcie_ops intel_pcie_ops = { - .cpu_addr_fixup = intel_pcie_cpu_addr, };Quoted 3 lines
Quoted 3 lines
static const struct
dw_pcie_host_opsintel_pcie_dw_ops= { @@
-409,6 +402,7 @@ static int intel_pcie_probe(structplatform_device*pdev)
Quoted 14 lines
Quoted 14 lines
platform_set_drvdata(pdev, pcie); pci = &pcie->pci; pci->dev = dev; + pci->use_parent_dt_ranges = true; pp = &pci->pp; ret = intel_pcie_get_resources(pdev);---
base-commit:1552be4855dacca5ea39b15b1ef0b96c91dbea0d
change-id: 20250305-intel-7c25bfb498b1Best regards,
Bjorn Helgaas
AppliedQuoted 5 lines · Frank Li
Remove
intel_pcie_cpu_addr_fixup()as the DT bus fabric should provide correct address translation. Setuse_parent_dt_rangesto allow the DWC core driver to fetch address translation from the device tree.Signed-off-by Frank Li <[email protected]>
Applied to pci/controller/dwc-cpu-addr-fixup for v6.15, thanks!
There is a minor dts change required, but Lei Chuan Hua has confirmed that all users are internal to Maxlinear and will update:
Quoted 64 lines
---
This patches basic on
https://lore.kernel.org/imx/[email protected]/I have not hardware to test and there are not intel,lgm-pcie in kernel tree.
Your dts should correct reflect hardware behavor, ref:
https://lore.kernel.org/linux-pci/[email protected]/T/#mb7ae78c3a22324b37567d24ecc1c810c1b3f55c5According to your
intel_pcie_cpu_addr_fixup()Basically, config space/io/mem space need minus
SZ_256. parent bus range convert it to original value.Look for driver owner, who help test this and start move forward to remove
cpu_addr_fixup()work.
---
Frank Li <[email protected]>--- drivers/pci/controller/dwc/pcie-intel-gw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/pci/controller/dwc/pcie-intel-gw.c +1
-8@@ -57,7 +57,6 @@ PCIE_APP_IRN_INTA | PCIE_APP_IRN_INTB | \ PCIE_APP_IRN_INTC | PCIE_APP_IRN_INTD) -#define BUS_IATU_OFFSET SZ_256M#define RESET_INTERVAL_MS 100struct intel_pcie {@@ -381,13 +380,7 @@ static int intel_pcie_rc_init(struct dw_pcie_rp *pp)return intel_pcie_host_setup (pcie); } -static u64 intel_pcie_cpu_addr (struct dw_pcie *pcie,u64 cpu_addr) -{ -return cpu_addr +BUS_IATU_OFFSET ; -} -static const struct dw_pcie_ops intel_pcie_ops = { - .cpu_addr_fixup = intel_pcie_cpu_addr, };static const struct dw_pcie_host_ops intel_pcie_dw_ops = {@@ -409,6 +402,7 @@ static int intel_pcie_probe(struct platform_device *pdev)platform_set_drvdata (pdev, pcie); pci = &pcie->pci; pci->dev = dev; + pci->use_parent_dt_ranges = true; pp = &pci->pp; ret =intel_pcie_get_resources (pdev); ---base-commit:
1552be4855dacca5ea39b15b1ef0b96c91dbea0d
change-id: 20250305-intel-7c25bfb498b1Best regards,