Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/guc: Add more KLV helper macros

In upcoming patches we will want to generate some of the KLV keys
from other macros. Add MAKE_GUC_KLV_{KEY|LEN} macros for that and
make sure they will correctly expand provided TAG parameter. Also
fix PREP_GUC_KLV_TAG to also work correctly within other macros.

Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240514190015.2172-2-michal.wajdeczko@intel.com

+14 -1
+14 -1
drivers/gpu/drm/xe/xe_guc_klv_helpers.h
··· 6 6 #ifndef _XE_GUC_KLV_HELPERS_H_ 7 7 #define _XE_GUC_KLV_HELPERS_H_ 8 8 9 + #include <linux/args.h> 9 10 #include <linux/types.h> 10 11 11 12 struct drm_printer; ··· 39 38 FIELD_PREP_CONST(GUC_KLV_0_LEN, (len))) 40 39 41 40 /** 41 + * MAKE_GUC_KLV_KEY - Prepare KLV KEY name based on unique KLV definition tag. 42 + * @TAG: unique tag of the KLV definition 43 + */ 44 + #define MAKE_GUC_KLV_KEY(TAG) CONCATENATE(CONCATENATE(GUC_KLV_, TAG), _KEY) 45 + 46 + /** 47 + * MAKE_GUC_KLV_LEN - Prepare KLV LEN name based on unique KLV definition tag. 48 + * @TAG: unique tag of the KLV definition 49 + */ 50 + #define MAKE_GUC_KLV_LEN(TAG) CONCATENATE(CONCATENATE(GUC_KLV_, TAG), _LEN) 51 + 52 + /** 42 53 * PREP_GUC_KLV_TAG - Prepare KLV header value based on unique KLV definition tag. 43 54 * @TAG: unique tag of the KLV definition 44 55 * ··· 59 46 * Return: value of the KLV header (u32). 60 47 */ 61 48 #define PREP_GUC_KLV_TAG(TAG) \ 62 - PREP_GUC_KLV_CONST(GUC_KLV_##TAG##_KEY, GUC_KLV_##TAG##_LEN) 49 + PREP_GUC_KLV_CONST(MAKE_GUC_KLV_KEY(TAG), MAKE_GUC_KLV_LEN(TAG)) 63 50 64 51 #endif