Skip to contentSkip to conversation

drm/{i915, xe}: Refactor generic_handle_irq_safe() error messages

PATCH Superseded Jonathan Cavitt 2 participants 3 messages Jun 4

Subsystems (4)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/{i915, xe}: Refactor generic_handle_irq_safe() error messages

Currently, all but one uses of generic_handle_irq_safe() report error messages using .*_err_ratelimited() error reporting helper functions. These helper functions declare their error messages in the following form:

"error handling [COMPONENT NAME] irq: %d\n"

.*_err_ratelimited() already logs "error" as a part of the error message, so declaring the error is redundant. Reword it.

The last usage of generic_handle_irq_safe() is in xe_i2c_irq_handler(), and it currently lacks the same error reporting that the other cases have. This is not intentional, so add error reporting to this location.

---
 drivers/gpu/drm/i915/display/intel_lpe_audio.c | 2 +-
 drivers/gpu/drm/i915/gt/intel_gsc.c            | 2 +-
 drivers/gpu/drm/xe/xe_heci_gsc.c               | 4 ++--
 drivers/gpu/drm/xe/xe_i2c.c                    | 5 ++++-
 4 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_lpe_audio.c +1 -1
index 022ad18044bf..e756ed1d1132 100644
@@ -265,7 +265,7 @@ void intel_lpe_audio_irq_handler(struct intel_display *display)
 	ret = generic_handle_irq_safe(display->audio.lpe.irq);
 	if (ret)
 		drm_err_ratelimited(display->drm,
-				    "error handling LPE audio irq: %d\n", ret);
+				    "failed to handle LPE audio irq: %d\n", ret);
 }
 
 /**
drivers/gpu/drm/i915/gt/intel_gsc.c +1 -1
index 050d909fb4f8..c2d76b0bc5fe 100644
@@ -286,7 +286,7 @@ static void gsc_irq_handler(struct intel_gt *gt, unsigned int intf_id)
 
 	ret = generic_handle_irq_safe(gt->gsc.intf[intf_id].irq);
 	if (ret)
-		gt_err_ratelimited(gt, "error handling GSC irq: %d\n", ret);
+		gt_err_ratelimited(gt, "failed to handle GSC irq: %d\n", ret);
 }
 
 void intel_gsc_irq_handler(struct intel_gt *gt, u32 iir)
drivers/gpu/drm/xe/xe_heci_gsc.c +2 -2
index 5af8903e10af..640db27137de 100644
@@ -224,7 +224,7 @@ void xe_heci_gsc_irq_handler(struct xe_device *xe, u32 iir)
 
 	ret = generic_handle_irq_safe(xe->heci_gsc.irq);
 	if (ret)
-		drm_err_ratelimited(&xe->drm, "error handling GSC irq: %d\n", ret);
+		drm_err_ratelimited(&xe->drm, "failed to handle GSC irq: %d\n", ret);
 }
 
 void xe_heci_csc_irq_handler(struct xe_device *xe, u32 iir)
@@ -244,5 +244,5 @@ void xe_heci_csc_irq_handler(struct xe_device *xe, u32 iir)
 
 	ret = generic_handle_irq_safe(xe->heci_gsc.irq);
 	if (ret)
-		drm_err_ratelimited(&xe->drm, "error handling GSC irq: %d\n", ret);
+		drm_err_ratelimited(&xe->drm, "failed to handle GSC irq: %d\n", ret);
 }
drivers/gpu/drm/xe/xe_i2c.c +4 -1
index 706783863d07..0f689e210e26 100644
@@ -177,12 +177,15 @@ static bool xe_i2c_irq_present(struct xe_device *xe)
 void xe_i2c_irq_handler(struct xe_device *xe, u32 master_ctl)
 {
 	struct xe_mmio *mmio = xe_root_tile_mmio(xe);
+	int ret;
 
 	if (!(master_ctl & I2C_IRQ) || !xe_i2c_irq_present(xe))
 		return;
 
 	/* Forward interrupt to I2C adapter */
-	generic_handle_irq_safe(xe->i2c->adapter_irq);
+	ret = generic_handle_irq_safe(xe->i2c->adapter_irq);
+	if (ret)
+		drm_err_ratelimited("failed to handle i2c irq: %d\n", ret);
 
 	/* Deassert after I2C adapter clears the interrupt */
 	xe_mmio_rmw32(mmio, I2C_CONFIG_CMD, 0, PCI_COMMAND_INTX_DISABLE);
Signature · 1 line
2.53.0
#1 lore raw

I forgot to forward this to [email protected], so I'm doing that now. -Jonathan Cavitt

-----Original Message-----
From: Cavitt, Jonathan <[email protected]>
Sent: Thursday, June 4, 2026 1:10 PM
To: [email protected]
Cc: Gupta, Saurabhg <[email protected]>; Zuo, Alex <[email protected]>; Cavitt, Jonathan <[email protected]>; Jadav, Raag <[email protected]>
Subject: [PATCH] drm/{i915, xe}: Refactor generic_handle_irq_safe() error messages

