]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe: Allow to drop vram resizing
authorLucas De Marchi <lucas.demarchi@intel.com>
Wed, 9 Apr 2025 14:09:56 +0000 (07:09 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 10 Apr 2025 22:50:01 +0000 (15:50 -0700)
The default behavior if the LMEMBAR doesn't match the maximum possible
size is to try to resize it. However the user might want to keep, even
for testing the behavior with small BAR, whatever size was set via
sysfs. Change the module parameter to int and check for negative value.

Cc: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
Link: https://lore.kernel.org/r/20250409-bar-resize-param-v1-1-75bf4df38aa0@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_module.c
drivers/gpu/drm/xe/xe_vram.c

index be8603b16ff3fbf7cfc5de6daa627c7a446bafde..64bf4664654495c4b107be61efee7f21dc222278 100644 (file)
@@ -39,8 +39,8 @@ MODULE_PARM_DESC(force_execlist, "Force Execlist submission");
 module_param_named(probe_display, xe_modparam.probe_display, bool, 0444);
 MODULE_PARM_DESC(probe_display, "Probe display HW, otherwise it's left untouched (default: true)");
 
-module_param_named(vram_bar_size, xe_modparam.force_vram_bar_size, uint, 0600);
-MODULE_PARM_DESC(vram_bar_size, "Set the vram bar size(in MiB)");
+module_param_named(vram_bar_size, xe_modparam.force_vram_bar_size, int, 0600);
+MODULE_PARM_DESC(vram_bar_size, "Set the vram bar size (in MiB) - <0=disable-resize, 0=max-needed-size[default], >0=force-size");
 
 module_param_named(guc_log_level, xe_modparam.guc_log_level, int, 0600);
 MODULE_PARM_DESC(guc_log_level, "GuC firmware logging level (0=disable, 1..5=enable with verbosity min..max)");
index b1f81dca610dc3a2f1afc8864da2658d67f17a70..e421a74fb87c66dd934065ede80da43aa3c501e3 100644 (file)
@@ -49,7 +49,7 @@ _resize_bar(struct xe_device *xe, int resno, resource_size_t size)
  */
 static void resize_vram_bar(struct xe_device *xe)
 {
-       u64 force_vram_bar_size = xe_modparam.force_vram_bar_size;
+       int force_vram_bar_size = xe_modparam.force_vram_bar_size;
        struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
        struct pci_bus *root = pdev->bus;
        resource_size_t current_size;
@@ -66,6 +66,9 @@ static void resize_vram_bar(struct xe_device *xe)
        if (!bar_size_mask)
                return;
 
+       if (force_vram_bar_size < 0)
+               return;
+
        /* set to a specific size? */
        if (force_vram_bar_size) {
                u32 bar_size_bit;