Skip to contentSkip to conversation

arm64: dts: qcom: sc8280xp: fix UFS DMA coherency

PATCH Applied Johan Hovold 7 participants 20 messages Dec 5, 2022 – Dec 6, 2022

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover arm64: dts: qcom: sc8280xp: fix UFS DMA coherency

The SC8280XP UFS controllers are cache coherent and must be marked as such in the devicetree to avoid potential data corruption.

Johan

Johan Hovold (2):
dt-bindings: ufs: qcom: allow 'dma-coherent' property
arm64: dts: qcom: sc8280xp: fix UFS DMA coherency

 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi              | 2 ++
 2 files changed, 4 insertions(+)
Signature · 1 line
2.37.4
#1 lore raw

PATCH 1/2 dt-bindings: ufs: qcom: allow 'dma-coherent' property

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

---
 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +2 -0
index f2d6298d926c..1f1d286749c0 100644
@@ -44,6 +44,8 @@ properties:
     minItems: 8
     maxItems: 11
 
+  dma-coherent: true
+
   interconnects:
     minItems: 2
     maxItems: 2
Signature · 1 line
2.37.4
#16 lore raw

PATCH 2/2 arm64: dts: qcom: sc8280xp: fix UFS DMA coherency

In reply to Johan Hovold

The SC8280XP UFS controllers are cache coherent and must be marked as such in the devicetree to avoid potential data corruption.

