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 20561FCC9B2 for ; Tue, 10 Mar 2026 03:25:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77FB910E62D; Tue, 10 Mar 2026 03:25:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="iT9tNnzB"; dkim-atps=neutral Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id D5AB410E62D for ; Tue, 10 Mar 2026 03:25:44 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2ab46931cf1so84671545ad.0 for ; Mon, 09 Mar 2026 20:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1773113144; x=1773717944; 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=iT9tNnzBPX+MgHLlwRmzgib5RKg9lu1davXR1TSNKREJTET8qgFG8INBV/NBcCxHty GDz5ttkXCd2XBHmjoBVqjWHI1iBNL6CEaD4m45iSnA7HV7EkhtCruNRsKQ2GyNikhrit 1l4uJPMAQiNLATOUm2hS4mLijPHoT/GaYuOtk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773113144; x=1773717944; 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=SKqJnc8nHgO1WpgnmnWLbY2aAmNkIAvscNzjdTY/ORvkxsTNWETRjFn6FAR7yrBN4H SP7Oq4BIROvAogvDR7OEIkH4ZTh8ADjs/L0P03eNrhTYo1W6wO5hJwL1nnDm86IvJk0J LanLHP1Q8SzhLhbFHN3wFofsoUpONs3bJWW0CG7nhnLsT50g62jdN2mHI+YenrVZmnCb q9CP34Gq2EHGILxYIqHH4C/jNtt4iiAfjmZSLvM9Q+s1SkvvOsD5bQlAV0Dwaqd2kUM4 EtCN08cJI4RRzhnrEJno4IgkFHQy9NEWOFJ9EzQ+Jf5VChbPfCZUZ0jGAiOJ+wUGRQbJ RxWQ== X-Forwarded-Encrypted: i=1; AJvYcCVMBdSTA0w7aV48z9Xi3MDQ2eQ3tXOpm/81yHGeQnQpAHlGyw0nyqujn6R+zY81qR3YItr7aSUO108=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yx96MGMlsej2l24jUd5hDusBxPNcdRsoUadSYEV6meDPjCzXxh9 Rla5dcnACh/EoWW95F87b+nhb9DfoF2iiirSLLyZ97KA0wnEkTAvY0npAkz1AMuIm7nkJ9Nqj4p qlcI= X-Gm-Gg: ATEYQzxNZaG9bkpG08WIiJbEz1eEJSdT3EvHn2XLTYQWF+XiCgOHUbpAgrCKwlC9Hv/ USqChqlGebztvrUZubyiv021ztK3a3a7CAQAh/jsBnMSlRsu9bJinacKPbqVJ6FefiXuYta9qUS niHLYTQxZSLD5FB020mQvdNF70maD5SEueUks7COYS00KvbRrN4pJCFCitnXGDJ9rkOQlqnR+p7 msAOUXoSxYlRsEdv0ftv1K4q4CJQHU56LGeXQjDtdRZkwZSzWlnlyuaw29hBvmop3OC1Hg/I5bV snczXdA7cOwHcFjfoUx4J2+P3Jm+DUnhTHlw39v6/5vhWyyT745wafLbdGBsR0CbeA9OWw+HbLD ZGGn+pd32bkE1+MHbqbILfb3rcFU1PzUeTjW985J1Pf1yq9fsMv5FHPgTbWsIWBtcfAjf0TS4Bt IBUPr6Uvw9lWMCnQJn7/UgAI/Lv2tN8zWuL6faJ7/T5zGgUMDWkvQ2ELdnPQghI3hpsf2qgUHdz uehcSEr X-Received: by 2002:a17:903:2349:b0:2a0:d454:5372 with SMTP id d9443c01a7336-2aea1f2f79emr17542375ad.22.1773113144386; Mon, 09 Mar 2026 20:25:44 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 20:25:43 -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 1/4] drm/prime: Limit scatter list size with dedicated DMA device Date: Tue, 10 Mar 2026 11:25:06 +0800 Message-ID: <20260310032511.2545500-2-wenst@chromium.org> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog In-Reply-To: <20260310032511.2545500-1-wenst@chromium.org> References: <20260310032511.2545500-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