diff mbox series

[1/8] drm/i915/guc: Add GuC oriented print macros

Message ID 20230120164050.1765-2-michal.wajdeczko@intel.com (mailing list archive)
State New, archived
Headers show
Series GuC oriented print macros | expand

Commit Message

Michal Wajdeczko Jan. 20, 2023, 4:40 p.m. UTC
While we do have GT oriented print macros, add few more GuC
specific to have common look and feel across all messages
related to the GuC and to avoid chasing the gt pointer.

We will use these macros shortly in upcoming patches.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_print.h | 48 ++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_print.h

Comments

John Harrison Jan. 23, 2023, 11:27 p.m. UTC | #1
On 1/20/2023 08:40, Michal Wajdeczko wrote:
> While we do have GT oriented print macros, add few more GuC
> specific to have common look and feel across all messages
> related to the GuC and to avoid chasing the gt pointer.
>
> We will use these macros shortly in upcoming patches.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> ---
>   drivers/gpu/drm/i915/gt/uc/intel_guc_print.h | 48 ++++++++++++++++++++
>   1 file changed, 48 insertions(+)
>   create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h b/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
> new file mode 100644
> index 000000000000..e75989d4ba06
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
> @@ -0,0 +1,48 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023 Intel Corporation
> + */
> +
> +#ifndef __INTEL_GUC_PRINT__
> +#define __INTEL_GUC_PRINT__
> +
> +#include "gt/intel_gt.h"
This necessary only for the guc_to_gt() accessor? Hmm. Maybe it is worth 
moving that to intel_guc.h? I know Jani for one would like to see all of 
that cleaned up. But maybe that's a follow up patch.

John.