Fixes 152d1faf1e2f ("arm64: dts: qcom: add SC8280XP platform")
---
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +2 -0
index c4947c563099..23d1f51527aa 100644
@@ -1430,6 +1430,7 @@ ufs_mem_hc: ufs@1d84000 {
 			required-opps = <&rpmhpd_opp_nom>;
 
 			iommus = <&apps_smmu 0xe0 0x0>;
+			dma-coherent;
 
 			clocks = <&gcc GCC_UFS_PHY_AXI_CLK>,
 				 <&gcc GCC_AGGRE_UFS_PHY_AXI_CLK>,
@@ -1491,6 +1492,7 @@ ufs_card_hc: ufs@1da4000 {
 			power-domains = <&gcc UFS_CARD_GDSC>;
 
 			iommus = <&apps_smmu 0x4a0 0x0>;
+			dma-coherent;
 
 			clocks = <&gcc GCC_UFS_CARD_AXI_CLK>,
 				 <&gcc GCC_AGGRE_UFS_CARD_AXI_CLK>,
Signature · 1 line
2.37.4
Reviewed-by on v1 2/2
#17 lore raw
Quoted 7 lines · Johan Hovold

The SC8280XP UFS controllers are cache coherent and must be marked as such in the devicetree to avoid potential data corruption.

Fixes 152d1faf1e2f ("arm64: dts: qcom: add SC8280XP platform")

---

Konrad

Quoted 23 lines
  arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 2 ++
  1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +2 -0
index c4947c563099..23d1f51527aa 100644
@@ -1430,6 +1430,7 @@ ufs_mem_hc: ufs@1d84000 {
  			required-opps = <&rpmhpd_opp_nom>;
 
  			iommus = <&apps_smmu 0xe0 0x0>;
+			dma-coherent;
 
  			clocks = <&gcc GCC_UFS_PHY_AXI_CLK>,
  				 <&gcc GCC_AGGRE_UFS_PHY_AXI_CLK>,
@@ -1491,6 +1492,7 @@ ufs_card_hc: ufs@1da4000 {
  			power-domains = <&gcc UFS_CARD_GDSC>;
 
  			iommus = <&apps_smmu 0x4a0 0x0>;
+			dma-coherent;
 
  			clocks = <&gcc GCC_UFS_CARD_AXI_CLK>,
  				 <&gcc GCC_AGGRE_UFS_CARD_AXI_CLK>,
#2 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

In reply to Johan Hovold
Quoted 15 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

---
 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +0 -0
index f2d6298d926c..1f1d286749c0 100644

Documentation/devicetree/bindings/ufs/qcom,ufs.yaml properties: · line 48

Quoted 5 lines
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +2 -0
@@ -44,6 +44,8 @@ properties:
     minItems: 8
     maxItems: 11
 
+  dma-coherent: true
+

This property is not applicable to all SoCs. So setting true here will make it valid for all.

Thanks,
Mani

Quoted 6 lines
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +0 -0
   interconnects:
     minItems: 2
     maxItems: 2
Signature · 1 line
2.37.4
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Reviewed-by on v1 2/2
#18 lore raw
In reply to Johan Hovold
Quoted 6 lines · Johan Hovold

The SC8280XP UFS controllers are cache coherent and must be marked as such in the devicetree to avoid potential data corruption.

Fixes 152d1faf1e2f ("arm64: dts: qcom: add SC8280XP platform")

Thanks,
Mani

Quoted 27 lines
---
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +2 -0
index c4947c563099..23d1f51527aa 100644
@@ -1430,6 +1430,7 @@ ufs_mem_hc: ufs@1d84000 {
 			required-opps = <&rpmhpd_opp_nom>;
 
 			iommus = <&apps_smmu 0xe0 0x0>;
+			dma-coherent;
 
 			clocks = <&gcc GCC_UFS_PHY_AXI_CLK>,
 				 <&gcc GCC_AGGRE_UFS_PHY_AXI_CLK>,
@@ -1491,6 +1492,7 @@ ufs_card_hc: ufs@1da4000 {
 			power-domains = <&gcc UFS_CARD_GDSC>;
 
 			iommus = <&apps_smmu 0x4a0 0x0>;
+			dma-coherent;
 
 			clocks = <&gcc GCC_UFS_CARD_AXI_CLK>,
 				 <&gcc GCC_AGGRE_UFS_CARD_AXI_CLK>,
Signature · 1 line
2.37.4
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#3 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

In reply to Manivannan Sadhasivam
Quoted 19 lines · Manivannan Sadhasivam
Quoted 18 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

---
 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +0 -0
index f2d6298d926c..1f1d286749c0 100644
@@ -44,6 +44,8 @@ properties:
     minItems: 8
     maxItems: 11
 
Quoted 5 lines

Documentation/devicetree/bindings/ufs/qcom,ufs.yaml properties: · line 48

Quoted 2 lines
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +2 -0
+  dma-coherent: true
+

This property is not applicable to all SoCs. So setting true here will make it valid for all.

Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding.

Johan

#4 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

Quoted 20 lines · Johan Hovold
Quoted 19 lines · Manivannan Sadhasivam
Quoted 18 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

---
 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +0 -0
index f2d6298d926c..1f1d286749c0 100644
@@ -44,6 +44,8 @@ properties:
     minItems: 8
     maxItems: 11
 
Quoted 9 lines
Quoted 5 lines

Documentation/devicetree/bindings/ufs/qcom,ufs.yaml properties: · line 48

Quoted 2 lines
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +2 -0
+  dma-coherent: true
+

This property is not applicable to all SoCs. So setting true here will make it valid for all.

Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding.

But if you make a property valid in the binding then it implies that anyone could add it to DTS which is wrong. You should make this property valid for SoCs that actually support it.

Thanks,
Mani

Quoted 1 line

Johan

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#5 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

Quoted 27 lines · Manivannan Sadhasivam
Quoted 26 lines · Johan Hovold
Quoted 24 lines · Manivannan Sadhasivam
Quoted 15 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

---
 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +0 -0
index f2d6298d926c..1f1d286749c0 100644

Documentation/devicetree/bindings/ufs/qcom,ufs.yaml properties: · line 48

Quoted 5 lines
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +2 -0
@@ -44,6 +44,8 @@ properties:
     minItems: 8
     maxItems: 11
 
+  dma-coherent: true
+

This property is not applicable to all SoCs. So setting true here will make it valid for all.

Quoted 7 lines
Quoted 3 lines

Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding.

But if you make a property valid in the binding then it implies that anyone could add it to DTS which is wrong. You should make this property valid for SoCs that actually support it.

No, it's not wrong.

Note that the binding only requires 'compatible' and 'regs', all other properties are optional, and you could, for example, add a 'reset' property to a node for a device which does not have a reset without the DT validation failing.

It's the devicetree which is supposed to describe hardware, you don't have to encode it also in the binding.

Johan

#6 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

Quoted 36 lines · Johan Hovold
Quoted 27 lines · Manivannan Sadhasivam
Quoted 26 lines · Johan Hovold
Quoted 24 lines · Manivannan Sadhasivam
Quoted 15 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

---
 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +0 -0
index f2d6298d926c..1f1d286749c0 100644

Documentation/devicetree/bindings/ufs/qcom,ufs.yaml properties: · line 48

Quoted 5 lines
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +2 -0
@@ -44,6 +44,8 @@ properties:
     minItems: 8
     maxItems: 11
 
+  dma-coherent: true
+

This property is not applicable to all SoCs. So setting true here will make it valid for all.

Quoted 7 lines
Quoted 3 lines

Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding.

But if you make a property valid in the binding then it implies that anyone could add it to DTS which is wrong. You should make this property valid for SoCs that actually support it.

Quoted 7 lines

No, it's not wrong.

Note that the binding only requires 'compatible' and 'regs', all other properties are optional, and you could, for example, add a 'reset' property to a node for a device which does not have a reset without the DT validation failing.

Then what is the point of devicetree validation using bindings?

There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390

Thanks,
Mani

Quoted 4 lines

It's the devicetree which is supposed to describe hardware, you don't have to encode it also in the binding.

Johan

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#7 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

Quoted 22 lines · Manivannan Sadhasivam
Quoted 21 lines · Johan Hovold
Quoted 10 lines · Manivannan Sadhasivam
Quoted 8 lines · Johan Hovold
Quoted 7 lines · Manivannan Sadhasivam
Quoted 6 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

Quoted 7 lines
Quoted 3 lines

Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding.

But if you make a property valid in the binding then it implies that anyone could add it to DTS which is wrong. You should make this property valid for SoCs that actually support it.

No, it's not wrong.

Quoted 7 lines
Quoted 5 lines

Note that the binding only requires 'compatible' and 'regs', all other properties are optional, and you could, for example, add a 'reset' property to a node for a device which does not have a reset without the DT validation failing.

Then what is the point of devicetree validation using bindings?

You're still making sure that no properties are added that are not documented, number of clocks, names of clocks, etc.

Quoted 1 line

There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390

Speaking of Krzysztof:

	https://lore.kernel.org/lkml/[email protected]/

Johan

#8 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

Quoted 31 lines · Johan Hovold
Quoted 22 lines · Manivannan Sadhasivam
Quoted 21 lines · Johan Hovold
Quoted 10 lines · Manivannan Sadhasivam
Quoted 8 lines · Johan Hovold
Quoted 7 lines · Manivannan Sadhasivam
Quoted 6 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

Quoted 7 lines
Quoted 3 lines

Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding.

But if you make a property valid in the binding then it implies that anyone could add it to DTS which is wrong. You should make this property valid for SoCs that actually support it.

No, it's not wrong.

Quoted 7 lines
Quoted 5 lines

Note that the binding only requires 'compatible' and 'regs', all other properties are optional, and you could, for example, add a 'reset' property to a node for a device which does not have a reset without the DT validation failing.

Then what is the point of devicetree validation using bindings?

Quoted 9 lines

You're still making sure that no properties are added that are not documented, number of clocks, names of clocks, etc.

Quoted 1 line

There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390

Speaking of Krzysztof:

	https://lore.kernel.org/lkml/[email protected]/

Heh... I will wait for him to chime in then.

Thanks,
Mani

Quoted 1 line

Johan

Signature · 1 line
மணிவண்ணன் சதாசிவம்
maintainer
#11 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

In reply to Johan Hovold
Quoted 8 lines · Johan Hovold
Quoted 7 lines · Manivannan Sadhasivam
Quoted 6 lines · Johan Hovold
Quoted 5 lines · Manivannan Sadhasivam
Quoted 4 lines · Johan Hovold
Quoted 3 lines · Manivannan Sadhasivam
Quoted 2 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

Typically, you'd only be doing unnecessary cache flushes without it rather than getting data corruption. However, it is possible this property triggers other system setup or something that would cause problems if not setup right.

Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

This is specifically needed on recent Qualcomm platforms like SC8280XP.

Quoted 7 lines
Quoted 3 lines

Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding.

But if you make a property valid in the binding then it implies that anyone could add it to DTS which is wrong. You should make this property valid for SoCs that actually support it.

No, it's not wrong.

Note that the binding only requires 'compatible' and 'regs', all other properties are optional, and you could, for example, add a 'reset' property to a node for a device which does not have a reset without the DT validation failing.

Quoted 4 lines
Quoted 1 line

Then what is the point of devicetree validation using bindings?

You're still making sure that no properties are added that are not documented, number of clocks, names of clocks, etc.

The schema can never be 100%. If it was, then we could practically just generate the DT.

IMO, 'dma-coherent' is bit special. I'd say it is valid on any DMA capable device node, but there's not any generic way to determine that. So it has to be explicit in a device binding.

Rob

maintainer Reviewed-by on v1 1/2
#13 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

In reply to Johan Hovold
Quoted 10 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

---
 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
 1 file changed, 2 insertions(+)
maintainer Reviewed-by on v1 1/2
#14 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

In reply to Johan Hovold
Quoted 6 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

This is specifically needed on recent Qualcomm platforms like SC8280XP.

But I think this should be picked up by James or Martin. Added them as explicit recipients, but perhaps they would like you to resubmit this?

I'm picking the dts change for now.

Thanks,
Bjorn

Quoted 20 lines
---
 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +2 -0
index f2d6298d926c..1f1d286749c0 100644
@@ -44,6 +44,8 @@ properties:
     minItems: 8
     maxItems: 11
 
+  dma-coherent: true
+
   interconnects:
     minItems: 2
     maxItems: 2
Signature · 1 line
2.37.4
#12 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

In reply to Rob Herring
Quoted 6 lines · Rob Herring
Quoted 5 lines · Johan Hovold
Quoted 4 lines · Manivannan Sadhasivam
Quoted 3 lines · Johan Hovold
Quoted 2 lines · Manivannan Sadhasivam
Quoted 1 line · Johan Hovold

On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote:

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Johan Hovold
Quoted 2 lines

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

Typically, you'd only be doing unnecessary cache flushes without it rather than getting data corruption. However, it is possible this property triggers other system setup or something that would cause problems if not setup right.

You can end up with data corruption, for example, if the kernel remaps a consistent buffer and writes data through the non-cacheable alias while the coherent device snoops stale data from the caches.

Johan

#15 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

In reply to Bjorn Andersson
Quoted 4 lines · Bjorn Andersson
Quoted 3 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

Quoted 8 lines
Quoted 3 lines

This is specifically needed on recent Qualcomm platforms like SC8280XP.

But I think this should be picked up by James or Martin. Added them as explicit recipients, but perhaps they would like you to resubmit this?

They were not included in the get_maintainer.pl output so I'm guessing they prefer to pick UFS binding patches from the scsi list.

Quoted 1 line

I'm picking the dts change for now.

Thanks.

Johan

#9 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

In reply to Manivannan Sadhasivam
Quoted 22 lines · Manivannan Sadhasivam
Quoted 21 lines · Johan Hovold
Quoted 20 lines · Manivannan Sadhasivam
Quoted 19 lines · Johan Hovold
Quoted 17 lines · Manivannan Sadhasivam
Quoted 5 lines · Johan Hovold
Quoted 4 lines · Manivannan Sadhasivam
Quoted 3 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

This is specifically needed on recent Qualcomm platforms like SC8280XP.

Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding.

But if you make a property valid in the binding then it implies that anyone could add it to DTS which is wrong. You should make this property valid for SoCs that actually support it.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

No, it's not wrong.

Note that the binding only requires 'compatible' and 'regs', all other properties are optional, and you could, for example, add a 'reset' property to a node for a device which does not have a reset without the DT validation failing.

Optional properties are optional primarily looking at one variant. It means that on different boards with the same SoC, things can be routed a bit differently and some property can be skipped. E.g. sometimes regulators come from PMIC and sometimes are wired to some VBATT, so we do not have regulator in DTS for them. Or some interrupt/pin is not connected.

Now between variants of devices - different SoCs: I don't think that "optional" should be used in such context, except special cases or lack of knowledge about hardware. For given SoC/variant, the property is either:
1. valid and possible (can be required or optional),
2. not valid, not possible.
And this we should express in constraints, if doable with reasonable complexity.

Therefore the question is: is dma-coherent not valid for other SoCs?

If it is "not needed" for other SoCs, then I would leave it like this. Consider also what Rob said, that otherwise we would create DTS from the bindings.

Also, too many allOf:if:then: constraints in the bindings make them trickier to read.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Then what is the point of devicetree validation using bindings?

Quoted 8 lines
Quoted 8 lines

You're still making sure that no properties are added that are not documented, number of clocks, names of clocks, etc.

Quoted 1 line

There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390

Speaking of Krzysztof:

	https://lore.kernel.org/lkml/[email protected]/

That's not the best example, because I just do not know where dma-coherent is applicable and where it is not, thus I added it as valid for all variants. Also, I think that all variants are capable of using IOMMU - it isn't restricted per variant. If they are capable of IOMMU, then dma-coherent is a possible choice.

Best regards,
Krzysztof

#10 lore raw

Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property

Quoted 45 lines · Krzysztof Kozlowski
Quoted 22 lines · Manivannan Sadhasivam
Quoted 21 lines · Johan Hovold
Quoted 20 lines · Manivannan Sadhasivam
Quoted 19 lines · Johan Hovold
Quoted 17 lines · Manivannan Sadhasivam
Quoted 5 lines · Johan Hovold
Quoted 4 lines · Manivannan Sadhasivam
Quoted 3 lines · Johan Hovold

UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

This is specifically needed on recent Qualcomm platforms like SC8280XP.

Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding.

But if you make a property valid in the binding then it implies that anyone could add it to DTS which is wrong. You should make this property valid for SoCs that actually support it.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

No, it's not wrong.

Note that the binding only requires 'compatible' and 'regs', all other properties are optional, and you could, for example, add a 'reset' property to a node for a device which does not have a reset without the DT validation failing.

Optional properties are optional primarily looking at one variant. It means that on different boards with the same SoC, things can be routed a bit differently and some property can be skipped. E.g. sometimes regulators come from PMIC and sometimes are wired to some VBATT, so we do not have regulator in DTS for them. Or some interrupt/pin is not connected.

Now between variants of devices - different SoCs: I don't think that "optional" should be used in such context, except special cases or lack of knowledge about hardware. For given SoC/variant, the property is either:
1. valid and possible (can be required or optional),
2. not valid, not possible.
And this we should express in constraints, if doable with reasonable complexity.

Quoted 2 lines

Therefore the question is: is dma-coherent not valid for other SoCs?

Yes, it is not valid on older SoCs because they don't support I/O coherency. So setting this property on those un-supported SoCs may lead to wierd behavior. This was the concern I had for setting this property valid for all SoCs.

So far we only know that SC8280XP and newer SoCs support I/O coherency.

Thanks,
Mani

Quoted 30 lines

If it is "not needed" for other SoCs, then I would leave it like this. Consider also what Rob said, that otherwise we would create DTS from the bindings.

Also, too many allOf:if:then: constraints in the bindings make them trickier to read.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Then what is the point of devicetree validation using bindings?

Quoted 8 lines
Quoted 8 lines

You're still making sure that no properties are added that are not documented, number of clocks, names of clocks, etc.

Quoted 1 line

There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390

Speaking of Krzysztof:

	https://lore.kernel.org/lkml/[email protected]/

That's not the best example, because I just do not know where dma-coherent is applicable and where it is not, thus I added it as valid for all variants. Also, I think that all variants are capable of using IOMMU - it isn't restricted per variant. If they are capable of IOMMU, then dma-coherent is a possible choice.

Best regards,
Krzysztof

Signature · 1 line
மணிவண்ணன் சதாசிவம்
maintainer Applied
#19 lore raw

Re: (subset) [PATCH 0/2] arm64: dts: qcom: sc8280xp: fix UFS DMA coherency

In reply to Johan Hovold
Quoted 11 lines · Johan Hovold

The SC8280XP UFS controllers are cache coherent and must be marked as such in the devicetree to avoid potential data corruption.

Johan

Johan Hovold (2):
dt-bindings: ufs: qcom: allow 'dma-coherent' property
arm64: dts: qcom: sc8280xp: fix UFS DMA coherency

[...]

Applied, thanks!

[2/2] arm64: dts: qcom: sc8280xp: fix UFS DMA coherency

      commit: 0953777640354dc459a22369eea488603d225dd9

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>