From: Sasha Levin <sashal@kernel.org>
To: Rob Clark <robin.clark@oss.qualcomm.com>
Cc: Dmitry Baryshkov <lumag@kernel.org>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] drm/msm: Fix the build without CONFIG_IOMMU_API
Date: Mon, 30 Nov 2026 09:15:01 -0500 [thread overview]
Message-ID: <20261130141501.1793800-2-sashal@kernel.org> (raw)
In-Reply-To: <20261130141501.1793800-1-sashal@kernel.org>
__map_iommu() and __unmap_iommu() call the domain's map_pages() and
unmap_pages() ops directly, but struct iommu_domain_ops is only defined
with CONFIG_IOMMU_API. imx_v6_v7_defconfig enables DRM_MSM without it
and fails to build:
drivers/gpu/drm/msm/msm_iommu.c:742:27: error: invalid use of undefined type 'const struct iommu_domain_ops'
drivers/gpu/drm/msm/msm_iommu.c:750:27: error: invalid use of undefined type 'const struct iommu_domain_ops'
Without CONFIG_IOMMU_API, iommu_paging_domain_alloc() always fails, so
msm_iommu_new() never creates an MMU and the two helpers can't be
reached. Give them stubs for that case.
Fixes: 1600c10eeda0 ("drm/msm: Convert iommu map/unmap to helpers")
Link: https://files.kernelci.org/kbuild-gcc-14-arm-imx_v6_v7_defconfig-6b0cabb2286e1965ecddf45b/build.log.gz
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Built drivers/gpu/drm/msm/msm_iommu.o with clang 21 and imx_v6_v7_defconfig on
top of msm-next: fails before, builds after. Also built with x86_64
allmodconfig (CONFIG_IOMMU_API=y). Not tested on hardware.
drivers/gpu/drm/msm/msm_iommu.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index 55655f25a1c75..ff2e37f939780 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -737,6 +737,7 @@ static void msm_iommu_detach(struct msm_mmu *mmu)
iommu_detach_device(iommu->domain, mmu->dev);
}
+#ifdef CONFIG_IOMMU_API
static size_t
__unmap_iommu(void *arg, u64 iova, size_t pgsize, size_t pgcount)
{
@@ -752,6 +753,21 @@ __map_iommu(void *arg, phys_addr_t paddr, u64 iova, size_t pgsize,
return domain->ops->map_pages(domain, iova, paddr, pgsize, pgcount,
prot, GFP_KERNEL, mapped);
}
+#else
+/* No struct iommu_domain_ops, and msm_iommu_new() can't allocate a domain */
+static size_t
+__unmap_iommu(void *arg, u64 iova, size_t pgsize, size_t pgcount)
+{
+ return 0;
+}
+
+static int
+__map_iommu(void *arg, phys_addr_t paddr, u64 iova, size_t pgsize,
+ size_t pgcount, int prot, size_t *mapped)
+{
+ return -ENODEV;
+}
+#endif
static void
__flush_iommu(void *arg)
--
2.53.0
next prev parent reply other threads:[~2026-11-30 14:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 14:15 [PATCH 1/2] drm/msm: Use designated initializers for the map_ops tables Sasha Levin
2026-11-30 14:15 ` Sasha Levin [this message]
2026-11-30 15:05 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130141501.1793800-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®