> +#include "gt/intel_gt_print.h"
> +
> +#define guc_printk(_guc, _level, _fmt, ...) \
> +	gt_##_level(guc_to_gt(_guc), "GUC: " _fmt, ##__VA_ARGS__)
> +
> +#define guc_err(_guc, _fmt, ...) \
> +	guc_printk((_guc), err, _fmt, ##__VA_ARGS__)
> +
> +#define guc_warn(_guc, _fmt, ...) \
> +	guc_printk((_guc), warn, _fmt, ##__VA_ARGS__)
> +
> +#define guc_notice(_guc, _fmt, ...) \
> +	guc_printk((_guc), notice, _fmt, ##__VA_ARGS__)
> +
> +#define guc_info(_guc, _fmt, ...) \
> +	guc_printk((_guc), info, _fmt, ##__VA_ARGS__)
> +
> +#define guc_dbg(_guc, _fmt, ...) \
> +	guc_printk((_guc), dbg, _fmt, ##__VA_ARGS__)
> +
> +#define guc_err_ratelimited(_guc, _fmt, ...) \
> +	guc_printk((_guc), err_ratelimited, _fmt, ##__VA_ARGS__)
> +
> +#define guc_probe_error(_guc, _fmt, ...) \
> +	guc_printk((_guc), probe_error, _fmt, ##__VA_ARGS__)
> +
> +#define guc_WARN(_guc, _cond, _fmt, ...) \
> +	gt_WARN(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__)
> +
> +#define guc_WARN_ONCE(_guc, _cond, _fmt, ...) \
> +	gt_WARN_ONCE(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__)
> +
> +#define guc_WARN_ON(_guc, _cond) \
> +	gt_WARN(guc_to_gt(_guc), _cond, "%s(%s)", "guc_WARN_ON", __stringify(_cond))
> +
> +#define guc_WARN_ON_ONCE(_guc, _cond) \
> +	gt_WARN_ONCE(guc_to_gt(_guc), _cond, "%s(%s)", "guc_WARN_ON_ONCE", __stringify(_cond))
> +
> +#endif /* __INTEL_GUC_PRINT__ */
Michal Wajdeczko Jan. 24, 2023, 10:59 a.m. UTC | #2
On 24.01.2023 00:27, John Harrison wrote:
> On 1/20/2023 08:40, Michal Wajdeczko wrote:
>> While we do have GT oriented print macros, add few more GuC
>> specific to have common look and feel across all messages
>> related to the GuC and to avoid chasing the gt pointer.
>>
>> We will use these macros shortly in upcoming patches.
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Cc: John Harrison <John.C.Harrison@Intel.com>
>> ---
>>   drivers/gpu/drm/i915/gt/uc/intel_guc_print.h | 48 ++++++++++++++++++++
>>   1 file changed, 48 insertions(+)
>>   create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
>>
>> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
>> b/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
>> new file mode 100644
>> index 000000000000..e75989d4ba06
>> --- /dev/null
>> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
>> @@ -0,0 +1,48 @@
>> +/* SPDX-License-Identifier: MIT */
>> +/*
>> + * Copyright © 2023 Intel Corporation
>> + */
>> +
>> +#ifndef __INTEL_GUC_PRINT__
>> +#define __INTEL_GUC_PRINT__
>> +
>> +#include "gt/intel_gt.h"
> This necessary only for the guc_to_gt() accessor? Hmm. Maybe it is worth
> moving that to intel_guc.h? I know Jani for one would like to see all of
> that cleaned up. But maybe that's a follow up patch.

we can't move it easily without creating new intel_guc_types.h file for
all struct definitions, so definitely separate follow up series would be
needed

Michal

> 
> John.
> 
>> +#include "gt/intel_gt_print.h"
>> +
>> +#define guc_printk(_guc, _level, _fmt, ...) \
>> +    gt_##_level(guc_to_gt(_guc), "GUC: " _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_err(_guc, _fmt, ...) \
>> +    guc_printk((_guc), err, _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_warn(_guc, _fmt, ...) \
>> +    guc_printk((_guc), warn, _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_notice(_guc, _fmt, ...) \
>> +    guc_printk((_guc), notice, _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_info(_guc, _fmt, ...) \
>> +    guc_printk((_guc), info, _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_dbg(_guc, _fmt, ...) \
>> +    guc_printk((_guc), dbg, _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_err_ratelimited(_guc, _fmt, ...) \
>> +    guc_printk((_guc), err_ratelimited, _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_probe_error(_guc, _fmt, ...) \
>> +    guc_printk((_guc), probe_error, _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_WARN(_guc, _cond, _fmt, ...) \
>> +    gt_WARN(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_WARN_ONCE(_guc, _cond, _fmt, ...) \
>> +    gt_WARN_ONCE(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__)
>> +
>> +#define guc_WARN_ON(_guc, _cond) \
>> +    gt_WARN(guc_to_gt(_guc), _cond, "%s(%s)", "guc_WARN_ON",
>> __stringify(_cond))
>> +
>> +#define guc_WARN_ON_ONCE(_guc, _cond) \
>> +    gt_WARN_ONCE(guc_to_gt(_guc), _cond, "%s(%s)",
>> "guc_WARN_ON_ONCE", __stringify(_cond))
>> +
>> +#endif /* __INTEL_GUC_PRINT__ */
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h b/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
new file mode 100644
index 000000000000..e75989d4ba06
--- /dev/null
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
@@ -0,0 +1,48 @@ 
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef __INTEL_GUC_PRINT__
+#define __INTEL_GUC_PRINT__
+
+#include "gt/intel_gt.h"
+#include "gt/intel_gt_print.h"
+
+#define guc_printk(_guc, _level, _fmt, ...) \
+	gt_##_level(guc_to_gt(_guc), "GUC: " _fmt, ##__VA_ARGS__)
+
+#define guc_err(_guc, _fmt, ...) \
+	guc_printk((_guc), err, _fmt, ##__VA_ARGS__)
+
+#define guc_warn(_guc, _fmt, ...) \
+	guc_printk((_guc), warn, _fmt, ##__VA_ARGS__)
+
+#define guc_notice(_guc, _fmt, ...) \
+	guc_printk((_guc), notice, _fmt, ##__VA_ARGS__)
+
+#define guc_info(_guc, _fmt, ...) \
+	guc_printk((_guc), info, _fmt, ##__VA_ARGS__)
+
+#define guc_dbg(_guc, _fmt, ...) \
+	guc_printk((_guc), dbg, _fmt, ##__VA_ARGS__)
+
+#define guc_err_ratelimited(_guc, _fmt, ...) \
+	guc_printk((_guc), err_ratelimited, _fmt, ##__VA_ARGS__)
+
+#define guc_probe_error(_guc, _fmt, ...) \
+	guc_printk((_guc), probe_error, _fmt, ##__VA_ARGS__)
+
+#define guc_WARN(_guc, _cond, _fmt, ...) \
+	gt_WARN(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__)
+
+#define guc_WARN_ONCE(_guc, _cond, _fmt, ...) \
+	gt_WARN_ONCE(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__)
+
+#define guc_WARN_ON(_guc, _cond) \
+	gt_WARN(guc_to_gt(_guc), _cond, "%s(%s)", "guc_WARN_ON", __stringify(_cond))
+
+#define guc_WARN_ON_ONCE(_guc, _cond) \
+	gt_WARN_ONCE(guc_to_gt(_guc), _cond, "%s(%s)", "guc_WARN_ON_ONCE", __stringify(_cond))
+
+#endif /* __INTEL_GUC_PRINT__ */