All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix GPU and display on ARM32 platforms using the MSM IOMMU
@ 2026-07-30 13:29 ` Dmitry Baryshkov
  0 siblings, 0 replies; 21+ messages in thread
From: Dmitry Baryshkov @ 2026-07-30 13:29 UTC (permalink / raw)
  To: Rob Clark, Joerg Roedel (AMD), Will Deacon, Robin Murphy,
	Sricharan Ramabadhran, Joerg Roedel, Russell King, Lu Baolu,
	Jerry Snitselaar, Jason Gunthorpe, Dmitry Baryshkov,
	Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
	David Airlie, Simona Vetter, Heiko Stuebner
  Cc: linux-arm-msm, iommu, linux-kernel, linux-arm-kernel, dri-devel,
	freedreno, linux-rockchip

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


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-07-30 14:31 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 13:29 [PATCH 0/3] Fix GPU and display on ARM32 platforms using the MSM IOMMU Dmitry Baryshkov
2026-07-30 13:29 ` Dmitry Baryshkov
2026-07-30 13:29 ` [PATCH 1/3] iommu/msm: track a context master per device and IOMMU Dmitry Baryshkov
2026-07-30 13:29   ` Dmitry Baryshkov
2026-07-30 13:52   ` sashiko-bot
2026-07-30 13:57   ` Konrad Dybcio
2026-07-30 13:57     ` Konrad Dybcio
2026-07-30 14:30     ` Dmitry Baryshkov
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 13:29   ` Dmitry Baryshkov
2026-07-30 14:04   ` Robin Murphy
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:29   ` Dmitry Baryshkov
2026-07-30 13:42   ` Konrad Dybcio
2026-07-30 13:42     ` Konrad Dybcio
2026-07-30 13:58     ` Dmitry Baryshkov
2026-07-30 13:58       ` Dmitry Baryshkov
2026-07-30 13:59       ` Konrad Dybcio
2026-07-30 13:59         ` Konrad Dybcio

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.