diff mbox series

[v2,1/1] drm/i915/pxp: Use drm_dbg if arb session failed due to fw version

Message ID 20221220221158.2390090-1-alan.previn.teres.alexis@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/1] drm/i915/pxp: Use drm_dbg if arb session failed due to fw version | expand

Commit Message

Teres Alexis, Alan Previn Dec. 20, 2022, 10:11 p.m. UTC
If PXP arb-session is being attempted on older hardware SKUs or
on hardware with older, unsupported, firmware versions, then don't
report the failure with a drm_error. Instead, look specifically for
the API-version error reply and drm_dbg that reply. In this case, the
user-space will eventually get a -ENODEV for the protected context
creation which is the correct behavior and we don't create unnecessary
drm_error's in our dmesg (for what is unsupported platforms).

Changes from prio revs:
   v1 : - print incorrect version from input packet, not output.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
---
 drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h | 1 +
 drivers/gpu/drm/i915/pxp/intel_pxp_tee.c               | 5 +++++
 2 files changed, 6 insertions(+)


base-commit: cc44a1e87ea6b788868878295119398966f98a81

Comments

Jani Nikula Dec. 21, 2022, 10:21 a.m. UTC | #1
On Tue, 20 Dec 2022, Alan Previn <alan.previn.teres.alexis@intel.com> wrote:
> If PXP arb-session is being attempted on older hardware SKUs or
> on hardware with older, unsupported, firmware versions, then don't
> report the failure with a drm_error. Instead, look specifically for
> the API-version error reply and drm_dbg that reply. In this case, the
> user-space will eventually get a -ENODEV for the protected context
> creation which is the correct behavior and we don't create unnecessary
> drm_error's in our dmesg (for what is unsupported platforms).
>
> Changes from prio revs:
>    v1 : - print incorrect version from input packet, not output.
>
> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> ---
>  drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h | 1 +
>  drivers/gpu/drm/i915/pxp/intel_pxp_tee.c               | 5 +++++
>  2 files changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
> index c2f23394f9b8..aaa8187a0afb 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
> @@ -17,6 +17,7 @@
>   */
>  enum pxp_status {
>  	PXP_STATUS_SUCCESS = 0x0,
> +	PXP_STATUS_ERROR_API_VERSION = 0x1002,
>  	PXP_STATUS_OP_NOT_PERMITTED = 0x4013
>  };
>  
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> index d50354bfb993..9d084ed9cc50 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> @@ -298,6 +298,11 @@ int intel_pxp_tee_cmd_create_arb_session(struct intel_pxp *pxp,
>  
>  	if (ret)
>  		drm_err(&i915->drm, "Failed to send tee msg ret=[%d]\n", ret);
> +

Superfluous newline that someone's gonna send a patch later to
remove. Easier to just not add it.

BR,
Jani.

> +	else if (msg_out.header.status == PXP_STATUS_ERROR_API_VERSION)
> +		drm_dbg(&i915->drm, "PXP firmware version unsupported, requested: "
> +			"CMD-ID-[0x%08x] on API-Ver-[0x%08x]\n",
> +			msg_in.header.command_id, msg_in.header.api_version);
>  	else if (msg_out.header.status != 0x0)
>  		drm_warn(&i915->drm, "PXP firmware failed arb session init request ret=[0x%08x]\n",
>  			 msg_out.header.status);
>
> base-commit: cc44a1e87ea6b788868878295119398966f98a81
Teres Alexis, Alan Previn Dec. 21, 2022, 5:33 p.m. UTC | #2
On Wed, 2022-12-21 at 12:21 +0200, Jani Nikula wrote:
> On Tue, 20 Dec 2022, Alan Previn <alan.previn.teres.alexis@intel.com> wrote:
> > 
Alan:[snip]
> > +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> > @@ -298,6 +298,11 @@ int intel_pxp_tee_cmd_create_arb_session(struct intel_pxp *pxp,
> >  
> >  	if (ret)
> >  		drm_err(&i915->drm, "Failed to send tee msg ret=[%d]\n", ret);
> > +
> 
> Superfluous newline that someone's gonna send a patch later to
> remove. Easier to just not add it.
> 
> BR,
> Jani.
> 
Alan: will fix
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
index c2f23394f9b8..aaa8187a0afb 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
@@ -17,6 +17,7 @@ 
  */
 enum pxp_status {
 	PXP_STATUS_SUCCESS = 0x0,
+	PXP_STATUS_ERROR_API_VERSION = 0x1002,
 	PXP_STATUS_OP_NOT_PERMITTED = 0x4013
 };
 
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
index d50354bfb993..9d084ed9cc50 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
@@ -298,6 +298,11 @@  int intel_pxp_tee_cmd_create_arb_session(struct intel_pxp *pxp,
 
 	if (ret)
 		drm_err(&i915->drm, "Failed to send tee msg ret=[%d]\n", ret);
+
+	else if (msg_out.header.status == PXP_STATUS_ERROR_API_VERSION)
+		drm_dbg(&i915->drm, "PXP firmware version unsupported, requested: "
+			"CMD-ID-[0x%08x] on API-Ver-[0x%08x]\n",
+			msg_in.header.command_id, msg_in.header.api_version);
 	else if (msg_out.header.status != 0x0)
 		drm_warn(&i915->drm, "PXP firmware failed arb session init request ret=[0x%08x]\n",
 			 msg_out.header.status);