]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/pf: Always expose VRAM provisioning data on discrete GPUs
authorLukasz Laguna <lukasz.laguna@intel.com>
Thu, 16 Oct 2025 12:22:33 +0000 (14:22 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 17 Oct 2025 14:55:57 +0000 (16:55 +0200)
Currently, VRAM provisioning data is only exposed if the device supports
LMTT. While it should not be possible to modify VRAM provisioning on
platforms without LMTT, it is still useful to be able to read the VRAM
provisioning data on all discrete GPU platforms.

Expose the VRAM debugfs attributes whenever running on dGFX, adjusting
file permissions to read only when LMTT is not available.

Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://lore.kernel.org/r/20251016122233.3789-1-lukasz.laguna@intel.com
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
drivers/gpu/drm/xe/xe_tile_sriov_pf_debugfs.c

index b2e5c52978e6a28d4c648369ad1e08c919f83c58..c0c0215c070360eda11ba91e6576655c8d8d70fd 100644 (file)
@@ -1548,7 +1548,8 @@ int xe_gt_sriov_pf_config_set_lmem(struct xe_gt *gt, unsigned int vfid, u64 size
 {
        int err;
 
-       xe_gt_assert(gt, xe_device_has_lmtt(gt_to_xe(gt)));
+       if (!xe_device_has_lmtt(gt_to_xe(gt)))
+               return -EPERM;
 
        mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
        if (vfid)
index c8df18af4d00c4179351c51b5d36c2778adeb738..6ba2332c77d41d38e2245217ff6ff415443022a7 100644 (file)
@@ -165,14 +165,17 @@ DEFINE_SRIOV_TILE_CONFIG_DEBUGFS_ATTRIBUTE(vram, lmem, u64, "%llu\n");
 
 static void pf_add_config_attrs(struct xe_tile *tile, struct dentry *dent, unsigned int vfid)
 {
+       struct xe_device *xe = tile->xe;
+
        xe_tile_assert(tile, tile == extract_tile(dent));
        xe_tile_assert(tile, vfid == extract_vfid(dent));
 
        debugfs_create_file_unsafe(vfid ? "ggtt_quota" : "ggtt_spare",
                                   0644, dent, dent, &ggtt_fops);
-       if (xe_device_has_lmtt(tile->xe))
+       if (IS_DGFX(xe))
                debugfs_create_file_unsafe(vfid ? "vram_quota" : "vram_spare",
-                                          0644, dent, dent, &vram_fops);
+                                          xe_device_has_lmtt(xe) ? 0644 : 0444,
+                                          dent, dent, &vram_fops);
 }
 
 static void pf_populate_tile(struct xe_tile *tile, struct dentry *dent, unsigned int vfid)
@@ -188,7 +191,7 @@ static void pf_populate_tile(struct xe_tile *tile, struct dentry *dent, unsigned
                drm_debugfs_create_files(pf_ggtt_info,
                                         ARRAY_SIZE(pf_ggtt_info),
                                         dent, minor);
-               if (xe_device_has_lmtt(xe))
+               if (IS_DGFX(xe))
                        drm_debugfs_create_files(pf_vram_info,
                                                 ARRAY_SIZE(pf_vram_info),
                                                 dent, minor);