From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD555186284 for ; Tue, 10 Mar 2026 03:20:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773112840; cv=none; b=gbJlm1AbSQhOpK0S5pqoQpj+kfCMY1XjUdWTYXnSDmFmaVbAxkc45iRFa7+MIEGWxGmFVevwKSWXJd/haHMGGVECvw0PUO0eMsvJepag2njMl1+p0OXwhRKgpB+WTienPyw7S6Ur+44fh7HgGdxOGcpx+ePwKgBv7nw4qWqmg3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773112840; c=relaxed/simple; bh=nW0gE2uSilWfbT4+upjDtgGRG+odry5LG5qMMvRLlKg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XWf31/mxs9ywsgW86CzhjExIhYBx4SzbPpYs9hJ6Oj6gDGHlCB2bzUDzOJET4T+L5Z5TwvbN6kjlNJ0KYemJQUTUE9Ly+GTQmXoTSN9e0D15uHVJrBcSLaSUfOtZRaCyt5xVxr8Sqecgxr6hEBorLHHI5E6uF6llG+nytDiL2fM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=MPFcGs7l; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="MPFcGs7l" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-358d80f60ccso6673349a91.3 for ; Mon, 09 Mar 2026 20:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1773112837; x=1773717637; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vSXqr7QpO3Zkkd0iv/RdDeMyqizg8C0r/CigYk0bPqI=; b=MPFcGs7la21yTrNG1cCnhCvRfrKjBQfLPvw2ks042uAQDxOaBFAYJdKvwpnTOoxV/X +DC/58JmeAS/+HfJITLgnLTL4VOjGr5i6lxAaoHHfP15HtuHHfvIClcdx/u8e0iD2MiH p5fXrndImuEt1IksIu8TINX5Up0lJtDaTTTB4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773112837; x=1773717637; 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=vSXqr7QpO3Zkkd0iv/RdDeMyqizg8C0r/CigYk0bPqI=; b=GWSmhrWlXBc5pxymbIpKA8J3RABCLyZOqkXrjUY37qMATs8Wlvo7FyXrTcp03esJgF zHnQioRHV5fBknMN6hWeTbZI/RrNYy/foPo/bIwG3CHRlM3dvqMp1K3DaTAdI4T0HXDZ EpuHjIJhoxWRBY/2C9Ys6AjN1q+ApLJKj+phVhEYiKfWJZFC00tSF/Ylq20kKlj414pk U/rPPmfGbdR/DkC8ZafF27S2wG3yLu4f4b4zCZ+a7z3uk4IPTuqrcVZVtyECvsMYDDtJ AvPIfCIBXmx2RIYkJyWuURASN2zKuprw2E+8NIoaG36S8OVmpRE4jJe5UPCtSeFCzJ/O HRvQ== X-Forwarded-Encrypted: i=1; AJvYcCUjvtWcJ5vtNcHUd/53vmrISehCp/5Mwa36uclSnYMunkA7zwDe1lCg3VwW0I/12rOWPDsoBe1HgiijDGQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw25a9i2mIOjQwJ7QKLsIkiXRJVb5gBLXD8zmX4T4LwEqBAaOUl dVOrZHXfvd3otC7aQyomGoWLbNXkc6ouSmjwwXG7AAUHCMMAufgvbgXdaSCkPhe93g== X-Gm-Gg: ATEYQzxgMdiX+yANSwhjNeHsIosVAePgXY1D8WR4kKd/5QBgOxR99X1IoQFpHjmMcsA oe+KmdOCafOjruV4+ZUhMH/cEY5TfbY/KQgfxbcmLBg32FGFAcOdL4OotgFxpXhfQ/H3uLUkc7i 7k1faqDLYXElcEyjvrwI++LztCl97bPSFsE6qvtanSvBVZ182w8BIz8sBQDRGQ0hjsYuIw0UuUS ZYnh6wrM+TH/r/1BNmW8G/jReAt3SgO8pyHfhi81VX40YoiVElvPYBFoTXHvC16+mpGhjS/VHXZ 3ywwHO7SAF9g+8t3ml2cS1H67KDWJprdnUDoZtPoHI5ojxytN+7I/4Qj2wR1BaEusEeUNHTcNUh 01K8sFbkGcjzQLa8s2NVqdUmO6dOD2nDmpSvxlf6mfomt7AawZIIx0sICRJDwathCMezSPnn6kj YVchN5VMI/KvA+Vni2dDM8uanPHLypWKK8AjFKU/aqMTjLbAJknZ6suvls5csXgdjJPxoZPmqsd JozOYHv X-Received: by 2002:a17:90b:534c:b0:349:7f0a:381b with SMTP id 98e67ed59e1d1-359be298ae2mr13611645a91.8.1773112837116; Mon, 09 Mar 2026 20:20:37 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2a00:79e0:201d:8:ee38:e01e:e888:6900]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-359f06f79absm1154608a91.6.2026.03.09.20.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 20:20:36 -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 , 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 0/4] drm/gem-dma: Support dedicated DMA device for allocation Date: Tue, 10 Mar 2026 11:20:03 +0800 Message-ID: <20260310032012.2542334-1-wenst@chromium.org> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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