]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/v3d: Add modparam for turning off Big/Super Pages
authorMaíra Canal <mcanal@igalia.com>
Mon, 23 Sep 2024 13:55:14 +0000 (10:55 -0300)
committerMaíra Canal <mcanal@igalia.com>
Wed, 25 Sep 2024 11:40:25 +0000 (08:40 -0300)
Add a modparam for turning off Big/Super Pages to make sure that if an
user doesn't want Big/Super Pages enabled, it can disabled it by setting
the modparam to false.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240923141348.2422499-11-mcanal@igalia.com
drivers/gpu/drm/v3d/v3d_drv.c
drivers/gpu/drm/v3d/v3d_drv.h
drivers/gpu/drm/v3d/v3d_gemfs.c

index d7ff1f5fa481f7a43c6c3dd0b0d19ac32ef6863b..8be8c6dd9b359086de3a0e5cebb3be9a63f5463a 100644 (file)
 #define DRIVER_MINOR 0
 #define DRIVER_PATCHLEVEL 0
 
+/* Only expose the `super_pages` modparam if THP is enabled. */
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+bool super_pages = true;
+module_param_named(super_pages, super_pages, bool, 0400);
+MODULE_PARM_DESC(super_pages, "Enable/Disable Super Pages support.");
+#endif
+
 static int v3d_get_param_ioctl(struct drm_device *dev, void *data,
                               struct drm_file *file_priv)
 {
index a98543290fa8abeb48ff76be46d9069b29f416f1..de73eefff9ac163a3a570b62c3c809ac730adf61 100644 (file)
@@ -539,6 +539,7 @@ void v3d_invalidate_caches(struct v3d_dev *v3d);
 void v3d_clean_caches(struct v3d_dev *v3d);
 
 /* v3d_gemfs.c */
+extern bool super_pages;
 void v3d_gemfs_init(struct v3d_dev *v3d);
 void v3d_gemfs_fini(struct v3d_dev *v3d);
 
index 31cf5bd11e393fee95858a32e28431e492404e41..4c5e18590a5cf1d835fb2836b3753fecf8133a71 100644 (file)
@@ -20,6 +20,10 @@ void v3d_gemfs_init(struct v3d_dev *v3d)
        if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
                goto err;
 
+       /* The user doesn't want to enable Super Pages */
+       if (!super_pages)
+               goto err;
+
        type = get_fs_type("tmpfs");
        if (!type)
                goto err;