Quoted 95 lines

Currently, all but one uses of generic_handle_irq_safe() report error messages using .*_err_ratelimited() error reporting helper functions. These helper functions declare their error messages in the following form:

"error handling [COMPONENT NAME] irq: %d\n"

.*_err_ratelimited() already logs "error" as a part of the error message, so declaring the error is redundant. Reword it.

The last usage of generic_handle_irq_safe() is in xe_i2c_irq_handler(), and it currently lacks the same error reporting that the other cases have. This is not intentional, so add error reporting to this location.

---
 drivers/gpu/drm/i915/display/intel_lpe_audio.c | 2 +-
 drivers/gpu/drm/i915/gt/intel_gsc.c            | 2 +-
 drivers/gpu/drm/xe/xe_heci_gsc.c               | 4 ++--
 drivers/gpu/drm/xe/xe_i2c.c                    | 5 ++++-
 4 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_lpe_audio.c +1 -1
index 022ad18044bf..e756ed1d1132 100644
@@ -265,7 +265,7 @@ void intel_lpe_audio_irq_handler(struct intel_display *display)
 	ret = generic_handle_irq_safe(display->audio.lpe.irq);
 	if (ret)
 		drm_err_ratelimited(display->drm,
-				    "error handling LPE audio irq: %d\n", ret);
+				    "failed to handle LPE audio irq: %d\n", ret);
 }
 
 /**
drivers/gpu/drm/i915/gt/intel_gsc.c +1 -1
index 050d909fb4f8..c2d76b0bc5fe 100644
@@ -286,7 +286,7 @@ static void gsc_irq_handler(struct intel_gt *gt, unsigned int intf_id)
 
 	ret = generic_handle_irq_safe(gt->gsc.intf[intf_id].irq);
 	if (ret)
-		gt_err_ratelimited(gt, "error handling GSC irq: %d\n", ret);
+		gt_err_ratelimited(gt, "failed to handle GSC irq: %d\n", ret);
 }
 
 void intel_gsc_irq_handler(struct intel_gt *gt, u32 iir)
drivers/gpu/drm/xe/xe_heci_gsc.c +2 -2
index 5af8903e10af..640db27137de 100644
@@ -224,7 +224,7 @@ void xe_heci_gsc_irq_handler(struct xe_device *xe, u32 iir)
 
 	ret = generic_handle_irq_safe(xe->heci_gsc.irq);
 	if (ret)
-		drm_err_ratelimited(&xe->drm, "error handling GSC irq: %d\n", ret);
+		drm_err_ratelimited(&xe->drm, "failed to handle GSC irq: %d\n", ret);
 }
 
 void xe_heci_csc_irq_handler(struct xe_device *xe, u32 iir)
@@ -244,5 +244,5 @@ void xe_heci_csc_irq_handler(struct xe_device *xe, u32 iir)
 
 	ret = generic_handle_irq_safe(xe->heci_gsc.irq);
 	if (ret)
-		drm_err_ratelimited(&xe->drm, "error handling GSC irq: %d\n", ret);
+		drm_err_ratelimited(&xe->drm, "failed to handle GSC irq: %d\n", ret);
 }
drivers/gpu/drm/xe/xe_i2c.c +4 -1
index 706783863d07..0f689e210e26 100644
@@ -177,12 +177,15 @@ static bool xe_i2c_irq_present(struct xe_device *xe)
 void xe_i2c_irq_handler(struct xe_device *xe, u32 master_ctl)
 {
 	struct xe_mmio *mmio = xe_root_tile_mmio(xe);
+	int ret;
 
 	if (!(master_ctl & I2C_IRQ) || !xe_i2c_irq_present(xe))
 		return;
 
 	/* Forward interrupt to I2C adapter */
-	generic_handle_irq_safe(xe->i2c->adapter_irq);
+	ret = generic_handle_irq_safe(xe->i2c->adapter_irq);
+	if (ret)
+		drm_err_ratelimited("failed to handle i2c irq: %d\n", ret);
 
 	/* Deassert after I2C adapter clears the interrupt */
 	xe_mmio_rmw32(mmio, I2C_CONFIG_CMD, 0, PCI_COMMAND_INTX_DISABLE);
Signature · 1 line
2.53.0
#2 lore raw

✗ CI.KUnit: failure for drm/{i915, xe}: Refactor generic_handle_irq_safe() error messages

In reply to Jonathan Cavitt
== Series Details ==

== Series Details ==

Series: drm/{i915, xe}: Refactor generic_handle_irq_safe() error messages
URL : https://patchwork.freedesktop.org/series/167909/
State : failure

== Summary ==

+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig ERROR:root:In file included from ../include/linux/device.h:15,

                 from ../include/drm/drm_print.h:31,
                 from ../drivers/gpu/drm/xe/xe_i2c.c:8:
../drivers/gpu/drm/xe/xe_i2c.c: In function ‘xe_i2c_irq_handler’:
../include/drm/drm_print.h:645:22: error: passing argument 1 of ‘__drm_to_dev’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  645 |         __drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
      |                      ^~~~~
      |                      |
      |                      char *

