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 6A55CFCC9AA for ; Tue, 10 Mar 2026 03:20:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF27D10E0BC; Tue, 10 Mar 2026 03:20:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CnTvKqH5"; dkim-atps=neutral Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 42A3E10E0BC for ; Tue, 10 Mar 2026 03:20:41 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-3598a09fcb3so3722328a91.0 for ; Mon, 09 Mar 2026 20:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1773112841; x=1773717641; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uHxroCmvUbDZdSuabhWIfcDNQo8xx33ypV1WgOxP5VE=; b=CnTvKqH5f0bJbObcCMHDX208wV0mJpMtJe1LQM6obWKuhgY4eiIVyXIgg7FENRepDR 89wntYRJO9HSPEZK8VXK50AgQp4jY7I8AZoFNlYUh7f9ioclcSm3GRnfQajKCOXhhQ89 nwxiKuw5bZNNJy7Q1C9c2EDxvSgftUKxPoWHM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773112841; x=1773717641; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uHxroCmvUbDZdSuabhWIfcDNQo8xx33ypV1WgOxP5VE=; b=L/oJuf2ydS90Cv9PXyMYQT2fStDWhzwqwlEhfZC65IUu53OofAlc68AsQixHvEJNLo +Wtb6xn87yuCFe6qhwoEWpSNmPAiPKnhUw/HVCANKMPOUDZwbhvxNv95wwrgcJ8CfPWi 5UhsvHee3Atq+qhLRxpnnBtlJGmTki0RG3acbvSggKsYWC0Xrg8tn18SKfOUI6PrFF8k VfUOix+PSDYKg/QfqR6Y9zGkggtSu/yZd57dhP3UF7epFbbPDtNIyyi3KcH7RAnP4Bze SKORbqVWlm5nY9xAFvT8fAjMcUr5yM+k4/dgbSjM89MJj6ofrvrWHRmTWy5UrPhO3YZN PMsA== X-Forwarded-Encrypted: i=1; AJvYcCXW3dH0T1sGWHn1UtrsNhaFSzVnZILBIXqeonGqRvyLX3IVQ+NQ5VkJNeDRDB+ScEwbAEstHlKLTcs=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxY2OPwEkVr1yYpd/jFsn/d80qj9tM0NdBeGZwbSOYH+VLDMXna RasaukLhDuRJhoPoOYrF5lNXpG7dB0VWEXA1IPHRUdnHGvLpYTLpVEFdWgp+pj4RFQ== X-Gm-Gg: ATEYQzyluLqxvoYo2okS+PYhs9LGJFP9lS3n+vZPhchmW+onlraXkOwZCyKnHZWvjoI 3+1iECGyJRM5TZk6KQyQMVxgaSYZuB22PWLmOR6jg3Qpw5t2/sndS0HjyaRiVxG2uAGfNzXuWHV EfnqppdD08NTffcUIyGTM1YtVVTsNoFkl237XJQlb3gq+mFTe9VRsarxHKAPzx6aKxmYTNCo0t5 Fpti7FIHwzObBqoWt4OCvFjz8bRwTHmcqRQIaVmfZ4Y7olOR9shg6svSZtPzNcHymheDe4kKaYs lao5Pl2haUFn9xfppS9jLJl/39AewLpTiiG/kVpODDbXvyzoGWUYhHHM3V47lBzBJ9Pq0ehQqUM aWy3thQDxtSMpT3EPEDdSGN+Q0RW/lDLgdPe54AUyAsowLsLPXx7fXhC2K2Z7aMcwozoqPIu+84 uLyDfNhFNsD2PQJMEFIVOgFB/jHeu4H2TIWecL+tsGKnmXlLQnAE+rQzFwg5PLqIiSfbxrk5IHO qJYko5x X-Received: by 2002:a17:90b:240e:b0:359:c7ef:97bc with SMTP id 98e67ed59e1d1-359c7ef9b32mr6509980a91.22.1773112840798; Mon, 09 Mar 2026 20:20: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 98e67ed59e1d1-359f06f79absm1154608a91.6.2026.03.09.20.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 20:20:40 -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@freedesktop.org, "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 1/4] drm/prime: Limit scatter list size with dedicated DMA device Date: Tue, 10 Mar 2026 11:20:04 +0800 Message-ID: <20260310032012.2542334-2-wenst@chromium.org> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog In-Reply-To: <20260310032012.2542334-1-wenst@chromium.org> References: <20260310032012.2542334-1-wenst@chromium.org> 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" If a dedicated DMA device is specified for the DRM device, then the scatter list size limit should pertain to the DMA device. Use the dedicated DMA device, if given, to limit the scatter list size. This only applies to drivers that have called drm_dev_set_dma_dev() and are using drm_prime_pages_to_sg() either directly or through the SHMEM helpers. At the time of this writing, the former case only includes the Rockchip DRM driver, while the latter case includes the gud, udl, and the tiny appletbdrm and gm12u320 drivers. Signed-off-by: Chen-Yu Tsai --- drivers/gpu/drm/drm_prime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 51fdb06d3e9f..9b44c78cd77f 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -859,7 +859,7 @@ struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev, return ERR_PTR(-ENOMEM); if (dev) - max_segment = dma_max_mapping_size(dev->dev); + max_segment = dma_max_mapping_size(drm_dev_dma_dev(dev)); if (max_segment == 0) max_segment = UINT_MAX; err = sg_alloc_table_from_pages_segment(sg, pages, nr_pages, 0, -- 2.53.0.473.g4a7958ca14-goog