]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/xe/vf: Move VF CCS debugfs attribute
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Mon, 8 Sep 2025 12:30:24 +0000 (14:30 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Tue, 9 Sep 2025 09:27:52 +0000 (11:27 +0200)
The VF CCS handling is per-device so its debugfs file should not
be exposed on per-GT basis. Move it up to the device level.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Link: https://lore.kernel.org/r/20250908123025.747-8-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_debugfs.c
drivers/gpu/drm/xe/xe_gt_debugfs.c
drivers/gpu/drm/xe/xe_sriov_vf.c
drivers/gpu/drm/xe/xe_sriov_vf.h
drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
drivers/gpu/drm/xe/xe_sriov_vf_ccs.h

index 4b71570529a631887b316c4681f64c73ab2b96dc..544d7d8460d9a1a64f65dee4559e6eead4ba7350 100644 (file)
@@ -24,6 +24,7 @@
 #include "xe_pxp_debugfs.h"
 #include "xe_sriov.h"
 #include "xe_sriov_pf.h"
+#include "xe_sriov_vf.h"
 #include "xe_step.h"
 #include "xe_tile_debugfs.h"
 #include "xe_wa.h"
@@ -395,4 +396,6 @@ void xe_debugfs_register(struct xe_device *xe)
 
        if (IS_SRIOV_PF(xe))
                xe_sriov_pf_debugfs_register(xe, root);
+       else if (IS_SRIOV_VF(xe))
+               xe_sriov_vf_debugfs_register(xe, root);
 }
index a9d960de0e5e958a5eacb790147961dec23c29de..f253e2df490776f171c83485cb9fadd29974c9e5 100644 (file)
@@ -124,33 +124,6 @@ static int powergate_info(struct xe_gt *gt, struct drm_printer *p)
        return ret;
 }
 
-static int sa_info_vf_ccs(struct xe_gt *gt, struct drm_printer *p)
-{
-       struct xe_device *xe = gt_to_xe(gt);
-       struct xe_sa_manager *bb_pool;
-       enum xe_sriov_vf_ccs_rw_ctxs ctx_id;
-
-       if (!IS_VF_CCS_READY(gt_to_xe(gt)))
-               return 0;
-
-       xe_pm_runtime_get(gt_to_xe(gt));
-
-       for_each_ccs_rw_ctx(ctx_id) {
-               bb_pool = xe->sriov.vf.ccs.contexts[ctx_id].mem.ccs_bb_pool;
-               if (!bb_pool)
-                       break;
-
-               drm_printf(p, "ccs %s bb suballoc info\n", ctx_id ? "write" : "read");
-               drm_printf(p, "-------------------------\n");
-               drm_suballoc_dump_debug_info(&bb_pool->base, p, xe_sa_manager_gpu_addr(bb_pool));
-               drm_puts(p, "\n");
-       }
-
-       xe_pm_runtime_put(gt_to_xe(gt));
-
-       return 0;
-}
-
 static int topology(struct xe_gt *gt, struct drm_printer *p)
 {
        xe_pm_runtime_get(gt_to_xe(gt));
@@ -318,13 +291,6 @@ static const struct drm_info_list vf_safe_debugfs_list[] = {
        {"hwconfig", .show = xe_gt_debugfs_simple_show, .data = hwconfig},
 };
 
-/*
- * only for GT debugfs files which are valid on VF. Not valid on PF.
- */
-static const struct drm_info_list vf_only_debugfs_list[] = {
-       {"sa_info_vf_ccs", .show = xe_gt_debugfs_simple_show, .data = sa_info_vf_ccs},
-};
-
 /* everything else should be added here */
 static const struct drm_info_list pf_only_debugfs_list[] = {
        {"hw_engines", .show = xe_gt_debugfs_simple_show, .data = hw_engines},
@@ -465,11 +431,6 @@ void xe_gt_debugfs_register(struct xe_gt *gt)
                drm_debugfs_create_files(pf_only_debugfs_list,
                                         ARRAY_SIZE(pf_only_debugfs_list),
                                         root, minor);
-       else
-               drm_debugfs_create_files(vf_only_debugfs_list,
-                                        ARRAY_SIZE(vf_only_debugfs_list),
-                                        root, minor);
-
 
        xe_uc_debugfs_register(&gt->uc, root);
 
index cb062328551aa2c4131a2f58869ab3c38e4e80cf..cdd9f8e78b2a236c88c541d856715dbd724af5ff 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright © 2023-2024 Intel Corporation
  */
 
+#include <drm/drm_debugfs.h>
 #include <drm/drm_managed.h>
 
 #include "xe_assert.h"
@@ -445,3 +446,30 @@ int xe_sriov_vf_init_late(struct xe_device *xe)
 
        return err;
 }
+
+static int sa_info_vf_ccs(struct seq_file *m, void *data)
+{
+       struct drm_info_node *node = m->private;
+       struct xe_device *xe = to_xe_device(node->minor->dev);
+       struct drm_printer p = drm_seq_file_printer(m);
+
+       xe_sriov_vf_ccs_print(xe, &p);
+       return 0;
+}
+
+static const struct drm_info_list debugfs_list[] = {
+       { .name = "sa_info_vf_ccs", .show = sa_info_vf_ccs },
+};
+
+/**
+ * xe_sriov_vf_debugfs_register - Register VF debugfs attributes.
+ * @xe: the &xe_device
+ * @root: the root &dentry
+ *
+ * Prepare debugfs attributes exposed by the VF.
+ */
+void xe_sriov_vf_debugfs_register(struct xe_device *xe, struct dentry *root)
+{
+       drm_debugfs_create_files(debugfs_list, ARRAY_SIZE(debugfs_list),
+                                root, xe->drm.primary);
+}
index 3bf3364799ad609d279e06b81c6966c5fd6f62fd..9e752105ec2aff1e673f1f0a70d3a0c63ffb6a79 100644 (file)
@@ -8,11 +8,13 @@
 
 #include <linux/types.h>
 
+struct dentry;
 struct xe_device;
 
 void xe_sriov_vf_init_early(struct xe_device *xe);
 int xe_sriov_vf_init_late(struct xe_device *xe);
 void xe_sriov_vf_start_migration_recovery(struct xe_device *xe);
 bool xe_sriov_vf_migration_supported(struct xe_device *xe);
+void xe_sriov_vf_debugfs_register(struct xe_device *xe, struct dentry *root);
 
 #endif
index c5c60f05073dc2537b8f383e7470f99708cac4c8..8dec616c37c983780b2270dac7c42cff732267e8 100644 (file)
@@ -13,6 +13,7 @@
 #include "xe_guc_submit.h"
 #include "xe_lrc.h"
 #include "xe_migrate.h"
+#include "xe_pm.h"
 #include "xe_sa.h"
 #include "xe_sriov_printk.h"
 #include "xe_sriov_vf.h"
@@ -376,3 +377,34 @@ int xe_sriov_vf_ccs_detach_bo(struct xe_bo *bo)
        }
        return 0;
 }
