Skip to contentSkip to conversation

drm/i915: Unifying debugfs return codes for unsupported features

PATCH Superseded Michal Wajdeczko 4 participants 6 messages Nov 28, 2017 – Nov 29, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Unifying debugfs return codes for unsupported features

Instead of trying different seq_puts messages, lets use common -ENODEV error code to indicate missing/unsupported feature.

Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 47 ++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +23 -24
index 2829447..5023acd 100644
@@ -1635,10 +1635,8 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 
-	if (!HAS_FBC(dev_priv)) {
-		seq_puts(m, "FBC unsupported on this chipset\n");
-		return 0;
-	}
+	if (!HAS_FBC(dev_priv))
+		return -ENODEV;
 
 	intel_runtime_pm_get(dev_priv);
 	mutex_lock(&dev_priv->fbc.lock);
@@ -1714,10 +1712,8 @@ static int i915_ips_status(struct seq_file *m, void *unused)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 
-	if (!HAS_IPS(dev_priv)) {
-		seq_puts(m, "not supported\n");
-		return 0;
-	}
+	if (!HAS_IPS(dev_priv))
+		return -ENODEV;
 
 	intel_runtime_pm_get(dev_priv);
 
@@ -1803,10 +1799,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 	int gpu_freq, ia_freq;
 	unsigned int max_gpu_freq, min_gpu_freq;
 
-	if (!HAS_LLC(dev_priv)) {
-		seq_puts(m, "unsupported on this chipset\n");
-		return 0;
-	}
+	if (!HAS_LLC(dev_priv))
+		return -ENODEV;
 
 	intel_runtime_pm_get(dev_priv);
 
@@ -2287,7 +2281,7 @@ static int i915_huc_load_status_info(struct seq_file *m, void *data)
 	struct drm_printer p;
 
 	if (!HAS_HUC_UCODE(dev_priv))
-		return 0;
+		return -ENODEV;
 
 	p = drm_seq_file_printer(m);
 	intel_uc_fw_dump(&dev_priv->huc.fw, &p);
@@ -2305,8 +2299,8 @@ static int i915_guc_load_status_info(struct seq_file *m, void *data)
 	struct drm_printer p;
 	u32 tmp, i;
 
-	if (!HAS_GUC_UCODE(dev_priv))
-		return 0;
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
 
 	p = drm_seq_file_printer(m);
 	intel_uc_fw_dump(&dev_priv->guc.fw, &p);
@@ -2400,6 +2394,9 @@ static int i915_guc_info(struct seq_file *m, void *data)
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 	const struct intel_guc *guc = &dev_priv->guc;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
 	if (!check_guc_submission(m))
 		return 0;
 
@@ -2428,6 +2425,9 @@ static int i915_guc_stage_pool(struct seq_file *m, void *data)
 	unsigned int tmp;
 	int index;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
 	if (!check_guc_submission(m))
 		return 0;
 
@@ -2482,6 +2482,9 @@ static int i915_guc_log_dump(struct seq_file *m, void *data)
 	u32 *log;
 	int i = 0;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
 	if (dump_load_err)
 		obj = dev_priv->guc.load_err_log;
 	else if (dev_priv->guc.log.vma)
@@ -2576,10 +2579,8 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
 	enum pipe pipe;
 	bool enabled = false;
 
-	if (!HAS_PSR(dev_priv)) {
-		seq_puts(m, "PSR not supported\n");
-		return 0;
-	}
+	if (!HAS_PSR(dev_priv))
+		return -ENODEV;
 
 	intel_runtime_pm_get(dev_priv);
 
@@ -2818,10 +2819,8 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 	struct intel_csr *csr;
 
-	if (!HAS_CSR(dev_priv)) {
-		seq_puts(m, "not supported\n");
-		return 0;
-	}
+	if (!HAS_CSR(dev_priv))
+		return -ENODEV;
 
 	csr = &dev_priv->csr;
 
@@ -3357,7 +3356,7 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
 	int plane;
 
 	if (INTEL_GEN(dev_priv) < 9)
-		return 0;
+		return -ENODEV;
 
 	drm_modeset_lock_all(dev);
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Unifying debugfs return codes for unsupported features

== Series Details ==

== Series Details ==

Series: drm/i915: Unifying debugfs return codes for unsupported features
URL : https://patchwork.freedesktop.org/series/34552/
State : failure

== Summary ==

Series 34552v1 drm/i915: Unifying debugfs return codes for unsupported features
https://patchwork.freedesktop.org/api/1.0/series/34552/revisions/1/mbox/

