From nobody Mon Feb 9 23:42:57 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB0833A79D2; Thu, 13 Nov 2025 17:00:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763053225; cv=none; b=CwNrP5/mTQdar1/7A575+KNar7Wggv63z0vfP04kDr/1tVAKWOJ9MQ9XSCxT2d3MbyYYjMcyZvBKMBjiY1LQvqExl7DrzPm9iOCGnrOHMZ17z/CzhpwKPSW6MMVN5t81xciC/FtTOh4kLnif3ZGtBzfr5v2sguolUemwIcCqKI4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763053225; c=relaxed/simple; bh=zYBl/Dqp6Izqq1kQ5gjEICYJes4BCUnNwwCmCl6OpvY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d+noicObSrtMTGEXcz1aoJgvnTfgPfzJ7+klUjGEtk4oQrXWVpo5BfDDblr4dOntOlHjLEbjQzpYv4EdIETS8aeE9dwpgG0FKZytfyyKmdic7uwlRMkPbJKDfJIeQM+YH6uVyoahAGKy1iJQQkRblCEbx51R7Eq7DgeNg2Afc4A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=f8C4RoEI; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="f8C4RoEI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1763053221; bh=zYBl/Dqp6Izqq1kQ5gjEICYJes4BCUnNwwCmCl6OpvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f8C4RoEIQl4ixC4AaSJTwU/a73ZdGP3iO7JtymnuRD46ZnGLlrX3zXIkeMEE38ivH NWbHWsSVmZVNJLMesX2GA2qEEIDBzOywRh7KpHLr1Enc274iJMUSR8OVGNMkmJkUNT qB4i3GRb1r5qfpBPWiZFYzPrWXoHV2a7w8BWxMzRP7rSAUkUGt7OetJFHHe5bXUwku xALRb4jhPjFNJBLQAZMkwsEwlSgRMdKiCIVdnq1H3tzw1Sb3Nbjvo0Cynx/QCK2zS3 lK2uWqC1sH6v4LLyNA3y9ph+dmuiy0HOwT/dAnonGddOVEq8rIkVVsDV4dSsUrWABy PqW485btNwz6w== Received: from debian-rockchip-rock5b-rk3588.. (unknown [IPv6:2a01:e0a:5e3:6100:826d:bc07:e98c:84a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: loicmolinari) by bali.collaboradmins.com (Postfix) with ESMTPSA id 35F8717E35D3; Thu, 13 Nov 2025 18:00:20 +0100 (CET) From: =?UTF-8?q?Lo=C3=AFc=20Molinari?= To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Boris Brezillon , Rob Herring , Steven Price , Liviu Dudau , Melissa Wen , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Hugh Dickins , Baolin Wang , Andrew Morton , =?UTF-8?q?Lo=C3=AFc=20Molinari?= , Al Viro , =?UTF-8?q?Miko=C5=82aj=20Wasiak?= , Christian Brauner , Nitin Gote , Andi Shyti , Jonathan Corbet , Christopher Healy , Matthew Wilcox , Bagas Sanjaya Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v8 10/11] drm/panfrost: Introduce huge tmpfs mountpoint option Date: Thu, 13 Nov 2025 18:00:06 +0100 Message-ID: <20251113170008.79587-11-loic.molinari@collabora.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251113170008.79587-1-loic.molinari@collabora.com> References: <20251113170008.79587-1-loic.molinari@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Introduce the 'panfrost.transparent_hugepage' boolean module parameter (false by default). When the parameter is set to true, a new tmpfs mountpoint is created and mounted using the 'huge=3Dwithin_size' option. It's then used at GEM object creation instead of the default 'shm_mnt' mountpoint in order to enable Transparent Hugepage (THP) for the object (without having to rely on a system wide parameter). v3: - use huge tmpfs mountpoint in drm_device v4: - fix builds with CONFIG_TRANSPARENT_HUGEPAGE=3Dn - clean up mountpoint creation error handling - print negative error value v5: - use drm_gem_has_huge_tmp() helper - get rid of CONFIG_TRANSPARENT_HUGEPAGE ifdefs Signed-off-by: Lo=C3=AFc Molinari Reviewed-by: Boris Brezillon --- drivers/gpu/drm/panfrost/panfrost_device.c | 3 +++ drivers/gpu/drm/panfrost/panfrost_drv.c | 6 ++++++ drivers/gpu/drm/panfrost/panfrost_drv.h | 9 +++++++++ drivers/gpu/drm/panfrost/panfrost_gem.c | 18 ++++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_gem.h | 2 ++ 5 files changed, 38 insertions(+) create mode 100644 drivers/gpu/drm/panfrost/panfrost_drv.h diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/p= anfrost/panfrost_device.c index c61b97af120c..dedc13e56631 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -12,6 +12,7 @@ #include "panfrost_device.h" #include "panfrost_devfreq.h" #include "panfrost_features.h" +#include "panfrost_gem.h" #include "panfrost_issues.h" #include "panfrost_gpu.h" #include "panfrost_job.h" @@ -267,6 +268,8 @@ int panfrost_device_init(struct panfrost_device *pfdev) if (err) goto out_job; =20 + panfrost_gem_init(pfdev); + return 0; out_job: panfrost_jm_fini(pfdev); diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panf= rost/panfrost_drv.c index 7d8c7c337606..7f59568faa05 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -858,6 +858,12 @@ static const struct drm_driver panfrost_drm_driver =3D= { #endif }; =20 +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +bool panfrost_transparent_hugepage; +module_param_named(transparent_hugepage, panfrost_transparent_hugepage, bo= ol, 0400); +MODULE_PARM_DESC(transparent_hugepage, "Use a dedicated tmpfs mount point = with Transparent Hugepage enabled (false =3D default)"); +#endif + static int panfrost_probe(struct platform_device *pdev) { struct panfrost_device *pfdev; diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.h b/drivers/gpu/drm/panf= rost/panfrost_drv.h new file mode 100644 index 000000000000..edeb093eb6da --- /dev/null +++ b/drivers/gpu/drm/panfrost/panfrost_drv.h @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 or MIT +/* Copyright 2025 Amazon.com, Inc. or its affiliates */ + +#ifndef __PANFROST_DRV_H__ +#define __PANFROST_DRV_H__ + +extern bool panfrost_transparent_hugepage; + +#endif diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panf= rost/panfrost_gem.c index 8041b65c6609..d8472a023e05 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gem.c +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright 2019 Linaro, Ltd, Rob Herring */ +/* Copyright 2025 Amazon.com, Inc. or its affiliates */ =20 #include #include @@ -10,9 +11,26 @@ #include #include #include "panfrost_device.h" +#include "panfrost_drv.h" #include "panfrost_gem.h" #include "panfrost_mmu.h" =20 +void panfrost_gem_init(struct panfrost_device *pfdev) +{ + int err; + + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && + !panfrost_transparent_hugepage) + return; + + err =3D drm_gem_huge_mnt_create(&pfdev->base, "within_size"); + if (drm_gem_has_huge_mnt(&pfdev->base)) + drm_info(&pfdev->base, "Using Transparent Hugepage\n"); + else if (err) + drm_warn(&pfdev->base, "Can't use Transparent Hugepage (%d)\n", + err); +} + #ifdef CONFIG_DEBUG_FS static void panfrost_gem_debugfs_bo_add(struct panfrost_device *pfdev, struct panfrost_gem_object *bo) diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.h b/drivers/gpu/drm/panf= rost/panfrost_gem.h index 8de3e76f2717..1a62529ff06f 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gem.h +++ b/drivers/gpu/drm/panfrost/panfrost_gem.h @@ -124,6 +124,8 @@ drm_mm_node_to_panfrost_mapping(struct drm_mm_node *nod= e) return container_of(node, struct panfrost_gem_mapping, mmnode); } =20 +void panfrost_gem_init(struct panfrost_device *pfdev); + struct drm_gem_object *panfrost_gem_create_object(struct drm_device *dev, = size_t size); =20 struct drm_gem_object * --=20 2.47.3