FAILED: patch "[PATCH] media: iris: Fix iova allocation from restrict region" failed to apply to 6.18-stable tree
Subsystems (5)
Sasha Levin
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 200473c198b201c308dfb916fb3233074d9407fa
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 200473c198b201c308dfb916fb3233074d9407fa Mon Sep 17 00:00:00 2001
From: Vishnu Reddy <[email protected]>
Date: Tue, 18 Aug 2026 20:43:22 +0530
Subject: [PATCH] media: iris: Fix iova allocation from restrict region
The VPU issues DMA through several SMMU streams, and the hardware does not give every stream the same addressable range. The non-pixel stream cannot address the low 600MB of IOVA space, while the pixel stream can address the full range:
+-----------------------------------------------------------+
| non-pixel stream addressable range (600 MB - 3.5 GB) |
| 0x25800000 - 0xe0000000 |
+-----------------------------------------------------------+
| pixel stream addressable range (0 - 3.5 GB) |
| 0x00000000 - 0xe0000000 |
+-----------------------------------------------------------+A single "iommus" property on the video-codec node puts every stream in one IOMMU domain sharing one IOVA space, so nothing stops a non-pixel buffer from landing below 600MB. Once an allocation lands below that boundary the hardware faults, which shows up as unhandled SMMU page faults and spontaneous reboots.
https://gitlab.freedesktop.org/drm/msm/-/work_items/100
Fix this by reserving the 0-600MB range, below the boundary the non-pixel stream cannot address, using dma_iova_try_alloc() so the IOMMU-DMA core never hands that range out to a real DMA mapping. This reserves only IOVA space, it does not allocate any physical memory.
Since sub-nodes for non-pixel, pixel, and secure streams do not exist yet and only a single device is available, the restriction is applied to both non-pixel and pixel stream IDs.
--- drivers/media/platform/qcom/iris/iris_core.h | 6 ++ drivers/media/platform/qcom/iris/iris_probe.c | 62 ++++++++++++++++++- 2 files changed, 67 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_core.h +6 -0
@@ -7,6 +7,7 @@#define __IRIS_CORE_H__#include <linux/types.h> +#include <linux/dma-mapping.h> #include <linux/pm_domain.h> #include <media/v4l2-device.h>
@@ -25,6 +26,9 @@ struct icc_info {#define IRIS_FW_VERSION_LENGTH 128#define IFACEQ_CORE_PKT_SIZE (1024 * 4) +#define IRIS_NP_RESERVE_IOVA_START 0x0 +#define IRIS_NP_RESERVE_IOVA_SIZE 0x25800000 +enum domain_type {ENCODER =BIT (0 ),DECODER =BIT (1 ),
@@ -77,6 +81,7 @@ struct qcom_ubwc_cfg_data;* @instances: a list_head of all instances * @inst_fw_caps_dec: an array of supported instance capabilities by decoder * @inst_fw_caps_enc: an array of supported instance capabilities by encoder +* @iova_state: a pointer to an array of dma_iova_state entries reserved for restricted IOVA region */ struct iris_core {
@@ -123,6 +128,7 @@ struct iris_core {/* encoder and decoder have overlapping caps, so two different arrays are required */ struct platform_inst_fw_cap inst_fw_caps_dec[INST_FW_CAP_MAX ];struct platform_inst_fw_cap inst_fw_caps_enc[INST_FW_CAP_MAX ]; +struct dma_iova_state *iova_state; };int iris_core_init (struct iris_core *core);
drivers/media/platform/qcom/iris/iris_probe.c +61 -1
89 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 media: iris: Fix iova allocation from restrict region
From: Vishnu Reddy <[email protected]>
[ Upstream commit 200473c198b201c308dfb916fb3233074d9407fa ]
The VPU issues DMA through several SMMU streams, and the hardware does not give every stream the same addressable range. The non-pixel stream cannot address the low 600MB of IOVA space, while the pixel stream can address the full range:
+-----------------------------------------------------------+
| non-pixel stream addressable range (600 MB - 3.5 GB) |
| 0x25800000 - 0xe0000000 |
+-----------------------------------------------------------+
| pixel stream addressable range (0 - 3.5 GB) |
| 0x00000000 - 0xe0000000 |
+-----------------------------------------------------------+A single "iommus" property on the video-codec node puts every stream in one IOMMU domain sharing one IOVA space, so nothing stops a non-pixel buffer from landing below 600MB. Once an allocation lands below that boundary the hardware faults, which shows up as unhandled SMMU page faults and spontaneous reboots.
https://gitlab.freedesktop.org/drm/msm/-/work_items/100
Fix this by reserving the 0-600MB range, below the boundary the non-pixel stream cannot address, using dma_iova_try_alloc() so the IOMMU-DMA core never hands that range out to a real DMA mapping. This reserves only IOVA space, it does not allocate any physical memory.
Since sub-nodes for non-pixel, pixel, and secure streams do not exist yet and only a single device is available, the restriction is applied to both non-pixel and pixel stream IDs.
--- drivers/media/platform/qcom/iris/iris_core.h | 6 ++ drivers/media/platform/qcom/iris/iris_probe.c | 62 ++++++++++++++++++- 2 files changed, 67 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_core.h +6 -0
@@ -7,6 +7,7 @@#define __IRIS_CORE_H__#include <linux/types.h> +#include <linux/dma-mapping.h> #include <linux/pm_domain.h> #include <media/v4l2-device.h>
@@ -25,6 +26,9 @@ struct icc_info {#define IRIS_FW_VERSION_LENGTH 128#define IFACEQ_CORE_PKT_SIZE (1024 * 4) +#define IRIS_NP_RESERVE_IOVA_START 0x0 +#define IRIS_NP_RESERVE_IOVA_SIZE 0x25800000 +enum domain_type {ENCODER =BIT (0 ),DECODER =BIT (1 ),
@@ -73,6 +77,7 @@ enum domain_type {* @instances: a list_head of all instances * @inst_fw_caps_dec: an array of supported instance capabilities by decoder * @inst_fw_caps_enc: an array of supported instance capabilities by encoder +* @iova_state: a pointer to an array of dma_iova_state entries reserved for restricted IOVA region */ struct iris_core {
@@ -117,6 +122,7 @@ struct iris_core {/* encoder and decoder have overlapping caps, so two different arrays are required */ struct platform_inst_fw_cap inst_fw_caps_dec[INST_FW_CAP_MAX ];struct platform_inst_fw_cap inst_fw_caps_enc[INST_FW_CAP_MAX ]; +struct dma_iova_state *iova_state; };int iris_core_init (struct iris_core *core);
drivers/media/platform/qcom/iris/iris_probe.c +61 -1
89 lines not on this page · raw message
Signature · 1 line
2.53.0