../include/linux/dev_printk.h:110:25: note: in definition of macro ‘dev_printk_index_wrap’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
../include/linux/dev_printk.h:215:17: note: in expansion of macro ‘dev_err’

  215 |                 dev_level(dev, fmt, ##__VA_ARGS__);                     \
      |                 ^~~~~~~~~
../include/linux/dev_printk.h:225:9: note: in expansion of macro ‘dev_level_ratelimited’
  225 |         dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
      |         ^~~~~~~~~~~~~~~~~~~~~
../include/drm/drm_print.h:615:9: note: in expansion of macro ‘dev_err_ratelimited’
  615 |         dev_##level##type(__drm_to_dev(drm), "[drm] " fmt, ##__VA_ARGS__)
      |         ^~~~
../include/drm/drm_print.h:645:9: note: in expansion of macro ‘__drm_printk’
  645 |         __drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
      |         ^~~~~~~~~~~~
../drivers/gpu/drm/xe/xe_i2c.c:188:17: note: in expansion of macro ‘drm_err_ratelimited’
  188 |                 drm_err_ratelimited("failed to handle i2c irq: %d\n", ret);
      |                 ^~~~~~~~~~~~~~~~~~~
../include/drm/drm_print.h:608:68: note: expected ‘const struct drm_device *’ but argument is of type ‘char *’
  608 | static inline struct device *__drm_to_dev(const struct drm_device *drm)
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~

../drivers/gpu/drm/xe/xe_i2c.c:188:71: error: expected ‘)’ before ‘ret’
188 | drm_err_ratelimited("failed to handle i2c irq: %d\n", ret);
| ^~~
../include/linux/dev_printk.h:110:30: note: in definition of macro ‘dev_printk_index_wrap’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
../include/linux/dev_printk.h:154:56: note: in expansion of macro ‘dev_fmt’
154 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
../include/linux/dev_printk.h:215:17: note: in expansion of macro ‘dev_err’

  215 |                 dev_level(dev, fmt, ##__VA_ARGS__);                     \
      |                 ^~~~~~~~~
../include/linux/dev_printk.h:225:9: note: in expansion of macro ‘dev_level_ratelimited’
  225 |         dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
      |         ^~~~~~~~~~~~~~~~~~~~~
../include/drm/drm_print.h:615:9: note: in expansion of macro ‘dev_err_ratelimited’
  615 |         dev_##level##type(__drm_to_dev(drm), "[drm] " fmt, ##__VA_ARGS__)
      |         ^~~~
../include/drm/drm_print.h:645:9: note: in expansion of macro ‘__drm_printk’
  645 |         __drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
      |         ^~~~~~~~~~~~
../drivers/gpu/drm/xe/xe_i2c.c:188:17: note: in expansion of macro ‘drm_err_ratelimited’
  188 |                 drm_err_ratelimited("failed to handle i2c irq: %d\n", ret);
      |                 ^~~~~~~~~~~~~~~~~~~

../include/linux/dev_printk.h:110:24: note: to match this ‘(’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^
../include/linux/dev_printk.h:154:9: note: in expansion of macro ‘dev_printk_index_wrap’

  154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
      |         ^~~~~~~~~~~~~~~~~~~~~
../include/linux/dev_printk.h:215:17: note: in expansion of macro ‘dev_err’
  215 |                 dev_level(dev, fmt, ##__VA_ARGS__);                     \
      |                 ^~~~~~~~~
../include/linux/dev_printk.h:225:9: note: in expansion of macro ‘dev_level_ratelimited’
  225 |         dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
      |         ^~~~~~~~~~~~~~~~~~~~~
../include/drm/drm_print.h:615:9: note: in expansion of macro ‘dev_err_ratelimited’
  615 |         dev_##level##type(__drm_to_dev(drm), "[drm] " fmt, ##__VA_ARGS__)
      |         ^~~~
../include/drm/drm_print.h:645:9: note: in expansion of macro ‘__drm_printk’
  645 |         __drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
      |         ^~~~~~~~~~~~
../drivers/gpu/drm/xe/xe_i2c.c:188:17: note: in expansion of macro ‘drm_err_ratelimited’
  188 |                 drm_err_ratelimited("failed to handle i2c irq: %d\n", ret);
      |                 ^~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:289: drivers/gpu/drm/xe/xe_i2c.o] Error 1 make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:548: drivers/gpu/drm/xe] Error 2 make[5]: *** [../scripts/Makefile.build:548: drivers/gpu/drm] Error 2 make[4]: *** [../scripts/Makefile.build:548: drivers/gpu] Error 2 make[3]: *** [../scripts/Makefile.build:548: drivers] Error 2 make[2]: *** [/kernel/Makefile:2143: .] Error 2
make[1]: *** [/kernel/Makefile:248: __sub-make] Error 2
make: *** [Makefile:248: __sub-make] Error 2

[20:15:58] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[20:16:02] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel