[PATCH v2 0/3] Fix GPU and display on ARM32 platforms using the MSM IOMMU
Dmitry Baryshkov <[email protected]> Thu, 30 Jul 2026 19:04:53 +0300
| Newsgroups | dev.linux.lists.iommu,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-rockchip,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- Changes in v2: - dropped dev_warn -> dev_dbg chunk (Konrad) - rewrote second patch to use correct device inside msm_iommu unmapping (Robin) - Link to v1: https://patch.msgid.link/[email protected] To: Rob Clark <[email protected]> To: "Joerg Roedel (AMD)" <[email protected]> To: Will Deacon <[email protected]> To: Robin Murphy <[email protected]> To: Joerg Roedel <[email protected]> To: Sricharan Ramabadhran <[email protected]> To: Dmitry Baryshkov <[email protected]> To: Abhinav Kumar <[email protected]> To: Jessica Zhang <[email protected]> To: Sean Paul <[email protected]> To: Marijn Suijten <[email protected]> To: David Airlie <[email protected]> To: Simona Vetter <[email protected]> To: Heiko Stuebner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] --- Dmitry Baryshkov (3): iommu/msm: track a context master per device and IOMMU iommu/msm: use the IOMMU device for page table allocation drm/msm: detach the ARM DMA mapping before attaching our own domain drivers/gpu/drm/msm/msm_iommu.c | 22 +++++++++++++ drivers/iommu/msm_iommu.c | 68 +++++++++++++++++++++++++++++++---------- 2 files changed, 74 insertions(+), 16 deletions(-) --- base-commit: 78bc8af4affb9a732504eb22eeac7d1e50883853 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