Test kms_frontbuffer_tracking:

        Subgroup basic:
                skip       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-byt-j1900)
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-bsw-n3050)
fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:445s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:444s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:381s
fi-bsw-n3050     total:288  pass:241  dwarn:0   dfail:0   fail:1   skip:46  time:509s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:281s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:498s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:503s
fi-byt-j1900     total:288  pass:252  dwarn:0   dfail:0   fail:1   skip:35  time:475s
fi-byt-n2820     total:288  pass:248  dwarn:0   dfail:0   fail:1   skip:39  time:466s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:1   skip:58  time:425s
fi-gdg-551       total:288  pass:178  dwarn:1   dfail:0   fail:1   skip:108 time:268s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:533s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:429s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:430s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:480s
fi-ivb-3770      total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:454s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:492s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:523s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:474s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:525s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:588s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:446s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:535s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:570s
fi-skl-6700k     total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:513s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:499s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:445s
fi-snb-2520m     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:552s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:410s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:594s
fi-cnl-y         total:231  pass:206  dwarn:0   dfail:0   fail:0   skip:24 
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:480s

73f135dccc60c8fa6e2a200286b00877209a9c29 drm-tip: 2017y-11m-28d-14h-52m-10s UTC integration manifest bbf2f8d039b5 drm/i915: Unifying debugfs return codes for unsupported features

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7326/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

Re: ✗ Fi.CI.BAT: failure for drm/i915: Unifying debugfs return codes for unsupported features

Quoted 11 lines · Patchwork

== Series Details ==

Series: drm/i915: Unifying debugfs return codes for unsupported features
URL : https://patchwork.freedesktop.org/series/34552/
State : failure

== Summary ==

Series 34552v1 drm/i915: Unifying debugfs return codes for unsupported features
https://patchwork.freedesktop.org/api/1.0/series/34552/revisions/1/mbox/

Quoted 7 lines

Test kms_frontbuffer_tracking:

        Subgroup basic:
                skip       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-byt-j1900)
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-bsw-n3050)

It looks that "igt/kms_frontbuffer_tracking: Keep the debugfs dir around" introduced igt_assert that fires when we try to return -ENODEV.

I think we can replace it with proper handling (see __igt_debugfs_read)

