[Intel-xe] [PATCH 2/5] drm/xe: Introduce SR-IOV logging macros

Lucas De Marchi lucas.demarchi at intel.com
Thu Dec 7 14:17:23 UTC 2023


On Tue, Nov 28, 2023 at 04:15:04PM +0100, Michal Wajdeczko wrote:
>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.
>
>Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>


Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>

Lucas De Marchi


>---
> drivers/gpu/drm/xe/xe_sriov_printk.h | 46 ++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
> create mode 100644 drivers/gpu/drm/xe/xe_sriov_printk.h
>
>diff --git a/drivers/gpu/drm/xe/xe_sriov_printk.h b/drivers/gpu/drm/xe/xe_sriov_printk.h
>new file mode 100644
>index 000000000000..117e1d541692
>--- /dev/null
>+++ b/drivers/gpu/drm/xe/xe_sriov_printk.h
>@@ -0,0 +1,46 @@
>+/* SPDX-License-Identifier: MIT */
>+/*
>+ * Copyright © 2023 Intel Corporation
>+ */
>+
>+#ifndef _XE_SRIOV_PRINTK_H_
>+#define _XE_SRIOV_PRINTK_H_
>+
>+#include <drm/drm_print.h>
>+
>+#include "xe_device_types.h"
>+#include "xe_sriov_types.h"
>+
>+#define xe_sriov_printk_prefix(xe) \
>+	((xe)->sriov.__mode == XE_SRIOV_MODE_PF ? "PF: " : \
>+	 (xe)->sriov.__mode == XE_SRIOV_MODE_VF ? "VF: " : "")
>+
>+#define xe_sriov_printk(xe, _level, fmt, ...) \
>+	drm_##_level(&(xe)->drm, "%s" fmt, xe_sriov_printk_prefix(xe), ##__VA_ARGS__)
>+
>+#define xe_sriov_err(xe, fmt, ...) \
>+	xe_sriov_printk((xe), err, fmt, ##__VA_ARGS__)
>+
>+#define xe_sriov_err_ratelimited(xe, fmt, ...) \
>+	xe_sriov_printk((xe), err_ratelimited, fmt, ##__VA_ARGS__)
>+
>+#define xe_sriov_warn(xe, fmt, ...) \
>+	xe_sriov_printk((xe), warn, fmt, ##__VA_ARGS__)
>+
>+#define xe_sriov_notice(xe, fmt, ...) \
>+	xe_sriov_printk((xe), notice, fmt, ##__VA_ARGS__)
>+
>+#define xe_sriov_info(xe, fmt, ...) \
>+	xe_sriov_printk((xe), info, fmt, ##__VA_ARGS__)
>+
>+#define xe_sriov_dbg(xe, fmt, ...) \
>+	xe_sriov_printk((xe), dbg, fmt, ##__VA_ARGS__)
>+
>+/* for low level noisy debug messages */
>+#ifdef CONFIG_DRM_XE_DEBUG_SRIOV
>+#define xe_sriov_dbg_verbose(xe, fmt, ...) xe_sriov_dbg(xe, fmt, ##__VA_ARGS__)
>+#else
>+#define xe_sriov_dbg_verbose(xe, fmt, ...) typecheck(struct xe_device *, (xe))
>+#endif
>+
>+#endif
>-- 
>2.25.1
>


More information about the Intel-xe mailing list