@@ -8,6 +8,7 @@
#include "intel_gt_ccs_mode.h"
#include "intel_gt_print.h"
#include "intel_gt_regs.h"
+#include "intel_gt_sysfs.h"
void intel_gt_ccs_mode_init(struct intel_gt *gt)
{
@@ -83,3 +84,25 @@ unsigned int intel_gt_apply_ccs_mode(struct intel_gt *gt)
return mode;
}
+
+static ssize_t num_cslices_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buff)
+{
+ struct intel_gt *gt = kobj_to_gt(&dev->kobj);
+ u32 num_slices;
+
+ num_slices = hweight32(gt->ccs.cslice_mask);
+
+ return sysfs_emit(buff, "%u\n", num_slices);
+}
+static DEVICE_ATTR_RO(num_cslices);
+
+void intel_gt_sysfs_ccs_init(struct intel_gt *gt)
+{
+ int err;
+
+ err = sysfs_create_file(>->sysfs_gt, &dev_attr_num_cslices.attr);
+ if (err)
+ gt_dbg(gt, "failed to create sysfs num_cslices files\n");
+}
@@ -9,6 +9,7 @@
struct intel_gt;
unsigned int intel_gt_apply_ccs_mode(struct intel_gt *gt);
+void intel_gt_sysfs_ccs_init(struct intel_gt *gt);
void intel_gt_ccs_mode_init(struct intel_gt *gt);
#endif /* __INTEL_GT_CCS_MODE_H__ */
@@ -12,6 +12,7 @@
#include "i915_drv.h"
#include "i915_sysfs.h"
#include "intel_gt.h"
+#include "intel_gt_ccs_mode.h"
#include "intel_gt_print.h"
#include "intel_gt_sysfs.h"
#include "intel_gt_sysfs_pm.h"
@@ -101,6 +102,7 @@ void intel_gt_sysfs_register(struct intel_gt *gt)
goto exit_fail;
intel_gt_sysfs_pm_init(gt, >->sysfs_gt);
+ intel_gt_sysfs_ccs_init(gt);
return;
Implement a sysfs interface to show the number of available CCS slices. The displayed number does not take into account the CCS balancing mode. Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com> --- drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c | 23 +++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.h | 1 + drivers/gpu/drm/i915/gt/intel_gt_sysfs.c | 2 ++ 3 files changed, 26 insertions(+)