Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] eliminate two common errors reported by any yaml on arm64
@ 2020-10-13  6:06 Zhen Lei
  2020-10-13  6:06 ` [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges Zhen Lei
  2020-10-13  6:06 ` [PATCH 2/2] arm64: dts: qcom: " Zhen Lei
  0 siblings, 2 replies; 10+ messages in thread
From: Zhen Lei @ 2020-10-13  6:06 UTC (permalink / raw)
  To: Rob Herring, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Andy Gross, Bjorn Andersson, linux-arm-msm, devicetree,
	linux-arm-kernel, linux-kernel
  Cc: Zhen Lei

The following errors occured no matter which YAML file I executed on arm64.
Therefore, it is necessary to eliminate it so that people's time and energy are
not wasted every time.

arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #size-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #size-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #size-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #size-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #size-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but its #size-cells (1) differs from / (2)
arch/arm64/boot/dts/qcom/ipq6018.dtsi:185.3-14: Warning (dma_ranges_format): /soc:dma-ranges: empty "dma-ranges" property but its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/qcom/ipq6018.dtsi:185.3-14: Warning (dma_ranges_format): /soc:dma-ranges: empty "dma-ranges" property but its #size-cells (1) differs from / (2)
arch/arm64/boot/dts/qcom/ipq6018.dtsi:185.3-14: Warning (dma_ranges_format): /soc:dma-ranges: empty "dma-ranges" property but its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/qcom/ipq6018.dtsi:185.3-14: Warning (dma_ranges_format): /soc:dma-ranges: empty "dma-ranges" property but its #size-cells (1) differs from / (2)

Zhen Lei (2):
  arm64: dts: broadcom: remove an unused property dma-ranges
  arm64: dts: qcom: remove an unused property dma-ranges

 arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi | 1 -
 arch/arm64/boot/dts/qcom/ipq6018.dtsi                   | 1 -
 2 files changed, 2 deletions(-)

-- 
1.8.3



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

