[PATCH v5 14/33] drm/xe/ras: Check RAS and LOG component definitions
Michal Wajdeczko <[email protected]>
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
While not strictly required, we want to make sure that components definitions used by the RAS firmware are in the same fixed relation with HW components definitions used by the LOG infrastructure to allow code simplification. Add static asserts to enforce that. Signed-off-by: Michal Wajdeczko <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Aravind Iddamsetty <[email protected]> Reviewed-by: Mallesh Koujalagi <[email protected]> --- v2: rebased after comp tag renames (Michal) --- drivers/gpu/drm/xe/xe_ras.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c index 004599c35aee..d25d25f77531 100644 --- a/drivers/gpu/drm/xe/xe_ras.c +++ b/drivers/gpu/drm/xe/xe_ras.c @@ -6,6 +6,7 @@ #include "xe_debugfs.h" #include "xe_device.h" #include "xe_drm_ras.h" +#include "xe_log.h" #include "xe_pm.h" #include "xe_printk.h" #include "xe_ras.h" @@ -46,6 +47,16 @@ enum xe_ras_component { XE_RAS_COMP_MAX }; +#define CHECK_COMPONENT(RAS_COMP, LOG_COMP) \ + static_assert(MAKE_XE_LOG_COMPONENT(HARDWARE, (RAS_COMP)) == (LOG_COMP)) + /* make sure components definitions maintain stable relation */ + CHECK_COMPONENT(XE_RAS_COMP_DEVICE_MEMORY, XE_LOG_COMPONENT_DEVICE_MEMORY); + CHECK_COMPONENT(XE_RAS_COMP_CORE_COMPUTE, XE_LOG_COMPONENT_CORE_COMPUTE); + CHECK_COMPONENT(XE_RAS_COMP_PCIE, XE_LOG_COMPONENT_PCIE); + CHECK_COMPONENT(XE_RAS_COMP_FABRIC, XE_LOG_COMPONENT_FABRIC); + CHECK_COMPONENT(XE_RAS_COMP_SOC_INTERNAL, XE_LOG_COMPONENT_SOC_INTERNAL); +#undef CHECK_COMPONENT + /* RAS response status codes */ enum xe_ras_response_status { XE_RAS_STATUS_SUCCESS = 0, -- 2.47.1