All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: John.C.Harrison@Intel.com, Intel-GFX@Lists.FreeDesktop.Org
Cc: DRI-Devel@Lists.FreeDesktop.Org
Subject: Re: [PATCH v2 2/5] drm/i915/huc: Add HuC specific debug print wrappers
Date: Tue, 22 Nov 2022 18:17:58 +0100	[thread overview]
Message-ID: <258b2016-3bbc-80ee-b187-bc6d93699359@intel.com> (raw)
In-Reply-To: <20221118015858.2548106-3-John.C.Harrison@Intel.com>



On 18.11.2022 02:58, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
> 
> Create a set of HuC printers and start using them.
> 
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>  drivers/gpu/drm/i915/gt/uc/intel_huc.c | 31 ++++++++++----------------
>  drivers/gpu/drm/i915/gt/uc/intel_huc.h | 23 +++++++++++++++++++
>  2 files changed, 35 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> index be855811d85df..0bbbc7192da63 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> @@ -107,11 +107,9 @@ static enum hrtimer_restart huc_delayed_load_timer_callback(struct hrtimer *hrti
>  
>  	if (!intel_huc_is_authenticated(huc)) {
>  		if (huc->delayed_load.status == INTEL_HUC_WAITING_ON_GSC)
> -			drm_notice(&huc_to_gt(huc)->i915->drm,
> -				   "timed out waiting for MEI GSC init to load HuC\n");
> +			huc_notice(huc, "Timed out waiting for MEI GSC init to load FW\n");
>  		else if (huc->delayed_load.status == INTEL_HUC_WAITING_ON_PXP)
> -			drm_notice(&huc_to_gt(huc)->i915->drm,
> -				   "timed out waiting for MEI PXP init to load HuC\n");
> +			huc_notice(huc, "Timed out waiting for MEI PXP init to load FW\n");
>  		else
>  			MISSING_CASE(huc->delayed_load.status);
>  
> @@ -174,8 +172,7 @@ static int gsc_notifier(struct notifier_block *nb, unsigned long action, void *d
>  
>  	case BUS_NOTIFY_DRIVER_NOT_BOUND: /* mei driver fails to be bound */
>  	case BUS_NOTIFY_UNBIND_DRIVER: /* mei driver about to be unbound */
> -		drm_info(&huc_to_gt(huc)->i915->drm,
> -			 "mei driver not bound, disabling HuC load\n");
> +		huc_info(huc, "- mei driver not bound, disabling HuC load\n");
>  		gsc_init_error(huc);
>  		break;
>  	}
> @@ -193,8 +190,7 @@ void intel_huc_register_gsc_notifier(struct intel_huc *huc, struct bus_type *bus
>  	huc->delayed_load.nb.notifier_call = gsc_notifier;
>  	ret = bus_register_notifier(bus, &huc->delayed_load.nb);
>  	if (ret) {
> -		drm_err(&huc_to_gt(huc)->i915->drm,
> -			"failed to register GSC notifier\n");
> +		huc_err(huc, "Failed to register GSC notifier\n");
>  		huc->delayed_load.nb.notifier_call = NULL;
>  		gsc_init_error(huc);
>  	}
> @@ -284,8 +280,7 @@ static int check_huc_loading_mode(struct intel_huc *huc)
>  			      GSC_LOADS_HUC;
>  
>  	if (fw_needs_gsc != hw_uses_gsc) {
> -		drm_err(&gt->i915->drm,
> -			"mismatch between HuC FW (%s) and HW (%s) load modes\n",
> +		huc_err(huc, "Mismatch between FW (%s) and HW (%s) load modes\n",
>  			HUC_LOAD_MODE_STRING(fw_needs_gsc),
>  			HUC_LOAD_MODE_STRING(hw_uses_gsc));
>  		return -ENOEXEC;
> @@ -294,19 +289,17 @@ static int check_huc_loading_mode(struct intel_huc *huc)
>  	/* make sure we can access the GSC via the mei driver if we need it */
>  	if (!(IS_ENABLED(CONFIG_INTEL_MEI_PXP) && IS_ENABLED(CONFIG_INTEL_MEI_GSC)) &&
>  	    fw_needs_gsc) {
> -		drm_info(&gt->i915->drm,
> -			 "Can't load HuC due to missing MEI modules\n");
> +		huc_info(huc, "Can't load due to missing MEI modules\n");
>  		return -EIO;
>  	}
>  
> -	drm_dbg(&gt->i915->drm, "GSC loads huc=%s\n", str_yes_no(fw_needs_gsc));
> +	huc_dbg(huc, "GSC loads huc=%s\n", str_yes_no(fw_needs_gsc));

this will give:

	"GT0: HuC GSC loads huc=yes"

but maybe better to change that to get:

	"GT0: HuC loaded by GSC=yes"

so this should be:

	huc_dbg(huc, "loaded by GSC=%s\n", str_yes_no(fw_needs_gsc));

>  
>  	return 0;
>  }
>  
>  int intel_huc_init(struct intel_huc *huc)
>  {
> -	struct drm_i915_private *i915 = huc_to_gt(huc)->i915;
>  	int err;
>  
>  	err = check_huc_loading_mode(huc);
> @@ -323,7 +316,7 @@ int intel_huc_init(struct intel_huc *huc)
>  
>  out:
>  	intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_INIT_FAIL);
> -	drm_info(&i915->drm, "HuC init failed with %d\n", err);
> +	huc_info(huc, "init failed with %d\n", err);
>  	return err;
>  }
>  
> @@ -366,13 +359,13 @@ int intel_huc_wait_for_auth_complete(struct intel_huc *huc)
>  	delayed_huc_load_complete(huc);
>  
>  	if (ret) {
> -		drm_err(&gt->i915->drm, "HuC: Firmware not verified %d\n", ret);
> +		huc_err(huc, "firmware not verified %d\n", ret);
>  		intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_LOAD_FAIL);
>  		return ret;
>  	}
>  
>  	intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_RUNNING);
> -	drm_info(&gt->i915->drm, "HuC authenticated\n");
> +	huc_info(huc, "authenticated\n");
>  	return 0;
>  }
>  
> @@ -407,7 +400,7 @@ int intel_huc_auth(struct intel_huc *huc)
>  
>  	ret = intel_guc_auth_huc(guc, intel_guc_ggtt_offset(guc, huc->fw.rsa_data));
>  	if (ret) {
> -		DRM_ERROR("HuC: GuC did not ack Auth request %d\n", ret);
> +		huc_err(huc, "auth request not acked by GuC: %d\n", ret);
>  		goto fail;
>  	}
>  
> @@ -419,7 +412,7 @@ int intel_huc_auth(struct intel_huc *huc)
>  	return 0;
>  
>  fail:
> -	i915_probe_error(gt->i915, "HuC: Authentication failed %d\n", ret);
> +	huc_probe_error(huc, "authentication failed %d\n", ret);
>  	return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.h b/drivers/gpu/drm/i915/gt/uc/intel_huc.h
> index 52db03620c609..f253c1c19f12f 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.h
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.h
> @@ -16,6 +16,29 @@
>  
>  struct bus_type;
>  
> +#define huc_err(_huc, _fmt, ...) \
> +	gt_err(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_warn(_huc, _fmt, ...) \
> +	gt_warn(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_notice(_huc, _fmt, ...) \
> +	gt_notice(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_info(_huc, _fmt, ...) \
> +	gt_info(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_dbg(_huc, _fmt, ...) \
> +	gt_dbg(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_probe_error(_huc, _fmt, ...) \
> +	do { \
> +		if (i915_error_injected()) \
> +			huc_dbg(_huc, _fmt, ##__VA_ARGS__); \
> +		else \
> +			huc_err(_huc, _fmt, ##__VA_ARGS__); \
> +	} while (0)

shouldn't we use gt_probe_error() here ?

#define huc_probe_error(_huc, _fmt, ...) \
	gt_probe_error(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)

> +
>  enum intel_huc_delayed_load_status {
>  	INTEL_HUC_WAITING_ON_GSC = 0,
>  	INTEL_HUC_WAITING_ON_PXP,

WARNING: multiple messages have this Message-ID (diff)
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: John.C.Harrison@Intel.com, Intel-GFX@Lists.FreeDesktop.Org
Cc: DRI-Devel@Lists.FreeDesktop.Org
Subject: Re: [Intel-gfx] [PATCH v2 2/5] drm/i915/huc: Add HuC specific debug print wrappers
Date: Tue, 22 Nov 2022 18:17:58 +0100	[thread overview]
Message-ID: <258b2016-3bbc-80ee-b187-bc6d93699359@intel.com> (raw)
In-Reply-To: <20221118015858.2548106-3-John.C.Harrison@Intel.com>



On 18.11.2022 02:58, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
> 
> Create a set of HuC printers and start using them.
> 
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>  drivers/gpu/drm/i915/gt/uc/intel_huc.c | 31 ++++++++++----------------
>  drivers/gpu/drm/i915/gt/uc/intel_huc.h | 23 +++++++++++++++++++
>  2 files changed, 35 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> index be855811d85df..0bbbc7192da63 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> @@ -107,11 +107,9 @@ static enum hrtimer_restart huc_delayed_load_timer_callback(struct hrtimer *hrti
>  
>  	if (!intel_huc_is_authenticated(huc)) {
>  		if (huc->delayed_load.status == INTEL_HUC_WAITING_ON_GSC)
> -			drm_notice(&huc_to_gt(huc)->i915->drm,
> -				   "timed out waiting for MEI GSC init to load HuC\n");
> +			huc_notice(huc, "Timed out waiting for MEI GSC init to load FW\n");
>  		else if (huc->delayed_load.status == INTEL_HUC_WAITING_ON_PXP)
> -			drm_notice(&huc_to_gt(huc)->i915->drm,
> -				   "timed out waiting for MEI PXP init to load HuC\n");
> +			huc_notice(huc, "Timed out waiting for MEI PXP init to load FW\n");
>  		else
>  			MISSING_CASE(huc->delayed_load.status);
>  
> @@ -174,8 +172,7 @@ static int gsc_notifier(struct notifier_block *nb, unsigned long action, void *d
>  
>  	case BUS_NOTIFY_DRIVER_NOT_BOUND: /* mei driver fails to be bound */
>  	case BUS_NOTIFY_UNBIND_DRIVER: /* mei driver about to be unbound */
> -		drm_info(&huc_to_gt(huc)->i915->drm,
> -			 "mei driver not bound, disabling HuC load\n");
> +		huc_info(huc, "- mei driver not bound, disabling HuC load\n");
>  		gsc_init_error(huc);
>  		break;
>  	}
> @@ -193,8 +190,7 @@ void intel_huc_register_gsc_notifier(struct intel_huc *huc, struct bus_type *bus
>  	huc->delayed_load.nb.notifier_call = gsc_notifier;
>  	ret = bus_register_notifier(bus, &huc->delayed_load.nb);
>  	if (ret) {
> -		drm_err(&huc_to_gt(huc)->i915->drm,
> -			"failed to register GSC notifier\n");
> +		huc_err(huc, "Failed to register GSC notifier\n");
>  		huc->delayed_load.nb.notifier_call = NULL;
>  		gsc_init_error(huc);
>  	}
> @@ -284,8 +280,7 @@ static int check_huc_loading_mode(struct intel_huc *huc)
>  			      GSC_LOADS_HUC;
>  
>  	if (fw_needs_gsc != hw_uses_gsc) {
> -		drm_err(&gt->i915->drm,
> -			"mismatch between HuC FW (%s) and HW (%s) load modes\n",
> +		huc_err(huc, "Mismatch between FW (%s) and HW (%s) load modes\n",
>  			HUC_LOAD_MODE_STRING(fw_needs_gsc),
>  			HUC_LOAD_MODE_STRING(hw_uses_gsc));
>  		return -ENOEXEC;
> @@ -294,19 +289,17 @@ static int check_huc_loading_mode(struct intel_huc *huc)
>  	/* make sure we can access the GSC via the mei driver if we need it */
>  	if (!(IS_ENABLED(CONFIG_INTEL_MEI_PXP) && IS_ENABLED(CONFIG_INTEL_MEI_GSC)) &&
>  	    fw_needs_gsc) {
> -		drm_info(&gt->i915->drm,
> -			 "Can't load HuC due to missing MEI modules\n");
> +		huc_info(huc, "Can't load due to missing MEI modules\n");
>  		return -EIO;
>  	}
>  
> -	drm_dbg(&gt->i915->drm, "GSC loads huc=%s\n", str_yes_no(fw_needs_gsc));
> +	huc_dbg(huc, "GSC loads huc=%s\n", str_yes_no(fw_needs_gsc));

this will give:

	"GT0: HuC GSC loads huc=yes"

but maybe better to change that to get:

	"GT0: HuC loaded by GSC=yes"

so this should be:

	huc_dbg(huc, "loaded by GSC=%s\n", str_yes_no(fw_needs_gsc));

>  
>  	return 0;
>  }
>  
>  int intel_huc_init(struct intel_huc *huc)
>  {
> -	struct drm_i915_private *i915 = huc_to_gt(huc)->i915;
>  	int err;
>  
>  	err = check_huc_loading_mode(huc);
> @@ -323,7 +316,7 @@ int intel_huc_init(struct intel_huc *huc)
>  
>  out:
>  	intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_INIT_FAIL);
> -	drm_info(&i915->drm, "HuC init failed with %d\n", err);
> +	huc_info(huc, "init failed with %d\n", err);
>  	return err;
>  }
>  
> @@ -366,13 +359,13 @@ int intel_huc_wait_for_auth_complete(struct intel_huc *huc)
>  	delayed_huc_load_complete(huc);
>  
>  	if (ret) {
> -		drm_err(&gt->i915->drm, "HuC: Firmware not verified %d\n", ret);
> +		huc_err(huc, "firmware not verified %d\n", ret);
>  		intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_LOAD_FAIL);
>  		return ret;
>  	}
>  
>  	intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_RUNNING);
> -	drm_info(&gt->i915->drm, "HuC authenticated\n");
> +	huc_info(huc, "authenticated\n");
>  	return 0;
>  }
>  
> @@ -407,7 +400,7 @@ int intel_huc_auth(struct intel_huc *huc)
>  
>  	ret = intel_guc_auth_huc(guc, intel_guc_ggtt_offset(guc, huc->fw.rsa_data));
>  	if (ret) {
> -		DRM_ERROR("HuC: GuC did not ack Auth request %d\n", ret);
> +		huc_err(huc, "auth request not acked by GuC: %d\n", ret);
>  		goto fail;
>  	}
>  
> @@ -419,7 +412,7 @@ int intel_huc_auth(struct intel_huc *huc)
>  	return 0;
>  
>  fail:
> -	i915_probe_error(gt->i915, "HuC: Authentication failed %d\n", ret);
> +	huc_probe_error(huc, "authentication failed %d\n", ret);
>  	return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.h b/drivers/gpu/drm/i915/gt/uc/intel_huc.h
> index 52db03620c609..f253c1c19f12f 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.h
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.h
> @@ -16,6 +16,29 @@
>  
>  struct bus_type;
>  
> +#define huc_err(_huc, _fmt, ...) \
> +	gt_err(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_warn(_huc, _fmt, ...) \
> +	gt_warn(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_notice(_huc, _fmt, ...) \
> +	gt_notice(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_info(_huc, _fmt, ...) \
> +	gt_info(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_dbg(_huc, _fmt, ...) \
> +	gt_dbg(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)
> +
> +#define huc_probe_error(_huc, _fmt, ...) \
> +	do { \
> +		if (i915_error_injected()) \
> +			huc_dbg(_huc, _fmt, ##__VA_ARGS__); \
> +		else \
> +			huc_err(_huc, _fmt, ##__VA_ARGS__); \
> +	} while (0)

shouldn't we use gt_probe_error() here ?

#define huc_probe_error(_huc, _fmt, ...) \
	gt_probe_error(huc_to_gt(_huc), "HuC " _fmt, ##__VA_ARGS__)

> +
>  enum intel_huc_delayed_load_status {
>  	INTEL_HUC_WAITING_ON_GSC = 0,
>  	INTEL_HUC_WAITING_ON_PXP,

  reply	other threads:[~2022-11-22 17:25 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18  1:58 [PATCH v2 0/5] Add module oriented dmesg output John.C.Harrison
2022-11-18  1:58 ` [Intel-gfx] " John.C.Harrison
2022-11-18  1:58 ` [PATCH v2 1/5] drm/i915/gt: Start adding " John.C.Harrison
2022-11-18  1:58   ` [Intel-gfx] " John.C.Harrison
2022-11-22 16:47   ` Michal Wajdeczko
2022-11-22 16:47     ` [Intel-gfx] " Michal Wajdeczko
2022-11-18  1:58 ` [PATCH v2 2/5] drm/i915/huc: Add HuC specific debug print wrappers John.C.Harrison
2022-11-18  1:58   ` [Intel-gfx] " John.C.Harrison
2022-11-22 17:17   ` Michal Wajdeczko [this message]
2022-11-22 17:17     ` Michal Wajdeczko
2022-11-18  1:58 ` [PATCH v2 3/5] drm/i915/guc: Add GuC " John.C.Harrison
2022-11-18  1:58   ` [Intel-gfx] " John.C.Harrison
2022-11-22 17:42   ` Michal Wajdeczko
2022-11-22 17:42     ` [Intel-gfx] " Michal Wajdeczko
2022-11-23  0:56     ` John Harrison
2022-11-23  0:56       ` [Intel-gfx] " John Harrison
2022-11-18  1:58 ` [PATCH v2 4/5] drm/i915/guc: Add GuC CT " John.C.Harrison
2022-11-18  1:58   ` [Intel-gfx] " John.C.Harrison
2022-11-22 17:54   ` Michal Wajdeczko
2022-11-23  1:25     ` John Harrison
2022-11-23 20:45       ` Michal Wajdeczko
2022-12-01  0:41         ` John Harrison
2022-12-01 11:56           ` Michal Wajdeczko
2022-12-01 12:01             ` Tvrtko Ursulin
2022-12-02 20:14               ` John Harrison
2022-12-05 13:16                 ` Tvrtko Ursulin
2022-12-05 18:44                   ` Michal Wajdeczko
2022-12-06 11:06                     ` Tvrtko Ursulin
2023-01-06 18:57                       ` John Harrison
2023-01-06 18:57                         ` John Harrison
2023-01-09  9:38                         ` Jani Nikula
2023-01-09  9:38                           ` Jani Nikula
2023-01-09 20:33                           ` John Harrison
2023-01-09 20:33                             ` John Harrison
2023-01-09  9:39                         ` Tvrtko Ursulin
2023-01-09  9:39                           ` Tvrtko Ursulin
2023-01-09 20:36                           ` John Harrison
2023-01-09 20:36                             ` John Harrison
2022-11-18  1:58 ` [PATCH v2 5/5] drm/i915/uc: Update the gt/uc code to use gt_err and friends John.C.Harrison
2022-11-18  1:58   ` [Intel-gfx] " John.C.Harrison
2022-11-18  2:24 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Add module oriented dmesg output Patchwork
2022-11-18  2:24 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-18  2:45 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-11-18 10:52 ` [Intel-gfx] [PATCH v2 0/5] " Jani Nikula
2022-11-18 10:52   ` Jani Nikula
2022-11-21 18:21   ` John Harrison
2022-11-21 18:21     ` John Harrison
2022-11-22  8:14     ` Tvrtko Ursulin
2022-11-22 16:35   ` Michal Wajdeczko
2022-11-22 18:21     ` Jani Nikula
2022-11-18 19:37 ` [Intel-gfx] ✓ Fi.CI.IGT: success for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=258b2016-3bbc-80ee-b187-bc6d93699359@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=DRI-Devel@Lists.FreeDesktop.Org \
    --cc=Intel-GFX@Lists.FreeDesktop.Org \
    --cc=John.C.Harrison@Intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.