Skip to contentSkip to conversation

dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region

PATCH Superseded Daniel J Blueman 9 participants 18 messages Jun 1 – Jul 12

Subsystems (7)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region

In addition to the firmware-loaded codec carveout, some Iris platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from IOVA ranges that earlier firmware stages have already mapped through the SMMU.

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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +5 -1
index 9c4b760508b5..6359e4953d42 100644
@@ -80,7 +80,11 @@ properties:
   dma-coherent: true
 
   memory-region:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
+    items:
+      - description: Firmware-loaded codec carveout
+      - description: IOMMU IOVA reservation region
 
   operating-points-v2: true
 

--
2.53.0

#1 lore raw

PATCH 2/2 arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults that cause spontaneous device reboots. This is readily reproduced with web pages that drive multiple concurrent video decode streams, eg ui.com.

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.

This applies to all current hamoa.dtsi consumers (X1E80100/X1P42100/ X1P64100 boards); other Iris-bearing SoCs (sm8550/sm8650/sa8775p/ qcs8300) do not include hamoa.dtsi thus not affected.

Backports also require the preceding binding patch ("dt-bindings:
media: qcom,sm8550-iris: Allow IOVA reservation memory-region"); without it, dtbs_check rejects the second memory-region entry.

---
 arch/arm64/boot/dts/qcom/hamoa.dtsi | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/hamoa.dtsi +10 -1
index 051dee076416..e2af0bc5e064 100644
@@ -724,6 +724,15 @@ smem_mem: smem@ffe00000 {
 			hwlocks = <&tcsr_mutex 3>;
 			no-map;
 		};
+
+		/*
+		 * Iris DMA below IOVA 0x25800000 triggers unhandled SMMU
+		 * faults on hamoa platforms; reserve the range so the IOMMU
+		 * layer keeps allocations above this boundary.
+		 */
+		iris_iova: iris-iova {
+			iommu-addresses = <&iris 0x0 0x0 0x0 0x25800000>;
+		};
 	};
 
 	qup_opp_table_100mhz: opp-table-qup100mhz {
@@ -5479,7 +5488,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";

--
2.53.0

#15 lore raw
In reply to Daniel J Blueman
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The binding schema fails to enforce the second `memory-region` item (IOVA reservation) for the…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The binding schema fails to enforce the second memory-region item (IOVA reservation) for the qcom,x1e80100-iris compatible, which strictly requires it to prevent system reboots. --

commit c0ad29924b6618f643fc065b86b7d5896e42b2ff
Author: Daniel J Blueman <[email protected]>

dt-bindings: media: qcom,sm8550-iris: Allow IOVA reservation memory-region

In addition to the firmware-loaded codec carveout, some Iris platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from IOVA ranges that earlier firmware stages have already mapped through the SMMU.

Quoted 5 lines
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +0 -0
index 9c4b760508b50..0d83bb86c6c3f 100644

Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml properties: · line 87

Quoted 9 lines
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +5 -1
@@ -80,7 +80,11 @@ properties:
   dma-coherent: true
 
   memory-region:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
+    items:
+      - description: Firmware-loaded codec carveout
+      - description: IOMMU IOVA reservation region

[Severity: Medium]
Should the schema also enforce minItems: 2 for the qcom,x1e80100-iris compatible in an allOf conditional block?

The commit message for the subsequent patch ("arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris") explicitly states that on X1-family hamoa platforms (which use the qcom,x1e80100-iris compatible), missing the IOVA reservation causes unhandled SMMU page faults and spontaneous device reboots.

Without an allOf constraint enforcing the second memory region item for this compatible, incomplete device trees missing the mandatory reservation will pass schema validation but cause runtime failures.

Quoted 3 lines
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +0 -0
   operating-points-v2: true
 
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#16 lore raw
In reply to Daniel J Blueman
Quoted 5 lines · Daniel J Blueman

In addition to the firmware-loaded codec carveout, some Iris platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from IOVA ranges that earlier firmware stages have already mapped through the SMMU.

Quoted 8 lines

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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml: properties:memory-region: {'minItems': 1, 'maxItems': 2, 'items': [{'description': 'Firmware-loaded codec carveout'}, {'description': 'IOMMU IOVA reservation region'}]} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

maintainer
#2 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

In reply to Daniel J Blueman
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

---
bod

#3 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

Quoted 5 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

If you follow the Link:, you can see that it does come from qcom..

https://github.com/qualcomm-linux/kernel-topics/issues/1157#issuecomment-4458933574

This series is basically a "hotfix" version of a more complicated series:

https://lore.kernel.org/linux-media/[email protected]/

that introduced an extra subnode that let the driver only use that restricted IOVA range for non-pixel buffers (only those actually need the restriction) but that resulted in a very long discussion and was kinda shelved because of that.. x_x

~val

maintainer
#4 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

Quoted 6 lines · Val Packett
Quoted 4 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

Quoted 7 lines
Quoted 2 lines

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

If you follow the Link:, you can see that it does come from qcom..

https://github.com/qualcomm-linux/kernel-topics/issues/1157#issuecomment-4458933574

A rhetorical and leading question - the commit log should just explain what is going on..

Quoted 9 lines

This series is basically a "hotfix" version of a more complicated series:

https://lore.kernel.org/linux-media/[email protected]/

that introduced an extra subnode that let the driver only use that restricted IOVA range for non-pixel buffers (only those actually need the restriction) but that resulted in a very long discussion and was kinda shelved because of that.. x_x

This and the subsequent require a Fixes:

I think this change is OK wrt to bindings because we are adding not subtracting - but I'd like the commit log to actually explain whats happening not give me links to random places.

---
bod

#5 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

In reply to Bryan O'Donoghue
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks,
Dan

[1] https://github.com/qualcomm-linux/kernel-topics/issues/1157#issuecomment-4458933574

--
Daniel J Blueman

maintainer
#6 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

Quoted 9 lines · Daniel J Blueman
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

Quoted 8 lines

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks Daniel for raising this patch. Did you also try the memory fix i mentioned in the bug [1] discussion ?

Coming to 600MB, this have been the VPU hardware restriction all the while since venus days, and since address could not go deeper all the way lower than 600MB, the issue never popped up earlier.

Consider the memory layout split as below (Iris device range is capped to 0xe0000000)

|-----600MB-----|-----(0xe0000000 - 600MB)-----|----IO reg--|

0-600MB range, VPU hardware would reserve this to generate different stream-IDs primarily for internal (non-pixel) buffers.

0-600 --> VPU would generate *secure* stream ID for non-pixel buffers 601 - 0xe0000000 --> VPU would generate non-secure stream ID for non-pixel buffers.

When many concurrent sessions were tried, non-pixel buffers were mapped into 0-600MB range, and VPU generated secure ID for those. Since those were not associated with the iommus configured for iris node, it led to USF (un-identified stream fault) and device would crash.

Keeping the region reserved, makes the non-pixel buffer always in the non secure range (601-..) and avoids the crash.

Downside of this design - It would eventually reserve 0-600MB un-map 'able for all buffer types, like pixel as well which do not have any such restriction.

Forward looking design - create devices dynamically and set reserve regions for those specific device using the api [1], instead of applying one reserve for all.

[1] https://lore.kernel.org/all/[email protected]/

Quoted 7 lines

Thanks,
Dan

[1] https://github.com/qualcomm-linux/kernel-topics/issues/1157#issuecomment-4458933574

--
Daniel J Blueman

#17 lore raw
In reply to Daniel J Blueman
Quoted 18 lines · Daniel J Blueman

In addition to the firmware-loaded codec carveout, some Iris platforms need to declare an IOMMU IOVA reservation (a reserved-memory node with iommu-addresses) to keep DMA away from IOVA ranges that earlier firmware stages have already mapped through the SMMU.

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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +0 -0
index 9c4b760508b5..6359e4953d42 100644

Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml properties: · line 87

Quoted 9 lines
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +5 -1
@@ -80,7 +80,11 @@ properties:
   dma-coherent: true
 
   memory-region:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
+    items:
+      - description: Firmware-loaded codec carveout
+      - description: IOMMU IOVA reservation region

Suppose you want to special iova space. does dma-ranges work for it?

bus {
     dma-ranges = <start size>;
     iris {
	...
     }
}

Frank

Quoted 6 lines
Documentation/devicetree/bindings/media/qcom,sm8550-iris.yaml +0 -1
   operating-points-v2: true
 
--

2.53.0

#7 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

In reply to Vikash Garodia
Quoted 27 lines · Vikash Garodia
Quoted 9 lines · Daniel J Blueman
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

Quoted 8 lines

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks Daniel for raising this patch. Did you also try the memory fix i mentioned in the bug [1] discussion ?

Coming to 600MB, this have been the VPU hardware restriction all the while since venus days, and since address could not go deeper all the way lower than 600MB, the issue never popped up earlier.

Consider the memory layout split as below (Iris device range is capped to 0xe0000000)

Quoted 8 lines

|-----600MB-----|-----(0xe0000000 - 600MB)-----|----IO reg--|

0-600MB range, VPU hardware would reserve this to generate different stream-IDs primarily for internal (non-pixel) buffers.

0-600 --> VPU would generate *secure* stream ID for non-pixel buffers 601 - 0xe0000000 --> VPU would generate non-secure stream ID for non-pixel buffers.

When many concurrent sessions were tried, non-pixel buffers were mapped into 0-600MB range, and VPU generated secure ID for those. Since those were not associated with the iommus configured for iris node, it led to USF (un-identified stream fault) and device would crash.

Umm.. is anything *actually* preventing us from adding the "secure" SID to the iommu node?

I just saw a patch for sc8280xp that did just add an "extra" SID for iris:

https://github.com/strongtz/linux-radxa-qcom/commit/e92850f792498c3a72d72d667503a29bf6bb0a31

and I'm wondering if that's about the same exact issue.. (Adding sophon@ to Cc: here)

Quoted 7 lines

Keeping the region reserved, makes the non-pixel buffer always in the non secure range (601-..) and avoids the crash.

Downside of this design - It would eventually reserve 0-600MB un-map 'able for all buffer types, like pixel as well which do not have any such restriction.

Forward looking design - create devices dynamically and set reserve regions for those specific device using the api [1], instead of applying one reserve for all.

[1] https://lore.kernel.org/all/[email protected]/

~val

#8 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

Quoted 38 lines · Val Packett
Quoted 27 lines · Vikash Garodia
Quoted 9 lines · Daniel J Blueman
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

Quoted 8 lines

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks Daniel for raising this patch. Did you also try the memory fix i mentioned in the bug [1] discussion ?

Coming to 600MB, this have been the VPU hardware restriction all the while since venus days, and since address could not go deeper all the way lower than 600MB, the issue never popped up earlier.

Consider the memory layout split as below (Iris device range is capped to 0xe0000000)

Quoted 8 lines

|-----600MB-----|-----(0xe0000000 - 600MB)-----|----IO reg--|

0-600MB range, VPU hardware would reserve this to generate different stream-IDs primarily for internal (non-pixel) buffers.

0-600 --> VPU would generate *secure* stream ID for non-pixel buffers 601 - 0xe0000000 --> VPU would generate non-secure stream ID for non- pixel buffers.

When many concurrent sessions were tried, non-pixel buffers were mapped into 0-600MB range, and VPU generated secure ID for those. Since those were not associated with the iommus configured for iris node, it led to USF (un-identified stream fault) and device would crash.

Quoted 8 lines

Umm.. is anything *actually* preventing us from adding the "secure" SID to the iommu node?

I just saw a patch for sc8280xp that did just add an "extra" SID for iris:

https://github.com/strongtz/linux-radxa-qcom/commit/ e92850f792498c3a72d72d667503a29bf6bb0a31

and I'm wondering if that's about the same exact issue.. (Adding sophon@ to Cc: here)

I'm not sure if we're having the same issue. Without adding that SID on sc8280xp (HFI Gen2 FW), it fails to decode anything and crashes instantly. From the trustzone log inside the crashdump, I can see that the buffer isn't actually in the 0-600MB range.

Signature · 2 lines
Best regards,
Xilin Wu <[email protected]>
maintainer
#11 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

In reply to Val Packett
Quoted 42 lines · Val Packett
Quoted 40 lines · Vikash Garodia
Quoted 9 lines · Daniel J Blueman
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

Quoted 8 lines

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks Daniel for raising this patch. Did you also try the memory fix i mentioned in the bug [1] discussion ?

Coming to 600MB, this have been the VPU hardware restriction all the while since venus days, and since address could not go deeper all the way lower than 600MB, the issue never popped up earlier.

Consider the memory layout split as below (Iris device range is capped to 0xe0000000)

|-----600MB-----|-----(0xe0000000 - 600MB)-----|----IO reg--|

0-600MB range, VPU hardware would reserve this to generate different stream-IDs primarily for internal (non-pixel) buffers.

0-600 --> VPU would generate *secure* stream ID for non-pixel buffers 601 - 0xe0000000 --> VPU would generate non-secure stream ID for non-pixel buffers.

Quoted 7 lines
Quoted 4 lines

When many concurrent sessions were tried, non-pixel buffers were mapped into 0-600MB range, and VPU generated secure ID for those. Since those were not associated with the iommus configured for iris node, it led to USF (un-identified stream fault) and device would crash.

Umm.. is anything *actually* preventing us from adding the "secure" SID to the iommu node?

Yes.

If the firmware has already provisioned SMMU entries for TZ SIDs then we would be adding duplicates from Linux, if not then we are claiming TZ SIDs which we can't actually access if we use them => those entries would need to be given out to a TZ driver/application of some sort which we don't have/support now/yet.

Quoted 26 lines

I just saw a patch for sc8280xp that did just add an "extra" SID for iris:

https://github.com/strongtz/linux-radxa-qcom/commit/e92850f792498c3a72d72d667503a29bf6bb0a31

and I'm wondering if that's about the same exact issue.. (Adding sophon@ to Cc: here)

Quoted 7 lines

Keeping the region reserved, makes the non-pixel buffer always in the non secure range (601-..) and avoids the crash.

Downside of this design - It would eventually reserve 0-600MB un-map 'able for all buffer types, like pixel as well which do not have any such restriction.

Quoted 6 lines

Forward looking design - create devices dynamically and set reserve regions for those specific device using the api [1], instead of applying one reserve for all.

[1]
https://lore.kernel.org/all/[email protected]/

~val

maintainer
#12 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

In reply to Vikash Garodia
Quoted 52 lines · Vikash Garodia
Quoted 9 lines · Daniel J Blueman
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

Quoted 8 lines

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks Daniel for raising this patch. Did you also try the memory fix i mentioned in the bug [1] discussion ?

Coming to 600MB, this have been the VPU hardware restriction all the while since venus days, and since address could not go deeper all the way lower than 600MB, the issue never popped up earlier.

Consider the memory layout split as below (Iris device range is capped to 0xe0000000)

|-----600MB-----|-----(0xe0000000 - 600MB)-----|----IO reg--|

0-600MB range, VPU hardware would reserve this to generate different stream-IDs primarily for internal (non-pixel) buffers.

0-600 --> VPU would generate *secure* stream ID for non-pixel buffers 601 - 0xe0000000 --> VPU would generate non-secure stream ID for non-pixel buffers.

When many concurrent sessions were tried, non-pixel buffers were mapped into 0-600MB range, and VPU generated secure ID for those. Since those were not associated with the iommus configured for iris node, it led to USF (un-identified stream fault) and device would crash.

Keeping the region reserved, makes the non-pixel buffer always in the non secure range (601-..) and avoids the crash.

Downside of this design - It would eventually reserve 0-600MB un-map 'able for all buffer types, like pixel as well which do not have any such restriction.

Quoted 6 lines

Forward looking design - create devices dynamically and set reserve regions for those specific device using the api [1], instead of applying one reserve for all.

[1]
https://lore.kernel.org/all/[email protected]/

The problem here is in the reponse to the email you linked:

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

- Inheriting the parent's properties is wrong
- We should just have a bus

But that leads us to churning DT and we'd have to figure out how/why to do it purely for the purpose of differentiating SIDs within Iris. There is no separate hardware - its one VPU which needs to figure out its IOVA for different SIDs.

Krzysztof would rightly say no - again - to putting collateral into DT to differentiate pixel streams based on SID, because that's not a hardware property.

- You have pixel and non-pixel SIDs that have to hit Linux
- You have to keep non-pixel allocations >= 600 MB
- You can allow pixel < 600mb =>
Daniel's patch is too restrictive

But what we can do is add information to the iris platform descriptors to enumerate what are the valid IOVA ranges for pixel and non-pixel data and then change the allocation code to operate from those platform-code described IOVAs.

No new iommu properties, not arguing about plonking SID/pixel-path data into DT.

Just teach the driver what the valid ranges are and allocate IOVAs based on those ranges.

I think Daniel's patch should be taken as it fixes a real bug for users right now but, I equally think its a NAK for any new SoC.

This IOVA allocation needs to be tackled correctly and IMO that needs to be and should be done via platform descriptors for valid ranges of IOVA.

No mad stuff about SIDs in DT, no lengthy arguments about adding strange iommu properties.

---
bod

#14 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

In reply to Vikash Garodia
Quoted 14 lines · Vikash Garodia
Quoted 13 lines · Daniel J Blueman
Quoted 6 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Quoted 5 lines
Quoted 2 lines

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks Daniel for raising this patch. Did you also try the memory fix i mentioned in the bug [1] discussion ?

With this patch, my Lenovo Slim 7x spontaneously rebooted after opening 3 tabs of https://ui.com rather than 1 without it. No crash/reboot is reproducible with the patch I proposed.

Quoted 2 lines

0-600MB range, VPU hardware would reserve this to generate different stream-IDs primarily for internal (non-pixel) buffers.

Thanks for the clearer description; I'll respin my patch with this and the DT fixes shortly to get the X1 user experience under control until a real fix.

@all I appreciate the ideas and discussion already ensured!

Dan

Signature · 1 line
Daniel J Blueman
maintainer
#13 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

In reply to Bryan O'Donoghue
Quoted 81 lines · Bryan O'Donoghue
Quoted 52 lines · Vikash Garodia
Quoted 9 lines · Daniel J Blueman
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

Quoted 8 lines

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks Daniel for raising this patch. Did you also try the memory fix i mentioned in the bug [1] discussion ?

Coming to 600MB, this have been the VPU hardware restriction all the while since venus days, and since address could not go deeper all the way lower than 600MB, the issue never popped up earlier.

Consider the memory layout split as below (Iris device range is capped to 0xe0000000)

|-----600MB-----|-----(0xe0000000 - 600MB)-----|----IO reg--|

0-600MB range, VPU hardware would reserve this to generate different stream-IDs primarily for internal (non-pixel) buffers.

0-600 --> VPU would generate *secure* stream ID for non-pixel buffers 601 - 0xe0000000 --> VPU would generate non-secure stream ID for non-pixel buffers.

When many concurrent sessions were tried, non-pixel buffers were mapped into 0-600MB range, and VPU generated secure ID for those. Since those were not associated with the iommus configured for iris node, it led to USF (un-identified stream fault) and device would crash.

Keeping the region reserved, makes the non-pixel buffer always in the non secure range (601-..) and avoids the crash.

Downside of this design - It would eventually reserve 0-600MB un-map 'able for all buffer types, like pixel as well which do not have any such restriction.

Quoted 6 lines

Forward looking design - create devices dynamically and set reserve regions for those specific device using the api [1], instead of applying one reserve for all.

[1]
https://lore.kernel.org/all/20260119054936.3350128-1- [email protected]/

The problem here is in the reponse to the email you linked:

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

- Inheriting the parent's properties is wrong
- We should just have a bus

But that leads us to churning DT and we'd have to figure out how/why to do it purely for the purpose of differentiating SIDs within Iris. There is no separate hardware - its one VPU which needs to figure out its IOVA for different SIDs.

Krzysztof would rightly say no - again - to putting collateral into DT to differentiate pixel streams based on SID, because that's not a hardware property.

- You have pixel and non-pixel SIDs that have to hit Linux
- You have to keep non-pixel allocations >= 600 MB
- You can allow pixel < 600mb =>
  Daniel's patch is too restrictive

But what we can do is add information to the iris platform descriptors to enumerate what are the valid IOVA ranges for pixel and non-pixel data and then change the allocation code to operate from those platform-code described IOVAs.

No new iommu properties, not arguing about plonking SID/pixel-path data into DT.

Just teach the driver what the valid ranges are and allocate IOVAs based on those ranges.

Quoted 8 lines

I think Daniel's patch should be taken as it fixes a real bug for users right now but, I equally think its a NAK for any new SoC.

This IOVA allocation needs to be tackled correctly and IMO that needs to be and should be done via platform descriptors for valid ranges of IOVA.

No mad stuff about SIDs in DT, no lengthy arguments about adding strange iommu properties.

---
bod

Please pause merging this patch until this thread bottoms out

https://lore.kernel.org/all/20260709-vpu_iommu_iova_handling-v1-7-72bb62cb2dfd@oss.qualcomm.com

---
bod

#9 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

In reply to Xilin Wu
Quoted 57 lines · Xilin Wu
Quoted 56 lines · Val Packett
Quoted 40 lines · Vikash Garodia
Quoted 9 lines · Daniel J Blueman
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

Quoted 8 lines

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks Daniel for raising this patch. Did you also try the memory fix i mentioned in the bug [1] discussion ?

Coming to 600MB, this have been the VPU hardware restriction all the while since venus days, and since address could not go deeper all the way lower than 600MB, the issue never popped up earlier.

Consider the memory layout split as below (Iris device range is capped to 0xe0000000)

|-----600MB-----|-----(0xe0000000 - 600MB)-----|----IO reg--|

0-600MB range, VPU hardware would reserve this to generate different stream-IDs primarily for internal (non-pixel) buffers.

0-600 --> VPU would generate *secure* stream ID for non-pixel buffers 601 - 0xe0000000 --> VPU would generate non-secure stream ID for non- pixel buffers.

Quoted 5 lines

When many concurrent sessions were tried, non-pixel buffers were mapped into 0-600MB range, and VPU generated secure ID for those. Since those were not associated with the iommus configured for iris node, it led to USF (un-identified stream fault) and device would crash.

Umm.. is anything *actually* preventing us from adding the "secure" SID to the iommu node?

I just saw a patch for sc8280xp that did just add an "extra" SID for iris:

https://github.com/strongtz/linux-radxa-qcom/commit/
e92850f792498c3a72d72d667503a29bf6bb0a31

Quoted 8 lines
Quoted 3 lines

and I'm wondering if that's about the same exact issue.. (Adding sophon@ to Cc: here)

I'm not sure if we're having the same issue. Without adding that SID on sc8280xp (HFI Gen2 FW), it fails to decode anything and crashes instantly. From the trustzone log inside the crashdump, I can see that the buffer isn't actually in the 0-600MB range.

Hmm. The decoding is working on Lenovo X13s ([1]). It says 6.18, but it was the Iris driver patched to support SM8350 / SC8280XP, which I posted some time ago. For the reference, the firmware reports the version to
be: video-firmware.1.1-b158087140355883dc40b004032856a8feb5d565.

[1] https://github.com/lumag/fluster-tests/blob/trunk/iris-sc8280xp.md

Signature · 2 lines
With best wishes
Dmitry
#10 lore raw

Re: [PATCH 2/2] arm64: dts: qcom: hamoa: Reserve low IOVA range for Iris

Quoted 67 lines · Dmitry Baryshkov
Quoted 57 lines · Xilin Wu
Quoted 56 lines · Val Packett
Quoted 40 lines · Vikash Garodia
Quoted 9 lines · Daniel J Blueman
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines · Daniel J Blueman

On X1-family hamoa platforms, Iris DMA below IOVA 0x25800000 (600MB) triggers unhandled SMMU page faults

How do we know that is a correct address - does it come from qcom documentation or trial and error ?

Quoted 8 lines

@Vikash, beyond your comment I linked in the patch [1] kindly cite a source for the different stream-ID <600MB behaviour, and share specifics, eg if silicon, firmware, or driver and constraint, defect or otherwise, so I can include a definitive description.

Also good to know if my workaround is good for long-term, or on the other hand handling streams <600MB is important/useful.

Thanks Daniel for raising this patch. Did you also try the memory fix i mentioned in the bug [1] discussion ?

Coming to 600MB, this have been the VPU hardware restriction all the while since venus days, and since address could not go deeper all the way lower than 600MB, the issue never popped up earlier.

Consider the memory layout split as below (Iris device range is capped to 0xe0000000)

|-----600MB-----|-----(0xe0000000 - 600MB)-----|----IO reg--|

0-600MB range, VPU hardware would reserve this to generate different stream-IDs primarily for internal (non-pixel) buffers.

0-600 --> VPU would generate *secure* stream ID for non-pixel buffers 601 - 0xe0000000 --> VPU would generate non-secure stream ID for non- pixel buffers.

Quoted 5 lines

When many concurrent sessions were tried, non-pixel buffers were mapped into 0-600MB range, and VPU generated secure ID for those. Since those were not associated with the iommus configured for iris node, it led to USF (un-identified stream fault) and device would crash.

Umm.. is anything *actually* preventing us from adding the "secure" SID to the iommu node?

I just saw a patch for sc8280xp that did just add an "extra" SID for iris:

https://github.com/strongtz/linux-radxa-qcom/commit/
e92850f792498c3a72d72d667503a29bf6bb0a31

Quoted 8 lines
Quoted 3 lines

and I'm wondering if that's about the same exact issue.. (Adding sophon@ to Cc: here)

I'm not sure if we're having the same issue. Without adding that SID on sc8280xp (HFI Gen2 FW), it fails to decode anything and crashes instantly.
From the trustzone log inside the crashdump, I can see that the buffer isn't
actually in the 0-600MB range.

Quoted 7 lines

Hmm. The decoding is working on Lenovo X13s ([1]). It says 6.18, but it was the Iris driver patched to support SM8350 / SC8280XP, which I posted some time ago. For the reference, the firmware reports the version to
be: video-firmware.1.1-b158087140355883dc40b004032856a8feb5d565.

[1] https://github.com/lumag/fluster-tests/blob/trunk/iris-sc8280xp.md

Yeah, HFI Gen1 FW should work on SC8280XP. But what I'm using is HFI Gen2 FW, it reports: video-firmware.2.4.2-39cc47c1d64195c749014787e6ab938cc34a4071

Signature · 2 lines
Best regards,
Xilin Wu <[email protected]>