]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gt: Perf_limit_reasons are only available for Gen11+
authorAshutosh Dixit <ashutosh.dixit@intel.com>
Wed, 28 Sep 2022 19:02:12 +0000 (12:02 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Wed, 28 Sep 2022 20:39:26 +0000 (16:39 -0400)
Register GT0_PERF_LIMIT_REASONS (0x1381a8) is available only for
Gen11+. Therefore ensure perf_limit_reasons sysfs files are created only
for Gen11+. Otherwise on Gen < 5 accessing these files results in the
following oops:

<1> [88.829420] BUG: unable to handle page fault for address: ffffc90000bb81a8
<1> [88.829438] #PF: supervisor read access in kernel mode
<1> [88.829447] #PF: error_code(0x0000) - not-present page

This patch is a backport of the drm-tip commit 0d2d201095e9
("drm/i915: Perf_limit_reasons are only available for Gen11+") to
drm-intel-fixes. The backport is not identical to the original, it only
includes the sysfs portions of if. The debugfs portion is not available
in drm-intel-fixes so has not been backported.

Bspec: 20008
Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/6863
Fixes: 6ede9754df36 ("drm/i915/gt: Add sysfs throttle frequency interfaces")
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220919162401.2077713-1-ashutosh.dixit@intel.com
(backported from commit 0d2d201095e9f141d6a9fb44320afce761f8b5c2)

drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c

index 73a8b46e0234430ec08515c93fdad7c4547a38e2..d09a0e845d098beba423bb01e596e680ccc05ebb 100644 (file)
@@ -545,8 +545,7 @@ static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_ratl, RATL_MASK);
 static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_vr_thermalert, VR_THERMALERT_MASK);
 static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_vr_tdc, VR_TDC_MASK);
 
-static const struct attribute *freq_attrs[] = {
-       &dev_attr_punit_req_freq_mhz.attr,
+static const struct attribute *throttle_reason_attrs[] = {
        &attr_throttle_reason_status.attr,
        &attr_throttle_reason_pl1.attr,
        &attr_throttle_reason_pl2.attr,
@@ -763,12 +762,20 @@ void intel_gt_sysfs_pm_init(struct intel_gt *gt, struct kobject *kobj)
        if (!is_object_gt(kobj))
                return;
 
-       ret = sysfs_create_files(kobj, freq_attrs);
+       ret = sysfs_create_file(kobj, &dev_attr_punit_req_freq_mhz.attr);
        if (ret)
                drm_warn(&gt->i915->drm,
-                        "failed to create gt%u throttle sysfs files (%pe)",
+                        "failed to create gt%u punit_req_freq_mhz sysfs (%pe)",
                         gt->info.id, ERR_PTR(ret));
 
+       if (GRAPHICS_VER(gt->i915) >= 11) {
+               ret = sysfs_create_files(kobj, throttle_reason_attrs);
+               if (ret)
+                       drm_warn(&gt->i915->drm,
+                                "failed to create gt%u throttle sysfs files (%pe)",
+                                gt->info.id, ERR_PTR(ret));
+       }
+
        if (HAS_MEDIA_RATIO_MODE(gt->i915) && intel_uc_uses_guc_slpc(&gt->uc)) {
                ret = sysfs_create_files(kobj, media_perf_power_attrs);
                if (ret)