Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/panthor: Introduce huge tmpfs mountpoint option

Introduce the 'panthor.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=within_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=n
- 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

v9:
- replace drm_gem_has_huge_tmp() by drm_gem_get_huge_tmp()

v11:
- enable 'panthor.transparent_hugepage' by default

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://patch.msgid.link/20251205182231.194072-9-loic.molinari@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>

authored by

Loïc Molinari and committed by
Boris Brezillon
c569b369 7cdf69d9

+39
+3
drivers/gpu/drm/panthor/panthor_device.c
··· 18 18 #include "panthor_devfreq.h" 19 19 #include "panthor_device.h" 20 20 #include "panthor_fw.h" 21 + #include "panthor_gem.h" 21 22 #include "panthor_gpu.h" 22 23 #include "panthor_hw.h" 23 24 #include "panthor_mmu.h" ··· 294 293 ret = panthor_sched_init(ptdev); 295 294 if (ret) 296 295 goto err_unplug_fw; 296 + 297 + panthor_gem_init(ptdev); 297 298 298 299 /* ~3 frames */ 299 300 pm_runtime_set_autosuspend_delay(ptdev->base.dev, 50);
+7
drivers/gpu/drm/panthor/panthor_drv.c
··· 1559 1559 .read = drm_read, 1560 1560 .llseek = noop_llseek, 1561 1561 .mmap = panthor_mmap, 1562 + .get_unmapped_area = drm_gem_get_unmapped_area, 1562 1563 .show_fdinfo = drm_show_fdinfo, 1563 1564 .fop_flags = FOP_UNSIGNED_OFFSET, 1564 1565 }; ··· 1627 1626 .debugfs_init = panthor_debugfs_init, 1628 1627 #endif 1629 1628 }; 1629 + 1630 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE 1631 + bool panthor_transparent_hugepage = true; 1632 + module_param_named(transparent_hugepage, panthor_transparent_hugepage, bool, 0400); 1633 + MODULE_PARM_DESC(transparent_hugepage, "Use a dedicated tmpfs mount point with Transparent Hugepage enabled (true = default)"); 1634 + #endif 1630 1635 1631 1636 static int panthor_probe(struct platform_device *pdev) 1632 1637 {
+9
drivers/gpu/drm/panthor/panthor_drv.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 or MIT */ 2 + /* Copyright 2025 Amazon.com, Inc. or its affiliates */ 3 + 4 + #ifndef __PANTHOR_DRV_H__ 5 + #define __PANTHOR_DRV_H__ 6 + 7 + extern bool panthor_transparent_hugepage; 8 + 9 + #endif
+18
drivers/gpu/drm/panthor/panthor_gem.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 or MIT 2 2 /* Copyright 2019 Linaro, Ltd, Rob Herring <robh@kernel.org> */ 3 3 /* Copyright 2023 Collabora ltd. */ 4 + /* Copyright 2025 Amazon.com, Inc. or its affiliates */ 4 5 5 6 #include <linux/cleanup.h> 6 7 #include <linux/dma-buf.h> ··· 13 12 #include <drm/panthor_drm.h> 14 13 15 14 #include "panthor_device.h" 15 + #include "panthor_drv.h" 16 16 #include "panthor_fw.h" 17 17 #include "panthor_gem.h" 18 18 #include "panthor_mmu.h" 19 + 20 + void panthor_gem_init(struct panthor_device *ptdev) 21 + { 22 + int err; 23 + 24 + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && 25 + !panthor_transparent_hugepage) 26 + return; 27 + 28 + err = drm_gem_huge_mnt_create(&ptdev->base, "within_size"); 29 + if (drm_gem_get_huge_mnt(&ptdev->base)) 30 + drm_info(&ptdev->base, "Using Transparent Hugepage\n"); 31 + else if (err) 32 + drm_warn(&ptdev->base, "Can't use Transparent Hugepage (%d)\n", 33 + err); 34 + } 19 35 20 36 #ifdef CONFIG_DEBUG_FS 21 37 static void panthor_gem_debugfs_bo_init(struct panthor_gem_object *bo)
+2
drivers/gpu/drm/panthor/panthor_gem.h
··· 136 136 return container_of(to_drm_gem_shmem_obj(obj), struct panthor_gem_object, base); 137 137 } 138 138 139 + void panthor_gem_init(struct panthor_device *ptdev); 140 + 139 141 struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_t size); 140 142 141 143 int