From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 093A4FCC9AD for ; Tue, 10 Mar 2026 03:25:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 692B310E1EB; Tue, 10 Mar 2026 03:25:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Vtd7PK0+"; dkim-atps=neutral Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B72110E1EB for ; Tue, 10 Mar 2026 03:25:41 +0000 (UTC) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2aaed195901so56661245ad.0 for ; Mon, 09 Mar 2026 20:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1773113141; x=1773717941; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OoV76OKOjG7uxIKEUxi5pEmwh+JGNhbt1HMoxK+jnjw=; b=Vtd7PK0+aNhxWHWizdjzhh/pkT7TXyW1Qh1G+NZGf9JBzT5aXwF+UNUJW36b0v/Hx+ Xm3OXoHUOq2GHdbtJx9uHZuOqI8vq/62/5i7IXaSz89aoT5xHycqw/94m+5oXtFI74Al 9E9q7oTMSOo2xSwkgr+lELgSkMjN43A++bgCM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773113141; x=1773717941; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OoV76OKOjG7uxIKEUxi5pEmwh+JGNhbt1HMoxK+jnjw=; b=iV4CTCFQ3KwOPKz1pwBAmcN1TerjHPj07BgkH8gKZmoE2iwus/Pa1N7Nd9hQwOq8+n 34RNGlLCpxOPR6Us9UvpH8JHmvYO+0PVzum04DdDNdA6nwHfWEB/Gww74kBbUfxb5Cbn EL5c7YnQuDBMk/XLk/wJJd/f7hqb9Nm0OyY3ysuAzQhgwW7AWCPwLBJilFm4l85dNkfR YAUoRe/TQtm9ftXfzp1iy1OQcRI068xa9mWMB8X4BssDnOZ87AN+yv437ebBxZ0jDFW1 RN0DTzuJ/CUe34ZXOzwqEVptUd0dwJ9MpIh4SoWbn5+d/dyQ7GdbVsE0HQFH0Ri/n6zf 3k4Q== X-Forwarded-Encrypted: i=1; AJvYcCXBDx8ZH2MqxM4oKJK1f+6Qli7AOZ9XQGq5nACRU01Dq3W2Xt8EMPRTNBDh+HuwWmTdIVolBZK49uY=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxckUvjLA5hzcThS7N9wVDQDVb1yvNnxRVF/LZ3na/WQaj1H05B QpZ715jXCX6k+4abMoApaSRi6KdN1/0iEi0vV7yrqqSqH2AI5qreonxMaEf35RiKJKm3LOhPr/n z3Lo= X-Gm-Gg: ATEYQzwI7/YfgPf5BCbBjxKP3IImA0ChGvW7sN6x7HXN7OMfl51DEzmXWQakWMmNNJR ZNtLiHPn0Jgc2XCSty/mcpKWg/fm4ginREcv0lGixZO6opV1fCM/UdiFMYViY565IVB4ZAvDuBV tPjuCkudNVp8ZYa0eZ+QmUknPfZYkmQHgpyr83fmSki2faQKnA/AAvQtfxYqZm2H/jTe9GEuAzW ziRoWF/x1vtPUWPnWGJz62kMqQogna8xwVAaQjAHzm9YERyeyzefTO19pHwVHLLAQ3hhiz7fthU tR1kIEKGKiZ5TUae0J5ezOmuFAvwB+5ecQg1sa5FkBbUvcANpW+l7phE3TQ6RWPQJelePLv6CbP 3/zQBS6NCVzpSXVZeCEvZtrm+LzRTcg0u/2JkRdlenSrPn5FxJ+Y5dhQ98M7+FLlK8T8tjZ/Vn4 +GZ67uauzjfccHRXkm9cS2p4E5o+ERYfuwvH0+rMyViqb62aP+PIvDksPRQddB8copoXegGOT5m cvdJvuX X-Received: by 2002:a17:903:2452:b0:2ae:5752:af82 with SMTP id d9443c01a7336-2ae82498328mr120569975ad.49.1773113140915; Mon, 09 Mar 2026 20:25:40 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2a00:79e0:201d:8:ee38:e01e:e888:6900]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae83e575e6sm126695095ad.5.2026.03.09.20.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 20:25:39 -0700 (PDT) From: Chen-Yu Tsai To: Matthias Brugger , AngeloGioacchino Del Regno , Chun-Kuang Hu , Philipp Zabel , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , David Airlie , Simona Vetter Cc: Chen-Yu Tsai , linux-sunxi@lists.linux.dev, Paul Kocialkowski , linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 0/4] drm/gem-dma: Support dedicated DMA device for allocation Date: Tue, 10 Mar 2026 11:25:05 +0800 Message-ID: <20260310032511.2545500-1-wenst@chromium.org> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" (resent with Samuel's email address fixed) Hi folks, This series expands the "dedicated DMA device" support in DRM to the GEM DMA helpers, and converts the MediaTek DRM driver to setting the DMA device and dropping the custom GEM helpers that implemented this function. Various display drivers implement the "dedicated DMA device" support with custom GEM helpers. These include Exynos, MediaTek, and Rockchip to name a few. Allwinner does something entirely different, calling of_dma_configure() on the virtual display device using the OF node of the actual DMA device. Recently this causes a warning if IOMMUs are involved. This series intends to allow the core helpers to deal with it, and not have every driver implement it in slightly different ways, duplicating code. Patch 1 adds dedicated DMA device support to drm_prime_pages_to_sg(). I believe this was missing from the original change that added dedicated DMA devices for PRIME. Patch 2 adds support for dedicated DMA device to the GEM DMA helpers for GEM buffer allocation and mmap. Patch 3 converts the MediaTek DRM driver to use the dedicated DMA device support, and drop all the remaining custom GEM callbacks that deal with it. Patch 4 converts the Allwinner sun4i DRM driver to use the dedicated DMA device support, instead of the of_dma_configure() hack it currently has. The series should be merged through drm-misc-next so that other drivers can take advantage of the change. I also intend to try to convert the Exynos and Rockchip drivers, however both also have options to set DMA_ATTR_NO_KERNEL_MAPPING when using dma_alloc_attrs() to allocate memory for the buffers. I intend to resurrect the DRM_MODE_DUMB_KERNEL_MAP work from Rob Herring [1] to handle this. The Rockchip driver also has custom IOMMU attachment that I'm still trying to understand. Thanks ChenYu Chen-Yu Tsai (4): drm/prime: Limit scatter list size with dedicated DMA device drm/gem-dma: Support dedicated DMA device for allocation and mapping drm/mediatek: Set dedicated DMA device and drop custom GEM callbacks drm/sun4i: Use backend/mixer as dedicated DMA device drivers/gpu/drm/drm_gem_dma_helper.c | 21 ++- drivers/gpu/drm/drm_prime.c | 2 +- drivers/gpu/drm/mediatek/mtk_crtc.c | 1 - drivers/gpu/drm/mediatek/mtk_drm_drv.c | 21 +-- drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 - drivers/gpu/drm/mediatek/mtk_gem.c | 231 ------------------------- drivers/gpu/drm/mediatek/mtk_gem.h | 17 -- drivers/gpu/drm/sun4i/sun4i_backend.c | 27 +-- drivers/gpu/drm/sun4i/sun8i_mixer.c | 27 +-- 9 files changed, 46 insertions(+), 302 deletions(-) delete mode 100644 drivers/gpu/drm/mediatek/mtk_gem.c delete mode 100644 drivers/gpu/drm/mediatek/mtk_gem.h -- 2.53.0.473.g4a7958ca14-goog