drm/i915/debugfs: add rcs topology entry
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 6 Mar 2018 12:28:54 +0000 (12:28 +0000)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 8 Mar 2018 10:06:21 +0000 (10:06 +0000)
While the end goal is to make this information available to userspace
through a new ioctl, there is no reason we can't display it in a human
readable fashion through debugfs.

slice0: 3 subslice(s) (0x7):
subslice0: 8 EUs (0xff)
subslice1: 8 EUs (0xff)
subslice2: 8 EUs (0xff)
subslice3: 0 EUs (0x0)
slice1: 3 subslice(s) (0x7):
subslice0: 8 EUs (0xff)
subslice1: 8 EUs (0xff)
subslice2: 8 EUs (0xff)
subslice3: 0 EUs (0x0)
slice2: 3 subslice(s) (0x7):
subslice0: 8 EUs (0xff)
subslice1: 8 EUs (0xff)
subslice2: 8 EUs (0xff)
subslice3: 0 EUs (0x0)

v2: Reformat debugfs printing (Tvrtko)
    Use the new EU mask helper (Tvrtko)

v3: Move printing code to intel_device_info.c to be shared with error
    state (Michal)

v4: Bump u8 to u16 when using sseu_get_eus() (Lionel)

Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180306122857.27317-4-lionel.g.landwerlin@intel.com
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/intel_device_info.c
drivers/gpu/drm/i915/intel_device_info.h

index bd5f98c60b5bc04217728ff7ef8279fb1248cb09..89f7ff2c652ee8b0694f0da2a33dc54d0e3b8402 100644 (file)
@@ -3201,6 +3201,16 @@ static int i915_engine_info(struct seq_file *m, void *unused)
        return 0;
 }
 
+static int i915_rcs_topology(struct seq_file *m, void *unused)
+{
+       struct drm_i915_private *dev_priv = node_to_i915(m->private);
+       struct drm_printer p = drm_seq_file_printer(m);
+
+       intel_device_info_dump_topology(&INTEL_INFO(dev_priv)->sseu, &p);
+
+       return 0;
+}
+
 static int i915_shrinker_info(struct seq_file *m, void *unused)
 {
        struct drm_i915_private *i915 = node_to_i915(m->private);
@@ -4733,6 +4743,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
        {"i915_dmc_info", i915_dmc_info, 0},
        {"i915_display_info", i915_display_info, 0},
        {"i915_engine_info", i915_engine_info, 0},
+       {"i915_rcs_topology", i915_rcs_topology, 0},
        {"i915_shrinker_info", i915_shrinker_info, 0},
        {"i915_shared_dplls_info", i915_shared_dplls_info, 0},
        {"i915_dp_mst_info", i915_dp_mst_info, 0},
index 14f2c72fdcff97d9141994ea1056b1ffd00bfb6a..3dd350f7b8e60d09206f5c95c683ac4f5cfa7dbc 100644 (file)
@@ -124,6 +124,30 @@ void intel_device_info_dump(const struct intel_device_info *info,
        intel_device_info_dump_flags(info, p);
 }
 
+void intel_device_info_dump_topology(const struct sseu_dev_info *sseu,
+                                    struct drm_printer *p)
+{
+       int s, ss;
+
+       if (sseu->max_slices == 0) {
+               drm_printf(p, "Unavailable\n");
+               return;
+       }
+
+       for (s = 0; s < sseu->max_slices; s++) {
+               drm_printf(p, "slice%d: %u subslice(s) (0x%hhx):\n",
+                          s, hweight8(sseu->subslice_mask[s]),
+                          sseu->subslice_mask[s]);
+
+               for (ss = 0; ss < sseu->max_subslices; ss++) {
+                       u16 enabled_eus = sseu_get_eus(sseu, s, ss);
+
+                       drm_printf(p, "\tsubslice%d: %u EUs (0x%hx)\n",
+                                  ss, hweight16(enabled_eus), enabled_eus);
+               }
+       }
+}
+
 static u16 compute_eu_total(const struct sseu_dev_info *sseu)
 {
        u16 i, total = 0;
index 4bc7b06a789ec43062629adb189f48e5a0cb32e4..0835752c8b2239277f2cd465d84a5fd048030b73 100644 (file)
@@ -244,6 +244,8 @@ void intel_device_info_dump_flags(const struct intel_device_info *info,
                                  struct drm_printer *p);
 void intel_device_info_dump_runtime(const struct intel_device_info *info,
                                    struct drm_printer *p);
+void intel_device_info_dump_topology(const struct sseu_dev_info *sseu,
+                                    struct drm_printer *p);
 
 void intel_driver_caps_print(const struct intel_driver_caps *caps,
                             struct drm_printer *p);