diff mbox series

drm/i915: Skip pxp init if gt is wedged

Message ID 20231026215444.54880-1-zhanjun.dong@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Skip pxp init if gt is wedged | expand

Commit Message

Zhanjun Dong Oct. 26, 2023, 9:54 p.m. UTC
gt wedged is fatal error, skip the pxp init on this situation.

Signed-off-by: Zhanjun Dong <zhanjun.dong@intel.com>
---
 drivers/gpu/drm/i915/pxp/intel_pxp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jani Nikula Oct. 27, 2023, 7:13 a.m. UTC | #1
On Thu, 26 Oct 2023, Zhanjun Dong <zhanjun.dong@intel.com> wrote:
> gt wedged is fatal error, skip the pxp init on this situation.

More information is needed in the commit message. When do you encounter
this situation?

I'll note that nobody checks intel_pxp_init() return status, so this
silently skips PXP.

BR,
Jani.

>
> Signed-off-by: Zhanjun Dong <zhanjun.dong@intel.com>
> ---
>  drivers/gpu/drm/i915/pxp/intel_pxp.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c b/drivers/gpu/drm/i915/pxp/intel_pxp.c
> index dc327cf40b5a..923f233c91e1 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
> @@ -212,6 +212,9 @@ int intel_pxp_init(struct drm_i915_private *i915)
>  	if (!gt)
>  		return -ENODEV;
>  
> +	if (intel_gt_is_wedged(gt))
> +		return -ENODEV;
> +
>  	/*
>  	 * At this point, we will either enable full featured PXP capabilities
>  	 * including session and object management, or we will init the backend tee
Teres Alexis, Alan Previn Oct. 31, 2023, 9:38 p.m. UTC | #2
On Fri, 2023-10-27 at 10:13 +0300, Jani Nikula wrote:
> On Thu, 26 Oct 2023, Zhanjun Dong <zhanjun.dong@intel.com> wrote:
> 
alan:snip
> I'll note that nobody checks intel_pxp_init() return status, so this
> silently skips PXP.
> 
> BR,
> Jani.

alan:snip
> > +	if (intel_gt_is_wedged(gt))
> > +		return -ENODEV;
> > +

alan: wondering if we can add a drm_dbg in the caller of intel_pxp_init and
use a unique return value for the case of gt_is_wedged (for example: -ENXIO.).
As we know gt being wedged at startup basically means all gt usage is dead
and therefore we cant enable PXP (along with everything else that needs submission/
guc/ etc). With a drm-debug in the caller that prints that return value, it
helps us to differentiate between gt-is-wedged vs platform config doesnt support
PXP. However, this would mean new drm-debug 'noise' for platforms that i915 just
doesn't support PXP on at all which would be okay if dont use drm_warn or drm_err
and use 'softer' message like "PXP skipped with %d".

Please treat above comment as a "nit" - i.e. existing patch is good enough for me...
(after addressing Jani's request for more commit message info). ...alan
Zhanjun Dong Nov. 1, 2023, 5:57 p.m. UTC | #3
On 2023-10-31 5:38 p.m., Teres Alexis, Alan Previn wrote:
> On Fri, 2023-10-27 at 10:13 +0300, Jani Nikula wrote:
>> On Thu, 26 Oct 2023, Zhanjun Dong <zhanjun.dong@intel.com> wrote:
>>
> alan:snip
>> I'll note that nobody checks intel_pxp_init() return status, so this
>> silently skips PXP.
>>
>> BR,
>> Jani.
> 
> alan:snip
>>> +	if (intel_gt_is_wedged(gt))
>>> +		return -ENODEV;
>>> +
> 
> alan: wondering if we can add a drm_dbg in the caller of intel_pxp_init and
> use a unique return value for the case of gt_is_wedged (for example: -ENXIO.).
> As we know gt being wedged at startup basically means all gt usage is dead
> and therefore we cant enable PXP (along with everything else that needs submission/
> guc/ etc). With a drm-debug in the caller that prints that return value, it
> helps us to differentiate between gt-is-wedged vs platform config doesnt support
> PXP. However, this would mean new drm-debug 'noise' for platforms that i915 just
> doesn't support PXP on at all which would be okay if dont use drm_warn or drm_err
> and use 'softer' message like "PXP skipped with %d".
> 
> Please treat above comment as a "nit" - i.e. existing patch is good enough for me...
> (after addressing Jani's request for more commit message info). ...alan
> 
> 

Thanks Alan.
I agree, add more drm-debug looks like add noise in case of 
gt_is_wedged, existing code already output useful info.

If logs already let us know gt_wedged happens and we are not expect pxp 
init running on gt wedged condition, then silently skip pxp_init looks 
like match the expectation.

I will re-post with updated commit message later.

Regards,
Zhanjun
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index dc327cf40b5a..923f233c91e1 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -212,6 +212,9 @@  int intel_pxp_init(struct drm_i915_private *i915)
 	if (!gt)
 		return -ENODEV;
 
+	if (intel_gt_is_wedged(gt))
+		return -ENODEV;
+
 	/*
 	 * At this point, we will either enable full featured PXP capabilities
 	 * including session and object management, or we will init the backend tee