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

drm/xe: Introduce SR-IOV logging macros

To simplify logging and help identify SR-IOV specific messages
define set of helper macros that will prefix messages based on
the current SR-IOV mode.

Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20231128151507.1015-3-michal.wajdeczko@intel.com
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Michal Wajdeczko and committed by
Rodrigo Vivi
5bcedc9e ed750833

+46
+46
drivers/gpu/drm/xe/xe_sriov_printk.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* 3 + * Copyright © 2023 Intel Corporation 4 + */ 5 + 6 + #ifndef _XE_SRIOV_PRINTK_H_ 7 + #define _XE_SRIOV_PRINTK_H_ 8 + 9 + #include <drm/drm_print.h> 10 + 11 + #include "xe_device_types.h" 12 + #include "xe_sriov_types.h" 13 + 14 + #define xe_sriov_printk_prefix(xe) \ 15 + ((xe)->sriov.__mode == XE_SRIOV_MODE_PF ? "PF: " : \ 16 + (xe)->sriov.__mode == XE_SRIOV_MODE_VF ? "VF: " : "") 17 + 18 + #define xe_sriov_printk(xe, _level, fmt, ...) \ 19 + drm_##_level(&(xe)->drm, "%s" fmt, xe_sriov_printk_prefix(xe), ##__VA_ARGS__) 20 + 21 + #define xe_sriov_err(xe, fmt, ...) \ 22 + xe_sriov_printk((xe), err, fmt, ##__VA_ARGS__) 23 + 24 + #define xe_sriov_err_ratelimited(xe, fmt, ...) \ 25 + xe_sriov_printk((xe), err_ratelimited, fmt, ##__VA_ARGS__) 26 + 27 + #define xe_sriov_warn(xe, fmt, ...) \ 28 + xe_sriov_printk((xe), warn, fmt, ##__VA_ARGS__) 29 + 30 + #define xe_sriov_notice(xe, fmt, ...) \ 31 + xe_sriov_printk((xe), notice, fmt, ##__VA_ARGS__) 32 + 33 + #define xe_sriov_info(xe, fmt, ...) \ 34 + xe_sriov_printk((xe), info, fmt, ##__VA_ARGS__) 35 + 36 + #define xe_sriov_dbg(xe, fmt, ...) \ 37 + xe_sriov_printk((xe), dbg, fmt, ##__VA_ARGS__) 38 + 39 + /* for low level noisy debug messages */ 40 + #ifdef CONFIG_DRM_XE_DEBUG_SRIOV 41 + #define xe_sriov_dbg_verbose(xe, fmt, ...) xe_sriov_dbg(xe, fmt, ##__VA_ARGS__) 42 + #else 43 + #define xe_sriov_dbg_verbose(xe, fmt, ...) typecheck(struct xe_device *, (xe)) 44 + #endif 45 + 46 + #endif