+
+/**
+ * xe_sriov_vf_ccs_print - Print VF CCS details.
+ * @xe: the &xe_device
+ * @p: the &drm_printer
+ *
+ * This function is for VF use only.
+ */
+void xe_sriov_vf_ccs_print(struct xe_device *xe, struct drm_printer *p)
+{
+       struct xe_sa_manager *bb_pool;
+       enum xe_sriov_vf_ccs_rw_ctxs ctx_id;
+
+       if (!IS_VF_CCS_READY(xe))
+               return;
+
+       xe_pm_runtime_get(xe);
+
+       for_each_ccs_rw_ctx(ctx_id) {
+               bb_pool = xe->sriov.vf.ccs.contexts[ctx_id].mem.ccs_bb_pool;
+               if (!bb_pool)
+                       break;
+
+               drm_printf(p, "ccs %s bb suballoc info\n", ctx_id ? "write" : "read");
+               drm_printf(p, "-------------------------\n");
+               drm_suballoc_dump_debug_info(&bb_pool->base, p, xe_sa_manager_gpu_addr(bb_pool));
+               drm_puts(p, "\n");
+       }
+
+       xe_pm_runtime_put(xe);
+}
index f0e1189b417ae399123439d9722ca81ec71e5c4d..0745c0ff022828e19cf231e185630d8d8d90029e 100644 (file)
@@ -10,6 +10,7 @@
 #include "xe_sriov.h"
 #include "xe_sriov_vf_ccs_types.h"
 
+struct drm_printer;
 struct xe_device;
 struct xe_bo;
 
@@ -17,6 +18,7 @@ int xe_sriov_vf_ccs_init(struct xe_device *xe);
 int xe_sriov_vf_ccs_attach_bo(struct xe_bo *bo);
 int xe_sriov_vf_ccs_detach_bo(struct xe_bo *bo);
 int xe_sriov_vf_ccs_register_context(struct xe_device *xe);
+void xe_sriov_vf_ccs_print(struct xe_device *xe, struct drm_printer *p);
 
 static inline bool xe_sriov_vf_ccs_ready(struct xe_device *xe)
 {