media: iris: Restrict lower IOVA range for Venus and Iris VPUs
Subsystems (9)
Vikash Garodia
maintainercover media: iris: Restrict lower IOVA range for Venus and Iris VPUs
Qualcomm venus and iris VPUs reserve IOVA addresses below 0x25800000 (600MB) for non-pixel stream ID in secure mode. When the kernel allocates DMA mappings from this restricted range, the VPU generate unhandled SMMU page faults, leading to video failures and, in some cases, spontaneous system reboots.
The issue is readily reproducible on affected platforms by running multiple concurrent video decode workloads, such as opening several browser tabs containing video streams.
To prevent allocations in the restricted region, this series introduces support for an IOMMU IOVA reserve memory-region in the Venus and Iris bindings and updates all affected device trees to reserve the low IOVA range [0, 0x25800000]. The memory-region is referenced by the video codec node, allowing the IOMMU layer to keep DMA allocations above the reserved boundary.
The series consists of:
* Binding updates for Venus and Iris schemas to permit an additional memory-region phandle describing the IOVA reservation.
* DTS updates for all affected Venus platforms.
* DTS updates for all affected Iris platforms.
This ensures that DMA allocations do not overlap restricted IOVA mappings for non-pixel stream IDs and prevents the resulting SMMU faults.
---
Daniel J Blueman (2):
dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region
arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Vikash Garodia (20):
dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region
dt-bindings: media: qcom,sc7180-venus: Allow IOVA reservation memory-region
arm64: dts: qcom: lemans: Reserve low IOVA range for Iris
arm64: dts: qcom: monaco: Reserve low IOVA range for Iris
arm64: dts: qcom: sc8280xp: Reserve low IOVA range for Iris
arm64: dts: qcom: sm8350: Reserve low IOVA range for Iris
arm64: dts: qcom: sm8550: Reserve low IOVA range for Iris
arm64: dts: qcom: sm8650: Reserve low IOVA range for Iris
arm64: dts: qcom: sm8750: Reserve low IOVA range for Iris
arm64: dts: qcom: agatti: Reserve low IOVA range for Venus
arm64: dts: qcom: kodiak: Reserve low IOVA range for Venus
arm64: dts: qcom: msm8916: Reserve low IOVA range for Venus
arm64: dts: qcom: msm8996: Reserve low IOVA range for Venus
arm64: dts: qcom: msm8998: Reserve low IOVA range for Venus
arm64: dts: qcom: sc7180: Reserve low IOVA range for Venus
arm64: dts: qcom: sdm630: Reserve low IOVA range for Venus
arm64: dts: qcom: sdm845: Reserve low IOVA range for Venus
arm64: dts: qcom: sm6115: Reserve low IOVA range for Venus
arm64: dts: qcom: sm8250: Reserve low IOVA range for Venus
arm64: dts: qcom: talos: Reserve low IOVA range for Venus
.../devicetree/bindings/media/qcom,sc7180-venus.yaml | 5 ++++- .../devicetree/bindings/media/qcom,sm8550-iris.yaml | 5 ++++- .../devicetree/bindings/media/qcom,venus-common.yaml | 5 ++++- arch/arm64/boot/dts/qcom/agatti.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/kodiak.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/lemans.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/monaco.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/msm8916.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/msm8996.dtsi | 14 +++++++++++++- arch/arm64/boot/dts/qcom/msm8998.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/qcs8550.dtsi | 11 +++++++++++ arch/arm64/boot/dts/qcom/sc7180.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/sdm630.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/sdm845.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/sm6115.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/sm8250.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/sm8350.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/sm8550.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/sm8650.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/sm8750.dtsi | 13 ++++++++++++- arch/arm64/boot/dts/qcom/talos.dtsi | 13 ++++++++++++- 23 files changed, 252 insertions(+), 22 deletions(-)
---
base-commit: 1701fda2f58e345c050f4309971bdc07cd6146ba
change-id: 20260807-iris_iova_600mb_fix-70f6ca25896d
Best regards,
Signature · 1 line
Vikash Garodia <[email protected]>
Vikash Garodia
maintainerPATCH 1/22 dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region
Non-pixel stream IDs should not allocate IOVA space from the 0 to 600MB restricted region, as this region is reserved exclusively for secure non-pixel.
In addition to the firmware-loaded codec carveout, platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from restricted IOVA range.
Permit a second memory-region phandle for this purpose, and describe the meaning of each entry so the ordering is unambiguous.
--- Documentation/devicetree/bindings/media/qcom,venus-common.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +4 -1
@@ -37,7 +37,10 @@ properties: maxItems: 20 memory-region: - maxItems: 1 + minItems: 1 + items: + - description: Firmware-loaded codec carveout + - description: IOMMU IOVA reservation region power-domains: minItems: 1
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 01/22] dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The patch updates `qcom,venus-common.yaml` to permit a second `memory-region` phandle for an…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch updates qcom,venus-common.yaml to permit a second memory-region phandle for an IOMMU IOVA reservation, but fails to remove a stale maxItems: 1 constraint from qcom,sc7180-venus.yaml. This prevents SC7180 devices from successfully validating if they supply the newly permitted second region. --
--- Patch [1]: [PATCH 01/22] dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region --- commit 44e20424e211e02ef9914abe4592c185ad0d75ac
Author: Vikash Garodia <[email protected]>
dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region
Non-pixel stream IDs should not allocate IOVA space from the 0 to 600MB restricted region, as this region is reserved exclusively for secure non-pixel.
In addition to the firmware-loaded codec carveout, platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from restricted IOVA range.
Permit a second memory-region phandle for this purpose, and describe the meaning of each entry so the ordering is unambiguous.
Documentation/devicetree/bindings/media/qcom,venus-common.yaml properties: · line 43
Quoted 13 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +4
-1@@ -37,7 +37,10 @@ properties: maxItems: 20 memory-region: - maxItems: 1 + minItems: 1 + items: + - description: Firmware-loaded codec carveout + - description: IOMMU IOVA reservation region
[Severity: Medium]
Since this patch expands the common schema to allow two memory-region items, should the local constraints in related variant schemas also be updated?
For example, the local constraint in qcom,sc7180-venus.yaml restricts the items to 1:
Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml:properties.memory-region {
...
memory-region:
maxItems: 1
...
}Because dt-schema evaluates a logical AND between local constraints and the included $ref schemas, won't SC7180 device trees fail dt_binding_check validation if they declare the newly permitted IOVA reservation region?
Quoted 3 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-0power-domains: minItems: 1
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Vikash Garodia
maintainerRe: [PATCH 01/22] dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region
Quoted 2 lines · On 8/7/2026 2:19 PM, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch updatesqcom,venus-common.yamlto permit a secondmemory-regionphandle for an IOMMU IOVA reservation, but fails to remove a stalemaxItems: 1constraint fromqcom,sc7180-venus.yaml. This prevents SC7180 devices from successfully validating if they supply the newly permitted second region.
patch #3 in this series incorporates this comment.
Quoted 55 lines
--
--- Patch [1]: [PATCH 01/22] dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region --- commit
44e20424e211e02ef9914abe4592c185ad0d75ac
Author: Vikash Garodia <[email protected]>dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region
Non-pixel stream IDs should not allocate IOVA space from the 0 to 600MB restricted region, as this region is reserved exclusively for secure non-pixel.
In addition to the firmware-loaded codec carveout, platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from restricted IOVA range.
Permit a second memory-region phandle for this purpose, and describe the meaning of each entry so the ordering is unambiguous.
Documentation/devicetree/bindings/media/qcom,venus-common.yaml properties: · line 43
Quoted 13 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +4
-1@@ -37,7 +37,10 @@ properties: maxItems: 20 memory-region: - maxItems: 1 + minItems: 1 + items: + - description: Firmware-loaded codec carveout + - description: IOMMU IOVA reservation region[Severity: Medium]
Since this patch expands the common schema to allow two memory-region items, should the local constraints in related variant schemas also be updated?For example, the local constraint in qcom,sc7180-venus.yaml restricts the items to 1:
Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml:properties.memory-region { ... memory-region: maxItems: 1 ... }Because dt-schema evaluates a logical AND between local constraints and the included $ref schemas, won't SC7180 device trees fail
dt_binding_checkvalidation if they declare the newly permitted IOVA reservation region?Quoted 3 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-0power-domains: minItems: 1
Vikash Garodia
maintainerPATCH 2/22 dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region
In reply to Vikash GarodiaFrom: Daniel J Blueman <[email protected]>
Non-pixel stream IDs should not allocate IOVA space from the 0 to 600MB restricted region, as this region is reserved exclusively for secure non-pixel.
In addition to the firmware-loaded codec carveout, Iris platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from restricted IOVA range.
Permit a second memory-region phandle for this purpose, and describe the meaning of each entry so the ordering is unambiguous.
--- Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +4 -1
@@ -84,7 +84,10 @@ properties: dma-coherent: true memory-region: - maxItems: 1 + minItems: 1 + items: + - description: Firmware-loaded codec carveout + - description: IOMMU IOVA reservation region operating-points-v2: true
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 02/22] dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] NULL pointer dereference when of_translate_dma_region() fails.
- [High] Parsing desynchronization when iommu-addresses contains entries for different devices. --
--- Patch [2]: [PATCH 02/22] dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region --- commit 75d07dc0e88c8eab8911e5e4c741c2ddba6cf12f
Author: Daniel J Blueman <[email protected]>
dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region
Non-pixel stream IDs should not allocate IOVA space from the restricted region, as this region is reserved exclusively for secure non-pixel. Iris platforms must declare an IOMMU IOVA reservation to keep DMA away from this range. This patch permits a second memory-region phandle for this purpose and describes each entry.
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml properties: · line 90
Quoted 13 lines
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +4
-1@@ -84,7 +84,10 @@ properties: dma-coherent: true memory-region: - maxItems: 1 + minItems: 1 + items: + - description: Firmware-loaded codec carveout + - description: IOMMU IOVA reservation region
[Severity: High]
This isn't a bug introduced by this patch, but introducing memory-region nodes utilizing iommu-addresses exposes a pre-existing NULL pointer dereference in the boot/probe path.
When the iommu-addresses property is parsed in of_iommu_get_resv_regions(), if of_translate_dma_region() fails (e.g. due to a missing parent bus or malformed address), it returns NULL, which is directly assigned to the maps pointer:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
if (np == dev->of_node) {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}Will this cause a kernel panic on the next iteration?
The check maps < end would evaluate to true (since end is a valid, non-zero pointer), and the code then executes be32_to_cpup(maps++), which dereferences the NULL pointer. Additionally, the length variable remains uninitialized on this failure path:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
struct device_node *np;
u32 phandle;
phandle = be32_to_cpup(maps++);
...
}[Severity: High]
This is a pre-existing issue, but utilizing iommu-addresses exposes a parsing desynchronization when the iommu-addresses property contains entries for different devices.
If the parser reads an entry where the phandle does not match dev->of_node, it skips processing but fails to advance the maps pointer past the address and size cells:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
...
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}
}
...
}Does this completely desynchronize the parser?
On the next iteration, it seems the parser would read the first address cell of the skipped entry as the next phandle, making it impossible to correctly parse a shared memory-region node containing multiple devices.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 02/22] dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region
In reply to Vikash GarodiaQuoted 27 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
Non-pixel stream IDs should not allocate IOVA space from the 0 to 600MB restricted region, as this region is reserved exclusively for secure non-pixel.
In addition to the firmware-loaded codec carveout, Iris platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from restricted IOVA range.
Permit a second memory-region phandle for this purpose, and describe the meaning of each entry so the ordering is unambiguous.
Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +0
-0
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml properties: · line 90
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +4
-1@@ -84,7 +84,10 @@ properties: dma-coherent: true memory-region: - maxItems: 1 + minItems: 1 + items: + - description: Firmware-loaded codec carveout + - description: IOMMU IOVA reservation region
And how does it work if there is no firmware carveout?
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerPATCH 3/22 dt-bindings: media: qcom,sc7180-venus: Allow IOVA reservation memory-region
In reply to Vikash GarodiaNon-pixel stream IDs should not allocate IOVA space from the 0 to 600MB restricted region, as this region is reserved exclusively for secure non-pixel.
In addition to the firmware-loaded codec carveout, platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from restricted IOVA range.
Permit a second memory-region phandle for this purpose, and describe the meaning of each entry so the ordering is unambiguous.
--- Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml +4 -1
@@ -51,7 +51,10 @@ properties: maxItems: 1 memory-region: - maxItems: 1 + minItems: 1 + items: + - description: Firmware-loaded codec carveout + - description: IOMMU IOVA reservation region interconnects: maxItems: 2
Signature · 1 line
2.34.1
Vikash Garodia
maintainerPATCH 4/22 arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
In reply to Vikash GarodiaFrom: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/hamoa.dtsi +12 -1
@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {
@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>; resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>; reset-names = "bus";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing bounds check, incorrect pointer advancement, and potential NULL pointer dereference when parsing the iommu-addresses property. --
--- Patch [4]: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris --- commit 0d7d545a5dddd31b4e0cc75f7a486bdd8ebe240d
Author: Daniel J Blueman <[email protected]>
arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
This commit adds a reserved iova region below 0x25800000 for the Iris vpu on hamoa platforms to prevent smmu faults. It references this reserved memory using the iommu-addresses property to keep dma allocations above the boundary.
Quoted 8 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +0
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; };
arch/arm64/boot/dts/qcom/hamoa.dtsi smem_mem: smem@ffe00000 { · line 678
Quoted 10 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +10
-0+ + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>;
[Severity: High]
This isn't a bug introduced by this patch, but adding this iommu-addresses property could trigger a pre-existing issue in the device tree parsing logic.
Looking at of_iommu_get_resv_regions() in drivers/iommu/of_iommu.c, when parsing the iommu-addresses property, if a parsed phandle does not match dev->of_node, the loop fails to skip the parent's na + ns cells:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
struct device_node *np;
u32 phandle;
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {
// ...
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}Because maps is only incremented by 1 cell (the phandle) instead of 1 + na + ns, the parser becomes misaligned. Subsequent iterations will interpret address and size cells as phandles.
Additionally, if of_translate_dma_region() fails, it returns null. The loop then assigns null to maps. Since end is a valid kernel pointer, the maps < end check passes on the next iteration, and be32_to_cpup(maps++) dereferences the null pointer.
Furthermore, in of_translate_dma_region(), there is no bounds checking against the property's allocation size:
drivers/of/address.c:of_translate_dma_region() {
...
address = of_translate_dma_address(dev, prop);
if (address == OF_BAD_ADDR)
return NULL;
size = of_read_number(prop + na, ns);
...
}If the parser is misaligned and a false match occurs near the end of the buffer, this can read out-of-bounds heap memory.
Does this new device tree property risk exposing these parsing issues if multiple entries or malformed data are present in the device tree?
Quoted 2 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-0+ }; };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
In reply to Vikash GarodiaQuoted 45 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {
arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5453
Quoted 5 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;
I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
Quoted 7 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +0
-0resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>; reset-names = "bus";Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 49 lines · Dmitry Baryshkov
Quoted 48 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem";
Quoted 5 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5453
Quoted 2 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1- memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems
honestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
https://lore.kernel.org/all/[email protected]/
Quoted 12 lines
later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
Quoted 7 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +0
-0resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>; reset-names = "bus";Signature · 1 line
2.34.1
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 55 lines · Vikash Garodia
Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {Quoted 8 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5452
Quoted 5 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems
Quoted 3 lines
honestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
So, if we land these patches, how do extend it later to account for all of that?
Quoted 15 lines
https://lore.kernel.org/all/[email protected]/
Quoted 11 lines
later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
Quoted 6 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +0
-0resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>; reset-names = "bus";Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 56 lines · Dmitry Baryshkov
Quoted 55 lines · Vikash Garodia
Quoted 52 lines · Dmitry Baryshkov
Quoted 44 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5452
Quoted 4 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems
Quoted 7 lines
Quoted 3 lines
honestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
please read the commit description again, the answer is there.
Quoted 4 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Quoted 16 lines
Quoted 15 lines
https://lore.kernel.org/all/[email protected]/
Quoted 11 lines
later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
Quoted 6 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +0
-0resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>; reset-names = "bus";Signature · 1 line
2.34.1
Bryan O'Donoghue
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 9 lines · Vikash Garodia
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I don't like the idea of this series, because
it_again_doesn't tell us the truth about the hardware. This typicall ends up with bigger problemshonestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
please read the commit description again, the answer is there.
So I don't necessarily get all of the detail out of the commit log myself.
Could you give some detail to address Dmitry's point.
The question as I read it is - are all of the other potential SIDs covered by this change ?
Quoted 5 lines
Quoted 3 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Yes it should be possible to branch to make subnodes work on-top of this - accepting that once this lands it becomes ABI and support for this method must be sustained, even after sub-nodes land.
---
bod
Vikash Garodia
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 9 lines · Bryan O'Donoghue
Quoted 8 lines · Vikash Garodia
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I don't like the idea of this series, because
it_again_doesn't tell us the truth about the hardware. This typicall ends up with bigger problemshonestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
Quoted 8 lines
Quoted 1 line
please read the commit description again, the answer is there.
So I don't necessarily get all of the detail out of the commit log myself.
Could you give some detail to address Dmitry's point.
The question as I read it is - are all of the other potential SIDs covered by this change ?
I get the query as "secure streams also have their dedicated reserve regions, so how does this approach helps" - This patch does not reserve any IOVA for secure streams, only the forward looking subnode can assign specific reserve for specific streams. The patch enforces a common IOVA across all streams, and is good enough to fix the problem we have w.r.t device reset.
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Yes it should be possible to branch to make subnodes work on-top of this
- accepting that once this lands it becomes ABI and support for this method must be sustained, even after sub-nodes land.
Thats the plan. This goes as ABI with subnode to land on top of it.
Quoted 2 lines
---
bod
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 24 lines · Vikash Garodia
Quoted 11 lines · Bryan O'Donoghue
Quoted 10 lines · Vikash Garodia
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
I don't like the idea of this series, because
it_again_doesn't tell us
the truth about the hardware. This typicall ends up with bigger problemshonestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
Quoted 9 lines
Quoted 1 line
please read the commit description again, the answer is there.
So I don't necessarily get all of the detail out of the commit log myself.
Could you give some detail to address Dmitry's point.
The question as I read it is - are all of the other potential SIDs covered by this change ?
Quoted 6 lines
I get the query as "secure streams also have their dedicated reserve regions, so how does this approach helps" - This patch does not reserve any IOVA for secure streams, only the forward looking subnode can assign specific reserve for specific streams.
The patch enforces a common IOVA across all streams, and is good enough to fix the problem we have w.r.t device reset.
No, it's not good enough. It defines that both non-secure streams use the provided memory range, it doesn't provide a natural way to later _expand_ it to support secure subnodes, etc.
We know that there is a problem. We already have been bitten by not describing the hardware as is and using band-aids. Can we now learn the lesson and write a proper hardware description?
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Quoted 6 lines
Quoted 4 lines
Yes it should be possible to branch to make subnodes work on-top of this
- accepting that once this lands it becomes ABI and support for this method must be sustained, even after sub-nodes land.Thats the plan. This goes as ABI with subnode to land on top of it.
So, do you actually plan to support both ABIs? This would also mean moving reserved regions to the subnode. What prevents us from landing subnodes straight away?
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 52 lines · Dmitry Baryshkov
Quoted 24 lines · Vikash Garodia
Quoted 11 lines · Bryan O'Donoghue
Quoted 10 lines · Vikash Garodia
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
I don't like the idea of this series, because
it_again_doesn't tell us
the truth about the hardware. This typicall ends up with bigger problemshonestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
Quoted 9 lines
Quoted 1 line
please read the commit description again, the answer is there.
So I don't necessarily get all of the detail out of the commit log myself.
Could you give some detail to address Dmitry's point.
The question as I read it is - are all of the other potential SIDs covered by this change ?
Quoted 6 lines
I get the query as "secure streams also have their dedicated reserve regions, so how does this approach helps" - This patch does not reserve any IOVA for secure streams, only the forward looking subnode can assign specific reserve for specific streams.
The patch enforces a common IOVA across all streams, and is good enough to fix the problem we have w.r.t device reset.No, it's not good enough. It defines that both non-secure streams use the provided memory range, it doesn't provide a natural way to later _expand_ it to support secure subnodes, etc.
We know that there is a problem. We already have been bitten by not describing the hardware as is and using band-aids. Can we now learn the lesson and write a proper hardware description?
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Yes it should be possible to branch to make subnodes work on-top of this
- accepting that once this lands it becomes ABI and support for this method must be sustained, even after sub-nodes land.
Quoted 4 lines
Quoted 1 line
Thats the plan. This goes as ABI with subnode to land on top of it.
So, do you actually plan to support both ABIs? This would also mean moving reserved regions to the subnode.
How is that different from moving the reserve region when stream IDs would also need to move, so be it for the associated memory regions.
Quoted 2 lines
What prevents us from landing subnodes straight away?
You are well aware of them, but still asking the same. Reasons,
1. We have been attempting the subnodes for almost a year with multiple pushbacks from multiple maintainers. We are closer and working on it to post for iris, followed by venus, once review is acceptable for iris.
2. Current solution, in this series, is much easy to apply for all kernels and can land faster so that it can fix the reset issue we have for already enabled devices.
Both from timewise and simplicity wise, this proposal is made to address the reset issue, while subnode can land ontop of this, without breaking ABI.
Regards,
Vikash
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 59 lines · Vikash Garodia
Quoted 50 lines · Dmitry Baryshkov
Quoted 22 lines · Vikash Garodia
Quoted 11 lines · Bryan O'Donoghue
Quoted 10 lines · Vikash Garodia
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
I don't like the idea of this series, because
it_again_doesn't tell us
the truth about the hardware. This typicall ends up with bigger problemshonestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
Quoted 9 lines
Quoted 1 line
please read the commit description again, the answer is there.
So I don't necessarily get all of the detail out of the commit log myself.
Could you give some detail to address Dmitry's point.
The question as I read it is - are all of the other potential SIDs covered by this change ?
Quoted 6 lines
I get the query as "secure streams also have their dedicated reserve regions, so how does this approach helps" - This patch does not reserve any IOVA for secure streams, only the forward looking subnode can assign specific reserve for specific streams.
The patch enforces a common IOVA across all streams, and is good enough to fix the problem we have w.r.t device reset.No, it's not good enough. It defines that both non-secure streams use the provided memory range, it doesn't provide a natural way to later _expand_ it to support secure subnodes, etc.
We know that there is a problem. We already have been bitten by not describing the hardware as is and using band-aids. Can we now learn the lesson and write a proper hardware description?
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Yes it should be possible to branch to make subnodes work on-top of this
- accepting that once this lands it becomes ABI and support for this method must be sustained, even after sub-nodes land.Quoted 4 lines
Quoted 1 line
Thats the plan. This goes as ABI with subnode to land on top of it.
So, do you actually plan to support both ABIs? This would also mean moving reserved regions to the subnode.
How is that different from moving the reserve region when stream IDs would also need to move, so be it for the associated memory regions.
Quoted 7 lines
Quoted 2 lines
What prevents us from landing subnodes straight away?
You are well aware of them, but still asking the same. Reasons,
1. We have been attempting the subnodes for almost a year with multiple pushbacks from multiple maintainers. We are closer and working on it to post for iris, followed by venus, once review is acceptable for iris.
I think that we should have concentrated on it. From my point of view, the subnodes solution is ready and the last obstacle was the under-informing commit message. As you can see, Rob has (had?) questions about this solution too.
Quoted 6 lines
2. Current solution, in this series, is much easy to apply for all kernels and can land faster so that it can fix the reset issue we have for already enabled devices.
Both from timewise and simplicity wise, this proposal is made to address the reset issue, while subnode can land ontop of this, without breaking ABI.
Or rather breaking the ABI in the same way as it is without the fix.
I'll give another reviewer's thought to it tomorrow...
Signature · 2 lines
With best wishes Dmitry
Bryan O'Donoghue
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 8 lines · Dmitry Baryshkov
Quoted 4 lines
You are well aware of them, but still asking the same. Reasons,
1. We have been attempting the subnodes for almost a year with multiple pushbacks from multiple maintainers. We are closer and working on it to post for iris, followed by venus, once review is acceptable for iris.I think that we should have concentrated on it. From my point of view, the subnodes solution is ready and the last obstacle was the under-informing commit message. As you can see, Rob has (had?) questions about this solution too.
Its taking too long.
I just suggested restricting concurrency but, that can't be right. The issue is IOVA - concurrency merely makes the bug more _likely_ to show up so in fact that won't work.
-rc1 hits soon, if sub-nodes isn't ready to go by that point there is no choice but to implement BROKEN or minItems, 100% up to qcom to decide which.
---
bod
Vikash Garodia
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 10 lines · Bryan O'Donoghue
Quoted 8 lines · Dmitry Baryshkov
Quoted 4 lines
You are well aware of them, but still asking the same. Reasons,
1. We have been attempting the subnodes for almost a year with multiple pushbacks from multiple maintainers. We are closer and working on it to post for iris, followed by venus, once review is acceptable for iris.I think that we should have concentrated on it. From my point of view, the subnodes solution is ready and the last obstacle was the under-informing commit message. As you can see, Rob has (had?) questions about this solution too.
Quoted 7 lines
Its taking too long.
I just suggested restricting concurrency but, that can't be right. The issue is IOVA - concurrency merely makes the bug more _likely_ to show up so in fact that won't work.
-rc1 hits soon, if sub-nodes isn't ready to go by that point there is no choice but to implement BROKEN or minItems, 100% up to qcom to decide which.
minItems is the way which could easily fix and patch all the kernels exposed with the known bug.
At the same time, we have identified a way to even reserve this in driver now (venus/iris) with [1] and the results are good with this as well. If not minItems, would prefer [1] in -rc1 to avoid further delays or to keep the crash exposed. Please review.
Regards,
Vikash
Quoted 2 lines
---
bod
Bryan O'Donoghue
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
In reply to Vikash GarodiaQuoted 74 lines · Vikash Garodia
Quoted 52 lines · Dmitry Baryshkov
Quoted 24 lines · Vikash Garodia
Quoted 11 lines · Bryan O'Donoghue
Quoted 10 lines · Vikash Garodia
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
I don't like the idea of this series, because
it_again_doesn't tell us
the truth about the hardware. This typicall ends up with bigger problemshonestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
Quoted 9 lines
Quoted 1 line
please read the commit description again, the answer is there.
So I don't necessarily get all of the detail out of the commit log myself.
Could you give some detail to address Dmitry's point.
The question as I read it is - are all of the other potential SIDs covered by this change ?
Quoted 6 lines
I get the query as "secure streams also have their dedicated reserve regions, so how does this approach helps" - This patch does not reserve any IOVA for secure streams, only the forward looking subnode can assign specific reserve for specific streams.
The patch enforces a common IOVA across all streams, and is good enough to fix the problem we have w.r.t device reset.No, it's not good enough. It defines that both non-secure streams use the provided memory range, it doesn't provide a natural way to later _expand_ it to support secure subnodes, etc.
We know that there is a problem. We already have been bitten by not describing the hardware as is and using band-aids. Can we now learn the lesson and write a proper hardware description?
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Yes it should be possible to branch to make subnodes work on-top of this
- accepting that once this lands it becomes ABI and support for this method must be sustained, even after sub-nodes land.Quoted 4 lines
Quoted 1 line
Thats the plan. This goes as ABI with subnode to land on top of it.
So, do you actually plan to support both ABIs? This would also mean moving reserved regions to the subnode.
How is that different from moving the reserve region when stream IDs would also need to move, so be it for the associated memory regions.
Quoted 2 lines
What prevents us from landing subnodes straight away?
You are well aware of them, but still asking the same. Reasons,
1. We have been attempting the subnodes for almost a year with multiple pushbacks from multiple maintainers. We are closer and working on it to post for iris, followed by venus, once review is acceptable for iris.
2. Current solution, in this series, is much easy to apply for all kernels and can land faster so that it can fix the reset issue we have for already enabled devices.
Quoted 6 lines
Both from timewise and simplicity wise, this proposal is made to address the reset issue, while subnode can land ontop of this, without breaking ABI.
Regards,
Vikash
There is another solution.
Restrict multiple concurrent streams in both drivers. The failure mode is as I understand it only triggered by _concurrent_ streams so, restrict that case in the .c code.
Nothing dictates DT as the means of addressing the problem. Clearly not many people run concurrent streams with the upstream stuff so formalise the restriction until sub-nodes permit reintroduction of the feature.
---
bod
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 82 lines · Bryan O'Donoghue
Quoted 74 lines · Vikash Garodia
Quoted 52 lines · Dmitry Baryshkov
Quoted 24 lines · Vikash Garodia
Quoted 11 lines · Bryan O'Donoghue
Quoted 10 lines · Vikash Garodia
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
I don't like the idea of this series, because
it_again_doesn't tell us
the truth about the hardware. This typicall ends up with bigger problemshonestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
Quoted 9 lines
Quoted 1 line
please read the commit description again, the answer is there.
So I don't necessarily get all of the detail out of the commit log myself.
Could you give some detail to address Dmitry's point.
The question as I read it is - are all of the other potential SIDs covered by this change ?
Quoted 6 lines
I get the query as "secure streams also have their dedicated reserve regions, so how does this approach helps" - This patch does not reserve any IOVA for secure streams, only the forward looking subnode can assign specific reserve for specific streams.
The patch enforces a common IOVA across all streams, and is good enough to fix the problem we have w.r.t device reset.No, it's not good enough. It defines that both non-secure streams use the provided memory range, it doesn't provide a natural way to later _expand_ it to support secure subnodes, etc.
We know that there is a problem. We already have been bitten by not describing the hardware as is and using band-aids. Can we now learn the lesson and write a proper hardware description?
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Yes it should be possible to branch to make subnodes work on-top of this
- accepting that once this lands it becomes ABI and support for this method must be sustained, even after sub-nodes land.Quoted 4 lines
Quoted 1 line
Thats the plan. This goes as ABI with subnode to land on top of it.
So, do you actually plan to support both ABIs? This would also mean moving reserved regions to the subnode.
How is that different from moving the reserve region when stream IDs would also need to move, so be it for the associated memory regions.
Quoted 2 lines
What prevents us from landing subnodes straight away?
You are well aware of them, but still asking the same. Reasons,
1. We have been attempting the subnodes for almost a year with multiple pushbacks from multiple maintainers. We are closer and working on it to post for iris, followed by venus, once review is acceptable for iris.
2. Current solution, in this series, is much easy to apply for all kernels and can land faster so that it can fix the reset issue we have for already enabled devices.Quoted 6 lines
Both from timewise and simplicity wise, this proposal is made to address the reset issue, while subnode can land ontop of this, without breaking ABI.
Regards,
Vikash
Quoted 5 lines
There is another solution.
Restrict multiple concurrent streams in both drivers. The failure mode is as I understand it only triggered by _concurrent_ streams so, restrict that case in the .c code.
I think this might be the best hot fix for now. Very local, very presice, touching the driver pieces, letting it to continue to exist even after the subnodes have landed to support the legacy case.
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 83 lines · Dmitry Baryshkov
Quoted 82 lines · Bryan O'Donoghue
Quoted 80 lines · Vikash Garodia
Quoted 52 lines · Dmitry Baryshkov
Quoted 24 lines · Vikash Garodia
Quoted 11 lines · Bryan O'Donoghue
Quoted 10 lines · Vikash Garodia
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
I don't like the idea of this series, because
it_again_doesn't tell us
the truth about the hardware. This typicall ends up with bigger problemshonestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
Quoted 9 lines
Quoted 1 line
please read the commit description again, the answer is there.
So I don't necessarily get all of the detail out of the commit log myself.
Could you give some detail to address Dmitry's point.
The question as I read it is - are all of the other potential SIDs covered by this change ?
Quoted 6 lines
I get the query as "secure streams also have their dedicated reserve regions, so how does this approach helps" - This patch does not reserve any IOVA for secure streams, only the forward looking subnode can assign specific reserve for specific streams.
The patch enforces a common IOVA across all streams, and is good enough to fix the problem we have w.r.t device reset.No, it's not good enough. It defines that both non-secure streams use the provided memory range, it doesn't provide a natural way to later _expand_ it to support secure subnodes, etc.
We know that there is a problem. We already have been bitten by not describing the hardware as is and using band-aids. Can we now learn the lesson and write a proper hardware description?
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Yes it should be possible to branch to make subnodes work on-top of this
- accepting that once this lands it becomes ABI and support for this method must be sustained, even after sub-nodes land.Quoted 4 lines
Quoted 1 line
Thats the plan. This goes as ABI with subnode to land on top of it.
So, do you actually plan to support both ABIs? This would also mean moving reserved regions to the subnode.
How is that different from moving the reserve region when stream IDs would also need to move, so be it for the associated memory regions.
Quoted 2 lines
What prevents us from landing subnodes straight away?
You are well aware of them, but still asking the same. Reasons,
1. We have been attempting the subnodes for almost a year with multiple pushbacks from multiple maintainers. We are closer and working on it to post for iris, followed by venus, once review is acceptable for iris.
2. Current solution, in this series, is much easy to apply for all kernels and can land faster so that it can fix the reset issue we have for already enabled devices.Both from timewise and simplicity wise, this proposal is made to address the reset issue, while subnode can land ontop of this, without breaking ABI.
Regards,
Vikash
Quoted 7 lines
Quoted 5 lines
There is another solution.
Restrict multiple concurrent streams in both drivers. The failure mode is as I understand it only triggered by _concurrent_ streams so, restrict that case in the .c code.
I think this might be the best hot fix for now. Very local, very
No, it's not. Restricting concurrency does not avoid the reset, it just reduces the possibility of occurrence.
Quoted 3 lines
presice, touching the driver pieces, letting it to continue to exist even after the subnodes have landed to support the legacy case.
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 88 lines · Vikash Garodia
Quoted 85 lines · Dmitry Baryshkov
Quoted 84 lines · Bryan O'Donoghue
Quoted 74 lines · Vikash Garodia
Quoted 52 lines · Dmitry Baryshkov
Quoted 24 lines · Vikash Garodia
Quoted 11 lines · Bryan O'Donoghue
Quoted 10 lines · Vikash Garodia
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
I don't like the idea of this series, because
it_again_doesn't tell us
the truth about the hardware. This typicall ends up with bigger problemshonestly...thats all the info i have about the vpu hardware that it restricts non pixel to DMA from the 0-600MB range. The same i have been trying for a year now
You are not honest here. You also know that there are secure streams, which have to use their own IOMMU SIDs. And some of them, as far as I remember, also have memory range restrictions.
Quoted 9 lines
Quoted 1 line
please read the commit description again, the answer is there.
So I don't necessarily get all of the detail out of the commit log myself.
Could you give some detail to address Dmitry's point.
The question as I read it is - are all of the other potential SIDs covered by this change ?
Quoted 6 lines
I get the query as "secure streams also have their dedicated reserve regions, so how does this approach helps" - This patch does not reserve any IOVA for secure streams, only the forward looking subnode can assign specific reserve for specific streams.
The patch enforces a common IOVA across all streams, and is good enough to fix the problem we have w.r.t device reset.No, it's not good enough. It defines that both non-secure streams use the provided memory range, it doesn't provide a natural way to later _expand_ it to support secure subnodes, etc.
We know that there is a problem. We already have been bitten by not describing the hardware as is and using band-aids. Can we now learn the lesson and write a proper hardware description?
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
So, if we land these patches, how do extend it later to account for all of that?
forward looking design would be subnode, which we can land ontop of this series.
Yes it should be possible to branch to make subnodes work on-top of this
- accepting that once this lands it becomes ABI and support for this method must be sustained, even after sub-nodes land.Quoted 4 lines
Quoted 1 line
Thats the plan. This goes as ABI with subnode to land on top of it.
So, do you actually plan to support both ABIs? This would also mean moving reserved regions to the subnode.
How is that different from moving the reserve region when stream IDs would also need to move, so be it for the associated memory regions.
Quoted 2 lines
What prevents us from landing subnodes straight away?
You are well aware of them, but still asking the same. Reasons,
1. We have been attempting the subnodes for almost a year with multiple pushbacks from multiple maintainers. We are closer and working on it to post for iris, followed by venus, once review is acceptable for iris.
2. Current solution, in this series, is much easy to apply for all kernels and can land faster so that it can fix the reset issue we have for already enabled devices.Quoted 6 lines
Both from timewise and simplicity wise, this proposal is made to address the reset issue, while subnode can land ontop of this, without breaking ABI.
Regards,
VikashThere is another solution.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Restrict multiple concurrent streams in both drivers. The failure mode is as I understand it only triggered by _concurrent_ streams so, restrict that case in the .c code.
I think this might be the best hot fix for now. Very local, very
No, it's not. Restricting concurrency does not avoid the reset, it just reduces the possibility of occurrence.
Ack.
Quoted 2 lines
Quoted 2 lines
presice, touching the driver pieces, letting it to continue to exist even after the subnodes have landed to support the legacy case.
Signature · 2 lines
With best wishes Dmitry
Rob Herring
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
In reply to Dmitry BaryshkovQuoted 49 lines · Dmitry Baryshkov
Quoted 48 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem";
Quoted 8 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5453
Quoted 2 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1- memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
I think this is an abuse of /reserved-memory. reserved-memory is reserved *physical* memory. Reserved IOVA is a property on top of that. I'm surprised this passes validation. If it does, I may go fix that.
Rob
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 56 lines · Rob Herring
Quoted 55 lines · Dmitry Baryshkov
Quoted 45 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5453
Quoted 5 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems later on, when it starts to affect other bits and pieces.
Quoted 4 lines
Quoted 1 line
I don't want to NAK it, but I'd strongly ask to reconsider it.
I think this is an abuse of /reserved-memory. reserved-memory is reserved *physical* memory. Reserved IOVA is a property on top of that. I'm surprised this passes validation. If it does, I may go fix that.
As per the reserved-memory.yaml schema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/reserved-memory/reserved-memory.yaml#L56
Quoted 2 lines
Rob
Bryan O'Donoghue
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 59 lines · Vishnu Reddy
Quoted 57 lines · Rob Herring
Quoted 56 lines · Dmitry Baryshkov
Quoted 45 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5453
Quoted 5 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
Quoted 8 lines
Quoted 3 lines
I think this is an abuse of /reserved-memory. reserved-memory is reserved *physical* memory. Reserved IOVA is a property on top of that. I'm surprised this passes validation. If it does, I may go fix that.
As per the
reserved-memory.yamlschema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/reserved-memory/reserved-memory.yaml#L56
I think that is an entirely reasonable reading of the text
Quote:
"If no "reg" property is specified, the "iommu-addresses" property
defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU."
Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
---
bod
Rob Herring
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 73 lines · Bryan O'Donoghue
Quoted 59 lines · Vishnu Reddy
Quoted 57 lines · Rob Herring
Quoted 56 lines · Dmitry Baryshkov
Quoted 45 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5453
Quoted 5 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
Quoted 8 lines
Quoted 3 lines
I think this is an abuse of /reserved-memory. reserved-memory is reserved *physical* memory. Reserved IOVA is a property on top of that. I'm surprised this passes validation. If it does, I may go fix that.
As per the
reserved-memory.yamlschema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/reserved-memory/reserved-memory.yaml#L56I think that is an entirely reasonable reading of the text
Quote:
Quoted 7 lines
"If no "reg" property is specified, the "iommu-addresses" property
defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU."Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
But if "iommu-addresses" is the only property of the reserved memory, why put this property in reserved-memory rather than directly in the device's node? I'm only questioning where is the right place to describe a reserved IOVA.
Rob
Vikash Garodia
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 79 lines · Rob Herring
Quoted 78 lines · Bryan O'Donoghue
Quoted 59 lines · Vishnu Reddy
Quoted 57 lines · Rob Herring
Quoted 56 lines · Dmitry Baryshkov
Quoted 45 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5453
Quoted 5 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
Quoted 8 lines
Quoted 3 lines
I think this is an abuse of /reserved-memory. reserved-memory is reserved *physical* memory. Reserved IOVA is a property on top of that. I'm surprised this passes validation. If it does, I may go fix that.
As per the
reserved-memory.yamlschema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/reserved-memory/reserved-memory.yaml#L56I think that is an entirely reasonable reading of the text
Quote:
"If no "reg" property is specified, the "iommu-addresses" property
defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU."
Quoted 8 lines
Quoted 2 lines
Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
But if "iommu-addresses" is the only property of the reserved memory, why put this property in reserved-memory rather than directly in the device's node? I'm only questioning where is the right place to describe a reserved IOVA.
a single property node vs multi-property node should not be the reason to decide the place i believe, rather having them all under reserve-memory keeps all reservation at one place instead of scattering it all over.
Regards,
Vikash
Quoted 1 line
Rob
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 90 lines · Vikash Garodia
Quoted 79 lines · Rob Herring
Quoted 78 lines · Bryan O'Donoghue
Quoted 59 lines · Vishnu Reddy
Quoted 57 lines · Rob Herring
Quoted 56 lines · Dmitry Baryshkov
Quoted 45 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5453
Quoted 5 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
Quoted 8 lines
Quoted 3 lines
I think this is an abuse of /reserved-memory. reserved-memory is reserved *physical* memory. Reserved IOVA is a property on top of that. I'm surprised this passes validation. If it does, I may go fix that.
As per the
reserved-memory.yamlschema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/reserved-memory/reserved-memory.yaml#L56I think that is an entirely reasonable reading of the text
Quote:
"If no "reg" property is specified, the "iommu-addresses" property
defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU."Quoted 8 lines
Quoted 2 lines
Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
But if "iommu-addresses" is the only property of the reserved memory, why put this property in reserved-memory rather than directly in the device's node? I'm only questioning where is the right place to describe a reserved IOVA.
Quoted 5 lines
a single property node vs multi-property node should not be the reason to decide the place i believe, rather having them all under reserve-memory keeps all reservation at one place instead of scattering it all over.
It is not about the amount of properties, but the intention of reserved-nodes. Their intention is for reserved memory, which you do not have here really.
Best regards,
Krzysztof
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
In reply to Rob HerringQuoted 79 lines · Rob Herring
Quoted 78 lines · Bryan O'Donoghue
Quoted 59 lines · Vishnu Reddy
Quoted 57 lines · Rob Herring
Quoted 56 lines · Dmitry Baryshkov
Quoted 45 lines · Vikash Garodia
From: Daniel J Blueman <[email protected]>
On X1-family hamoa platforms, the Iris VPU reserves IOVA addresses below
0x25800000(600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.Add a reserved-memory IOVA reservation node covering [0,
0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.Fixes 9065340ac04d ("arm64: dts: qcom: x1e80100: Add IRIS video codec")Signed-off-by Daniel J Blueman <[email protected]>Signed-off-by Vikash Garodia <[email protected]>--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/hamoa.dtsi +11
-0@@ -666,6 +666,17 @@ smem_mem: smem@ffe00000 { hwlocks = <&tcsr_mutex 3>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; qup_opp_table_100mhz: opp-table-qup100mhz {arch/arm64/boot/dts/qcom/hamoa.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5453
Quoted 5 lines
arch/arm64/boot/dts/qcom/hamoa.dtsi +1
-1@@ -5439,7 +5450,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;I don't like the idea of this series, because it _again_ doesn't tell us the truth about the hardware. This typicall ends up with bigger problems later on, when it starts to affect other bits and pieces.
I don't want to NAK it, but I'd strongly ask to reconsider it.
Quoted 8 lines
Quoted 3 lines
I think this is an abuse of /reserved-memory. reserved-memory is reserved *physical* memory. Reserved IOVA is a property on top of that. I'm surprised this passes validation. If it does, I may go fix that.
As per the
reserved-memory.yamlschema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/reserved-memory/reserved-memory.yaml#L56I think that is an entirely reasonable reading of the text
Quote:
"If no "reg" property is specified, the "iommu-addresses" property
defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU."
Quoted 7 lines
Quoted 2 lines
Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
But if "iommu-addresses" is the only property of the reserved memory, why put this property in reserved-memory rather than directly in the device's node? I'm only questioning where is the right place to describe a reserved IOVA.
Per the reserved-memory.yaml:
If no "reg" property is specified, the "iommu-addresses" property defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU.
I think this defines exactly this usecase. Would you still prefer if Vikash moves iommu-addresses to the device node?
Signature · 2 lines
With best wishes Dmitry
Bryan O'Donoghue
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
In reply to Rob HerringQuoted 13 lines · Rob Herring
Quoted 13 lines
Quoted 4 lines
As per the
reserved-memory.yamlschema document, the iommu-addresses
property for IOVA reservation into /reserved-memory is allowed — it's
documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/ schemas/reserved-memory/reserved-memory.yaml#L56I think that is an entirely reasonable reading of the text
Quote:
"If no "reg" property is specified, the "iommu-addresses" property
defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU."
Quoted 8 lines
Quoted 2 lines
Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
But if "iommu-addresses" is the only property of the reserved memory, why put this property in reserved-memory rather than directly in the device's node? I'm only questioning where is the right place to describe a reserved IOVA.
Rob
Back from the eclipse, sorry for the delayed response.
Ah I get you.
Yes.
I take your point. This is a property of the node itself; the IOVA < 600MB only matters _if_ the venus or iris nodes are enabled - otherwise an IOVA < 600MB is perfectly fine.
So it follows its a property specific to this node not specific to the overall system.
Yep, I agree - its a device/node property, not a top-level property.
---
bod
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 30 lines · Bryan O'Donoghue
Quoted 14 lines · Rob Herring
Quoted 14 lines
Quoted 5 lines
As per the
reserved-memory.yamlschema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/
schemas/reserved-memory/reserved-memory.yaml#L56I think that is an entirely reasonable reading of the text
Quote:
"If no "reg" property is specified, the "iommu-addresses" property
defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU."Quoted 8 lines
Quoted 2 lines
Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
But if "iommu-addresses" is the only property of the reserved memory, why put this property in reserved-memory rather than directly in the device's node? I'm only questioning where is the right place to describe a reserved IOVA.
Rob
Back from the eclipse, sorry for the delayed response.
Ah I get you.
Yes.
Quoted 8 lines
I take your point. This is a property of the node itself; the IOVA < 600MB only matters _if_ the venus or iris nodes are enabled - otherwise an IOVA < 600MB is perfectly fine.
So it follows its a property specific to this node not specific to the overall system.
Yep, I agree - its a device/node property, not a top-level property.
:-)
FWIW, I think it's a proper way to describe it too.
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 35 lines · Dmitry Baryshkov
Quoted 34 lines · Bryan O'Donoghue
Quoted 14 lines · Rob Herring
Quoted 14 lines
Quoted 5 lines
As per the
reserved-memory.yamlschema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/
schemas/reserved-memory/reserved-memory.yaml#L56I think that is an entirely reasonable reading of the text
Quote:
"If no "reg" property is specified, the "iommu-addresses" property
defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU."Quoted 8 lines
Quoted 2 lines
Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
But if "iommu-addresses" is the only property of the reserved memory, why put this property in reserved-memory rather than directly in the device's node? I'm only questioning where is the right place to describe a reserved IOVA.
Rob
Back from the eclipse, sorry for the delayed response.
Ah I get you.
Yes.
I take your point. This is a property of the node itself; the IOVA < 600MB only matters _if_ the venus or iris nodes are enabled - otherwise an IOVA < 600MB is perfectly fine.
Quoted 9 lines
Quoted 4 lines
So it follows its a property specific to this node not specific to the overall system.
Yep, I agree - its a device/node property, not a top-level property.
:-)
FWIW, I think it's a proper way to describe it too.
From my readings, a node defined under reserved-memory can have other properties like "reg" alongwith "iommu-addresses". Are we saying when *only* "iommu-addresses" is there, then move to the device and when other property is there, then move to individual device ?
Again the device may have the "reg" property already, in such case, moving the iommu-addresses + reg in corresponding device might not be feasible.
Regards,
Vikash
Vikash Garodia
maintainerRe: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 42 lines · Vikash Garodia
Quoted 40 lines · Dmitry Baryshkov
Quoted 38 lines · Bryan O'Donoghue
Quoted 14 lines · Rob Herring
Quoted 14 lines
Quoted 5 lines
As per the
reserved-memory.yamlschema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/
schemas/reserved-memory/reserved-memory.yaml#L56I think that is an entirely reasonable reading of the text
Quote:
"If no "reg" property is specified, the "iommu-addresses" property defines carveout regions in the IOVA space for the given device. This can be useful if a certain memory region should not be mapped through the IOMMU."
Quoted 8 lines
Quoted 2 lines
Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
But if "iommu-addresses" is the only property of the reserved memory, why put this property in reserved-memory rather than directly in the device's node? I'm only questioning where is the right place to describe a reserved IOVA.
Rob
Back from the eclipse, sorry for the delayed response.
Ah I get you.
Yes.
I take your point. This is a property of the node itself; the IOVA < 600MB only matters _if_ the venus or iris nodes are enabled - otherwise an IOVA < 600MB is perfectly fine.
So it follows its a property specific to this node not specific to the overall system.
Yep, I agree - its a device/node property, not a top-level property.
Quoted 7 lines
Quoted 4 lines
:-)
FWIW, I think it's a proper way to describe it too.
From my readings, a node defined under reserved-memory can have other
properties like "reg" alongwith "iommu-addresses". Are we saying when *only* "iommu-addresses" is there, then move to the device and when other property is there, then move to individual device ?
sorry, typo. Pls read the last few words as ".., then keep under reserve-memory ?"
Quoted 5 lines
Again the device may have the "reg" property already, in such case, moving the iommu-addresses + reg in corresponding device might not be feasible.
Regards,
Vikash
Re: [PATCH 04/22] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris
Quoted 53 lines · Vikash Garodia
Quoted 51 lines · Vikash Garodia
Quoted 48 lines · Dmitry Baryshkov
Quoted 38 lines · Bryan O'Donoghue
Quoted 16 lines · Rob Herring
Quoted 16 lines
Quoted 5 lines
As per the
reserved-memory.yamlschema document, the iommu-addresses property for IOVA reservation into /reserved-memory is allowed — it's documented for IOVA carveout reservations:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/
schemas/reserved-memory/reserved-memory.yaml#L56I think that is an entirely reasonable reading of the text
Quote:
"If no "reg" property is specified, the "iommu-addresses" property defines carveout regions in the IOVA space for the given device. This
can be useful if a certain memory region should not be mapped through
the IOMMU."Quoted 8 lines
Quoted 2 lines
Which is exactly what this series does. Excludes a specific IOVA range from being allocated for this device.
But if "iommu-addresses" is the only property of the reserved memory, why put this property in reserved-memory rather than directly in the device's node? I'm only questioning where is the right place to describe a reserved IOVA.
Rob
Back from the eclipse, sorry for the delayed response.
Ah I get you.
Yes.
I take your point. This is a property of the node itself; the IOVA < 600MB
only matters _if_ the venus or iris nodes are enabled - otherwise an IOVA <
600MB is perfectly fine.Quoted 4 lines
So it follows its a property specific to this node not specific to the overall system.
Yep, I agree - its a device/node property, not a top-level property.
:-)
FWIW, I think it's a proper way to describe it too.
Quoted 12 lines
Quoted 4 lines
From my readings, a node defined under reserved-memory can have other
properties like "reg" alongwith "iommu-addresses". Are we saying when *only* "iommu-addresses" is there, then move to the device and when other property is there, then move to individual device ?sorry, typo. Pls read the last few words as ".., then keep under reserve-memory ?"
Quoted 4 lines
Again the device may have the "reg" property already, in such case, moving the iommu-addresses + reg in corresponding device might not be feasible.
Your sub-devices do not have reg property, so there is no such case, unless you meant the entire iris node?
Anyway, the point is that this does not describe anyhow system memory, any reserved memory. You want to affect the device virtual memory mappings and as such this is a property of the device itself, because this is how we structure DT. Attributes of devices do not go to top-level but to the devices themselves as properties.
Best regards,
Krzysztof
Vikash Garodia
maintainerPATCH 5/22 arm64: dts: qcom: lemans: Reserve low IOVA range for Iris
In reply to Vikash GarodiaIris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/lemans.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/lemans.dtsi +12 -1
@@ -862,6 +862,17 @@ cpucp_fw_mem: cpucp-fw@db200000 { reg = <0x0 0xdb200000 0x0 0x100000>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; smp2p-adsp {
@@ -4957,7 +4968,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&pil_video_mem>; + memory-region = <&pil_video_mem>, <&iris_iova>; resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>; reset-names = "bus";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 05/22] arm64: dts: qcom: lemans: Reserve low IOVA range for Iris
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] of_iommu_get_resv_regions() fails to advance the 'maps' pointer when a parsed phandle does not match dev->of_node, leading to corrupted DT property parsing and out-of-bounds reads.
- [High] of_iommu_get_resv_regions() will dereference a NULL pointer and use uninitialized stack variables if of_translate_dma_region() fails.
- [Medium] Device node reference count leak in of_iommu_get_resv_regions().
--
--- Patch [5]: [PATCH 05/22] arm64: dts: qcom: lemans: Reserve low IOVA range for Iris --- commit 4e0d92ff7cab972552bdfb654d8534c1ad241835
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: lemans: Reserve low IOVA range for Iris
Iris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots.
Quoted 8 lines
arch/arm64/boot/dts/qcom/lemans.dtsi +0
-0@@ -862,6 +862,17 @@ cpucp_fw_mem: cpucp-fw@db200000 { reg = <0x0 0xdb200000 0x0 0x100000>; no-map; };
arch/arm64/boot/dts/qcom/lemans.dtsi cpucp_fw_mem: cpucp-fw@db200000 { · line 874
Quoted 10 lines
arch/arm64/boot/dts/qcom/lemans.dtsi +10
-0+ + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>;
[Severity: High]
This isn't a bug introduced by this patch, but adding this property might trigger a pre-existing issue in drivers/iommu/of_iommu.c:of_iommu_get_resv_regions().
If the iommu-addresses property contains multiple entries and the first entry's phandle does not match dev->of_node, the code skips the if block but fails to advance the maps pointer:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
if (np == dev->of_node) {
// ... parses and advances maps ...
}
// MISSING ELSE BRANCH to advance maps pointer
...
}Will this cause the next iteration to incorrectly interpret the first address cell of the unmatched entry as a phandle, reducing the parsing to a corrupted word-by-word scan?
[Severity: Medium]
This is a pre-existing issue, but does of_iommu_get_resv_regions() leak the device node reference count when parsing these iommu-addresses?
Every iteration of the loop fetches the node, but there is no corresponding of_node_put(np) to release it:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
np = of_find_node_by_phandle(phandle);
...
}[Severity: High]
This is also a pre-existing issue, but what happens if of_translate_dma_region() fails when parsing this property?
The maps pointer is reassigned to the return value without checking for NULL, and the function relies on the uninitialized iova and length variables on failure:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}If of_translate_dma_region() returns NULL, the maps pointer is assigned NULL, and the loop condition maps < end evaluates to true. Will the next iteration then dereference the NULL maps pointer?
Quoted 2 lines
arch/arm64/boot/dts/qcom/lemans.dtsi +1
-0+ }; };
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Vikash Garodia
maintainerPATCH 6/22 arm64: dts: qcom: monaco: Reserve low IOVA range for Iris
In reply to Vikash GarodiaIris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/monaco.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/monaco.dtsi +12 -1
@@ -812,6 +812,17 @@ video_mem: video-region@9be82000 { reg = <0x0 0x9be82000 0x0 0x700000>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; smp2p-adsp {
@@ -5399,7 +5410,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>; resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>; reset-names = "bus";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 06/22] arm64: dts: qcom: monaco: Reserve low IOVA range for Iris
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Pre-existing flaws in of_iommu_get_resv_regions cause a kernel panic on translation failure, break parsing for multiple device entries, and leak device node references. --
--- Patch [6]: [PATCH 06/22] arm64: dts: qcom: monaco: Reserve low IOVA range for Iris --- commit 80dd45ef37e8a085b1612e1aef1e011d1e74726c
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: monaco: Reserve low IOVA range for Iris
Iris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the Iris node.
Quoted 4 lines
arch/arm64/boot/dts/qcom/monaco.dtsi +0
-0
[ ... ]
Quoted 4 lines
arch/arm64/boot/dts/qcom/monaco.dtsi +0
-0@@ -812,6 +812,17 @@ video_mem: video-region@9be82000 { reg = <0x0 0x9be82000 0x0 0x700000>; no-map; };
arch/arm64/boot/dts/qcom/monaco.dtsi video_mem: video-region@9be82000 { · line 824
Quoted 10 lines
arch/arm64/boot/dts/qcom/monaco.dtsi +10
-0+ + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>;
[Severity: High]
This is a pre-existing issue, but does using the iommu-addresses property expose flaws in the underlying parser in of_iommu_get_resv_regions()?
Looking at drivers/iommu/of_iommu.c:of_iommu_get_resv_regions():
while (maps < end) {
struct device_node *np;
u32 phandle;
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {
...
maps = of_translate_dma_region(np, maps, &iova, &length);If of_translate_dma_region() fails, it returns NULL. The maps pointer becomes NULL, and the while loop condition (maps < end) continues evaluating to true. The next iteration calls be32_to_cpup(maps++), which dereferences NULL and panics the kernel.
Additionally, if the parsed phandle does not match dev->of_node, maps is not advanced past the skipped device's address and size cells. This causes the next iteration to incorrectly read part of the DMA address as a phandle, which breaks parsing for any property with multiple entries.
Finally, np is acquired via of_find_node_by_phandle() which increments the refcount, but of_node_put() is never called to release it. Does this leak the device node reference?
While this patch adds only a single-entry array and might bypass the multi-entry parsing failure, the parser itself appears vulnerable to panicking on malformed device trees.
Quoted 4 lines
arch/arm64/boot/dts/qcom/monaco.dtsi +1
-0+ }; }; smp2p-adsp {
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
Vikash Garodia
maintainerPATCH 7/22 arm64: dts: qcom: sc8280xp: Reserve low IOVA range for Iris
In reply to Vikash GarodiaIris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +12 -1
@@ -669,6 +669,17 @@ reserved-region@aeb00000 { reg = <0 0xaeb00000 0 0x16600000>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; smp2p-adsp {
@@ -4266,7 +4277,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, operating-points-v2 = <&iris_opp_table>; iommus = <&apps_smmu 0x2a00 0x400>; - memory-region = <&pil_video_mem>; + memory-region = <&pil_video_mem>, <&iris_iova>; status = "disabled";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 07/22] arm64: dts: qcom: sc8280xp: Reserve low IOVA range for Iris
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] If of_translate_dma_region() fails during IOVA reservation parsing, it returns NULL, which causes a subsequent NULL pointer dereference on the next loop iteration.
- [Medium] The device node reference obtained via of_find_node_by_phandle() is never released, leading to a memory leak.
--
--- Patch [7]: [PATCH 07/22] arm64: dts: qcom: sc8280xp: Reserve low IOVA range for Iris --- commit 5bb5ca70fa7d2aa5a3d66cdd7f006042161ce0dc
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: sc8280xp: Reserve low IOVA range for Iris
This patch reserves an IOVA range for the Iris VPU to prevent unhandled SMMU page faults when DMA accesses that range from other stream IDs. It achieves this by adding a reserved-memory IOVA reservation node and referencing it from the Iris node.
Quoted 8 lines
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +0
-0@@ -669,6 +669,17 @@ reserved-region@aeb00000 { reg = <0 0xaeb00000 0 0x16600000>; no-map; };
arch/arm64/boot/dts/qcom/sc8280xp.dtsi reserved-region@aeb00000 { · line 681
Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +10
-0+ + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>;
[Severity: Medium]
This is a pre-existing issue, but does of_iommu_get_resv_regions() leak the device node reference when processing the iommu-addresses property?
When parsing these nodes, the reference is acquired via of_find_node_by_phandle():
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
struct device_node *np;
u32 phandle;
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
...
}But it looks like of_node_put(np) is never called within the loop or the function, which would result in a leak on every element in the property.
[Severity: High]
This is a pre-existing issue, but is there a risk of a NULL pointer dereference here if of_translate_dma_region() fails?
If the translation fails (for example, due to an invalid DMA parent), of_translate_dma_region() returns NULL:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
if (length == 0) {
dev_warn(dev, "Cannot reserve IOVA region of 0 size\n");
continue;
}
...
}Since maps is updated to NULL, the loop condition (maps < end) still evaluates to true. On the next iteration, be32_to_cpup(maps++) would unconditionally dereference the NULL pointer:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
struct device_node *np;
u32 phandle;
phandle = be32_to_cpup(maps++);
...
}Quoted 2 lines
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +1
-0+ }; };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
Vikash Garodia
maintainerPATCH 8/22 arm64: dts: qcom: sm8350: Reserve low IOVA range for Iris
In reply to Vikash GarodiaIris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +12 -1
@@ -553,6 +553,17 @@ removed_mem: memory@d8800000 { reg = <0x0 0xd8800000 0x0 0x6800000>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; smp2p-adsp {
@@ -2786,7 +2797,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, operating-points-v2 = <&iris_opp_table>; iommus = <&apps_smmu 0x2100 0x400>; - memory-region = <&pil_video_mem>; + memory-region = <&pil_video_mem>, <&iris_iova>; status = "disabled";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 08/22] arm64: dts: qcom: sm8350: Reserve low IOVA range for Iris
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Uninitialized variable usage and NULL pointer dereference in of_iommu_get_resv_regions() when of_translate_dma_region() fails. --
--- Patch [8]: [PATCH 08/22] arm64: dts: qcom: sm8350: Reserve low IOVA range for Iris --- commit ff9e2ea90c6d8293aa79fd7350941f4a90c4b7df
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: sm8350: Reserve low IOVA range for Iris
The Iris VPU needs IOVA addresses below 0x25800000 reserved to prevent unhandled SMMU page faults and reboots caused by DMA from other stream IDs. This patch adds a reserved-memory IOVA reservation node and references it from the Iris node.
Quoted 4 lines
arch/arm64/boot/dts/qcom/sm8350.dtsi +0
-0
[ ... ]
Quoted 4 lines
arch/arm64/boot/dts/qcom/sm8350.dtsi +0
-0@@ -553,6 +553,17 @@ removed_mem: memory@d8800000 { reg = <0x0 0xd8800000 0x0 0x6800000>; no-map; };
arch/arm64/boot/dts/qcom/sm8350.dtsi removed_mem: memory@d8800000 { · line 565
Quoted 10 lines
arch/arm64/boot/dts/qcom/sm8350.dtsi +10
-0+ + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>;
[Severity: High]
This isn't a bug introduced by this patch, but adding this iommu-addresses property highlights a pre-existing issue in the parsing code. Does of_iommu_get_resv_regions() safely handle translation failures?
Looking at drivers/iommu/of_iommu.c:of_iommu_get_resv_regions(), when of_translate_dma_region() fails, it returns NULL:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
if (length == 0) {
...
}The return value is assigned directly to maps without checking for NULL, leaving the iova and length stack variables uninitialized.
If the loop continues to the next iteration, it attempts to dereference maps:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
phandle = be32_to_cpup(maps++);
...
}This causes a NULL pointer dereference and a kernel panic.
Could the parsing code in of_iommu.c be hardened to gracefully handle invalid or untranslatable data without panicking?
Quoted 2 lines
arch/arm64/boot/dts/qcom/sm8350.dtsi +1
-0+ }; };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
Vikash Garodia
maintainerPATCH 9/22 arm64: dts: qcom: sm8550: Reserve low IOVA range for Iris
In reply to Vikash GarodiaIris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/qcs8550.dtsi | 11 +++++++++++ arch/arm64/boot/dts/qcom/sm8550.dtsi | 13 ++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/qcs8550.dtsi +11 -0
@@ -158,5 +158,16 @@ mpss_dsm_mem: mpss-dsm-region@d4d00000 { reg = <0x0 0xd4d00000 0x0 0x3300000>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; };
arch/arm64/boot/dts/qcom/sm8550.dtsi +12 -1
@@ -1088,6 +1088,17 @@ hyp_ext_reserved_mem: hyp-ext-reserved-region@ff700000 { reg = <0 0xff700000 0 0x100000>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; smp2p-adsp {
@@ -3686,7 +3697,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>; resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>; reset-names = "bus";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 09/22] arm64: dts: qcom: sm8550: Reserve low IOVA range for Iris
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] Kernel panic via NULL pointer dereference in of_iommu_get_resv_regions() if DMA translation fails.
- [High] Incorrect iteration over iommu-addresses when a phandle does not match dev->of_node, causing parsing misalignment and out-of-bounds reads.
- [Medium] Pre-existing memory leak of device_node in of_iommu_get_resv_regions().
--
--- Patch [9]: [PATCH 09/22] arm64: dts: qcom: sm8550: Reserve low IOVA range for Iris --- commit b23293d9b1e601df9a40295b28db44388efa63a4
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: sm8550: Reserve low IOVA range for Iris
This commit adds a reserved-memory IOVA reservation node for the Iris VPU to keep IOMMU allocations above 0x25800000. It prevents SMMU page faults and device reboots when DMA accesses that range. The new region is referenced from the Iris node using the iommu-addresses property.
Quoted 4 lines
arch/arm64/boot/dts/qcom/sm8550.dtsi +0
-0
[ ... ]
Quoted 5 lines
arch/arm64/boot/dts/qcom/sm8550.dtsi +1
-0@@ -1088,6 +1088,17 @@ hyp_ext_reserved_mem: hyp-ext-reserved-region@ff700000 { reg = <0 0xff700000 0 0x100000>; no-map; }; +
arch/arm64/boot/dts/qcom/sm8550.dtsi hyp_ext_reserved_mem: hyp-ext-reserved-region@ff700000 { · line 1101
Quoted 10 lines
arch/arm64/boot/dts/qcom/sm8550.dtsi +10
-0+ /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + };
[Severity: High]
This is a pre-existing issue, but could introducing this iommu-addresses property expose a panic in the device tree parsing logic?
In drivers/iommu/of_iommu.c:of_iommu_get_resv_regions(), if the DMA region translation fails, the maps pointer is overwritten with a NULL pointer and length is left uninitialized:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
if (length == 0) {
...
}Because length is uninitialized stack memory, it might not be zero.
The loop would then iterate again, and since maps is NULL and end is a valid memory address, the loop condition is met and it attempts to dereference the NULL pointer:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
struct device_node *np;
u32 phandle;
phandle = be32_to_cpup(maps++);
...
}[Severity: High]
This isn't a bug introduced by this patch, but does the IOMMU parsing logic correctly advance the maps pointer when a phandle does not match?
When iterating over the properties, if the phandle does not match the active device node, the maps pointer only advances by one cell:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {
...
}Without logic to advance maps past the address and size cells of the skipped entry, subsequent iterations will mistakenly read the address or size data as the next phandle, corrupting the array parsing and potentially causing an out-of-bounds read.
[Severity: Medium]
This is a pre-existing issue, but is there a reference count leak for the device node during this parsing loop?
Inside the same property parsing loop, a reference to the device node is obtained:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
np = of_find_node_by_phandle(phandle);
...
}However, the loop iteration concludes without calling of_node_put() to drop the reference:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
}
}
...
}Would it be helpful to add an of_node_put(np) call after the entry is parsed to prevent leaking the reference on each valid phandle?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
Vikash Garodia
maintainerPATCH 10/22 arm64: dts: qcom: sm8650: Reserve low IOVA range for Iris
In reply to Vikash GarodiaIris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/sm8650.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8650.dtsi +12 -1
@@ -1905,6 +1905,17 @@ llcc_lpi_mem: llcc-lpi@ff800000 { reg = <0 0xff800000 0 0x600000>; no-map; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; smp2p-adsp {
@@ -5266,7 +5277,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>; resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>, <&videocc VIDEO_CC_XO_CLK_ARES>,
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 10/22] arm64: dts: qcom: sm8650: Reserve low IOVA range for Iris
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Pre-existing parsing bug in of_iommu_get_resv_regions() causing misalignment and incorrect parsing when encountering non-matching shared reservations.
- [High] Missing NULL check for the return value of of_translate_dma_region() causes a kernel panic if address translation fails.
--
--- Patch [10]: [PATCH 10/22] arm64: dts: qcom: sm8650: Reserve low IOVA range for Iris --- commit 0235003bbbcd1eb35cb1bdeb1f805b1bd98ddfd1
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: sm8650: Reserve low IOVA range for Iris
Iris VPU reserves IOVA addresses below 0x25800000, primarily for secure non-pixel buffers. This commit adds a reserved-memory IOVA reservation node covering [0, 0x25800000] and references it from the Iris node to keep DMA allocations above that boundary.
Quoted 3 lines
arch/arm64/boot/dts/qcom/sm8650.dtsi +0
-0
[ ... ]
arch/arm64/boot/dts/qcom/sm8650.dtsi &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, · line 5280
Quoted 6 lines
arch/arm64/boot/dts/qcom/sm8650.dtsi +1
-1@@ -5266,7 +5277,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interconnect-names = "cpu-cfg", "video-mem"; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>;
[Severity: High]
This isn't a bug introduced by this patch, but does adding multiple entries to a memory-region expose a parsing bug in of_iommu_get_resv_regions()?
When processing a node with multiple entries, if an earlier phandle in the list does not match dev->of_node, the loop in drivers/iommu/of_iommu.c fails to advance the maps pointer over the address and size cells:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}
/* Missing advancement of maps if np != dev->of_node */
}Will the next iteration erroneously read the unparsed address or size cells as the next phandle, corrupting the device tree parsing?
[Severity: High]
This is another pre-existing issue in the same parsing area, but could address translation failures lead to a kernel panic here?
If of_translate_dma_region() fails (for example, if the device lacks a DMA parent), it returns NULL. The return value is assigned directly to maps without checking:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
if (length == 0) {
...
}On the next loop iteration, the condition maps < end will be evaluated where NULL is less than the valid kernel pointer end, and be32_to_cpup(maps++) will dereference the NULL pointer.
Could this trigger a crash on boot if an untranslatable DMA region is encountered?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
Vikash Garodia
maintainerPATCH 11/22 arm64: dts: qcom: sm8750: Reserve low IOVA range for Iris
In reply to Vikash GarodiaIris VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the Iris node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/sm8750.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8750.dtsi +12 -1
@@ -562,6 +562,17 @@ adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { size = <0x0 0xc00000>; reusable; }; + + /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + }; }; smp2p-adsp {
@@ -2970,7 +2981,7 @@ &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&iris_iova>; operating-points-v2 = <&iris_opp_table>;
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 11/22] arm64: dts: qcom: sm8750: Reserve low IOVA range for Iris
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing error handling for of_translate_dma_region leads to uninitialized stack usage and a NULL pointer dereference.
- [High] The loop parsing iommu-addresses fails to advance the property pointer when skipping entries for other devices, corrupting parsing. --
--- Patch [11]: [PATCH 11/22] arm64: dts: qcom: sm8750: Reserve low IOVA range for Iris --- commit c7d055796e0d5e48c39a3d7938283d3a8d0628e4
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: sm8750: Reserve low IOVA range for Iris
This commit adds a reserved-memory IOVA reservation node for the Iris VPU to keep IOMMU allocations above 0x25800000, preventing unhandled SMMU faults. It also references the reservation node from the Iris node.
Quoted 9 lines
arch/arm64/boot/dts/qcom/sm8750.dtsi +1
-0@@ -562,6 +562,17 @@ adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { size = <0x0 0xc00000>; reusable; }; +
arch/arm64/boot/dts/qcom/sm8750.dtsi adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { · line 575
Quoted 10 lines
arch/arm64/boot/dts/qcom/sm8750.dtsi +10
-0+ /* + * The Iris VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + iris_iova: iris-iova { + iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>; + };
[Severity: High]
This isn't a bug introduced by this patch, but using iommu-addresses here exposes a NULL pointer dereference risk in drivers/iommu/of_iommu.c if the device tree is ever misconfigured.
If of_translate_dma_region() fails (e.g., due to invalid dma-ranges), it returns NULL, which is assigned directly to maps without checking:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}On the next loop iteration, maps is compared to end, and then dereferenced via be32_to_cpup(maps++), causing a kernel oops and failing to boot:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
struct device_node *np;
u32 phandle;
phandle = be32_to_cpup(maps++);
...
}In addition, length and iova remain uninitialized stack variables. Can we add a check for NULL after of_translate_dma_region() to prevent this crash?
[Severity: High]
This is a pre-existing issue, but adding iommu-addresses here is affected by a parsing bug in drivers/iommu/of_iommu.c for multi-entry properties.
When parsing the array, if the phandle does not match dev->of_node, the code skips the if block and loops, but fails to advance past the DMA address and size cells for the skipped entry:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
if (np == dev->of_node) {
int err;
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}The next loop iteration will misinterpret the skipped DMA address as the next phandle, corrupting the parsing entirely. Does this need to be fixed in of_iommu_get_resv_regions() to safely support multi-entry iommu-addresses properties?
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
Vikash Garodia
maintainerPATCH 12/22 arm64: dts: qcom: agatti: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/agatti.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/agatti.dtsi +12 -1
@@ -381,6 +381,17 @@ rmtfs_mem: memory@89b01000 { qcom,client-id = <1>; qcom,vmid = <QCOM_SCM_VMID_MSS_MSA QCOM_SCM_VMID_NAV>; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>; + }; }; smp2p-adsp {
@@ -2486,7 +2497,7 @@ venus: video-codec@5a00000 { "vcodec0_core", "vcodec0_bus"; - memory-region = <&pil_video_mem>; + memory-region = <&pil_video_mem>, <&venus_iova>; iommus = <&apps_smmu 0x860 0x0>, <&apps_smmu 0x880 0x0>;
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 12/22] arm64: dts: qcom: agatti: Reserve low IOVA range for Venus
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Multiple parsing vulnerabilities in of_iommu_get_resv_regions when processing iommu-addresses. --
--- Patch [12]: [PATCH 12/22] arm64: dts: qcom: agatti: Reserve low IOVA range for Venus --- commit ce9067cc6b514ef4e9f906bcee46fa8222f6c18b
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: agatti: Reserve low IOVA range for Venus
This commit reserves IOVA addresses below 0x25800000 for the Venus VPU. This prevents unhandled SMMU page faults and spontaneous reboots when other stream IDs DMA into that range.
Quoted 4 lines
arch/arm64/boot/dts/qcom/agatti.dtsi +0
-0
[ ... ]
Quoted 5 lines
arch/arm64/boot/dts/qcom/agatti.dtsi +1
-0@@ -381,6 +381,17 @@ rmtfs_mem: memory@89b01000 { qcom,client-id = <1>; qcom,vmid = <QCOM_SCM_VMID_MSS_MSA QCOM_SCM_VMID_NAV>; }; +
arch/arm64/boot/dts/qcom/agatti.dtsi rmtfs_mem: memory@89b01000 { · line 394
Quoted 10 lines
arch/arm64/boot/dts/qcom/agatti.dtsi +10
-0+ /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>; + };
[Severity: High]
This isn't a bug introduced by this patch, but using the iommu-addresses property here exposes multiple parsing vulnerabilities in of_iommu_get_resv_regions() in drivers/iommu/of_iommu.c.
First, if a memory-region specifies iommu-addresses with entries for multiple devices, the loop reads the first phandle. If it doesn't match dev->of_node, it continues without advancing the maps pointer by the required address and size cells (na + ns):
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {
...
}Does this cause the next iteration to incorrectly interpret the remaining address and size cells as a phandle?
Second, if of_translate_dma_region() fails because there is no DMA parent, it returns null. The stack variable length remains uninitialized. If length is not zero, the loop proceeds.
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
if (length == 0)
continue;
...
}Since maps is null, will this trigger a fatal null pointer dereference on the next maps++ ?
Finally, there appears to be no bounds check before of_translate_dma_region() reads na + ns cells from the maps pointer.
Should these parser issues in of_iommu_get_resv_regions() be fixed before or alongside introducing this iommu-addresses usage?
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
Vikash Garodia
maintainerPATCH 13/22 arm64: dts: qcom: kodiak: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/kodiak.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/kodiak.dtsi +12 -1
@@ -198,6 +198,17 @@ adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { alignment = <0x0 0x400000>; size = <0x0 0x800000>; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>; + }; }; cpus {
@@ -5026,7 +5037,7 @@ venus: video-codec@aa00000 { interconnect-names = "cpu-cfg", "video-mem"; iommus = <&apps_smmu 0x2180 0x20>; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&venus_iova>; status = "disabled";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 13/22] arm64: dts: qcom: kodiak: Reserve low IOVA range for Venus
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Fatal parsing bug and NULL pointer dereference in of_iommu_get_resv_regions when parsing iommu-addresses. --
--- Patch [13]: [PATCH 13/22] arm64: dts: qcom: kodiak: Reserve low IOVA range for Venus --- commit c5c55dfe3f391bbec75ef2147bce3c7b4d05e83b
Author: Vikash Garodia <[email protected]>
Subject: arm64: dts: qcom: kodiak: Reserve low IOVA range for Venus
This commit reserves IOVA addresses below 0x25800000 for the Venus VPU to prevent SMMU page faults and spontaneous reboots caused by unhandled DMA. It adds a reserved-memory IOVA reservation node and references it from the venus node to keep IOMMU allocations above this boundary.
Quoted 3 lines
arch/arm64/boot/dts/qcom/kodiak.dtsi +0
-0
[ ... ]
Quoted 4 lines
arch/arm64/boot/dts/qcom/kodiak.dtsi +0
-0@@ -198,6 +198,17 @@ adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { alignment = <0x0 0x400000>; size = <0x0 0x800000>; };
arch/arm64/boot/dts/qcom/kodiak.dtsi adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { · line 210
Quoted 10 lines
arch/arm64/boot/dts/qcom/kodiak.dtsi +10
-0+ + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>;
[Severity: High]
This isn't a bug introduced by this patch, but adding this iommu-addresses property exposes a fatal parsing flaw in the IOMMU core layer that can panic the kernel.
In drivers/iommu/of_iommu.c:of_iommu_get_resv_regions(), the loop parsing the iommu-addresses property assigns the map pointer without validation:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}If of_translate_dma_region() fails, it returns NULL. The code does not check for this, meaning maps becomes NULL. The loop condition (maps < end) then evaluates to true, and the next iteration will directly dereference NULL.
Additionally, if the parsed phandle does not match dev->of_node:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
if (np == dev->of_node) {
// ...
}
...
}The code falls through without advancing the maps pointer to skip the current device's address and size cells. This causes the next iteration to incorrectly read address cells as phandles, entirely corrupting the DT parsing structure.
Is there any risk that this new configuration could trigger a translation failure or phandle mismatch during device probe and hit these bugs?
Quoted 4 lines
arch/arm64/boot/dts/qcom/kodiak.dtsi +1
-0+ }; }; cpus {
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=13
Vikash Garodia
maintainerPATCH 14/22 arm64: dts: qcom: msm8916: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +12 -1
@@ -114,6 +114,17 @@ mba_mem: mba { no-map; status = "disabled"; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x25800000>; + }; }; clocks {
@@ -1834,7 +1845,7 @@ venus: video-codec@1d00000 { <&gcc GCC_VENUS0_AXI_CLK>; clock-names = "core", "iface", "bus"; iommus = <&apps_iommu 5>; - memory-region = <&venus_mem>; + memory-region = <&venus_mem>, <&venus_iova>; status = "disabled"; };
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 14/22] arm64: dts: qcom: msm8916: Reserve low IOVA range for Venus
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The IOVA reservation added for Venus is ineffective because the qcom-iommu driver does not…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The IOVA reservation added for Venus is ineffective because the qcom-iommu driver does not implement the .get_resv_regions callback. --
--- Patch [14]: [PATCH 14/22] arm64: dts: qcom: msm8916: Reserve low IOVA range for Venus --- commit d8c0142deff84cf404f92b187d9bada3c787a2bb
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: msm8916: Reserve low IOVA range for Venus
This commit reserves the IOVA address range below 0x25800000 for the Venus VPU to prevent unhandled SMMU page faults and spontaneous reboots during video decode. It adds a reserved-memory IOVA node and references it in the venus node.
Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +0
-0
[ ... ]
Quoted 5 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +1
-0@@ -114,6 +114,17 @@ mba_mem: mba { no-map; status = "disabled"; }; +
arch/arm64/boot/dts/qcom/msm8916.dtsi mba_mem: mba { · line 127
Quoted 10 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +10
-0+ /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x25800000>; + };
[Severity: High]
Is this reservation effective on this platform?
Looking at the qcom-iommu driver used by apps_iommu, the qcom_iommu_ops structure does not implement the .get_resv_regions callback:
drivers/iommu/arm/arm-smmu/qcom_iommu.c:qcom_iommu_ops {
static const struct iommu_ops qcom_iommu_ops = {
.identity_domain = &qcom_iommu_identity_domain,
.capable = qcom_iommu_capable,
...
};
}Without this callback, iommu_get_resv_regions() will return an empty list and silently ignore the iommu-addresses property defined in the device tree.
Could this allow the DMA API to continue allocating IOVA addresses in the reserved range, thereby still triggering the SMMU faults and system reboots?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=14
Vikash Garodia
maintainerPATCH 15/22 arm64: dts: qcom: msm8996: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8996.dtsi +13 -1
@@ -592,6 +592,18 @@ mdata_mem: mpss-metadata { size = <0x0 0x4000>; no-map; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x25800000>; + }; + }; smem {
@@ -2427,7 +2439,7 @@ venus: video-codec@c00000 { <&venus_smmu 0x2c>, <&venus_smmu 0x2d>, <&venus_smmu 0x31>; - memory-region = <&venus_mem>; + memory-region = <&venus_mem>, <&venus_iova>; status = "disabled"; video-decoder {
Signature · 1 line
2.34.1
Vikash Garodia
maintainerPATCH 16/22 arm64: dts: qcom: msm8998: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/msm8998.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8998.dtsi +12 -1
@@ -116,6 +116,17 @@ mdata_mem: mpss-metadata { size = <0x0 0x4000>; no-map; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x25800000>; + }; }; clocks {
@@ -3201,7 +3212,7 @@ venus: video-codec@cc00000 { <&mmss_smmu 0x42d>, <&mmss_smmu 0x411>, <&mmss_smmu 0x431>; - memory-region = <&venus_mem>; + memory-region = <&venus_mem>, <&venus_iova>; status = "disabled"; video-decoder {
Signature · 1 line
2.34.1
Vikash Garodia
maintainerPATCH 17/22 arm64: dts: qcom: sc7180: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc7180.dtsi +12 -1
@@ -692,6 +692,17 @@ rmtfs_mem: memory@94600000 { qcom,client-id = <1>; qcom,vmid = <QCOM_SCM_VMID_MSS_MSA>; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>; + }; }; smem {
@@ -3155,7 +3166,7 @@ venus: video-codec@aa00000 { clock-names = "core", "iface", "bus", "vcodec0_core", "vcodec0_bus"; iommus = <&apps_smmu 0x0c00 0x60>; - memory-region = <&venus_mem>; + memory-region = <&venus_mem>, <&venus_iova>; interconnects = <&mmss_noc MASTER_VIDEO_P0 0 &mc_virt SLAVE_EBI1 0>, <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; interconnect-names = "video-mem", "cpu-cfg";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 17/22] arm64: dts: qcom: sc7180: Reserve low IOVA range for Venus
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Flawed iteration and error handling in of_iommu_get_resv_regions() causes parser corruption and NULL pointer dereference. --
--- Patch [17]: [PATCH 17/22] arm64: dts: qcom: sc7180: Reserve low IOVA range for Venus --- commit dbfbcf45d9c413275eb757edbb4fc53e7e4ee11b
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: sc7180: Reserve low IOVA range for Venus
This commit adds a reserved-memory IOVA node for the Venus VPU covering the first 600MB. It references this node in the venus video-codec to keep IOMMU allocations above this boundary and prevent spontaneous reboots caused by unhandled SMMU page faults.
Quoted 8 lines
arch/arm64/boot/dts/qcom/sc7180.dtsi +0
-0@@ -692,6 +692,17 @@ rmtfs_mem: memory@94600000 { qcom,client-id = <1>; qcom,vmid = <QCOM_SCM_VMID_MSS_MSA>; };
arch/arm64/boot/dts/qcom/sc7180.dtsi rmtfs_mem: memory@94600000 { · line 704
Quoted 10 lines
arch/arm64/boot/dts/qcom/sc7180.dtsi +10
-0+ + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>;
[Severity: High]
This isn't a bug introduced by this patch, but adding this iommu-addresses property exposes a pre-existing flaw in how drivers/iommu/of_iommu.c handles parsing in of_iommu_get_resv_regions().
If a phandle does not match dev->of_node:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
...
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {
...
}Does the code fail to advance the maps pointer past the current entry's address and size cells, corrupting subsequent parsing?
Additionally, if of_translate_dma_region() fails, it returns NULL:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
if (length == 0) {
dev_warn(dev, "Cannot reserve IOVA region of 0 size\n");
continue;
}
...
}Could this leave length and iova uninitialized and set maps to NULL, leading to a NULL pointer dereference on the next loop iteration?
Quoted 2 lines
arch/arm64/boot/dts/qcom/sc7180.dtsi +1
-0+ }; };
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=17
Vikash Garodia
maintainerPATCH 18/22 arm64: dts: qcom: sdm630: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/sdm630.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm630.dtsi +12 -1
@@ -518,6 +518,17 @@ mdata_mem: mpss-metadata { size = <0x0 0x4000>; no-map; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x25800000>; + }; }; smem: smem {
@@ -2243,7 +2254,7 @@ venus: video-codec@cc00000 { <&mmss_smmu 0x42d>, <&mmss_smmu 0x411>, <&mmss_smmu 0x431>; - memory-region = <&venus_region>; + memory-region = <&venus_region>, <&venus_iova>; power-domains = <&mmcc VENUS_GDSC>; status = "disabled";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 18/22] arm64: dts: qcom: sdm630: Reserve low IOVA range for Venus
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Severe parsing flaws in of_iommu_get_resv_regions() lead to parser desynchronization, out-of-bounds reads, and a NULL pointer dereference when processing the iommu-addresses device tree property. --
--- Patch [18]: [PATCH 18/22] arm64: dts: qcom: sdm630: Reserve low IOVA range for Venus --- commit c911f79533bbf9fd3f531d014c6333ee5871bf3d
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: sdm630: Reserve low IOVA range for Venus
This commit reserves IOVA addresses below 0x25800000 for the Venus VPU to prevent unhandled SMMU page faults. It adds a reserved-memory IOVA reservation node and references it from the venus node.
Quoted 4 lines
arch/arm64/boot/dts/qcom/sdm630.dtsi +0
-0
[ ... ]
Quoted 5 lines
arch/arm64/boot/dts/qcom/sdm630.dtsi +1
-0@@ -518,6 +518,17 @@ mdata_mem: mpss-metadata { size = <0x0 0x4000>; no-map; }; +
arch/arm64/boot/dts/qcom/sdm630.dtsi mdata_mem: mpss-metadata { · line 531
Quoted 10 lines
arch/arm64/boot/dts/qcom/sdm630.dtsi +10
-0+ /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x25800000>; + };
[Severity: High]
This is a pre-existing issue, but could this iommu-addresses property trigger parsing flaws in of_iommu_get_resv_regions()?
Looking at drivers/iommu/of_iommu.c:of_iommu_get_resv_regions():
while (maps < end) {
struct device_node *np;
u32 phandle;
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {If np != dev->of_node, the loop fails to advance maps by the number of address and size cells for the current phandle. This causes a parser desynchronization on the next iteration.
Additionally, a few lines later:
maps = of_translate_dma_region(np, maps, &iova, &length);
if (length == 0) {The unchecked NULL return from of_translate_dma_region() is assigned directly to maps. The uninitialized length stack variable is then checked instead of verifying the pointer.
If of_translate_dma_region() fails and returns NULL, it can lead to a subsequent NULL pointer dereference in the next loop iteration.
Quoted 3 lines
arch/arm64/boot/dts/qcom/sdm630.dtsi +0
-0}; smem: smem {
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=18
Vikash Garodia
maintainerPATCH 19/22 arm64: dts: qcom: sdm845: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +12 -1
@@ -898,6 +898,17 @@ fastrpc_mem: fastrpc { size = <0x0 0x1000000>; reusable; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>; + }; }; adsp_pas: remoteproc-adsp {
@@ -4346,7 +4357,7 @@ venus: video-codec@aa00000 { "vcodec1_core", "vcodec1_bus"; iommus = <&apps_smmu 0x10a0 0x8>, <&apps_smmu 0x10b0 0x0>; - memory-region = <&venus_mem>; + memory-region = <&venus_mem>, <&venus_iova>; interconnects = <&mmss_noc MASTER_VIDEO_P0 0 &mem_noc SLAVE_EBI1 0>, <&gladiator_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; interconnect-names = "video-mem", "cpu-cfg";
Signature · 1 line
2.34.1
Vikash Garodia
maintainerPATCH 20/22 arm64: dts: qcom: sm6115: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/sm6115.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm6115.dtsi +12 -1
@@ -532,6 +532,17 @@ rmtfs_mem: memory@89b01000 { qcom,client-id = <1>; qcom,vmid = <QCOM_SCM_VMID_MSS_MSA QCOM_SCM_VMID_NAV>; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>; + }; }; smp2p-adsp {
@@ -1880,7 +1891,7 @@ venus: video-codec@5a00000 { "vcodec0_core", "vcodec0_bus"; - memory-region = <&pil_video_mem>; + memory-region = <&pil_video_mem>, <&venus_iova>; iommus = <&apps_smmu 0x860 0x0>, <&apps_smmu 0x880 0x0>;
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 20/22] arm64: dts: qcom: sm6115: Reserve low IOVA range for Venus
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Low] The venus-iova node lacks required reg or size properties and relies on an undocumented property, violating the reserved-memory schema.
Pre-existing issues:
- [High] Reference leak and parsing desync in of_iommu_get_resv_regions when parsing iommu-addresses for unmatched devices.
- [High] NULL pointer dereference in of_iommu_get_resv_regions if of_translate_dma_region fails.
--
--- Patch [20]: [PATCH 20/22] arm64: dts: qcom: sm6115: Reserve low IOVA range for Venus --- commit bec476bec203ee86c0c6ea293d84bdd69fa09d6f
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: sm6115: Reserve low IOVA range for Venus
Venus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node.
Quoted 4 lines
arch/arm64/boot/dts/qcom/sm6115.dtsi +0
-0
[ ... ]
Quoted 4 lines
arch/arm64/boot/dts/qcom/sm6115.dtsi +0
-0@@ -532,6 +532,17 @@ rmtfs_mem: memory@89b01000 { qcom,client-id = <1>; qcom,vmid = <QCOM_SCM_VMID_MSS_MSA QCOM_SCM_VMID_NAV>; };
arch/arm64/boot/dts/qcom/sm6115.dtsi rmtfs_mem: memory@89b01000 { · line 544
Quoted 10 lines
arch/arm64/boot/dts/qcom/sm6115.dtsi +10
-0+ + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>;
[Severity: Low]
Will this fail devicetree validation tooling? The venus_iova node appears to be missing the standard reg or size properties, and relies on the undocumented iommu-addresses property, which might violate the core reserved-memory devicetree schema.
[Severity: High]
This isn't a bug introduced by this patch, but using the iommu-addresses property here exposes an existing reference leak and parsing desynchronization in drivers/iommu/of_iommu.c:of_iommu_get_resv_regions().
If the property contains a phandle that does not match dev->of_node, the node reference is leaked:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {
...
}Because the if block is skipped for unmatched devices, of_node_put(np) is never called. Furthermore, the maps pointer is not advanced past the device's address and size cells. Would this cause the next loop iteration to read the address/size as a phandle, corrupting all subsequent parsing?
[Severity: High]
This is also a pre-existing issue, but utilizing iommu-addresses here could trigger a NULL pointer dereference in the same parsing function.
If of_translate_dma_region() returns NULL on a translation error (such as a bad address or missing DMA parent):
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
...
}The maps pointer becomes NULL and is directly dereferenced in the next iteration of the while loop. Could this cause a kernel panic during device probe if the devicetree configuration is malformed?
Quoted 4 lines
arch/arm64/boot/dts/qcom/sm6115.dtsi +1
-0+ }; }; smp2p-adsp {
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=20
Vikash Garodia
maintainerPATCH 21/22 arm64: dts: qcom: sm8250: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/sm8250.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8250.dtsi +12 -1
@@ -872,6 +872,17 @@ adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { alignment = <0x0 0x400000>; size = <0x0 0x800000>; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>; + }; }; smem {
@@ -4353,7 +4364,7 @@ venus: video-codec@aa00000 { interconnect-names = "cpu-cfg", "video-mem"; iommus = <&apps_smmu 0x2100 0x0400>; - memory-region = <&video_mem>; + memory-region = <&video_mem>, <&venus_iova>; resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>, <&videocc VIDEO_CC_MVS0C_CLK_ARES>;
Signature · 1 line
2.34.1
Vikash Garodia
maintainerPATCH 22/22 arm64: dts: qcom: talos: Reserve low IOVA range for Venus
In reply to Vikash GarodiaVenus VPU reserves IOVA addresses below 0x25800000 (600MB), primarily for secure non-pixel buffers. DMA into that range, from any other stream id would triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with one or more browser tabs driving multiple concurrent video decode streams.
Add a reserved-memory IOVA reservation node covering [0, 0x25800000] and reference it from the venus node so the IOMMU layer keeps DMA allocations above that boundary.
--- arch/arm64/boot/dts/qcom/talos.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/talos.dtsi +12 -1
@@ -687,6 +687,17 @@ adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { alignment = <0x0 0x400000>; size = <0x0 0x800000>; }; + + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>; + }; }; soc: soc@0 {
@@ -4116,7 +4127,7 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, iommus = <&apps_smmu 0xe60 0x20>; - memory-region = <&pil_video_mem>; + memory-region = <&pil_video_mem>, <&venus_iova>; status = "disabled";
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 22/22] arm64: dts: qcom: talos: Reserve low IOVA range for Venus
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the parsing loop in of_iommu_get_resv_regions fails to properly advance the maps pointer when a tuple's phandle does not match the target device, leading to corrupt parsing and potential out-of-bounds reads.
- [High] This problem wasn't introduced by this patch, but an unchecked return value from of_translate_dma_region() in of_iommu_get_resv_regions() leads to uninitialized stack variable usage and a NULL pointer dereference. --
--- Patch [22]: [PATCH 22/22] arm64: dts: qcom: talos: Reserve low IOVA range for Venus --- commit c79264714a3878505bc5105c9bc703dbf039cc23
Author: Vikash Garodia <[email protected]>
arm64: dts: qcom: talos: Reserve low IOVA range for Venus
This commit adds a reserved-memory IOVA reservation node for the Venus VPU and references it to keep DMA allocations above 0x25800000. This prevents unhandled SMMU page faults and spontaneous device reboots.
Quoted 8 lines
arch/arm64/boot/dts/qcom/talos.dtsi +0
-0@@ -687,6 +687,17 @@ adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { alignment = <0x0 0x400000>; size = <0x0 0x800000>; };
arch/arm64/boot/dts/qcom/talos.dtsi adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap { · line 699
Quoted 10 lines
arch/arm64/boot/dts/qcom/talos.dtsi +10
-0+ + /* + * The Venus VPU reserves IOVA below 0x25800000 (600MB), + * primarily for non-pixel buffers using different Stream IDs. + * DMA into that range triggers unhandled SMMU faults and + * spontaneous reboots, so reserve it to keep IOMMU + * allocations above this boundary. + */ + venus_iova: venus-iova { + iommu-addresses = <&venus 0x0 0x0 0x0 0x25800000>;
[Severity: High]
This isn't a bug introduced by this patch, but does adding an iommu-addresses property expose an existing parsing issue in of_iommu_get_resv_regions()?
When parsing the iommu-addresses property, if a tuple's phandle does not match dev->of_node, the loop skips the match block but fails to properly advance the maps pointer past the current tuple's address and size cells:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
phandle = be32_to_cpup(maps++);
np = of_find_node_by_phandle(phandle);
if (np == dev->of_node) {
...
}
/* maps is not advanced by address/size cells if np != dev->of_node */
}
...
}Could this lead to the next iteration incorrectly treating part of the DMA address as the next phandle, resulting in out-of-bounds reads or corrupt parsing?
[Severity: High]
This is also a pre-existing issue, but could parsing this property lead to a NULL pointer dereference if of_translate_dma_region() fails?
If of_translate_dma_region() returns NULL (e.g. due to missing dma-ranges or a malformed DT), the return value is assigned directly to maps without a NULL check:
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
maps = of_translate_dma_region(np, maps, &iova, &length);
if (length == 0) {
...
}Since length is evaluated without initialization if the translation fails, and maps becomes NULL, could the subsequent loop iteration dereference the NULL maps pointer when reading the next phandle?
drivers/iommu/of_iommu.c:of_iommu_get_resv_regions() {
...
while (maps < end) {
phandle = be32_to_cpup(maps++);
...
}Quoted 2 lines
arch/arm64/boot/dts/qcom/talos.dtsi +1
-0+ }; };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=22
Quoted 19 lines · Vikash Garodia
Qualcomm venus and iris VPUs reserve IOVA addresses below
0x25800000(600MB) for non-pixel stream ID in secure mode. When the kernel allocates DMA mappings from this restricted range, the VPU generate unhandled SMMU page faults, leading to video failures and, in some cases, spontaneous system reboots.The issue is readily reproducible on affected platforms by running multiple concurrent video decode workloads, such as opening several browser tabs containing video streams.
To prevent allocations in the restricted region, this series introduces support for an IOMMU IOVA reserve memory-region in the Venus and Iris bindings and updates all affected device trees to reserve the low IOVA range [0,
0x25800000]. The memory-region is referenced by the video codec node, allowing the IOMMU layer to keep DMA allocations above the reserved boundary.The series consists of:
Quoted 8 lines
* Binding updates for Venus and Iris schemas to permit an additional memory-region phandle describing the IOVA reservation.
* DTS updates for all affected Venus platforms.
* DTS updates for all affected Iris platforms.This ensures that DMA allocations do not overlap restricted IOVA mappings for non-pixel stream IDs and prevents the resulting SMMU faults.
LGTM
For the series.
---
bod
Quoted 19 lines · Vikash Garodia
Qualcomm venus and iris VPUs reserve IOVA addresses below
0x25800000(600MB) for non-pixel stream ID in secure mode. When the kernel allocates DMA mappings from this restricted range, the VPU generate unhandled SMMU page faults, leading to video failures and, in some cases, spontaneous system reboots.The issue is readily reproducible on affected platforms by running multiple concurrent video decode workloads, such as opening several browser tabs containing video streams.
To prevent allocations in the restricted region, this series introduces support for an IOMMU IOVA reserve memory-region in the Venus and Iris bindings and updates all affected device trees to reserve the low IOVA range [0,
0x25800000]. The memory-region is referenced by the video codec node, allowing the IOMMU layer to keep DMA allocations above the reserved boundary.The series consists of:
Quoted 8 lines
* Binding updates for Venus and Iris schemas to permit an additional memory-region phandle describing the IOVA reservation.
* DTS updates for all affected Venus platforms.
* DTS updates for all affected Iris platforms.This ensures that DMA allocations do not overlap restricted IOVA mappings for non-pixel stream IDs and prevents the resulting SMMU faults.
Some of these patches have been sent already. Why is it again at v1?
Quoted 29 lines
Signed-off-by Vikash Garodia <[email protected]>---
Daniel J Blueman (2):
dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region
arm64: dts: qcom: hamoa: Reserve low IOVA range for IrisVikash Garodia (20):
dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region
dt-bindings: media: qcom,sc7180-venus: Allow IOVA reservation memory-region
arm64: dts: qcom: lemans: Reserve low IOVA range for Iris
arm64: dts: qcom: monaco: Reserve low IOVA range for Iris
arm64: dts: qcom: sc8280xp: Reserve low IOVA range for Iris
arm64: dts: qcom: sm8350: Reserve low IOVA range for Iris
arm64: dts: qcom: sm8550: Reserve low IOVA range for Iris
arm64: dts: qcom: sm8650: Reserve low IOVA range for Iris
arm64: dts: qcom: sm8750: Reserve low IOVA range for Iris
arm64: dts: qcom: agatti: Reserve low IOVA range for Venus
arm64: dts: qcom: kodiak: Reserve low IOVA range for Venus
arm64: dts: qcom: msm8916: Reserve low IOVA range for Venus
arm64: dts: qcom: msm8996: Reserve low IOVA range for Venus
arm64: dts: qcom: msm8998: Reserve low IOVA range for Venus
arm64: dts: qcom: sc7180: Reserve low IOVA range for Venus
arm64: dts: qcom: sdm630: Reserve low IOVA range for Venus
arm64: dts: qcom: sdm845: Reserve low IOVA range for Venus
arm64: dts: qcom: sm6115: Reserve low IOVA range for Venus
arm64: dts: qcom: sm8250: Reserve low IOVA range for Venus
arm64: dts: qcom: talos: Reserve low IOVA range for Venus
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerQuoted 25 lines · Dmitry Baryshkov
Quoted 24 lines · Vikash Garodia
Qualcomm venus and iris VPUs reserve IOVA addresses below
0x25800000(600MB) for non-pixel stream ID in secure mode. When the kernel allocates DMA mappings from this restricted range, the VPU generate unhandled SMMU page faults, leading to video failures and, in some cases, spontaneous system reboots.The issue is readily reproducible on affected platforms by running multiple concurrent video decode workloads, such as opening several browser tabs containing video streams.
To prevent allocations in the restricted region, this series introduces support for an IOMMU IOVA reserve memory-region in the Venus and Iris bindings and updates all affected device trees to reserve the low IOVA range [0,
0x25800000]. The memory-region is referenced by the video codec node, allowing the IOMMU layer to keep DMA allocations above the reserved boundary.The series consists of:
* Binding updates for Venus and Iris schemas to permit an additional memory-region phandle describing the IOVA reservation.
* DTS updates for all affected Venus platforms.
* DTS updates for all affected Iris platforms.
Quoted 4 lines
Quoted 3 lines
This ensures that DMA allocations do not overlap restricted IOVA mappings for non-pixel stream IDs and prevents the resulting SMMU faults.
Some of these patches have been sent already. Why is it again at v1?
By some, i assume you are referring to the 2 patches from Daniel. Kept it as part of this series to maintain the continuity with patches across other socs, other option would be to bring them as dependency and drop them from here.
Quoted 9 lines
Quoted 9 lines
Signed-off-by Vikash Garodia<[email protected]>---
Daniel J Blueman (2):
dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region
arm64: dts: qcom: hamoa: Reserve low IOVA range for IrisVikash Garodia (20):
dt-bindings: media: qcom,venus-common: Allow IOVA reservation memory-region
Quoted 26 lines · Vikash Garodia
Quoted 24 lines · Dmitry Baryshkov
Quoted 23 lines · Vikash Garodia
Qualcomm venus and iris VPUs reserve IOVA addresses below
0x25800000(600MB) for non-pixel stream ID in secure mode. When the kernel allocates DMA mappings from this restricted range, the VPU generate unhandled SMMU page faults, leading to video failures and, in some cases, spontaneous system reboots.
The issue is readily reproducible on affected platforms by running multiple concurrent video decode workloads, such as opening several browser tabs containing video streams.To prevent allocations in the restricted region, this series introduces support for an IOMMU IOVA reserve memory-region in the Venus and Iris bindings and updates all affected device trees to reserve the low IOVA range [0,
0x25800000]. The memory-region is referenced by the video codec node, allowing the IOMMU layer to keep DMA allocations above the reserved boundary.
The series consists of:
* Binding updates for Venus and Iris schemas to permit an additional memory-region phandle describing the IOVA reservation.
* DTS updates for all affected Venus platforms.
* DTS updates for all affected Iris platforms.
This ensures that DMA allocations do not overlap restricted IOVA mappings for non-pixel stream IDs and prevents the resulting SMMU faults.
Quoted 6 lines
Quoted 1 line
Some of these patches have been sent already. Why is it again at v1?
By some, i assume you are referring to the 2 patches from Daniel. Kept it as part of this series to maintain the continuity with patches across other socs, other option would be to bring them as dependency and drop them from here.
So, your series should have been v2 at least. V1 has already sailed.
Signature · 2 lines
With best wishes Dmitry