* [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges
  2020-10-13  6:06 [PATCH 0/2] eliminate two common errors reported by any yaml on arm64 Zhen Lei
@ 2020-10-13  6:06 ` Zhen Lei
  2020-10-14  3:12   ` Florian Fainelli
  2020-10-13  6:06 ` [PATCH 2/2] arm64: dts: qcom: " Zhen Lei
  1 sibling, 1 reply; 10+ messages in thread
From: Zhen Lei @ 2020-10-13  6:06 UTC (permalink / raw)
  To: Rob Herring, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Andy Gross, Bjorn Andersson, linux-arm-msm, devicetree,
	linux-arm-kernel, linux-kernel
  Cc: Zhen Lei

stingray-usb.dtsi is finally included by three dts files:
bcm958802a802x.dts, bcm958742k.dts and bcm958742t.dts. I searched all
these three entire expanded dts files, and each of them contains only one
dma-ranges. No conversion range is specified, so it cannot work properly.
I think this property "dma-ranges" is added by mistake, just remove it.
Otherwise, the following error will be reported when any YAML detection
is performed on arm64.

arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
(dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
(dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
its #size-cells (1) differs from / (2)

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi
index 55259f973b5a9e4..9ac8be6c65aa031 100644
--- a/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi
+++ b/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi
@@ -4,7 +4,6 @@
  */
 	usb {
 		compatible = "simple-bus";
-		dma-ranges;
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges = <0x0 0x0 0x68500000 0x00400000>;
-- 
1.8.3



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

* [PATCH 2/2] arm64: dts: qcom: remove an unused property dma-ranges
  2020-10-13  6:06 [PATCH 0/2] eliminate two common errors reported by any yaml on arm64 Zhen Lei
  2020-10-13  6:06 ` [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges Zhen Lei
@ 2020-10-13  6:06 ` Zhen Lei
  1 sibling, 0 replies; 10+ messages in thread
From: Zhen Lei @ 2020-10-13  6:06 UTC (permalink / raw)
  To: Rob Herring, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Andy Gross, Bjorn Andersson, linux-arm-msm, devicetree,
	linux-arm-kernel, linux-kernel
  Cc: Zhen Lei

ipq6018.dtsi is only included by ipq6018-cp01-c1.dts. I searched the
entire expanded ipq6018-cp01-c1.dts file, and only one dma-ranges was
defined. No conversion range is specified, so it cannot work properly.
I think this property "dma-ranges" is added by mistake, just remove it.
Otherwise, the following error will be reported when any YAML detection
is performed on arm64.

arch/arm64/boot/dts/qcom/ipq6018.dtsi:185.3-14: Warning \
(dma_ranges_format): /soc:dma-ranges: empty "dma-ranges" property but \
its #address-cells (1) differs from / (2)
arch/arm64/boot/dts/qcom/ipq6018.dtsi:185.3-14: Warning \
(dma_ranges_format): /soc:dma-ranges: empty "dma-ranges" property but \
its #size-cells (1) differs from / (2)

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 arch/arm64/boot/dts/qcom/ipq6018.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
index a94dac76bf3fbdd..ec88c0723fb512d 100644
--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
@@ -182,7 +182,6 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges = <0 0 0 0xffffffff>;
-		dma-ranges;
 		compatible = "simple-bus";
 
 		prng: qrng@e1000 {
-- 
1.8.3



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

* Re: [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges
  2020-10-13  6:06 ` [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges Zhen Lei
@ 2020-10-14  3:12   ` Florian Fainelli
  2020-10-14  7:38     ` Arnd Bergmann
  0 siblings, 1 reply; 10+ messages in thread
From: Florian Fainelli @ 2020-10-14  3:12 UTC (permalink / raw)
  To: Zhen Lei, Rob Herring, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Andy Gross, Bjorn Andersson,
	linux-arm-msm, devicetree, linux-arm-kernel, linux-kernel



On 10/12/2020 11:06 PM, Zhen Lei wrote:
> stingray-usb.dtsi is finally included by three dts files:
> bcm958802a802x.dts, bcm958742k.dts and bcm958742t.dts. I searched all
> these three entire expanded dts files, and each of them contains only one
> dma-ranges. No conversion range is specified, so it cannot work properly.
> I think this property "dma-ranges" is added by mistake, just remove it.
> Otherwise, the following error will be reported when any YAML detection
> is performed on arm64.
> 
> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
> its #address-cells (1) differs from / (2)
> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
> its #size-cells (1) differs from / (2)
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

This looks fine to me, Scott, Ray do you want to Ack this patch before I 
take it?
-- 
Florian

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

* Re: [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges
  2020-10-14  3:12   ` Florian Fainelli
@ 2020-10-14  7:38     ` Arnd Bergmann
  2020-10-14 13:36       ` Leizhen (ThunderTown)
  0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2020-10-14  7:38 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Zhen Lei, Rob Herring, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Andy Gross, Bjorn Andersson,
	linux-arm-msm, devicetree, linux-arm-kernel, linux-kernel

On Wed, Oct 14, 2020 at 5:15 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
> On 10/12/2020 11:06 PM, Zhen Lei wrote:
> > stingray-usb.dtsi is finally included by three dts files:
> > bcm958802a802x.dts, bcm958742k.dts and bcm958742t.dts. I searched all
> > these three entire expanded dts files, and each of them contains only one
> > dma-ranges. No conversion range is specified, so it cannot work properly.
> > I think this property "dma-ranges" is added by mistake, just remove it.
> > Otherwise, the following error will be reported when any YAML detection
> > is performed on arm64.
> >
> > arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
> > (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
> > its #address-cells (1) differs from / (2)
> > arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
> > (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
> > its #size-cells (1) differs from / (2)
> >
> > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>
> This looks fine to me, Scott, Ray do you want to Ack this patch before I
> take it?

Does it mean that there are no devices on this bus that can do DMA?

Usually there should be a dma-ranges property to identify that DMA
is possible and what the limits are, though we have failed to enforce
that.

Also note that the #address-cells=<1> means that any device under
this bus is assumed to only support 32-bit addressing, and DMA will
have to go through a slow swiotlb in the absence of an IOMMU.

      Arnd

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

* Re: [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges
  2020-10-14  7:38     ` Arnd Bergmann
@ 2020-10-14 13:36       ` Leizhen (ThunderTown)
  2020-10-14 13:43         ` Leizhen (ThunderTown)
  2020-10-14 14:02         ` Arnd Bergmann
  0 siblings, 2 replies; 10+ messages in thread
From: Leizhen (ThunderTown) @ 2020-10-14 13:36 UTC (permalink / raw)
  To: Arnd Bergmann, Florian Fainelli
  Cc: Rob Herring, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Andy Gross, Bjorn Andersson, linux-arm-msm, devicetree,
	linux-arm-kernel, linux-kernel



On 2020/10/14 15:38, Arnd Bergmann wrote:
> On Wed, Oct 14, 2020 at 5:15 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
>> On 10/12/2020 11:06 PM, Zhen Lei wrote:
>>> stingray-usb.dtsi is finally included by three dts files:
>>> bcm958802a802x.dts, bcm958742k.dts and bcm958742t.dts. I searched all
>>> these three entire expanded dts files, and each of them contains only one
>>> dma-ranges. No conversion range is specified, so it cannot work properly.
>>> I think this property "dma-ranges" is added by mistake, just remove it.
>>> Otherwise, the following error will be reported when any YAML detection
>>> is performed on arm64.
>>>
>>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
>>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
>>> its #address-cells (1) differs from / (2)
>>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
>>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
>>> its #size-cells (1) differs from / (2)
>>>
>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>
>> This looks fine to me, Scott, Ray do you want to Ack this patch before I
>> take it?
> 
> Does it mean that there are no devices on this bus that can do DMA?
> 
> Usually there should be a dma-ranges property to identify that DMA
> is possible and what the limits are, though we have failed to enforce
> that.

Documentation/devicetree/bindings/iommu/iommu.txt +79
When an "iommus" property is specified in a device tree node, the IOMMU will
be used for address translation. If a "dma-ranges" property exists in the
device's parent node it will be ignored. An exception to this rule is if the
referenced IOMMU is disabled, in which case the "dma-ranges" property of the
parent shall take effect.

The dma-ranges is only required by IOMMU disabled case. And should exist in
the parent node of IOMMU device. But this deleted dma-ranges is under the usb
bus node.

> 
> Also note that the #address-cells=<1> means that any device under
> this bus is assumed to only support 32-bit addressing, and DMA will
> have to go through a slow swiotlb in the absence of an IOMMU.

The dma_alloc_coherent() will allocate memory with GFP_DMA32 flag and
try the 0-4G first. The reserved swiotlb buffer memory is used only
when the allocation failed.

 memory@80000000:
    device_type: ["memory"]
    reg: [[0x0, 0x80000000, 0x0, 0x80000000], [0x8, 0x80000000, 0x1, 0x80000000]]

If this is the actual physical memory size, the #address-cells should be set to <1>.

> 
>       Arnd
> 
> .
> 


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

* Re: [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges
  2020-10-14 13:36       ` Leizhen (ThunderTown)
@ 2020-10-14 13:43         ` Leizhen (ThunderTown)
  2020-10-14 14:02         ` Arnd Bergmann
  1 sibling, 0 replies; 10+ messages in thread
From: Leizhen (ThunderTown) @ 2020-10-14 13:43 UTC (permalink / raw)
  To: Arnd Bergmann, Florian Fainelli
  Cc: Rob Herring, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Andy Gross, Bjorn Andersson, linux-arm-msm, devicetree,
	linux-arm-kernel, linux-kernel



On 2020/10/14 21:36, Leizhen (ThunderTown) wrote:
> 
> 
> On 2020/10/14 15:38, Arnd Bergmann wrote:
>> On Wed, Oct 14, 2020 at 5:15 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
>>> On 10/12/2020 11:06 PM, Zhen Lei wrote:
>>>> stingray-usb.dtsi is finally included by three dts files:
>>>> bcm958802a802x.dts, bcm958742k.dts and bcm958742t.dts. I searched all
>>>> these three entire expanded dts files, and each of them contains only one
>>>> dma-ranges. No conversion range is specified, so it cannot work properly.
>>>> I think this property "dma-ranges" is added by mistake, just remove it.
>>>> Otherwise, the following error will be reported when any YAML detection
>>>> is performed on arm64.
>>>>
>>>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
>>>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
>>>> its #address-cells (1) differs from / (2)
>>>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
>>>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
>>>> its #size-cells (1) differs from / (2)
>>>>
>>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>>
>>> This looks fine to me, Scott, Ray do you want to Ack this patch before I
>>> take it?
>>
>> Does it mean that there are no devices on this bus that can do DMA?
>>
>> Usually there should be a dma-ranges property to identify that DMA
>> is possible and what the limits are, though we have failed to enforce
>> that.
> 
> Documentation/devicetree/bindings/iommu/iommu.txt +79
> When an "iommus" property is specified in a device tree node, the IOMMU will
> be used for address translation. If a "dma-ranges" property exists in the
> device's parent node it will be ignored. An exception to this rule is if the
> referenced IOMMU is disabled, in which case the "dma-ranges" property of the
> parent shall take effect.
> 
> The dma-ranges is only required by IOMMU disabled case. And should exist in
> the parent node of IOMMU device. But this deleted dma-ranges is under the usb
> bus node.
> 
>>
>> Also note that the #address-cells=<1> means that any device under
>> this bus is assumed to only support 32-bit addressing, and DMA will
>> have to go through a slow swiotlb in the absence of an IOMMU.
> 
> The dma_alloc_coherent() will allocate memory with GFP_DMA32 flag and
> try the 0-4G first. The reserved swiotlb buffer memory is used only
> when the allocation failed.

----- Sorry, my mistake, please ignore the following.

> 
>  memory@80000000:
>     device_type: ["memory"]
>     reg: [[0x0, 0x80000000, 0x0, 0x80000000], [0x8, 0x80000000, 0x1, 0x80000000]]
> 
> If this is the actual physical memory size, the #address-cells should be set to <1>.
> 
>>
>>       Arnd
>>
>> .
>>


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

* Re: [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges
  2020-10-14 13:36       ` Leizhen (ThunderTown)
  2020-10-14 13:43         ` Leizhen (ThunderTown)
@ 2020-10-14 14:02         ` Arnd Bergmann
  2020-10-16  7:06           ` Leizhen (ThunderTown)
  1 sibling, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2020-10-14 14:02 UTC (permalink / raw)
  To: Leizhen (ThunderTown)
  Cc: Florian Fainelli, Rob Herring, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Andy Gross, Bjorn Andersson,
	linux-arm-msm, devicetree, linux-arm-kernel, linux-kernel

On Wed, Oct 14, 2020 at 3:36 PM Leizhen (ThunderTown)
<thunder.leizhen@huawei.com> wrote:
> On 2020/10/14 15:38, Arnd Bergmann wrote:
> > On Wed, Oct 14, 2020 at 5:15 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
> >> On 10/12/2020 11:06 PM, Zhen Lei wrote:
> >>> stingray-usb.dtsi is finally included by three dts files:
> >>> bcm958802a802x.dts, bcm958742k.dts and bcm958742t.dts. I searched all
> >>> these three entire expanded dts files, and each of them contains only one
> >>> dma-ranges. No conversion range is specified, so it cannot work properly.
> >>> I think this property "dma-ranges" is added by mistake, just remove it.
> >>> Otherwise, the following error will be reported when any YAML detection
> >>> is performed on arm64.
> >>>
> >>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
> >>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
> >>> its #address-cells (1) differs from / (2)
> >>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
> >>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
> >>> its #size-cells (1) differs from / (2)
> >>>
> >>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> >>
> >> This looks fine to me, Scott, Ray do you want to Ack this patch before I
> >> take it?
> >
> > Does it mean that there are no devices on this bus that can do DMA?
> >
> > Usually there should be a dma-ranges property to identify that DMA
> > is possible and what the limits are, though we have failed to enforce
> > that.
>
> Documentation/devicetree/bindings/iommu/iommu.txt +79
> When an "iommus" property is specified in a device tree node, the IOMMU will
> be used for address translation. If a "dma-ranges" property exists in the
> device's parent node it will be ignored. An exception to this rule is if the
> referenced IOMMU is disabled, in which case the "dma-ranges" property of the
> parent shall take effect.
>
> The dma-ranges is only required by IOMMU disabled case. And should exist in
> the parent node of IOMMU device. But this deleted dma-ranges is under the usb
> bus node.

The USB hosts here don't use an IOMMU though, right?

> > Also note that the #address-cells=<1> means that any device under
> > this bus is assumed to only support 32-bit addressing, and DMA will
> > have to go through a slow swiotlb in the absence of an IOMMU.
>
> The dma_alloc_coherent() will allocate memory with GFP_DMA32 flag and
> try the 0-4G first. The reserved swiotlb buffer memory is used only
> when the allocation failed.

The swiotlb is primarily about the streaming mappings with dma_map_*(),
which has to copy all data sent to the device. dma_alloc_coherent()
is a rare operation and less impacted by DMA limitations.

      Arnd

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

* Re: [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges
  2020-10-14 14:02         ` Arnd Bergmann
@ 2020-10-16  7:06           ` Leizhen (ThunderTown)
  2020-10-16  7:53             ` Leizhen (ThunderTown)
  0 siblings, 1 reply; 10+ messages in thread
From: Leizhen (ThunderTown) @ 2020-10-16  7:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: devicetree, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, Rob Herring, Bjorn Andersson, Andy Gross,
	bcm-kernel-feedback-list, linux-arm-msm, linux-arm-kernel



On 2020/10/14 22:02, Arnd Bergmann wrote:
> On Wed, Oct 14, 2020 at 3:36 PM Leizhen (ThunderTown)
> <thunder.leizhen@huawei.com> wrote:
>> On 2020/10/14 15:38, Arnd Bergmann wrote:
>>> On Wed, Oct 14, 2020 at 5:15 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
>>>> On 10/12/2020 11:06 PM, Zhen Lei wrote:
>>>>> stingray-usb.dtsi is finally included by three dts files:
>>>>> bcm958802a802x.dts, bcm958742k.dts and bcm958742t.dts. I searched all
>>>>> these three entire expanded dts files, and each of them contains only one
>>>>> dma-ranges. No conversion range is specified, so it cannot work properly.
>>>>> I think this property "dma-ranges" is added by mistake, just remove it.
>>>>> Otherwise, the following error will be reported when any YAML detection
>>>>> is performed on arm64.
>>>>>
>>>>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
>>>>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
>>>>> its #address-cells (1) differs from / (2)
>>>>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
>>>>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
>>>>> its #size-cells (1) differs from / (2)
>>>>>
>>>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>>>
>>>> This looks fine to me, Scott, Ray do you want to Ack this patch before I
>>>> take it?
>>>
>>> Does it mean that there are no devices on this bus that can do DMA?
>>>
>>> Usually there should be a dma-ranges property to identify that DMA
>>> is possible and what the limits are, though we have failed to enforce
>>> that.
>>
>> Documentation/devicetree/bindings/iommu/iommu.txt +79
>> When an "iommus" property is specified in a device tree node, the IOMMU will
>> be used for address translation. If a "dma-ranges" property exists in the
>> device's parent node it will be ignored. An exception to this rule is if the
>> referenced IOMMU is disabled, in which case the "dma-ranges" property of the
>> parent shall take effect.
>>
>> The dma-ranges is only required by IOMMU disabled case. And should exist in
>> the parent node of IOMMU device. But this deleted dma-ranges is under the usb
>> bus node.
> 
> The USB hosts here don't use an IOMMU though, right?

Generally, USB devices are accessed through the IOMMU. However, even in this
case, dma-ranges is not necessarily required. There are many examples of this
in arch/arm64/boot/dts/. For example: arch/arm64/boot/dts/arm/juno.dt.yaml.

Not sure, but maybe I found the answer.

vi drivers/of/address.c +457
457                                               Thus we treat the absence of
458          * "ranges" as equivalent to an empty "ranges" property which means
459          * a 1:1 translation at that level.

466          * This quirk also applies for 'dma-ranges' which frequently exist in
467          * child nodes without 'dma-ranges' in the parent nodes. --RobH

475         if (ranges == NULL || rlen == 0) {
476                 offset = of_read_number(addr, na);
477                 memset(addr, 0, pna * 4);
478                 pr_debug("empty ranges; 1:1 translation\n");
479                 goto finish;
480         }

By the way: At first, I thought that these errors was detected by YAML. Now,
I found that it was generated by "make dtbs". That's why it was reported by
any YAML. Thus, the need to fix these errors is even more urgent.


> 
>>> Also note that the #address-cells=<1> means that any device under
>>> this bus is assumed to only support 32-bit addressing, and DMA will
>>> have to go through a slow swiotlb in the absence of an IOMMU.
>>
>> The dma_alloc_coherent() will allocate memory with GFP_DMA32 flag and
>> try the 0-4G first. The reserved swiotlb buffer memory is used only
>> when the allocation failed.
> 
> The swiotlb is primarily about the streaming mappings with dma_map_*(),
> which has to copy all data sent to the device. dma_alloc_coherent()
> is a rare operation and less impacted by DMA limitations.

OK, I got it.

> 
>       Arnd
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 


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

* Re: [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges
  2020-10-16  7:06           ` Leizhen (ThunderTown)
@ 2020-10-16  7:53             ` Leizhen (ThunderTown)
  0 siblings, 0 replies; 10+ messages in thread
From: Leizhen (ThunderTown) @ 2020-10-16  7:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: devicetree, Florian Fainelli, Scott Branden, Ray Jui,
	linux-kernel, Bjorn Andersson, Rob Herring,
	bcm-kernel-feedback-list, Andy Gross, linux-arm-msm,
	linux-arm-kernel



On 2020/10/16 15:06, Leizhen (ThunderTown) wrote:
> 
> 
> On 2020/10/14 22:02, Arnd Bergmann wrote:
>> On Wed, Oct 14, 2020 at 3:36 PM Leizhen (ThunderTown)
>> <thunder.leizhen@huawei.com> wrote:
>>> On 2020/10/14 15:38, Arnd Bergmann wrote:
>>>> On Wed, Oct 14, 2020 at 5:15 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
>>>>> On 10/12/2020 11:06 PM, Zhen Lei wrote:
>>>>>> stingray-usb.dtsi is finally included by three dts files:
>>>>>> bcm958802a802x.dts, bcm958742k.dts and bcm958742t.dts. I searched all
>>>>>> these three entire expanded dts files, and each of them contains only one
>>>>>> dma-ranges. No conversion range is specified, so it cannot work properly.
>>>>>> I think this property "dma-ranges" is added by mistake, just remove it.
>>>>>> Otherwise, the following error will be reported when any YAML detection
>>>>>> is performed on arm64.
>>>>>>
>>>>>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
>>>>>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
>>>>>> its #address-cells (1) differs from / (2)
>>>>>> arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14: Warning \
>>>>>> (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges" property but \
>>>>>> its #size-cells (1) differs from / (2)
>>>>>>
>>>>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>>>>
>>>>> This looks fine to me, Scott, Ray do you want to Ack this patch before I
>>>>> take it?
>>>>
>>>> Does it mean that there are no devices on this bus that can do DMA?
>>>>
>>>> Usually there should be a dma-ranges property to identify that DMA
>>>> is possible and what the limits are, though we have failed to enforce
>>>> that.
>>>
>>> Documentation/devicetree/bindings/iommu/iommu.txt +79
>>> When an "iommus" property is specified in a device tree node, the IOMMU will
>>> be used for address translation. If a "dma-ranges" property exists in the
>>> device's parent node it will be ignored. An exception to this rule is if the
>>> referenced IOMMU is disabled, in which case the "dma-ranges" property of the
>>> parent shall take effect.
>>>
>>> The dma-ranges is only required by IOMMU disabled case. And should exist in
>>> the parent node of IOMMU device. But this deleted dma-ranges is under the usb
>>> bus node.
>>
>> The USB hosts here don't use an IOMMU though, right?
> 
> Generally, USB devices are accessed through the IOMMU. However, even in this
> case, dma-ranges is not necessarily required. There are many examples of this
> in arch/arm64/boot/dts/. For example: arch/arm64/boot/dts/arm/juno.dt.yaml.
> 
> Not sure, but maybe I found the answer.
> 
> vi drivers/of/address.c +457
> 457                                               Thus we treat the absence of
> 458          * "ranges" as equivalent to an empty "ranges" property which means
> 459          * a 1:1 translation at that level.
> 
> 466          * This quirk also applies for 'dma-ranges' which frequently exist in
> 467          * child nodes without 'dma-ranges' in the parent nodes. --RobH
> 
> 475         if (ranges == NULL || rlen == 0) {
> 476                 offset = of_read_number(addr, na);
> 477                 memset(addr, 0, pna * 4);
> 478                 pr_debug("empty ranges; 1:1 translation\n");
> 479                 goto finish;
> 480         }
> 
> By the way: At first, I thought that these errors was detected by YAML. Now,
> I found that it was generated by "make dtbs". That's why it was reported by
> any YAML. Thus, the need to fix these errors is even more urgent.
> 
> 
>>
>>>> Also note that the #address-cells=<1> means that any device under
>>>> this bus is assumed to only support 32-bit addressing, and DMA will

Hi, Arnd:
  I known what you mean now. I will rewrite the patch. Thanks.

>>>> have to go through a slow swiotlb in the absence of an IOMMU.
>>>
>>> The dma_alloc_coherent() will allocate memory with GFP_DMA32 flag and
>>> try the 0-4G first. The reserved swiotlb buffer memory is used only
>>> when the allocation failed.
>>
>> The swiotlb is primarily about the streaming mappings with dma_map_*(),
>> which has to copy all data sent to the device. dma_alloc_coherent()
>> is a rare operation and less impacted by DMA limitations.
> 
> OK, I got it.
> 
>>
>>       Arnd
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
>> .
>>
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 


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

end of thread, back to index

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13  6:06 [PATCH 0/2] eliminate two common errors reported by any yaml on arm64 Zhen Lei
2020-10-13  6:06 ` [PATCH 1/2] arm64: dts: broadcom: remove an unused property dma-ranges Zhen Lei
2020-10-14  3:12   ` Florian Fainelli
2020-10-14  7:38     ` Arnd Bergmann
2020-10-14 13:36       ` Leizhen (ThunderTown)
2020-10-14 13:43         ` Leizhen (ThunderTown)
2020-10-14 14:02         ` Arnd Bergmann
2020-10-16  7:06           ` Leizhen (ThunderTown)
2020-10-16  7:53             ` Leizhen (ThunderTown)
2020-10-13  6:06 ` [PATCH 2/2] arm64: dts: qcom: " Zhen Lei

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git