drm/xe/pcode: Rework error mapping
authorLucas De Marchi <lucas.demarchi@intel.com>
Mon, 10 Nov 2025 16:41:08 +0000 (08:41 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 12 Nov 2025 16:57:27 +0000 (08:57 -0800)
commit459a0ce8dcb19edbd270d26b07fc9d72bfeece36
tree744360bd21d6e0ce5e0ab63ff0e7f98c9ba47a46
parent53361aa64f2137e31a10813ccbd00d99f4dac130
drm/xe/pcode: Rework error mapping

The sparse array used for error decoding from is unnecessarily big. It
should be better handled by a switch statement that will also allow us
to more easily improve this code.

Add a CASE_ERR() macro to keep the table compact and use it instead of
the 256-entries array, which saves some space:

$ bloat-o-meter xe_pcode.o.old xe_pcode.o
add/remove: 0/1 grow/shrink: 2/0 up/down: 190/-4096 (-3906)
Function                                     old     new   delta
__pcode_mailbox_rw                           363     465    +102
__pcode_mailbox_rw.cold                       58     146     +88
err_decode                                  4096       -   -4096
Total: Before=7890, After=3984, chg -49.51%

Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Link: https://patch.msgid.link/20251110-pcode-errmap-v2-1-cb18c8f54238@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_pcode.c
drivers/gpu/drm/xe/xe_pcode_api.h