2020-10-16 09:14:10

by Zhen Lei

[permalink] [raw]
Subject: [PATCH v2 0/2] eliminate two common errors reported by any yaml on arm64

v1 --> v2:
Although it's simpler to delete the empty "dma-ranges" property, and the function
of_translate_one() in drivers/of/address.c will treate non "dma-ranges" case as
empty "dma-ranges". But as Arnd Bergmann suggested: it's not good for the scenario
of IOMMU disabled or absented.

This version make sure that the node have empty "dma-ranges" property have the same
"#address-cells" and "#size-cells" values as its parent node.


v1:
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: clear the warnings caused by empty dma-ranges
arm64: dts: qcom: clear the warnings caused by empty dma-ranges

.../boot/dts/broadcom/stingray/stingray-usb.dtsi | 20 +++---
arch/arm64/boot/dts/qcom/ipq6018.dtsi | 72 +++++++++++-----------
2 files changed, 46 insertions(+), 46 deletions(-)

--
1.8.3



2020-10-16 09:18:04

by Zhen Lei

[permalink] [raw]
Subject: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

The scripts/dtc/checks.c requires that the node have empty "dma-ranges"
property must have the same "#address-cells" and "#size-cells" values as
the parent node. Otherwise, the following warnings is reported:

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)

Arnd Bergmann figured out why it's necessary:
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.

