Re: [Intel-gfx] [PATCH] drm/i915: Perf_limit_reasons are only available for Gen11+

2022-09-28 Thread Dixit, Ashutosh
On Wed, 28 Sep 2022 11:35:18 -0700, Rodrigo Vivi wrote:
>
> On Wed, Sep 28, 2022 at 11:17:06AM -0700, Dixit, Ashutosh wrote:
> > On Wed, 28 Sep 2022 04:38:46 -0700, Jani Nikula wrote:
> > >
> > > On Mon, 19 Sep 2022, Ashutosh Dixit  wrote:
> > > > Register GT0_PERF_LIMIT_REASONS (0x1381a8) is available only for
> > > > Gen11+. Therefore ensure perf_limit_reasons sysfs/debugfs 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: 
> > > > c9bb81a8
> > > > <1> [88.829438] #PF: supervisor read access in kernel mode
> > > > <1> [88.829447] #PF: error_code(0x) - not-present page
> > > >
> > > > Bspec: 20008
> > > > Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/6863
> > > > Fixes: fe5979665f64 ("drm/i915/debugfs: Add perf_limit_reasons in 
> > > > debugfs")
> > > > Fixes: fa68bff7cf27 ("drm/i915/gt: Add sysfs throttle frequency 
> > > > interfaces")
> > > > Signed-off-by: Ashutosh Dixit 
> > >
> >
> > Hi Jani,
> >
> > > Ashutosh, can you provide a backport of this i.e. commit 0d2d201095e9
> > > ("drm/i915: Perf_limit_reasons are only available for Gen11+") that
> > > applies cleanly on drm-intel-fixes, please?
> >
> > I've sent the patch:
> >
> > https://patchwork.freedesktop.org/series/109196/
> >
> > Not sure though if it is worth applying on drm-intel-fixes because of one
> > conflict with drm-tip which will need to be resolved manually. On

Hi Rodrigo,

> The conflict shouldn't be that bad to resolve, but since the patch deviates
> from the original, the new commit message needs to highlight and explain
> that this is a backport and the reasons of the difference and including the 
> sha
> of the already merged patch. Similar to the option 3 of the stable rules. [1].

I have improved the commit message and sent out a v2. Please take a look.

Thanks.
--
Ashutosh

> Well, another option is to wait until this patch gets propagated to Linus 
> master
> and then send the backported version to the stable mailing list. But again,
> with the proper rules of the option 3. [1]
>
> [1] - https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
>
> > drm-intel-fixes the crash mentioned above will be seen only on Gen < 5 if
> > someone manually cat's the sysfs. We had to fix on drm-tip because there
> > was a CI failure with Gen3 debugfs but that code is not in drm-intel-fixes.
>
> since it is sysfs it is probably a good protection to have anyway.
>
> >
> > Thanks.
> > --
> > Ashutosh


Re: [Intel-gfx] [PATCH] drm/i915: Perf_limit_reasons are only available for Gen11+

2022-09-28 Thread Rodrigo Vivi
On Wed, Sep 28, 2022 at 11:17:06AM -0700, Dixit, Ashutosh wrote:
> On Wed, 28 Sep 2022 04:38:46 -0700, Jani Nikula wrote:
> >
> > On Mon, 19 Sep 2022, Ashutosh Dixit  wrote:
> > > Register GT0_PERF_LIMIT_REASONS (0x1381a8) is available only for
> > > Gen11+. Therefore ensure perf_limit_reasons sysfs/debugfs 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: 
> > > c9bb81a8
> > > <1> [88.829438] #PF: supervisor read access in kernel mode
> > > <1> [88.829447] #PF: error_code(0x) - not-present page
> > >
> > > Bspec: 20008
> > > Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/6863
> > > Fixes: fe5979665f64 ("drm/i915/debugfs: Add perf_limit_reasons in 
> > > debugfs")
> > > Fixes: fa68bff7cf27 ("drm/i915/gt: Add sysfs throttle frequency 
> > > interfaces")
> > > Signed-off-by: Ashutosh Dixit 
> >
> 
> Hi Jani,
> 
> > Ashutosh, can you provide a backport of this i.e. commit 0d2d201095e9
> > ("drm/i915: Perf_limit_reasons are only available for Gen11+") that
> > applies cleanly on drm-intel-fixes, please?
> 
> I've sent the patch:
> 
> https://patchwork.freedesktop.org/series/109196/
> 
> Not sure though if it is worth applying on drm-intel-fixes because of one
> conflict with drm-tip which will need to be resolved manually. On

The conflict shouldn't be that bad to resolve, but since the patch deviates
from the original, the new commit message needs to highlight and explain
that this is a backport and the reasons of the difference and including the sha
of the already merged patch. Similar to the option 3 of the stable rules. [1].

Well, another option is to wait until this patch gets propagated to Linus master
and then send the backported version to the stable mailing list. But again,
with the proper rules of the option 3. [1]

[1] - https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

> drm-intel-fixes the crash mentioned above will be seen only on Gen < 5 if
> someone manually cat's the sysfs. We had to fix on drm-tip because there
> was a CI failure with Gen3 debugfs but that code is not in drm-intel-fixes.

since it is sysfs it is probably a good protection to have anyway.

> 
> Thanks.
> --
> Ashutosh


Re: [Intel-gfx] [PATCH] drm/i915: Perf_limit_reasons are only available for Gen11+

2022-09-28 Thread Dixit, Ashutosh
On Wed, 28 Sep 2022 04:38:46 -0700, Jani Nikula wrote:
>
> On Mon, 19 Sep 2022, Ashutosh Dixit  wrote:
> > Register GT0_PERF_LIMIT_REASONS (0x1381a8) is available only for
> > Gen11+. Therefore ensure perf_limit_reasons sysfs/debugfs 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: 
> > c9bb81a8
> > <1> [88.829438] #PF: supervisor read access in kernel mode
> > <1> [88.829447] #PF: error_code(0x) - not-present page
> >
> > Bspec: 20008
> > Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/6863
> > Fixes: fe5979665f64 ("drm/i915/debugfs: Add perf_limit_reasons in debugfs")
> > Fixes: fa68bff7cf27 ("drm/i915/gt: Add sysfs throttle frequency interfaces")
> > Signed-off-by: Ashutosh Dixit 
>

Hi Jani,

> Ashutosh, can you provide a backport of this i.e. commit 0d2d201095e9
> ("drm/i915: Perf_limit_reasons are only available for Gen11+") that
> applies cleanly on drm-intel-fixes, please?

I've sent the patch:

https://patchwork.freedesktop.org/series/109196/

Not sure though if it is worth applying on drm-intel-fixes because of one
conflict with drm-tip which will need to be resolved manually. On
drm-intel-fixes the crash mentioned above will be seen only on Gen < 5 if
someone manually cat's the sysfs. We had to fix on drm-tip because there
was a CI failure with Gen3 debugfs but that code is not in drm-intel-fixes.

Thanks.
--
Ashutosh


Re: [Intel-gfx] [PATCH] drm/i915: Perf_limit_reasons are only available for Gen11+

2022-09-28 Thread Jani Nikula
On Mon, 19 Sep 2022, Ashutosh Dixit  wrote:
> Register GT0_PERF_LIMIT_REASONS (0x1381a8) is available only for
> Gen11+. Therefore ensure perf_limit_reasons sysfs/debugfs 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: c9bb81a8
> <1> [88.829438] #PF: supervisor read access in kernel mode
> <1> [88.829447] #PF: error_code(0x) - not-present page
>
> Bspec: 20008
> Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/6863
> Fixes: fe5979665f64 ("drm/i915/debugfs: Add perf_limit_reasons in debugfs")
> Fixes: fa68bff7cf27 ("drm/i915/gt: Add sysfs throttle frequency interfaces")
> Signed-off-by: Ashutosh Dixit 

Ashutosh, can you provide a backport of this i.e. commit 0d2d201095e9
("drm/i915: Perf_limit_reasons are only available for Gen11+") that
applies cleanly on drm-intel-fixes, please?

BR,
Jani.


> ---
>  drivers/gpu/drm/i915/gt/intel_gt.c|  4 
>  drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c | 10 +-
>  drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c   | 15 +++
>  3 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c 
> b/drivers/gpu/drm/i915/gt/intel_gt.c
> index 5ddae95d4886..b367cfff48d5 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -233,6 +233,10 @@ static void gen6_clear_engine_error_register(struct 
> intel_engine_cs *engine)
>  
>  i915_reg_t intel_gt_perf_limit_reasons_reg(struct intel_gt *gt)
>  {
> + /* GT0_PERF_LIMIT_REASONS is available only for Gen11+ */
> + if (GRAPHICS_VER(gt->i915) < 11)
> + return INVALID_MMIO_REG;
> +
>   return gt->type == GT_MEDIA ?
>   MTL_MEDIA_PERF_LIMIT_REASONS : GT0_PERF_LIMIT_REASONS;
>  }
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c 
> b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> index 68310881a793..10f680dbd7b6 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> @@ -682,6 +682,14 @@ static int perf_limit_reasons_clear(void *data, u64 val)
>  
>   return 0;
>  }
> +
> +static bool perf_limit_reasons_eval(void *data)
> +{
> + struct intel_gt *gt = data;
> +
> + return i915_mmio_reg_valid(intel_gt_perf_limit_reasons_reg(gt));
> +}
> +
>  DEFINE_SIMPLE_ATTRIBUTE(perf_limit_reasons_fops, perf_limit_reasons_get,
>   perf_limit_reasons_clear, "%llu\n");
>  
> @@ -694,7 +702,7 @@ void intel_gt_pm_debugfs_register(struct intel_gt *gt, 
> struct dentry *root)
>   { "forcewake_user", _user_fops, NULL},
>   { "llc", _fops, llc_eval },
>   { "rps_boost", _boost_fops, rps_eval },
> - { "perf_limit_reasons", _limit_reasons_fops, NULL },
> + { "perf_limit_reasons", _limit_reasons_fops, 
> perf_limit_reasons_eval },
>   };
>  
>   intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c 
> b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> index 54deae45d81f..904160952369 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> @@ -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[] = {
> - _attr_punit_req_freq_mhz.attr,
> +static const struct attribute *throttle_reason_attrs[] = {
>   _throttle_reason_status.attr,
>   _throttle_reason_pl1.attr,
>   _throttle_reason_pl2.attr,
> @@ -791,12 +790,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, _attr_punit_req_freq_mhz.attr);
>   if (ret)
>   drm_warn(>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 (i915_mmio_reg_valid(intel_gt_perf_limit_reasons_reg(gt))) {
> + ret = sysfs_create_files(kobj, throttle_reason_attrs);
> + if (ret)
> + drm_warn(>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(>uc)) {
>   ret = sysfs_create_files(kobj, media_perf_power_attrs);
>   if (ret)

-- 
Jani Nikula, Intel Open Source Graphics Center

Re: [Intel-gfx] [PATCH] drm/i915: Perf_limit_reasons are only available for Gen11+

2022-09-20 Thread Rodrigo Vivi
On Mon, Sep 19, 2022 at 09:24:01AM -0700, Ashutosh Dixit wrote:
> Register GT0_PERF_LIMIT_REASONS (0x1381a8) is available only for
> Gen11+. Therefore ensure perf_limit_reasons sysfs/debugfs 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: c9bb81a8
> <1> [88.829438] #PF: supervisor read access in kernel mode
> <1> [88.829447] #PF: error_code(0x) - not-present page
> 
> Bspec: 20008
> Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/6863
> Fixes: fe5979665f64 ("drm/i915/debugfs: Add perf_limit_reasons in debugfs")
> Fixes: fa68bff7cf27 ("drm/i915/gt: Add sysfs throttle frequency interfaces")
> Signed-off-by: Ashutosh Dixit 

Reviewed-by: Rodrigo Vivi 
> ---
>  drivers/gpu/drm/i915/gt/intel_gt.c|  4 
>  drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c | 10 +-
>  drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c   | 15 +++
>  3 files changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c 
> b/drivers/gpu/drm/i915/gt/intel_gt.c
> index 5ddae95d4886..b367cfff48d5 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -233,6 +233,10 @@ static void gen6_clear_engine_error_register(struct 
> intel_engine_cs *engine)
>  
>  i915_reg_t intel_gt_perf_limit_reasons_reg(struct intel_gt *gt)
>  {
> + /* GT0_PERF_LIMIT_REASONS is available only for Gen11+ */
> + if (GRAPHICS_VER(gt->i915) < 11)
> + return INVALID_MMIO_REG;
> +
>   return gt->type == GT_MEDIA ?
>   MTL_MEDIA_PERF_LIMIT_REASONS : GT0_PERF_LIMIT_REASONS;
>  }
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c 
> b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> index 68310881a793..10f680dbd7b6 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> @@ -682,6 +682,14 @@ static int perf_limit_reasons_clear(void *data, u64 val)
>  
>   return 0;
>  }
> +
> +static bool perf_limit_reasons_eval(void *data)
> +{
> + struct intel_gt *gt = data;
> +
> + return i915_mmio_reg_valid(intel_gt_perf_limit_reasons_reg(gt));
> +}
> +
>  DEFINE_SIMPLE_ATTRIBUTE(perf_limit_reasons_fops, perf_limit_reasons_get,
>   perf_limit_reasons_clear, "%llu\n");
>  
> @@ -694,7 +702,7 @@ void intel_gt_pm_debugfs_register(struct intel_gt *gt, 
> struct dentry *root)
>   { "forcewake_user", _user_fops, NULL},
>   { "llc", _fops, llc_eval },
>   { "rps_boost", _boost_fops, rps_eval },
> - { "perf_limit_reasons", _limit_reasons_fops, NULL },
> + { "perf_limit_reasons", _limit_reasons_fops, 
> perf_limit_reasons_eval },
>   };
>  
>   intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c 
> b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> index 54deae45d81f..904160952369 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> @@ -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[] = {
> - _attr_punit_req_freq_mhz.attr,
> +static const struct attribute *throttle_reason_attrs[] = {
>   _throttle_reason_status.attr,
>   _throttle_reason_pl1.attr,
>   _throttle_reason_pl2.attr,
> @@ -791,12 +790,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, _attr_punit_req_freq_mhz.attr);
>   if (ret)
>   drm_warn(>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 (i915_mmio_reg_valid(intel_gt_perf_limit_reasons_reg(gt))) {
> + ret = sysfs_create_files(kobj, throttle_reason_attrs);
> + if (ret)
> + drm_warn(>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(>uc)) {
>   ret = sysfs_create_files(kobj, media_perf_power_attrs);
>   if (ret)
> -- 
> 2.34.1
> 


[Intel-gfx] [PATCH] drm/i915: Perf_limit_reasons are only available for Gen11+

2022-09-19 Thread Ashutosh Dixit
Register GT0_PERF_LIMIT_REASONS (0x1381a8) is available only for
Gen11+. Therefore ensure perf_limit_reasons sysfs/debugfs 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: c9bb81a8
<1> [88.829438] #PF: supervisor read access in kernel mode
<1> [88.829447] #PF: error_code(0x) - not-present page

Bspec: 20008
Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/6863
Fixes: fe5979665f64 ("drm/i915/debugfs: Add perf_limit_reasons in debugfs")
Fixes: fa68bff7cf27 ("drm/i915/gt: Add sysfs throttle frequency interfaces")
Signed-off-by: Ashutosh Dixit 
---
 drivers/gpu/drm/i915/gt/intel_gt.c|  4 
 drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c | 10 +-
 drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c   | 15 +++
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c 
b/drivers/gpu/drm/i915/gt/intel_gt.c
index 5ddae95d4886..b367cfff48d5 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -233,6 +233,10 @@ static void gen6_clear_engine_error_register(struct 
intel_engine_cs *engine)
 
 i915_reg_t intel_gt_perf_limit_reasons_reg(struct intel_gt *gt)
 {
+   /* GT0_PERF_LIMIT_REASONS is available only for Gen11+ */
+   if (GRAPHICS_VER(gt->i915) < 11)
+   return INVALID_MMIO_REG;
+
return gt->type == GT_MEDIA ?
MTL_MEDIA_PERF_LIMIT_REASONS : GT0_PERF_LIMIT_REASONS;
 }
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c 
b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
index 68310881a793..10f680dbd7b6 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
@@ -682,6 +682,14 @@ static int perf_limit_reasons_clear(void *data, u64 val)
 
return 0;
 }
+
+static bool perf_limit_reasons_eval(void *data)
+{
+   struct intel_gt *gt = data;
+
+   return i915_mmio_reg_valid(intel_gt_perf_limit_reasons_reg(gt));
+}
+
 DEFINE_SIMPLE_ATTRIBUTE(perf_limit_reasons_fops, perf_limit_reasons_get,
perf_limit_reasons_clear, "%llu\n");
 
@@ -694,7 +702,7 @@ void intel_gt_pm_debugfs_register(struct intel_gt *gt, 
struct dentry *root)
{ "forcewake_user", _user_fops, NULL},
{ "llc", _fops, llc_eval },
{ "rps_boost", _boost_fops, rps_eval },
-   { "perf_limit_reasons", _limit_reasons_fops, NULL },
+   { "perf_limit_reasons", _limit_reasons_fops, 
perf_limit_reasons_eval },
};
 
intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c 
b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
index 54deae45d81f..904160952369 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
@@ -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[] = {
-   _attr_punit_req_freq_mhz.attr,
+static const struct attribute *throttle_reason_attrs[] = {
_throttle_reason_status.attr,
_throttle_reason_pl1.attr,
_throttle_reason_pl2.attr,
@@ -791,12 +790,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, _attr_punit_req_freq_mhz.attr);
if (ret)
drm_warn(>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 (i915_mmio_reg_valid(intel_gt_perf_limit_reasons_reg(gt))) {
+   ret = sysfs_create_files(kobj, throttle_reason_attrs);
+   if (ret)
+   drm_warn(>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(>uc)) {
ret = sysfs_create_files(kobj, media_perf_power_attrs);
if (ret)
-- 
2.34.1