diff mbox series

[2/8] drm/i915/guc: Update GuC messages in intel_guc.c

Message ID 20230120164050.1765-3-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
Use new macros to have common prefix that also include GT#.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc.c | 31 +++++++++++++-------------
 1 file changed, 15 insertions(+), 16 deletions(-)

Comments

John Harrison Jan. 23, 2023, 10:48 p.m. UTC | #1
On 1/20/2023 08:40, Michal Wajdeczko wrote:
> Use new macros to have common prefix that also include GT#.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> ---
>   drivers/gpu/drm/i915/gt/uc/intel_guc.c | 31 +++++++++++++-------------
>   1 file changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.c b/drivers/gpu/drm/i915/gt/uc/intel_guc.c
> index 1bccc175f9e6..be39e519b5fd 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.c
> @@ -11,6 +11,7 @@
>   #include "intel_guc.h"
>   #include "intel_guc_ads.h"
>   #include "intel_guc_capture.h"
> +#include "intel_guc_print.h"
>   #include "intel_guc_slpc.h"
>   #include "intel_guc_submission.h"
>   #include "i915_drv.h"
> @@ -94,8 +95,8 @@ static void gen9_enable_guc_interrupts(struct intel_guc *guc)
>   	assert_rpm_wakelock_held(&gt->i915->runtime_pm);
>   
>   	spin_lock_irq(gt->irq_lock);
> -	WARN_ON_ONCE(intel_uncore_read(gt->uncore, GEN8_GT_IIR(2)) &
> -		     gt->pm_guc_events);
> +	guc_WARN_ON_ONCE(guc, intel_uncore_read(gt->uncore, GEN8_GT_IIR(2)) &
> +			 gt->pm_guc_events);
>   	gen6_gt_pm_enable_irq(gt, gt->pm_guc_events);
>   	spin_unlock_irq(gt->irq_lock);
>   
> @@ -342,7 +343,7 @@ static void guc_init_params(struct intel_guc *guc)
>   	params[GUC_CTL_DEVID] = guc_ctl_devid(guc);
>   
>   	for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
> -		DRM_DEBUG_DRIVER("param[%2d] = %#x\n", i, params[i]);
> +		guc_dbg(guc, "param[%2d] = %#x\n", i, params[i]);
>   }
>   
>   /*
> @@ -389,7 +390,6 @@ void intel_guc_dump_time_info(struct intel_guc *guc, struct drm_printer *p)
>   
>   int intel_guc_init(struct intel_guc *guc)
>   {
> -	struct intel_gt *gt = guc_to_gt(guc);
>   	int ret;
>   
>   	ret = intel_uc_fw_init(&guc->fw);
> @@ -451,7 +451,7 @@ int intel_guc_init(struct intel_guc *guc)
>   	intel_uc_fw_fini(&guc->fw);
>   out:
>   	intel_uc_fw_change_status(&guc->fw, INTEL_UC_FIRMWARE_INIT_FAIL);
> -	i915_probe_error(gt->i915, "failed with %d\n", ret);
> +	guc_probe_error(guc, "failed with %pe\n", ERR_PTR(ret));
>   	return ret;
>   }
>   
> @@ -480,7 +480,6 @@ void intel_guc_fini(struct intel_guc *guc)
>   int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
>   			u32 *response_buf, u32 response_buf_size)
>   {
> -	struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
>   	struct intel_uncore *uncore = guc_to_gt(guc)->uncore;
>   	u32 header;
>   	int i;
> @@ -515,7 +514,7 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
>   					   10, 10, &header);
>   	if (unlikely(ret)) {
>   timeout:
> -		drm_err(&i915->drm, "mmio request %#x: no reply %x\n",
> +		guc_err(guc, "mmio request %#x: no reply %x\n",
>   			request[0], header);
>   		goto out;
>   	}
> @@ -537,7 +536,7 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
>   	if (FIELD_GET(GUC_HXG_MSG_0_TYPE, header) == GUC_HXG_TYPE_NO_RESPONSE_RETRY) {
>   		u32 reason = FIELD_GET(GUC_HXG_RETRY_MSG_0_REASON, header);
>   
> -		drm_dbg(&i915->drm, "mmio request %#x: retrying, reason %u\n",
> +		guc_dbg(guc, "mmio request %#x: retrying, reason %u\n",
>   			request[0], reason);
>   		goto retry;
>   	}
> @@ -546,7 +545,7 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
>   		u32 hint = FIELD_GET(GUC_HXG_FAILURE_MSG_0_HINT, header);
>   		u32 error = FIELD_GET(GUC_HXG_FAILURE_MSG_0_ERROR, header);
>   
> -		drm_err(&i915->drm, "mmio request %#x: failure %x/%u\n",
> +		guc_err(guc, "mmio request %#x: failure %x/%u\n",
>   			request[0], error, hint);
>   		ret = -ENXIO;
>   		goto out;
> @@ -554,7 +553,7 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
>   
>   	if (FIELD_GET(GUC_HXG_MSG_0_TYPE, header) != GUC_HXG_TYPE_RESPONSE_SUCCESS) {
>   proto:
> -		drm_err(&i915->drm, "mmio request %#x: unexpected reply %#x\n",
> +		guc_err(guc, "mmio request %#x: unexpected reply %#x\n",
>   			request[0], header);
>   		ret = -EPROTO;
>   		goto out;
> @@ -597,9 +596,9 @@ int intel_guc_to_host_process_recv_msg(struct intel_guc *guc,
>   	msg = payload[0] & guc->msg_enabled_mask;
>   
>   	if (msg & INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED)
> -		drm_err(&guc_to_gt(guc)->i915->drm, "Received early GuC crash dump notification!\n");
> +		guc_err(guc, "Received early GuC crash dump notification!\n");
>   	if (msg & INTEL_GUC_RECV_MSG_EXCEPTION)
> -		drm_err(&guc_to_gt(guc)->i915->drm, "Received early GuC exception notification!\n");
> +		guc_err(guc, "Received early GuC exception notification!\n");
These two should drop the 'GUC' string from the message given that it is 
now a prefix.

John.

>   
>   	return 0;
>   }
> @@ -653,7 +652,8 @@ int intel_guc_suspend(struct intel_guc *guc)
>   		 */
>   		ret = intel_guc_send_mmio(guc, action, ARRAY_SIZE(action), NULL, 0);
>   		if (ret)
> -			DRM_ERROR("GuC suspend: RESET_CLIENT action failed with error %d!\n", ret);
> +			guc_err(guc, "suspend: RESET_CLIENT action failed with %pe\n",
> +				ERR_PTR(ret));
>   	}
>   
>   	/* Signal that the GuC isn't running. */
> @@ -828,12 +828,11 @@ static int __guc_action_self_cfg(struct intel_guc *guc, u16 key, u16 len, u64 va
>   
>   static int __guc_self_cfg(struct intel_guc *guc, u16 key, u16 len, u64 value)
>   {
> -	struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
>   	int err = __guc_action_self_cfg(guc, key, len, value);
>   
>   	if (unlikely(err))
> -		i915_probe_error(i915, "Unsuccessful self-config (%pe) key %#hx value %#llx\n",
> -				 ERR_PTR(err), key, value);
> +		guc_probe_error(guc, "Unsuccessful self-config (%pe) key %#hx value %#llx\n",
> +				ERR_PTR(err), key, value);
>   	return err;
>   }
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.c b/drivers/gpu/drm/i915/gt/uc/intel_guc.c
index 1bccc175f9e6..be39e519b5fd 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.c
@@ -11,6 +11,7 @@ 
 #include "intel_guc.h"
 #include "intel_guc_ads.h"
 #include "intel_guc_capture.h"
+#include "intel_guc_print.h"
 #include "intel_guc_slpc.h"
 #include "intel_guc_submission.h"
 #include "i915_drv.h"
@@ -94,8 +95,8 @@  static void gen9_enable_guc_interrupts(struct intel_guc *guc)
 	assert_rpm_wakelock_held(&gt->i915->runtime_pm);
 
 	spin_lock_irq(gt->irq_lock);
-	WARN_ON_ONCE(intel_uncore_read(gt->uncore, GEN8_GT_IIR(2)) &
-		     gt->pm_guc_events);
+	guc_WARN_ON_ONCE(guc, intel_uncore_read(gt->uncore, GEN8_GT_IIR(2)) &
+			 gt->pm_guc_events);
 	gen6_gt_pm_enable_irq(gt, gt->pm_guc_events);
 	spin_unlock_irq(gt->irq_lock);
 
@@ -342,7 +343,7 @@  static void guc_init_params(struct intel_guc *guc)
 	params[GUC_CTL_DEVID] = guc_ctl_devid(guc);
 
 	for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
-		DRM_DEBUG_DRIVER("param[%2d] = %#x\n", i, params[i]);
+		guc_dbg(guc, "param[%2d] = %#x\n", i, params[i]);
 }
 
 /*
@@ -389,7 +390,6 @@  void intel_guc_dump_time_info(struct intel_guc *guc, struct drm_printer *p)
 
 int intel_guc_init(struct intel_guc *guc)
 {
-	struct intel_gt *gt = guc_to_gt(guc);
 	int ret;
 
 	ret = intel_uc_fw_init(&guc->fw);
@@ -451,7 +451,7 @@  int intel_guc_init(struct intel_guc *guc)
 	intel_uc_fw_fini(&guc->fw);
 out:
 	intel_uc_fw_change_status(&guc->fw, INTEL_UC_FIRMWARE_INIT_FAIL);
-	i915_probe_error(gt->i915, "failed with %d\n", ret);
+	guc_probe_error(guc, "failed with %pe\n", ERR_PTR(ret));
 	return ret;
 }
 
@@ -480,7 +480,6 @@  void intel_guc_fini(struct intel_guc *guc)
 int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
 			u32 *response_buf, u32 response_buf_size)
 {
-	struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
 	struct intel_uncore *uncore = guc_to_gt(guc)->uncore;
 	u32 header;
 	int i;
@@ -515,7 +514,7 @@  int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
 					   10, 10, &header);
 	if (unlikely(ret)) {
 timeout:
-		drm_err(&i915->drm, "mmio request %#x: no reply %x\n",
+		guc_err(guc, "mmio request %#x: no reply %x\n",
 			request[0], header);
 		goto out;
 	}
@@ -537,7 +536,7 @@  int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
 	if (FIELD_GET(GUC_HXG_MSG_0_TYPE, header) == GUC_HXG_TYPE_NO_RESPONSE_RETRY) {
 		u32 reason = FIELD_GET(GUC_HXG_RETRY_MSG_0_REASON, header);
 
-		drm_dbg(&i915->drm, "mmio request %#x: retrying, reason %u\n",
+		guc_dbg(guc, "mmio request %#x: retrying, reason %u\n",
 			request[0], reason);
 		goto retry;
 	}
@@ -546,7 +545,7 @@  int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
 		u32 hint = FIELD_GET(GUC_HXG_FAILURE_MSG_0_HINT, header);
 		u32 error = FIELD_GET(GUC_HXG_FAILURE_MSG_0_ERROR, header);
 
-		drm_err(&i915->drm, "mmio request %#x: failure %x/%u\n",
+		guc_err(guc, "mmio request %#x: failure %x/%u\n",
 			request[0], error, hint);
 		ret = -ENXIO;
 		goto out;
@@ -554,7 +553,7 @@  int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
 
 	if (FIELD_GET(GUC_HXG_MSG_0_TYPE, header) != GUC_HXG_TYPE_RESPONSE_SUCCESS) {
 proto:
-		drm_err(&i915->drm, "mmio request %#x: unexpected reply %#x\n",
+		guc_err(guc, "mmio request %#x: unexpected reply %#x\n",
 			request[0], header);
 		ret = -EPROTO;
 		goto out;
@@ -597,9 +596,9 @@  int intel_guc_to_host_process_recv_msg(struct intel_guc *guc,
 	msg = payload[0] & guc->msg_enabled_mask;
 
 	if (msg & INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED)
-		drm_err(&guc_to_gt(guc)->i915->drm, "Received early GuC crash dump notification!\n");
+		guc_err(guc, "Received early GuC crash dump notification!\n");
 	if (msg & INTEL_GUC_RECV_MSG_EXCEPTION)
-		drm_err(&guc_to_gt(guc)->i915->drm, "Received early GuC exception notification!\n");
+		guc_err(guc, "Received early GuC exception notification!\n");
 
 	return 0;
 }
@@ -653,7 +652,8 @@  int intel_guc_suspend(struct intel_guc *guc)
 		 */
 		ret = intel_guc_send_mmio(guc, action, ARRAY_SIZE(action), NULL, 0);
 		if (ret)
-			DRM_ERROR("GuC suspend: RESET_CLIENT action failed with error %d!\n", ret);
+			guc_err(guc, "suspend: RESET_CLIENT action failed with %pe\n",
+				ERR_PTR(ret));
 	}
 
 	/* Signal that the GuC isn't running. */
@@ -828,12 +828,11 @@  static int __guc_action_self_cfg(struct intel_guc *guc, u16 key, u16 len, u64 va
 
 static int __guc_self_cfg(struct intel_guc *guc, u16 key, u16 len, u64 value)
 {
-	struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
 	int err = __guc_action_self_cfg(guc, key, len, value);
 
 	if (unlikely(err))
-		i915_probe_error(i915, "Unsuccessful self-config (%pe) key %#hx value %#llx\n",
-				 ERR_PTR(err), key, value);
+		guc_probe_error(guc, "Unsuccessful self-config (%pe) key %#hx value %#llx\n",
+				ERR_PTR(err), key, value);
 	return err;
 }