Suggested-by: Arnd Bergmann <[email protected]>
Signed-off-by: Zhen Lei <[email protected]>
---
.../boot/dts/broadcom/stingray/stingray-usb.dtsi | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi
index 55259f973b5a9e4..aef8f2b00778d71 100644
--- a/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi
+++ b/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi
@@ -5,20 +5,20 @@
usb {
compatible = "simple-bus";
dma-ranges;
- #address-cells = <1>;
- #size-cells = <1>;
- ranges = <0x0 0x0 0x68500000 0x00400000>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges = <0x0 0x0 0x0 0x68500000 0x0 0x00400000>;

usbphy0: usb-phy@0 {
compatible = "brcm,sr-usb-combo-phy";
- reg = <0x00000000 0x100>;
+ reg = <0x0 0x00000000 0x0 0x100>;
#phy-cells = <1>;
status = "disabled";
};

xhci0: usb@1000 {
compatible = "generic-xhci";
- reg = <0x00001000 0x1000>;
+ reg = <0x0 0x00001000 0x0 0x1000>;
interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>;
phys = <&usbphy0 1>, <&usbphy0 0>;
phy-names = "phy0", "phy1";
@@ -28,7 +28,7 @@

bdc0: usb@2000 {
compatible = "brcm,bdc-v0.16";
- reg = <0x00002000 0x1000>;
+ reg = <0x0 0x00002000 0x0 0x1000>;
interrupts = <GIC_SPI 259 IRQ_TYPE_LEVEL_HIGH>;
phys = <&usbphy0 0>, <&usbphy0 1>;
phy-names = "phy0", "phy1";
@@ -38,21 +38,21 @@

usbphy1: usb-phy@10000 {
compatible = "brcm,sr-usb-combo-phy";
- reg = <0x00010000 0x100>;
+ reg = <0x0 0x00010000 0x0 0x100>;
#phy-cells = <1>;
status = "disabled";
};

usbphy2: usb-phy@20000 {
compatible = "brcm,sr-usb-hs-phy";
- reg = <0x00020000 0x100>;
+ reg = <0x0 0x00020000 0x0 0x100>;
#phy-cells = <0>;
status = "disabled";
};

xhci1: usb@11000 {
compatible = "generic-xhci";
- reg = <0x00011000 0x1000>;
+ reg = <0x0 0x00011000 0x0 0x1000>;
interrupts = <GIC_SPI 263 IRQ_TYPE_LEVEL_HIGH>;
phys = <&usbphy1 1>, <&usbphy2>, <&usbphy1 0>;
phy-names = "phy0", "phy1", "phy2";
@@ -62,7 +62,7 @@

bdc1: usb@21000 {
compatible = "brcm,bdc-v0.16";
- reg = <0x00021000 0x1000>;
+ reg = <0x0 0x00021000 0x0 0x1000>;
interrupts = <GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>;
phys = <&usbphy2>;
phy-names = "phy0";
--
1.8.3


2020-10-16 09:20:03

by Zhen Lei

[permalink] [raw]
Subject: [PATCH v2 2/2] arm64: dts: qcom: clear the warnings caused by empty dma-ranges

The scripts/dtc/checks.c requires that the node have empty "dma-ranges"
property must have the same "#address-cells" and "#size-cells" values as
the parent node. Otherwise, the following warnings is reported:

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)

Arnd Bergmann figured out why it's necessary:
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.

Suggested-by: Arnd Bergmann <[email protected]>
Signed-off-by: Zhen Lei <[email protected]>
---
arch/arm64/boot/dts/qcom/ipq6018.dtsi | 72 +++++++++++++++++------------------
1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
index a94dac76bf3fbdd..59e0cbfa2214305 100644
--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
@@ -179,22 +179,22 @@
};

soc: soc {
- #address-cells = <1>;
- #size-cells = <1>;
- ranges = <0 0 0 0xffffffff>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges = <0 0 0 0 0x0 0xffffffff>;
dma-ranges;
compatible = "simple-bus";

prng: qrng@e1000 {
compatible = "qcom,prng-ee";
- reg = <0xe3000 0x1000>;
+ reg = <0x0 0xe3000 0x0 0x1000>;
clocks = <&gcc GCC_PRNG_AHB_CLK>;
clock-names = "core";
};

cryptobam: dma@704000 {
compatible = "qcom,bam-v1.7.0";
- reg = <0x00704000 0x20000>;
+ reg = <0x0 0x00704000 0x0 0x20000>;
interrupts = <GIC_SPI 207 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&gcc GCC_CRYPTO_AHB_CLK>;
clock-names = "bam_clk";
@@ -206,7 +206,7 @@

crypto: crypto@73a000 {
compatible = "qcom,crypto-v5.1";
- reg = <0x0073a000 0x6000>;
+ reg = <0x0 0x0073a000 0x0 0x6000>;
clocks = <&gcc GCC_CRYPTO_AHB_CLK>,
<&gcc GCC_CRYPTO_AXI_CLK>,
<&gcc GCC_CRYPTO_CLK>;
@@ -217,7 +217,7 @@

tlmm: pinctrl@1000000 {
compatible = "qcom,ipq6018-pinctrl";
- reg = <0x01000000 0x300000>;
+ reg = <0x0 0x01000000 0x0 0x300000>;
interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
gpio-controller;
#gpio-cells = <2>;
@@ -235,7 +235,7 @@

gcc: gcc@1800000 {
compatible = "qcom,gcc-ipq6018";
- reg = <0x01800000 0x80000>;
+ reg = <0x0 0x01800000 0x0 0x80000>;
clocks = <&xo>, <&sleep_clk>;
clock-names = "xo", "sleep_clk";
#clock-cells = <1>;
@@ -244,17 +244,17 @@

tcsr_mutex_regs: syscon@1905000 {
compatible = "syscon";
- reg = <0x01905000 0x8000>;
+ reg = <0x0 0x01905000 0x0 0x8000>;
};

tcsr_q6: syscon@1945000 {
compatible = "syscon";
- reg = <0x01945000 0xe000>;
+ reg = <0x0 0x01945000 0x0 0xe000>;
};

blsp_dma: dma@7884000 {
compatible = "qcom,bam-v1.7.0";
- reg = <0x07884000 0x2b000>;
+ reg = <0x0 0x07884000 0x0 0x2b000>;
interrupts = <GIC_SPI 238 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&gcc GCC_BLSP1_AHB_CLK>;
clock-names = "bam_clk";
@@ -264,7 +264,7 @@

blsp1_uart3: serial@78b1000 {
compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
- reg = <0x078b1000 0x200>;
+ reg = <0x0 0x078b1000 0x0 0x200>;
interrupts = <GIC_SPI 306 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&gcc GCC_BLSP1_UART3_APPS_CLK>,
<&gcc GCC_BLSP1_AHB_CLK>;
@@ -276,7 +276,7 @@
compatible = "qcom,spi-qup-v2.2.1";
#address-cells = <1>;
#size-cells = <0>;
- reg = <0x078b5000 0x600>;
+ reg = <0x0 0x078b5000 0x0 0x600>;
interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
spi-max-frequency = <50000000>;
clocks = <&gcc GCC_BLSP1_QUP1_SPI_APPS_CLK>,
@@ -291,7 +291,7 @@
compatible = "qcom,spi-qup-v2.2.1";
#address-cells = <1>;
#size-cells = <0>;
- reg = <0x078b6000 0x600>;
+ reg = <0x0 0x078b6000 0x0 0x600>;
interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
spi-max-frequency = <50000000>;
clocks = <&gcc GCC_BLSP1_QUP2_SPI_APPS_CLK>,
@@ -306,7 +306,7 @@
compatible = "qcom,i2c-qup-v2.2.1";
#address-cells = <1>;
#size-cells = <0>;
- reg = <0x078b6000 0x600>;
+ reg = <0x0 0x078b6000 0x0 0x600>;
interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&gcc GCC_BLSP1_AHB_CLK>,
<&gcc GCC_BLSP1_QUP2_I2C_APPS_CLK>;
@@ -321,7 +321,7 @@
compatible = "qcom,i2c-qup-v2.2.1";
#address-cells = <1>;
#size-cells = <0>;
- reg = <0x078b7000 0x600>;
+ reg = <0x0 0x078b7000 0x0 0x600>;
interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&gcc GCC_BLSP1_AHB_CLK>,
<&gcc GCC_BLSP1_QUP3_I2C_APPS_CLK>;
@@ -336,24 +336,24 @@
compatible = "qcom,msm-qgic2";
interrupt-controller;
#interrupt-cells = <0x3>;
- reg = <0x0b000000 0x1000>, /*GICD*/
- <0x0b002000 0x1000>, /*GICC*/
- <0x0b001000 0x1000>, /*GICH*/
- <0x0b004000 0x1000>; /*GICV*/
+ reg = <0x0 0x0b000000 0x0 0x1000>, /*GICD*/
+ <0x0 0x0b002000 0x0 0x1000>, /*GICC*/
+ <0x0 0x0b001000 0x0 0x1000>, /*GICH*/
+ <0x0 0x0b004000 0x0 0x1000>; /*GICV*/
interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
};

watchdog@b017000 {
compatible = "qcom,kpss-wdt";
interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
- reg = <0x0b017000 0x40>;
+ reg = <0x0 0x0b017000 0x0 0x40>;
clocks = <&sleep_clk>;
timeout-sec = <10>;
};

apcs_glb: mailbox@b111000 {
compatible = "qcom,ipq6018-apcs-apps-global";
- reg = <0x0b111000 0x1000>;
+ reg = <0x0 0x0b111000 0x0 0x1000>;
#clock-cells = <1>;
clocks = <&a53pll>, <&xo>;
clock-names = "pll", "xo";
@@ -362,7 +362,7 @@

a53pll: clock@b116000 {
compatible = "qcom,ipq6018-a53pll";
- reg = <0x0b116000 0x40>;
+ reg = <0x0 0x0b116000 0x0 0x40>;
#clock-cells = <0>;
clocks = <&xo>;
clock-names = "xo";
@@ -377,68 +377,68 @@
};

timer@b120000 {
- #address-cells = <1>;
- #size-cells = <1>;
+ #address-cells = <2>;
+ #size-cells = <2>;
ranges;
compatible = "arm,armv7-timer-mem";
- reg = <0x0b120000 0x1000>;
+ reg = <0x0 0x0b120000 0x0 0x1000>;
clock-frequency = <19200000>;

frame@b120000 {
frame-number = <0>;
interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0x0b121000 0x1000>,
- <0x0b122000 0x1000>;
+ reg = <0x0 0x0b121000 0x0 0x1000>,
+ <0x0 0x0b122000 0x0 0x1000>;
};

frame@b123000 {
frame-number = <1>;
interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0xb123000 0x1000>;
+ reg = <0x0 0xb123000 0x0 0x1000>;
status = "disabled";
};

frame@b124000 {
frame-number = <2>;
interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0x0b124000 0x1000>;
+ reg = <0x0 0x0b124000 0x0 0x1000>;
status = "disabled";
};

frame@b125000 {
frame-number = <3>;
interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0x0b125000 0x1000>;
+ reg = <0x0 0x0b125000 0x0 0x1000>;
status = "disabled";
};

frame@b126000 {
frame-number = <4>;
interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0x0b126000 0x1000>;
+ reg = <0x0 0x0b126000 0x0 0x1000>;
status = "disabled";
};

frame@b127000 {
frame-number = <5>;
interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0x0b127000 0x1000>;
+ reg = <0x0 0x0b127000 0x0 0x1000>;
status = "disabled";
};

frame@b128000 {
frame-number = <6>;
interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0x0b128000 0x1000>;
+ reg = <0x0 0x0b128000 0x0 0x1000>;
status = "disabled";
};
};

q6v5_wcss: remoteproc@cd00000 {
compatible = "qcom,ipq8074-wcss-pil";
- reg = <0x0cd00000 0x4040>,
- <0x004ab000 0x20>;
+ reg = <0x0 0x0cd00000 0x0 0x4040>,
+ <0x0 0x004ab000 0x0 0x20>;
reg-names = "qdsp6",
"rmb";
interrupts-extended = <&intc GIC_SPI 325 IRQ_TYPE_EDGE_RISING>,
--
1.8.3


2020-10-16 19:57:14

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On 10/16/20 4:01 AM, Arnd Bergmann wrote:
> On Fri, Oct 16, 2020 at 11:09 AM Zhen Lei <[email protected]> wrote:
>>
>> The scripts/dtc/checks.c requires that the node have empty "dma-ranges"
>> property must have the same "#address-cells" and "#size-cells" values as
>> the parent node. Otherwise, the following warnings is reported:
>>
>> 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)
>>
>> Arnd Bergmann figured out why it's necessary:
>> 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.
>>
>> Suggested-by: Arnd Bergmann <[email protected]>
>> Signed-off-by: Zhen Lei <[email protected]>
>
> Acked-by: Arnd Bergmann <[email protected]>
>
> I see that at least the 'bcd' and 'xhci' devices in fact try to
> use 64-bit DMA. It would be good to test this on actual
> hardware to ensure that it works correctly when this is enabled.
>
> Ideally avoiding the swiotlb bounce buffering should only
> make it faster here, but there are many chips on which
> 64-bit DMA is broken in some form.

Is this change really an improvement though? This 'usb' pseudo bus node
could just keep being defined with #address-cells = <1> and #size-cells
= <1> so as to satisfy the 'reg' definition however we could just adjust
dma-ranges to indicate full 64-bit addressing capability. Would not that
work?
--
Florian

2020-10-16 22:17:34

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On 10/16/20 11:23 AM, Arnd Bergmann wrote:
> On Fri, Oct 16, 2020 at 6:48 PM Florian Fainelli <[email protected]> wrote:
>> On 10/16/20 4:01 AM, Arnd Bergmann wrote:
>>> On Fri, Oct 16, 2020 at 11:09 AM Zhen Lei <[email protected]> wrote:
>>>>
>>>> Suggested-by: Arnd Bergmann <[email protected]>
>>>> Signed-off-by: Zhen Lei <[email protected]>
>>>
>>> Acked-by: Arnd Bergmann <[email protected]>
>>>
>>> I see that at least the 'bcd' and 'xhci' devices in fact try to
>>> use 64-bit DMA. It would be good to test this on actual
>>> hardware to ensure that it works correctly when this is enabled.
>>>
>>> Ideally avoiding the swiotlb bounce buffering should only
>>> make it faster here, but there are many chips on which
>>> 64-bit DMA is broken in some form.
>>
>> Is this change really an improvement though? This 'usb' pseudo bus node
>> could just keep being defined with #address-cells = <1> and #size-cells
>> = <1> so as to satisfy the 'reg' definition however we could just adjust
>> dma-ranges to indicate full 64-bit addressing capability. Would not that
>> work?
>
> When #address-cells is '1', you cannot specify dma-ranges that
> go beyond a 32-bit address range.

Would not it be enough to remove the 'dma-ranges' property though? Sorry
for being slow here.
--
Florian

2020-10-18 03:39:17

by Zhen Lei

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges



On 2020/10/17 3:27, Florian Fainelli wrote:
> On 10/16/20 11:23 AM, Arnd Bergmann wrote:
>> On Fri, Oct 16, 2020 at 6:48 PM Florian Fainelli <[email protected]> wrote:
>>> On 10/16/20 4:01 AM, Arnd Bergmann wrote:
>>>> On Fri, Oct 16, 2020 at 11:09 AM Zhen Lei <[email protected]> wrote:
>>>>>
>>>>> Suggested-by: Arnd Bergmann <[email protected]>
>>>>> Signed-off-by: Zhen Lei <[email protected]>
>>>>
>>>> Acked-by: Arnd Bergmann <[email protected]>
>>>>
>>>> I see that at least the 'bcd' and 'xhci' devices in fact try to
>>>> use 64-bit DMA. It would be good to test this on actual
>>>> hardware to ensure that it works correctly when this is enabled.
>>>>
>>>> Ideally avoiding the swiotlb bounce buffering should only
>>>> make it faster here, but there are many chips on which
>>>> 64-bit DMA is broken in some form.
>>>
>>> Is this change really an improvement though? This 'usb' pseudo bus node
>>> could just keep being defined with #address-cells = <1> and #size-cells
>>> = <1> so as to satisfy the 'reg' definition however we could just adjust
>>> dma-ranges to indicate full 64-bit addressing capability. Would not that
>>> work?
>>
>> When #address-cells is '1', you cannot specify dma-ranges that
>> go beyond a 32-bit address range.
>
> Would not it be enough to remove the 'dma-ranges' property though? Sorry
> for being slow here.

Remove the 'dma-ranges' property should also work. After all, it is equivalent
to the original empty dma-ranges scheme. In addition, since the IOMMU nodes are
defined, it should be enabled. Therefore, Arnd's concern about the scenario where
the IOMMU is disabled may not be triggered. All roads lead to Rome. Which solution
should be chose depends on individual preferences. For me, either solution is fine.

The third solution is to define a non-empty dma-ranges property. However, because
stingray-usb.dtsi is included in multiple files, it may not be appropriate.


>

2020-10-26 05:11:28

by Zhen Lei

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges



On 2020/10/23 15:17, Arnd Bergmann wrote:
> On Sun, Oct 18, 2020 at 4:10 AM Leizhen (ThunderTown)
> <[email protected]> wrote:
>> On 2020/10/17 3:27, Florian Fainelli wrote:
>>> On 10/16/20 11:23 AM, Arnd Bergmann wrote:
>>>> On Fri, Oct 16, 2020 at 6:48 PM Florian Fainelli <[email protected]> wrote:
>>>>> On 10/16/20 4:01 AM, Arnd Bergmann wrote:
>>>>>> On Fri, Oct 16, 2020 at 11:09 AM Zhen Lei <[email protected]> wrote:
>>>>>>>
>>>>>>> Suggested-by: Arnd Bergmann <[email protected]>
>>>>>>> Signed-off-by: Zhen Lei <[email protected]>
>>>>>>
>>>>>> Acked-by: Arnd Bergmann <[email protected]>
>>>>>>
>>>>>> I see that at least the 'bcd' and 'xhci' devices in fact try to
>>>>>> use 64-bit DMA. It would be good to test this on actual
>>>>>> hardware to ensure that it works correctly when this is enabled.
>>>>>>
>>>>>> Ideally avoiding the swiotlb bounce buffering should only
>>>>>> make it faster here, but there are many chips on which
>>>>>> 64-bit DMA is broken in some form.
>>>>>
>>>>> Is this change really an improvement though? This 'usb' pseudo bus node
>>>>> could just keep being defined with #address-cells = <1> and #size-cells
>>>>> = <1> so as to satisfy the 'reg' definition however we could just adjust
>>>>> dma-ranges to indicate full 64-bit addressing capability. Would not that
>>>>> work?
>>>>
>>>> When #address-cells is '1', you cannot specify dma-ranges that
>>>> go beyond a 32-bit address range.
>>>
>>> Would not it be enough to remove the 'dma-ranges' property though? Sorry
>>> for being slow here.
>>
>> Remove the 'dma-ranges' property should also work. After all, it is equivalent
>> to the original empty dma-ranges scheme. In addition, since the IOMMU nodes are
>> defined, it should be enabled.
>
> Are you sure? I was expecting the IOMMU not to get used here since
> the devices do contain list an 'iommus' property.

OK,If the SMMU maybe disabled, then your proposal is necessary.

>
> Arnd
>
> .
>

2020-11-09 06:20:36

by Zhen Lei

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

Hi, everybody:
How do we deal with this problem? I updated the kernel to the latest and the problem still persists.

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j24 dtbs 2>err.txt
vim err.txt

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




On 2020/10/26 10:21, Leizhen (ThunderTown) wrote:
>
>
> On 2020/10/23 15:17, Arnd Bergmann wrote:
>> On Sun, Oct 18, 2020 at 4:10 AM Leizhen (ThunderTown)
>> <[email protected]> wrote:
>>> On 2020/10/17 3:27, Florian Fainelli wrote:
>>>> On 10/16/20 11:23 AM, Arnd Bergmann wrote:
>>>>> On Fri, Oct 16, 2020 at 6:48 PM Florian Fainelli <[email protected]> wrote:
>>>>>> On 10/16/20 4:01 AM, Arnd Bergmann wrote:
>>>>>>> On Fri, Oct 16, 2020 at 11:09 AM Zhen Lei <[email protected]> wrote:
>>>>>>>>
>>>>>>>> Suggested-by: Arnd Bergmann <[email protected]>
>>>>>>>> Signed-off-by: Zhen Lei <[email protected]>
>>>>>>>
>>>>>>> Acked-by: Arnd Bergmann <[email protected]>
>>>>>>>
>>>>>>> I see that at least the 'bcd' and 'xhci' devices in fact try to
>>>>>>> use 64-bit DMA. It would be good to test this on actual
>>>>>>> hardware to ensure that it works correctly when this is enabled.
>>>>>>>
>>>>>>> Ideally avoiding the swiotlb bounce buffering should only
>>>>>>> make it faster here, but there are many chips on which
>>>>>>> 64-bit DMA is broken in some form.
>>>>>>
>>>>>> Is this change really an improvement though? This 'usb' pseudo bus node
>>>>>> could just keep being defined with #address-cells = <1> and #size-cells
>>>>>> = <1> so as to satisfy the 'reg' definition however we could just adjust
>>>>>> dma-ranges to indicate full 64-bit addressing capability. Would not that
>>>>>> work?
>>>>>
>>>>> When #address-cells is '1', you cannot specify dma-ranges that
>>>>> go beyond a 32-bit address range.
>>>>
>>>> Would not it be enough to remove the 'dma-ranges' property though? Sorry
>>>> for being slow here.
>>>
>>> Remove the 'dma-ranges' property should also work. After all, it is equivalent
>>> to the original empty dma-ranges scheme. In addition, since the IOMMU nodes are
>>> defined, it should be enabled.
>>
>> Are you sure? I was expecting the IOMMU not to get used here since
>> the devices do contain list an 'iommus' property.
>
> OK,If the SMMU maybe disabled, then your proposal is necessary.
>
>>
>> Arnd
>>
>> .
>>

2020-11-09 17:30:27

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On 11/8/20 10:18 PM, Leizhen (ThunderTown) wrote:
> Hi, everybody:
> How do we deal with this problem? I updated the kernel to the latest and the problem still persists.
>
> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j24 dtbs 2>err.txt
> vim err.txt
>
> 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/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)

I was hoping that Ray or Scott could give this a try, and TBH, I am
still not a big fan of having to mangle the 'reg' property to be
compatible with #address-cells = <2> and #size-cells = <2>, I would have
preferred omitting the 'dma-ranges' property entirely.

We have plenty of time to get this patch applied for v5.11.
--
Florian

2020-11-09 17:58:41

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On Mon, Nov 9, 2020 at 6:30 PM Florian Fainelli <[email protected]> wrote:
>
> On 11/8/20 10:18 PM, Leizhen (ThunderTown) wrote:
> > Hi, everybody:
> > How do we deal with this problem? I updated the kernel to the latest and the problem still persists.
> >
> > make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j24 dtbs 2>err.txt
> > vim err.txt
> >
> > 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/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)
>
> I was hoping that Ray or Scott could give this a try, and TBH, I am
> still not a big fan of having to mangle the 'reg' property to be
> compatible with #address-cells = <2> and #size-cells = <2>, I would have
> preferred omitting the 'dma-ranges' property entirely.
>
> We have plenty of time to get this patch applied for v5.11.

I would much prefer to get the warning fixed for v5.10, once we know what the
hardware can or cannot actually do, as it is one of the warnings that shows
up in every kernelci build.

Arnd

2020-11-09 18:04:11

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On 11/9/20 9:56 AM, Arnd Bergmann wrote:
> On Mon, Nov 9, 2020 at 6:30 PM Florian Fainelli <[email protected]> wrote:
>>
>> On 11/8/20 10:18 PM, Leizhen (ThunderTown) wrote:
>>> Hi, everybody:
>>> How do we deal with this problem? I updated the kernel to the latest and the problem still persists.
>>>
>>> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j24 dtbs 2>err.txt
>>> vim err.txt
>>>
>>> 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/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)
>>
>> I was hoping that Ray or Scott could give this a try, and TBH, I am
>> still not a big fan of having to mangle the 'reg' property to be
>> compatible with #address-cells = <2> and #size-cells = <2>, I would have
>> preferred omitting the 'dma-ranges' property entirely.
>>
>> We have plenty of time to get this patch applied for v5.11.
>
> I would much prefer to get the warning fixed for v5.10, once we know what the
> hardware can or cannot actually do, as it is one of the warnings that shows
> up in every kernelci build.

OK, in that case:

Acked-by: Florian Fainelli <[email protected]>

feel free to pick those patches directly for 5.10 fixes. Thanks!
--
Florian

2020-11-11 04:46:45

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] arm64: dts: qcom: clear the warnings caused by empty dma-ranges

On Fri 16 Oct 04:08 CDT 2020, Zhen Lei wrote:

> The scripts/dtc/checks.c requires that the node have empty "dma-ranges"
> property must have the same "#address-cells" and "#size-cells" values as
> the parent node. Otherwise, the following warnings is reported:
>
> 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)
>
> Arnd Bergmann figured out why it's necessary:
> 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.
>
> Suggested-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Zhen Lei <[email protected]>

Thanks for fixing this up Zhen!

Reviewed-by: Bjorn Andersson <[email protected]>

and applied for 5.11.

Regards,
Bjorn

> ---
> arch/arm64/boot/dts/qcom/ipq6018.dtsi | 72 +++++++++++++++++------------------
> 1 file changed, 36 insertions(+), 36 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
> index a94dac76bf3fbdd..59e0cbfa2214305 100644
> --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
> +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
> @@ -179,22 +179,22 @@
> };
>
> soc: soc {
> - #address-cells = <1>;
> - #size-cells = <1>;
> - ranges = <0 0 0 0xffffffff>;
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges = <0 0 0 0 0x0 0xffffffff>;
> dma-ranges;
> compatible = "simple-bus";
>
> prng: qrng@e1000 {
> compatible = "qcom,prng-ee";
> - reg = <0xe3000 0x1000>;
> + reg = <0x0 0xe3000 0x0 0x1000>;
> clocks = <&gcc GCC_PRNG_AHB_CLK>;
> clock-names = "core";
> };
>
> cryptobam: dma@704000 {
> compatible = "qcom,bam-v1.7.0";
> - reg = <0x00704000 0x20000>;
> + reg = <0x0 0x00704000 0x0 0x20000>;
> interrupts = <GIC_SPI 207 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&gcc GCC_CRYPTO_AHB_CLK>;
> clock-names = "bam_clk";
> @@ -206,7 +206,7 @@
>
> crypto: crypto@73a000 {
> compatible = "qcom,crypto-v5.1";
> - reg = <0x0073a000 0x6000>;
> + reg = <0x0 0x0073a000 0x0 0x6000>;
> clocks = <&gcc GCC_CRYPTO_AHB_CLK>,
> <&gcc GCC_CRYPTO_AXI_CLK>,
> <&gcc GCC_CRYPTO_CLK>;
> @@ -217,7 +217,7 @@
>
> tlmm: pinctrl@1000000 {
> compatible = "qcom,ipq6018-pinctrl";
> - reg = <0x01000000 0x300000>;
> + reg = <0x0 0x01000000 0x0 0x300000>;
> interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
> gpio-controller;
> #gpio-cells = <2>;
> @@ -235,7 +235,7 @@
>
> gcc: gcc@1800000 {
> compatible = "qcom,gcc-ipq6018";
> - reg = <0x01800000 0x80000>;
> + reg = <0x0 0x01800000 0x0 0x80000>;
> clocks = <&xo>, <&sleep_clk>;
> clock-names = "xo", "sleep_clk";
> #clock-cells = <1>;
> @@ -244,17 +244,17 @@
>
> tcsr_mutex_regs: syscon@1905000 {
> compatible = "syscon";
> - reg = <0x01905000 0x8000>;
> + reg = <0x0 0x01905000 0x0 0x8000>;
> };
>
> tcsr_q6: syscon@1945000 {
> compatible = "syscon";
> - reg = <0x01945000 0xe000>;
> + reg = <0x0 0x01945000 0x0 0xe000>;
> };
>
> blsp_dma: dma@7884000 {
> compatible = "qcom,bam-v1.7.0";
> - reg = <0x07884000 0x2b000>;
> + reg = <0x0 0x07884000 0x0 0x2b000>;
> interrupts = <GIC_SPI 238 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&gcc GCC_BLSP1_AHB_CLK>;
> clock-names = "bam_clk";
> @@ -264,7 +264,7 @@
>
> blsp1_uart3: serial@78b1000 {
> compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
> - reg = <0x078b1000 0x200>;
> + reg = <0x0 0x078b1000 0x0 0x200>;
> interrupts = <GIC_SPI 306 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&gcc GCC_BLSP1_UART3_APPS_CLK>,
> <&gcc GCC_BLSP1_AHB_CLK>;
> @@ -276,7 +276,7 @@
> compatible = "qcom,spi-qup-v2.2.1";
> #address-cells = <1>;
> #size-cells = <0>;
> - reg = <0x078b5000 0x600>;
> + reg = <0x0 0x078b5000 0x0 0x600>;
> interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
> spi-max-frequency = <50000000>;
> clocks = <&gcc GCC_BLSP1_QUP1_SPI_APPS_CLK>,
> @@ -291,7 +291,7 @@
> compatible = "qcom,spi-qup-v2.2.1";
> #address-cells = <1>;
> #size-cells = <0>;
> - reg = <0x078b6000 0x600>;
> + reg = <0x0 0x078b6000 0x0 0x600>;
> interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
> spi-max-frequency = <50000000>;
> clocks = <&gcc GCC_BLSP1_QUP2_SPI_APPS_CLK>,
> @@ -306,7 +306,7 @@
> compatible = "qcom,i2c-qup-v2.2.1";
> #address-cells = <1>;
> #size-cells = <0>;
> - reg = <0x078b6000 0x600>;
> + reg = <0x0 0x078b6000 0x0 0x600>;
> interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&gcc GCC_BLSP1_AHB_CLK>,
> <&gcc GCC_BLSP1_QUP2_I2C_APPS_CLK>;
> @@ -321,7 +321,7 @@
> compatible = "qcom,i2c-qup-v2.2.1";
> #address-cells = <1>;
> #size-cells = <0>;
> - reg = <0x078b7000 0x600>;
> + reg = <0x0 0x078b7000 0x0 0x600>;
> interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&gcc GCC_BLSP1_AHB_CLK>,
> <&gcc GCC_BLSP1_QUP3_I2C_APPS_CLK>;
> @@ -336,24 +336,24 @@
> compatible = "qcom,msm-qgic2";
> interrupt-controller;
> #interrupt-cells = <0x3>;
> - reg = <0x0b000000 0x1000>, /*GICD*/
> - <0x0b002000 0x1000>, /*GICC*/
> - <0x0b001000 0x1000>, /*GICH*/
> - <0x0b004000 0x1000>; /*GICV*/
> + reg = <0x0 0x0b000000 0x0 0x1000>, /*GICD*/
> + <0x0 0x0b002000 0x0 0x1000>, /*GICC*/
> + <0x0 0x0b001000 0x0 0x1000>, /*GICH*/
> + <0x0 0x0b004000 0x0 0x1000>; /*GICV*/
> interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
> };
>
> watchdog@b017000 {
> compatible = "qcom,kpss-wdt";
> interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
> - reg = <0x0b017000 0x40>;
> + reg = <0x0 0x0b017000 0x0 0x40>;
> clocks = <&sleep_clk>;
> timeout-sec = <10>;
> };
>
> apcs_glb: mailbox@b111000 {
> compatible = "qcom,ipq6018-apcs-apps-global";
> - reg = <0x0b111000 0x1000>;
> + reg = <0x0 0x0b111000 0x0 0x1000>;
> #clock-cells = <1>;
> clocks = <&a53pll>, <&xo>;
> clock-names = "pll", "xo";
> @@ -362,7 +362,7 @@
>
> a53pll: clock@b116000 {
> compatible = "qcom,ipq6018-a53pll";
> - reg = <0x0b116000 0x40>;
> + reg = <0x0 0x0b116000 0x0 0x40>;
> #clock-cells = <0>;
> clocks = <&xo>;
> clock-names = "xo";
> @@ -377,68 +377,68 @@
> };
>
> timer@b120000 {
> - #address-cells = <1>;
> - #size-cells = <1>;
> + #address-cells = <2>;
> + #size-cells = <2>;
> ranges;
> compatible = "arm,armv7-timer-mem";
> - reg = <0x0b120000 0x1000>;
> + reg = <0x0 0x0b120000 0x0 0x1000>;
> clock-frequency = <19200000>;
>
> frame@b120000 {
> frame-number = <0>;
> interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
> <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
> - reg = <0x0b121000 0x1000>,
> - <0x0b122000 0x1000>;
> + reg = <0x0 0x0b121000 0x0 0x1000>,
> + <0x0 0x0b122000 0x0 0x1000>;
> };
>
> frame@b123000 {
> frame-number = <1>;
> interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
> - reg = <0xb123000 0x1000>;
> + reg = <0x0 0xb123000 0x0 0x1000>;
> status = "disabled";
> };
>
> frame@b124000 {
> frame-number = <2>;
> interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
> - reg = <0x0b124000 0x1000>;
> + reg = <0x0 0x0b124000 0x0 0x1000>;
> status = "disabled";
> };
>
> frame@b125000 {
> frame-number = <3>;
> interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
> - reg = <0x0b125000 0x1000>;
> + reg = <0x0 0x0b125000 0x0 0x1000>;
> status = "disabled";
> };
>
> frame@b126000 {
> frame-number = <4>;
> interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
> - reg = <0x0b126000 0x1000>;
> + reg = <0x0 0x0b126000 0x0 0x1000>;
> status = "disabled";
> };
>
> frame@b127000 {
> frame-number = <5>;
> interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
> - reg = <0x0b127000 0x1000>;
> + reg = <0x0 0x0b127000 0x0 0x1000>;
> status = "disabled";
> };
>
> frame@b128000 {
> frame-number = <6>;
> interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
> - reg = <0x0b128000 0x1000>;
> + reg = <0x0 0x0b128000 0x0 0x1000>;
> status = "disabled";
> };
> };
>
> q6v5_wcss: remoteproc@cd00000 {
> compatible = "qcom,ipq8074-wcss-pil";
> - reg = <0x0cd00000 0x4040>,
> - <0x004ab000 0x20>;
> + reg = <0x0 0x0cd00000 0x0 0x4040>,
> + <0x0 0x004ab000 0x0 0x20>;
> reg-names = "qdsp6",
> "rmb";
> interrupts-extended = <&intc GIC_SPI 325 IRQ_TYPE_EDGE_RISING>,
> --
> 1.8.3
>
>

2020-11-28 05:04:10

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On Fri, 16 Oct 2020 17:08:32 +0800, Zhen Lei <[email protected]> wrote:
> The scripts/dtc/checks.c requires that the node have empty "dma-ranges"
> property must have the same "#address-cells" and "#size-cells" values as
> the parent node. Otherwise, the following warnings is reported:
>
> 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)
>
> Arnd Bergmann figured out why it's necessary:
> 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.
>
> Suggested-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Zhen Lei <[email protected]>
> ---

Applied to devicetree-arm64/next, thanks!
--
Florian

2020-11-28 22:03:05

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On Sat, Nov 28, 2020 at 5:53 AM Florian Fainelli <[email protected]> wrote:
>
> On Fri, 16 Oct 2020 17:08:32 +0800, Zhen Lei <[email protected]> wrote:
> > The scripts/dtc/checks.c requires that the node have empty "dma-ranges"
> > property must have the same "#address-cells" and "#size-cells" values as
> > the parent node. Otherwise, the following warnings is reported:
> >
> > 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)
> >
> > Arnd Bergmann figured out why it's necessary:
> > 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.
> >
> > Suggested-by: Arnd Bergmann <[email protected]>
> > Signed-off-by: Zhen Lei <[email protected]>
> > ---
>
> Applied to devicetree-arm64/next, thanks!

The notification may have gone missing, but I had merged it into v5.10-fixes
already, and as of today, it's in mainline, so you can drop it from your
next branch, or just leave it in if you want to avoid taking things out of
your tree.

Arnd

2020-12-14 19:19:51

by Ray Jui

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

+ Bharat

On 11/28/2020 1:58 AM, Arnd Bergmann wrote:
> On Sat, Nov 28, 2020 at 5:53 AM Florian Fainelli <[email protected]> wrote:
>>
>> On Fri, 16 Oct 2020 17:08:32 +0800, Zhen Lei <[email protected]> wrote:
>>> The scripts/dtc/checks.c requires that the node have empty "dma-ranges"
>>> property must have the same "#address-cells" and "#size-cells" values as
>>> the parent node. Otherwise, the following warnings is reported:
>>>
>>> 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)
>>>
>>> Arnd Bergmann figured out why it's necessary:
>>> 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.
>>>
>>> Suggested-by: Arnd Bergmann <[email protected]>
>>> Signed-off-by: Zhen Lei <[email protected]>
>>> ---
>>
>> Applied to devicetree-arm64/next, thanks!
>
> The notification may have gone missing, but I had merged it into v5.10-fixes
> already, and as of today, it's in mainline, so you can drop it from your
> next branch, or just leave it in if you want to avoid taking things out of
> your tree.
>
> Arnd
>

It looks like this patch might have caused a regression on Stingray USB.
Bharat, could you please confirm?

The fix would be to properly define the dma-ranges to be 32-bit (0x0 ~
0xffffffff) since IOMMU is disabled on this device and the device's DMA
engine is on a 32-bit bus.

Thanks,

Ray





--
This electronic communication and the information and any files transmitted
with it, or attached to it, are confidential and are intended solely for
the use of the individual or entity to whom it is addressed and may contain
information that is confidential, legally privileged, protected by privacy
laws, or otherwise restricted from disclosure to anyone else. If you are
not the intended recipient or the person responsible for delivering the
e-mail to the intended recipient, you are hereby notified that any use,
copying, distributing, dissemination, forwarding, printing, or copying of
this e-mail is strictly prohibited. If you received this e-mail in error,
please return the e-mail to the sender, delete it from your computer, and
destroy any printed copy of it.


Attachments:
smime.p7s (4.05 kB)
S/MIME Cryptographic Signature

2020-12-15 15:44:08

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges



On 12/14/2020 11:46 AM, Arnd Bergmann wrote:
> On Mon, Dec 14, 2020 at 8:09 PM Ray Jui <[email protected]> wrote:
>> On 11/28/2020 1:58 AM, Arnd Bergmann wrote:
>>> On Sat, Nov 28, 2020 at 5:53 AM Florian Fainelli <[email protected]> wrote:
>>>>
>>>> On Fri, 16 Oct 2020 17:08:32 +0800, Zhen Lei <[email protected]> wrote:
>>>>> The scripts/dtc/checks.c requires that the node have empty "dma-ranges"
>>>>> property must have the same "#address-cells" and "#size-cells" values as
>>>>> the parent node. Otherwise, the following warnings is reported:
>>>>>
>>>>> 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)
>>>>>
>>>>> Arnd Bergmann figured out why it's necessary:
>>>>> 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.
>>>>>
>>>>> Suggested-by: Arnd Bergmann <[email protected]>
>>>>> Signed-off-by: Zhen Lei <[email protected]>
>>>>> ---
>>>>
>>>> Applied to devicetree-arm64/next, thanks!
>>>
>>> The notification may have gone missing, but I had merged it into v5.10-fixes
>>> already, and as of today, it's in mainline, so you can drop it from your
>>> next branch, or just leave it in if you want to avoid taking things out of
>>> your tree.
>>
>> It looks like this patch might have caused a regression on Stingray USB.
>> Bharat, could you please confirm?
>
> Well, this is what I had asked about originally, I assumed that
> Florian had asked someone with access to the datasheet.

It looks like we had some bad communication here, the notification email
indicating that you had applied the patch did not make it through, and I
failed to make you aware that I was waiting for some testing from Scott
and Ray.
--
Florian

2020-12-15 15:48:10

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges



On 12/15/2020 5:19 AM, Bharat Gooty wrote:
> Since the IOMMU is disabled and DMA engine is on 32-bit bus, We can not
> give the complete DDR for the USB DMA.
> So restricting the usable DAM size to 4GB.

Thanks, can you make this a proper patch submission along with a Fixes:
tag that is:

Fixes: 2013a4b684b6 ("arm64: dts: broadcom: clear the warnings caused by
empty dma-ranges")
--
Florian

2020-12-15 15:53:16

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On Tue, Dec 15, 2020 at 4:41 PM Florian Fainelli <[email protected]> wrote:
>
> On 12/15/2020 5:19 AM, Bharat Gooty wrote:
> > Since the IOMMU is disabled and DMA engine is on 32-bit bus, We can not
> > give the complete DDR for the USB DMA.
> > So restricting the usable DAM size to 4GB.
>
> Thanks, can you make this a proper patch submission along with a Fixes:
> tag that is:
>
> Fixes: 2013a4b684b6 ("arm64: dts: broadcom: clear the warnings caused by
> empty dma-ranges")

Yes, that would be helpful, though I would appreciate a better description
that explains what is actually going on: is it the device or the bus that
has the 32-bit limitation, and if it is indeed a bug in the device, why do
you pretend that this is a 64-bit device on a 32-bit bus instead (this
could also use a comment in the dts file)?

Arnd

2021-01-12 18:30:26

by Ray Jui

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

Hi Arnd,

On 2020-12-15 7:49 a.m., Arnd Bergmann wrote:
> On Tue, Dec 15, 2020 at 4:41 PM Florian Fainelli <[email protected]> wrote:
>>
>> On 12/15/2020 5:19 AM, Bharat Gooty wrote:
>>> Since the IOMMU is disabled and DMA engine is on 32-bit bus, We can not
>>> give the complete DDR for the USB DMA.
>>> So restricting the usable DAM size to 4GB.
>>
>> Thanks, can you make this a proper patch submission along with a Fixes:
>> tag that is:
>>
>> Fixes: 2013a4b684b6 ("arm64: dts: broadcom: clear the warnings caused by
>> empty dma-ranges")
>
> Yes, that would be helpful, though I would appreciate a better description
> that explains what is actually going on: is it the device or the bus that
> has the 32-bit limitation, and if it is indeed a bug in the device, why do
> you pretend that this is a 64-bit device on a 32-bit bus instead (this
> could also use a comment in the dts file)?
>
> Arnd
>

Sorry for the delay in reply. Bharat finally got time to do some
investigation to confirm the following:

These USB controllers indeed can address 64-bit. However, on the bus
internally, only 40-bits are connected to the interconnect of CCN. As a
result, the 'dma-ranges' should be modified to address 40-bit in size.

We also have a somewhat related question, is it true that since v5.10,
defining of 'dma-ranges' on the bus node where its child device node has
implication of IOMMU usage (through 'iommus' or 'iommu-map') is now
mandatory? My understanding is that the 'dma-ranges' in this scheme will
define the IOVA address to system address mapping required by all
devices on that bus. Please help to confirm if my understanding is correct.

Thanks,

Ray


Attachments:
smime.p7s (4.05 kB)
S/MIME Cryptographic Signature

2021-01-13 02:33:25

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On Tue, Jan 12, 2021 at 7:28 PM Ray Jui <[email protected]> wrote:
> On 2020-12-15 7:49 a.m., Arnd Bergmann wrote:
> > On Tue, Dec 15, 2020 at 4:41 PM Florian Fainelli <[email protected]> wrote:
> >>
> >> On 12/15/2020 5:19 AM, Bharat Gooty wrote:
> >>> Since the IOMMU is disabled and DMA engine is on 32-bit bus, We can not
> >>> give the complete DDR for the USB DMA.
> >>> So restricting the usable DAM size to 4GB.
> >>
> >> Thanks, can you make this a proper patch submission along with a Fixes:
> >> tag that is:
> >>
> >> Fixes: 2013a4b684b6 ("arm64: dts: broadcom: clear the warnings caused by
> >> empty dma-ranges")
> >
> > Yes, that would be helpful, though I would appreciate a better description
> > that explains what is actually going on: is it the device or the bus that
> > has the 32-bit limitation, and if it is indeed a bug in the device, why do
> > you pretend that this is a 64-bit device on a 32-bit bus instead (this
> > could also use a comment in the dts file)?
> >
> > Arnd
> >
>
> Sorry for the delay in reply. Bharat finally got time to do some
> investigation to confirm the following:
>
> These USB controllers indeed can address 64-bit. However, on the bus
> internally, only 40-bits are connected to the interconnect of CCN. As a
> result, the 'dma-ranges' should be modified to address 40-bit in size.

a 40-bit range is effectively the same as a 64-bit range though, so I
think you'll still need a driver quirk if the device cannot use the whole 40
bit addressing but is limited to 32 bits because of a bug in its dma engine.

> We also have a somewhat related question, is it true that since v5.10,
> defining of 'dma-ranges' on the bus node where its child device node has
> implication of IOMMU usage (through 'iommus' or 'iommu-map') is now
> mandatory? My understanding is that the 'dma-ranges' in this scheme will
> define the IOVA address to system address mapping required by all
> devices on that bus. Please help to confirm if my understanding is correct

I have not actually seen that change. In general, you should always
have a dma-ranges property in the parent of a DMA master, I think
we just never enforced that and fall back to a 32-bit mask by default.

Arnd

2021-01-13 02:35:53

by Ray Jui

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges



On 1/12/2021 12:40 PM, Arnd Bergmann wrote:
> On Tue, Jan 12, 2021 at 7:28 PM Ray Jui <[email protected]> wrote:
>> On 2020-12-15 7:49 a.m., Arnd Bergmann wrote:
>>> On Tue, Dec 15, 2020 at 4:41 PM Florian Fainelli <[email protected]> wrote:
>>>>
>>>> On 12/15/2020 5:19 AM, Bharat Gooty wrote:
>>>>> Since the IOMMU is disabled and DMA engine is on 32-bit bus, We can not
>>>>> give the complete DDR for the USB DMA.
>>>>> So restricting the usable DAM size to 4GB.
>>>>
>>>> Thanks, can you make this a proper patch submission along with a Fixes:
>>>> tag that is:
>>>>
>>>> Fixes: 2013a4b684b6 ("arm64: dts: broadcom: clear the warnings caused by
>>>> empty dma-ranges")
>>>
>>> Yes, that would be helpful, though I would appreciate a better description
>>> that explains what is actually going on: is it the device or the bus that
>>> has the 32-bit limitation, and if it is indeed a bug in the device, why do
>>> you pretend that this is a 64-bit device on a 32-bit bus instead (this
>>> could also use a comment in the dts file)?
>>>
>>> Arnd
>>>
>>
>> Sorry for the delay in reply. Bharat finally got time to do some
>> investigation to confirm the following:
>>
>> These USB controllers indeed can address 64-bit. However, on the bus
>> internally, only 40-bits are connected to the interconnect of CCN. As a
>> result, the 'dma-ranges' should be modified to address 40-bit in size.
>
> a 40-bit range is effectively the same as a 64-bit range though, so I
> think you'll still need a driver quirk if the device cannot use the whole 40
> bit addressing but is limited to 32 bits because of a bug in its dma engine.
>

Bharat can correct me if I'm wrong, but I don't think we have a bug in
the USB DMA engine that causes it can only address 32-bit. I believe we
can set dma-ranges size to 40-bit here.

The dma-range property is though required to be specified, instead of
leaving it as empty, with the use of IOMMU. That seems to be a v5.10
specific behavior as I described below.

Thanks,

Ray

>> We also have a somewhat related question, is it true that since v5.10,
>> defining of 'dma-ranges' on the bus node where its child device node has
>> implication of IOMMU usage (through 'iommus' or 'iommu-map') is now
>> mandatory? My understanding is that the 'dma-ranges' in this scheme will
>> define the IOVA address to system address mapping required by all
>> devices on that bus. Please help to confirm if my understanding is correct
>
> I have not actually seen that change. In general, you should always
> have a dma-ranges property in the parent of a DMA master, I think
> we just never enforced that and fall back to a 32-bit mask by default.
>
> Arnd
>


Attachments:
smime.p7s (4.05 kB)
S/MIME Cryptographic Signature

2021-01-13 03:48:09

by Bharat Gooty

[permalink] [raw]
Subject: RE: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

Hello Ray,

I had cross checked with Design and integration team.
Yes we can set the "dma-rages" to 40 bit DMA ranges. Tested, it is working.

Thanks,
-Bharat

-----Original Message-----
From: Ray Jui <[email protected]>
Sent: Wednesday, January 13, 2021 2:28 AM
To: Arnd Bergmann <[email protected]>
Cc: Florian Fainelli <[email protected]>; Bharat Gooty
<[email protected]>; devicetree <[email protected]>;
linux-kernel <[email protected]>; Arnd Bergmann <[email protected]>;
Scott Branden <[email protected]>; Ray Jui <[email protected]>;
linux-arm-msm <[email protected]>; Andy Gross
<[email protected]>; Bjorn Andersson <[email protected]>; Rob
Herring <[email protected]>; bcm-kernel-feedback-list
<[email protected]>; Zhen Lei
<[email protected]>; linux-arm-kernel
<[email protected]>
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused
by empty dma-ranges



On 1/12/2021 12:40 PM, Arnd Bergmann wrote:
> On Tue, Jan 12, 2021 at 7:28 PM Ray Jui <[email protected]> wrote:
>> On 2020-12-15 7:49 a.m., Arnd Bergmann wrote:
>>> On Tue, Dec 15, 2020 at 4:41 PM Florian Fainelli <[email protected]>
>>> wrote:
>>>>
>>>> On 12/15/2020 5:19 AM, Bharat Gooty wrote:
>>>>> Since the IOMMU is disabled and DMA engine is on 32-bit bus, We can
>>>>> not
>>>>> give the complete DDR for the USB DMA.
>>>>> So restricting the usable DAM size to 4GB.
>>>>
>>>> Thanks, can you make this a proper patch submission along with a Fixes:
>>>> tag that is:
>>>>
>>>> Fixes: 2013a4b684b6 ("arm64: dts: broadcom: clear the warnings caused
>>>> by
>>>> empty dma-ranges")
>>>
>>> Yes, that would be helpful, though I would appreciate a better
>>> description
>>> that explains what is actually going on: is it the device or the bus
>>> that
>>> has the 32-bit limitation, and if it is indeed a bug in the device, why
>>> do
>>> you pretend that this is a 64-bit device on a 32-bit bus instead (this
>>> could also use a comment in the dts file)?
>>>
>>> Arnd
>>>
>>
>> Sorry for the delay in reply. Bharat finally got time to do some
>> investigation to confirm the following:
>>
>> These USB controllers indeed can address 64-bit. However, on the bus
>> internally, only 40-bits are connected to the interconnect of CCN. As a
>> result, the 'dma-ranges' should be modified to address 40-bit in size.
>
> a 40-bit range is effectively the same as a 64-bit range though, so I
> think you'll still need a driver quirk if the device cannot use the whole
> 40
> bit addressing but is limited to 32 bits because of a bug in its dma
> engine.
>

Bharat can correct me if I'm wrong, but I don't think we have a bug in
the USB DMA engine that causes it can only address 32-bit. I believe we
can set dma-ranges size to 40-bit here.

The dma-range property is though required to be specified, instead of
leaving it as empty, with the use of IOMMU. That seems to be a v5.10
specific behavior as I described below.

Thanks,

Ray

>> We also have a somewhat related question, is it true that since v5.10,
>> defining of 'dma-ranges' on the bus node where its child device node has
>> implication of IOMMU usage (through 'iommus' or 'iommu-map') is now
>> mandatory? My understanding is that the 'dma-ranges' in this scheme will
>> define the IOVA address to system address mapping required by all
>> devices on that bus. Please help to confirm if my understanding is
>> correct
>
> I have not actually seen that change. In general, you should always
> have a dma-ranges property in the parent of a DMA master, I think
> we just never enforced that and fall back to a 32-bit mask by default.
>
> Arnd
>

--
This electronic communication and the information and any files transmitted
with it, or attached to it, are confidential and are intended solely for
the use of the individual or entity to whom it is addressed and may contain
information that is confidential, legally privileged, protected by privacy
laws, or otherwise restricted from disclosure to anyone else. If you are
not the intended recipient or the person responsible for delivering the
e-mail to the intended recipient, you are hereby notified that any use,
copying, distributing, dissemination, forwarding, printing, or copying of
this e-mail is strictly prohibited. If you received this e-mail in error,
please return the e-mail to the sender, delete it from your computer, and
destroy any printed copy of it.


Attachments:
smime.p7s (4.07 kB)
S/MIME Cryptographic Signature

2021-01-13 08:08:37

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On Wed, Jan 13, 2021 at 4:42 AM Bharat Gooty <[email protected]> wrote:
>
> Hello Ray,
>
> I had cross checked with Design and integration team.
> Yes we can set the "dma-rages" to 40 bit DMA ranges. Tested, it is working.
>
> -----Original Message-----
> From: Ray Jui <[email protected]>
>
> Bharat can correct me if I'm wrong, but I don't think we have a bug in
> the USB DMA engine that causes it can only address 32-bit. I believe we
> can set dma-ranges size to 40-bit here.
>
> The dma-range property is though required to be specified, instead of
> leaving it as empty, with the use of IOMMU. That seems to be a v5.10
> specific behavior as I described below.

Ok, thanks for double-checking. I had misremembered the version
that actually went into the as the one that used 64-bit dma-ranges
and thought that was what broke, rather than the version without
dma-ranges.

If any of you want to send me that bugfix directly, or have Florian
pick it up through his fixes branch, I'll make sure we get it into v5.11.

Arnd

2021-01-13 16:59:13

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

On 1/13/21 12:05 AM, Arnd Bergmann wrote:
> On Wed, Jan 13, 2021 at 4:42 AM Bharat Gooty <[email protected]> wrote:
>>
>> Hello Ray,
>>
>> I had cross checked with Design and integration team.
>> Yes we can set the "dma-rages" to 40 bit DMA ranges. Tested, it is working.
>>
>> -----Original Message-----
>> From: Ray Jui <[email protected]>
>>
>> Bharat can correct me if I'm wrong, but I don't think we have a bug in
>> the USB DMA engine that causes it can only address 32-bit. I believe we
>> can set dma-ranges size to 40-bit here.
>>
>> The dma-range property is though required to be specified, instead of
>> leaving it as empty, with the use of IOMMU. That seems to be a v5.10
>> specific behavior as I described below.
>
> Ok, thanks for double-checking. I had misremembered the version
> that actually went into the as the one that used 64-bit dma-ranges
> and thought that was what broke, rather than the version without
> dma-ranges.
>
> If any of you want to send me that bugfix directly, or have Florian
> pick it up through his fixes branch, I'll make sure we get it into v5.11.

I have another change for v5.11 that I would like to send, so please do
send a bugfix when you get a chance and we can lump those two changes
together, say, by the end of the week?
--
Florian

2021-01-13 17:48:45

by Ray Jui

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges

Hi Bharat,

On 1/13/2021 8:55 AM, Florian Fainelli wrote:
> On 1/13/21 12:05 AM, Arnd Bergmann wrote:
>> On Wed, Jan 13, 2021 at 4:42 AM Bharat Gooty <[email protected]> wrote:
>>>
>>> Hello Ray,
>>>
>>> I had cross checked with Design and integration team.
>>> Yes we can set the "dma-rages" to 40 bit DMA ranges. Tested, it is working.
>>>
>>> -----Original Message-----
>>> From: Ray Jui <[email protected]>
>>>
>>> Bharat can correct me if I'm wrong, but I don't think we have a bug in
>>> the USB DMA engine that causes it can only address 32-bit. I believe we
>>> can set dma-ranges size to 40-bit here.
>>>
>>> The dma-range property is though required to be specified, instead of
>>> leaving it as empty, with the use of IOMMU. That seems to be a v5.10
>>> specific behavior as I described below.
>>
>> Ok, thanks for double-checking. I had misremembered the version
>> that actually went into the as the one that used 64-bit dma-ranges
>> and thought that was what broke, rather than the version without
>> dma-ranges.
>>
>> If any of you want to send me that bugfix directly, or have Florian
>> pick it up through his fixes branch, I'll make sure we get it into v5.11.
>
> I have another change for v5.11 that I would like to send, so please do
> send a bugfix when you get a chance and we can lump those two changes
> together, say, by the end of the week?
>

Would you be able to help to send this out by the end of this week as
Florian advised? Your previous patch with the extension to 40-bit in
size plus a fixes-by tag should do!

Thanks!

Ray


Attachments:
smime.p7s (4.05 kB)
S/MIME Cryptographic Signature