From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: Rob Clark <robin.clark@oss.qualcomm.com>,
"Joerg Roedel (AMD)" <joro@8bytes.org>,
Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Sricharan Ramabadhran <quic_srichara@quicinc.com>,
Joerg Roedel <jroedel@suse.de>,
Russell King <linux@armlinux.org.uk>,
Lu Baolu <baolu.lu@linux.intel.com>,
Jerry Snitselaar <jsnitsel@redhat.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
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>,
Heiko Stuebner <heiko@sntech.de>
Cc: linux-arm-msm@vger.kernel.org, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
linux-rockchip@lists.infradead.org
Subject: [PATCH 0/3] Fix GPU and display on ARM32 platforms using the MSM IOMMU
Date: Thu, 30 Jul 2026 16:29:30 +0300 [thread overview]
Message-ID: <20260730-fix-qcom-smmu-v1-0-b12fa067804e@oss.qualcomm.com> (raw)
On apq8064 (tested on the IFC6410 board) neither the GPU nor the display
controller comes up in mainline: with CONFIG_ARM_DMA_USE_IOMMU enabled
both devices either fail to probe with -EBUSY or take the kernel down
during the ensuing unwind. Three independent problems stack up on that
path, one in each of three subsystems, and only fixing all of them makes
the board usable.
First, the MSM IOMMU driver does not handle a device that is attached to
several IOMMU instances, which is exactly how apq8064 describes both the
GPU (&gfx3d and &gfx3d1) and the display controller (&mdp_port0 and
&mdp_port1). It keyed the per-device bookkeeping off two mismatched
things, a per-IOMMU list and a per-device pointer, so only one of the
instances ever got programmed with the stream IDs. That had been merely
wrong for years, but it turned into a NULL dereference once the IOMMU
core started deferring probe per instance, so today the board does not
even reach a shell with the display enabled.
Second, on ARM32 the arch code gives every IOMMU-backed device a
dma_iommu_mapping of its own and attaches it. drm/msm manages its address
spaces itself and cannot take over a device whose group already has that
foreign domain attached. The other ARM32 DRM drivers that are in the same
position (tegra, rockchip, exynos) drop the arch mapping first; drm/msm
has to do the same.
Third, arm_iommu_detach_device() undoes things in the opposite order from
the one arm_iommu_attach_device() set them up in. An IOMMU driver that
allocates its page tables during attach therefore frees them with the
IOMMU DMA ops installed rather than the direct ops that mapped them,
which ends in a NULL pointer dereference. This is trivially reachable as
soon as any of the probe failures above unwinds, and it is what turns the
GPU probe failure into a crash rather than an error message.
The three patches are independent and are expected to be picked up by
three different maintainers.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
Dmitry Baryshkov (3):
iommu/msm: track a context master per device and IOMMU
ARM: dma-mapping: reset DMA ops before detaching from the IOMMU
drm/msm: detach the ARM DMA mapping before attaching our own domain
arch/arm/mm/dma-mapping.c | 5 ++++-
drivers/gpu/drm/msm/msm_iommu.c | 22 ++++++++++++++++++++++
drivers/iommu/msm_iommu.c | 27 +++++++++++++++------------
3 files changed, 41 insertions(+), 13 deletions(-)
---
base-commit: 3652b49adac266a3d27cb41cdfdb7d8790fc3633
change-id: 20260723-fix-qcom-smmu-b5798c65d689
prerequisite-change-id: 20260723-msm-fix-crash-8c13220d9465:v1
prerequisite-patch-id: 3556d41e924ad64e8e9c06cc5bd1972c66957f42
Best regards,
--
With best wishes
Dmitry
next reply other threads:[~2026-07-30 13:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 13:29 Dmitry Baryshkov [this message]
2026-07-30 13:29 ` [PATCH 1/3] iommu/msm: track a context master per device and IOMMU Dmitry Baryshkov
2026-07-30 13:57 ` Konrad Dybcio
2026-07-30 14:30 ` Dmitry Baryshkov
2026-07-30 13:29 ` [PATCH 2/3] ARM: dma-mapping: reset DMA ops before detaching from the IOMMU Dmitry Baryshkov
2026-07-30 14:04 ` Robin Murphy
2026-07-30 13:29 ` [PATCH 3/3] drm/msm: detach the ARM DMA mapping before attaching our own domain Dmitry Baryshkov
2026-07-30 13:42 ` Konrad Dybcio
2026-07-30 13:58 ` Dmitry Baryshkov
2026-07-30 13:59 ` 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=20260730-fix-qcom-smmu-v1-0-b12fa067804e@oss.qualcomm.com \
--to=dmitry.baryshkov@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=baolu.lu@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=iommu@lists.linux.dev \
--cc=jesszhan0024@gmail.com \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=jroedel@suse.de \
--cc=jsnitsel@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_srichara@quicinc.com \
--cc=robin.clark@oss.qualcomm.com \
--cc=robin.murphy@arm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=will@kernel.org \
/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®