tests/kms_frontbuffer_tracking.c +2 -1
index a068c8a..50019d1 100644
@@ -783,7 +783,8 @@ static bool set_mode_for_params(struct modeset_params *params)
 static void __debugfs_read(const char *param, char *buf, int len)
 {
        len = igt_sysfs_read(drm.debugfs, param, buf, len - 1);
-       igt_assert(len > 0);
+       if (len < 0)
+               len = 0;
        buf[len] = '\0';
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Michal Wajdeczko
Quoted 2 lines · Michal Wajdeczko

Instead of trying different seq_puts messages, lets use common -ENODEV error code to indicate missing/unsupported feature.

I agree that this is the simplest way to unify

Quoted 131 lines
Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
---
  drivers/gpu/drm/i915/i915_debugfs.c | 47 ++++++++++++++++++-------------------
  1 file changed, 23 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +22 -23
index 2829447..5023acd 100644
@@ -1635,10 +1635,8 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
  {
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 
-	if (!HAS_FBC(dev_priv)) {
-		seq_puts(m, "FBC unsupported on this chipset\n");
-		return 0;
-	}
+	if (!HAS_FBC(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
  	mutex_lock(&dev_priv->fbc.lock);
@@ -1714,10 +1712,8 @@ static int i915_ips_status(struct seq_file *m, void *unused)
  {
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 
-	if (!HAS_IPS(dev_priv)) {
-		seq_puts(m, "not supported\n");
-		return 0;
-	}
+	if (!HAS_IPS(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
 
@@ -1803,10 +1799,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
  	int gpu_freq, ia_freq;
  	unsigned int max_gpu_freq, min_gpu_freq;
 
-	if (!HAS_LLC(dev_priv)) {
-		seq_puts(m, "unsupported on this chipset\n");
-		return 0;
-	}
+	if (!HAS_LLC(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
 
@@ -2287,7 +2281,7 @@ static int i915_huc_load_status_info(struct seq_file *m, void *data)
  	struct drm_printer p;
 
  	if (!HAS_HUC_UCODE(dev_priv))
-		return 0;
+		return -ENODEV;
 
  	p = drm_seq_file_printer(m);
  	intel_uc_fw_dump(&dev_priv->huc.fw, &p);
@@ -2305,8 +2299,8 @@ static int i915_guc_load_status_info(struct seq_file *m, void *data)
  	struct drm_printer p;
  	u32 tmp, i;
 
-	if (!HAS_GUC_UCODE(dev_priv))
-		return 0;
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
 
  	p = drm_seq_file_printer(m);
  	intel_uc_fw_dump(&dev_priv->guc.fw, &p);
@@ -2400,6 +2394,9 @@ static int i915_guc_info(struct seq_file *m, void *data)
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
  	const struct intel_guc *guc = &dev_priv->guc;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
  	if (!check_guc_submission(m))
  		return 0;
 
@@ -2428,6 +2425,9 @@ static int i915_guc_stage_pool(struct seq_file *m, void *data)
  	unsigned int tmp;
  	int index;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
  	if (!check_guc_submission(m))
  		return 0;
 
@@ -2482,6 +2482,9 @@ static int i915_guc_log_dump(struct seq_file *m, void *data)
  	u32 *log;
  	int i = 0;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
  	if (dump_load_err)
  		obj = dev_priv->guc.load_err_log;
  	else if (dev_priv->guc.log.vma)
@@ -2576,10 +2579,8 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
  	enum pipe pipe;
  	bool enabled = false;
 
-	if (!HAS_PSR(dev_priv)) {
-		seq_puts(m, "PSR not supported\n");
-		return 0;
-	}
+	if (!HAS_PSR(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
 
@@ -2818,10 +2819,8 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
  	struct intel_csr *csr;
 
-	if (!HAS_CSR(dev_priv)) {
-		seq_puts(m, "not supported\n");
-		return 0;
-	}
+	if (!HAS_CSR(dev_priv))
+		return -ENODEV;
 
  	csr = &dev_priv->csr;
 

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 3362

Quoted 8 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
@@ -3357,7 +3356,7 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
  	int plane;
 
  	if (INTEL_GEN(dev_priv) < 9)
-		return 0;
+		return -ENODEV;
 
  	drm_modeset_lock_all(dev);
 

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
In reply to Michal Wajdeczko
Quoted 2 lines · Michal Wajdeczko

Instead of trying different seq_puts messages, lets use common -ENODEV error code to indicate missing/unsupported feature.

I agree that this is the simplest way to unify the message.

Regards,
Sujaritha

Quoted 130 lines
Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
---
  drivers/gpu/drm/i915/i915_debugfs.c | 47 ++++++++++++++++++-------------------
  1 file changed, 23 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +22 -23
index 2829447..5023acd 100644
@@ -1635,10 +1635,8 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
  {
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 
-	if (!HAS_FBC(dev_priv)) {
-		seq_puts(m, "FBC unsupported on this chipset\n");
-		return 0;
-	}
+	if (!HAS_FBC(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
  	mutex_lock(&dev_priv->fbc.lock);
@@ -1714,10 +1712,8 @@ static int i915_ips_status(struct seq_file *m, void *unused)
  {
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 
-	if (!HAS_IPS(dev_priv)) {
-		seq_puts(m, "not supported\n");
-		return 0;
-	}
+	if (!HAS_IPS(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
 
@@ -1803,10 +1799,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
  	int gpu_freq, ia_freq;
  	unsigned int max_gpu_freq, min_gpu_freq;
 
-	if (!HAS_LLC(dev_priv)) {
-		seq_puts(m, "unsupported on this chipset\n");
-		return 0;
-	}
+	if (!HAS_LLC(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
 
@@ -2287,7 +2281,7 @@ static int i915_huc_load_status_info(struct seq_file *m, void *data)
  	struct drm_printer p;
 
  	if (!HAS_HUC_UCODE(dev_priv))
-		return 0;
+		return -ENODEV;
 
  	p = drm_seq_file_printer(m);
  	intel_uc_fw_dump(&dev_priv->huc.fw, &p);
@@ -2305,8 +2299,8 @@ static int i915_guc_load_status_info(struct seq_file *m, void *data)
  	struct drm_printer p;
  	u32 tmp, i;
 
-	if (!HAS_GUC_UCODE(dev_priv))
-		return 0;
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
 
  	p = drm_seq_file_printer(m);
  	intel_uc_fw_dump(&dev_priv->guc.fw, &p);
@@ -2400,6 +2394,9 @@ static int i915_guc_info(struct seq_file *m, void *data)
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
  	const struct intel_guc *guc = &dev_priv->guc;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
  	if (!check_guc_submission(m))
  		return 0;
 
@@ -2428,6 +2425,9 @@ static int i915_guc_stage_pool(struct seq_file *m, void *data)
  	unsigned int tmp;
  	int index;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
  	if (!check_guc_submission(m))
  		return 0;
 
@@ -2482,6 +2482,9 @@ static int i915_guc_log_dump(struct seq_file *m, void *data)
  	u32 *log;
  	int i = 0;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
  	if (dump_load_err)
  		obj = dev_priv->guc.load_err_log;
  	else if (dev_priv->guc.log.vma)
@@ -2576,10 +2579,8 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
  	enum pipe pipe;
  	bool enabled = false;
 
-	if (!HAS_PSR(dev_priv)) {
-		seq_puts(m, "PSR not supported\n");
-		return 0;
-	}
+	if (!HAS_PSR(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
 
@@ -2818,10 +2819,8 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
  	struct intel_csr *csr;
 
-	if (!HAS_CSR(dev_priv)) {
-		seq_puts(m, "not supported\n");
-		return 0;
-	}
+	if (!HAS_CSR(dev_priv))
+		return -ENODEV;
 
  	csr = &dev_priv->csr;
 

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 3362

Quoted 8 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
@@ -3357,7 +3356,7 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
  	int plane;
 
  	if (INTEL_GEN(dev_priv) < 9)
-		return 0;
+		return -ENODEV;
 
  	drm_modeset_lock_all(dev);
 

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Michal Wajdeczko
Quoted 77 lines · Michal Wajdeczko

Instead of trying different seq_puts messages, lets use common -ENODEV error code to indicate missing/unsupported feature.

Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
---
  drivers/gpu/drm/i915/i915_debugfs.c | 47 ++++++++++++++++++-------------------
  1 file changed, 23 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +9 -15
index 2829447..5023acd 100644
@@ -1635,10 +1635,8 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
  {
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 
-	if (!HAS_FBC(dev_priv)) {
-		seq_puts(m, "FBC unsupported on this chipset\n");
-		return 0;
-	}
+	if (!HAS_FBC(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
  	mutex_lock(&dev_priv->fbc.lock);
@@ -1714,10 +1712,8 @@ static int i915_ips_status(struct seq_file *m, void *unused)
  {
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 
-	if (!HAS_IPS(dev_priv)) {
-		seq_puts(m, "not supported\n");
-		return 0;
-	}
+	if (!HAS_IPS(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
 
@@ -1803,10 +1799,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
  	int gpu_freq, ia_freq;
  	unsigned int max_gpu_freq, min_gpu_freq;
 
-	if (!HAS_LLC(dev_priv)) {
-		seq_puts(m, "unsupported on this chipset\n");
-		return 0;
-	}
+	if (!HAS_LLC(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
 
@@ -2287,7 +2281,7 @@ static int i915_huc_load_status_info(struct seq_file *m, void *data)
  	struct drm_printer p;
 
  	if (!HAS_HUC_UCODE(dev_priv))
-		return 0;
+		return -ENODEV;
 
  	p = drm_seq_file_printer(m);
  	intel_uc_fw_dump(&dev_priv->huc.fw, &p);
@@ -2305,8 +2299,8 @@ static int i915_guc_load_status_info(struct seq_file *m, void *data)
  	struct drm_printer p;
  	u32 tmp, i;
 
-	if (!HAS_GUC_UCODE(dev_priv))
-		return 0;
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
 
  	p = drm_seq_file_printer(m);
  	intel_uc_fw_dump(&dev_priv->guc.fw, &p);

drivers/gpu/drm/i915/i915_debugfs.c static int i915_guc_info(struct seq_file *m, void *data) · line 2400

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +3 -0
@@ -2400,6 +2394,9 @@ static int i915_guc_info(struct seq_file *m, void *data)
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
  	const struct intel_guc *guc = &dev_priv->guc;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
  	if (!check_guc_submission(m))

Should this function check_guc_submission be updated in this patch with proper message now? Should we add HAS_GUC check to i915_guc_log_control_get as well?

Quoted 49 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -8
  		return 0;
 
@@ -2428,6 +2425,9 @@ static int i915_guc_stage_pool(struct seq_file *m, void *data)
  	unsigned int tmp;
  	int index;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
  	if (!check_guc_submission(m))
  		return 0;
 
@@ -2482,6 +2482,9 @@ static int i915_guc_log_dump(struct seq_file *m, void *data)
  	u32 *log;
  	int i = 0;
 
+	if (!HAS_GUC(dev_priv))
+		return -ENODEV;
+
  	if (dump_load_err)
  		obj = dev_priv->guc.load_err_log;
  	else if (dev_priv->guc.log.vma)
@@ -2576,10 +2579,8 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
  	enum pipe pipe;
  	bool enabled = false;
 
-	if (!HAS_PSR(dev_priv)) {
-		seq_puts(m, "PSR not supported\n");
-		return 0;
-	}
+	if (!HAS_PSR(dev_priv))
+		return -ENODEV;
 
  	intel_runtime_pm_get(dev_priv);
 
@@ -2818,10 +2819,8 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
  	struct intel_csr *csr;
 
-	if (!HAS_CSR(dev_priv)) {
-		seq_puts(m, "not supported\n");
-		return 0;
-	}
+	if (!HAS_CSR(dev_priv))
+		return -ENODEV;
 
  	csr = &dev_priv->csr;
 

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 3362

Quoted 8 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
@@ -3357,7 +3356,7 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
  	int plane;
 
  	if (INTEL_GEN(dev_priv) < 9)
-		return 0;
+		return -ENODEV;
 
  	drm_modeset_lock_all(dev);
 

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx