All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Alan Previn <alan.previn.teres.alexis@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	intel-gfx@lists.freedesktop.org,
	Alexander Usyskin <alexander.usyskin@intel.com>,
	dri-devel@lists.freedesktop.org,
	Tomas Winkler <tomas.winkler@intel.com>,
	Vivi@freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v5 2/6] drm/i915/pxp: add device link between i915 and mei_pxp
Date: Thu, 19 Jan 2023 14:25:12 -0500	[thread overview]
Message-ID: <Y8mZGMjjlTW3U0jA@intel.com> (raw)
In-Reply-To: <20230113011850.1463965-3-alan.previn.teres.alexis@intel.com>

On Thu, Jan 12, 2023 at 05:18:46PM -0800, Alan Previn wrote:
> From: Alexander Usyskin <alexander.usyskin@intel.com>
> 
> Add device link with i915 as consumer and mei_pxp as supplier
> to ensure proper ordering of power flows.
> 
> V2: condition on absence of heci_pxp to filter out DG
> 
> Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> ---
>  drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> index d50354bfb993..bef6d7f8ac55 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> @@ -127,6 +127,10 @@ static int i915_pxp_tee_component_bind(struct device *i915_kdev,
>  	intel_wakeref_t wakeref;
>  	int ret = 0;
>  
> +	if (!HAS_HECI_PXP(i915) &&
> +	    drm_WARN_ON(&i915->drm, !device_link_add(i915_kdev, tee_kdev,

I don't like the action here hidden behind the drm_WARN_ON.
Please notice that almost every use of this and other helpers like
this expect the param as a failure. Not an actual action. So,
most of lazy readers like me might ignore that the main function
is actually a param inside  this warn condition.

We should probably stash the link as well...

pxp->dev_link = device_link_add(i915_kdev, tee_kdev,...);

so in the end below, instead of checking the HAS_HECI_PXP again
and use the remove version you check the dev_link and use the del
function.

something like:

if (pxp->dev_link)
   device_link_del(pxp->dev_link);

Also, do you really need the WARN to see the stack when this happens
or you already know the callers?
Why not a simple drm_error msg?

if (!HAS_HECI_PXP(i915) {
	pxp->dev_link = device_link_add(i915_kdev, tee_kdev,...);
	if (!pxp->dev_link) {
	   drm_error();
	   return -ESOMETHING;

>  DL_FLAG_STATELESS)))

do we need the RPM in sync as well?
I mean:

DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME)))

?

> +		return -ENOMEM;

why ENOMEM?

> +
>  	mutex_lock(&pxp->tee_mutex);
>  	pxp->pxp_component = data;
>  	pxp->pxp_component->tee_dev = tee_kdev;
> @@ -169,6 +173,9 @@ static void i915_pxp_tee_component_unbind(struct device *i915_kdev,
>  	mutex_lock(&pxp->tee_mutex);
>  	pxp->pxp_component = NULL;
>  	mutex_unlock(&pxp->tee_mutex);
> +
> +	if (!HAS_HECI_PXP(i915))
> +		device_link_remove(i915_kdev, tee_kdev);
>  }
>  
>  static const struct component_ops i915_pxp_tee_component_ops = {
> -- 
> 2.39.0
> 

  reply	other threads:[~2023-01-19 19:25 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13  1:18 [Intel-gfx] [PATCH v5 0/6] drm/i915/pxp: Add missing cleanup steps for PXP global-teardown Alan Previn
2023-01-13  1:18 ` Alan Previn
2023-01-13  1:18 ` [Intel-gfx] [PATCH v5 1/6] mei: mei-me: resume device in prepare Alan Previn
2023-01-13  1:18   ` Alan Previn
2023-01-18 11:42   ` [Intel-gfx] " Winkler, Tomas
2023-01-18 11:42     ` Winkler, Tomas
2023-01-13  1:18 ` [Intel-gfx] [PATCH v5 2/6] drm/i915/pxp: add device link between i915 and mei_pxp Alan Previn
2023-01-13  1:18   ` Alan Previn
2023-01-19 19:25   ` Rodrigo Vivi [this message]
2023-01-19 23:01     ` [Intel-gfx] " Teres Alexis, Alan Previn
2023-01-22  6:57     ` Usyskin, Alexander
2023-01-22  6:57       ` Usyskin, Alexander
2023-01-23 12:43       ` Jani Nikula
2023-01-23 12:43         ` Jani Nikula
2023-01-23 14:31       ` Rodrigo Vivi
2023-01-24  1:53         ` Teres Alexis, Alan Previn
2023-01-13  1:18 ` [Intel-gfx] [PATCH v5 3/6] mei: clean pending read with vtag on bus Alan Previn
2023-01-13  1:18   ` Alan Previn
2023-01-18 11:43   ` [Intel-gfx] " Winkler, Tomas
2023-01-18 11:43     ` Winkler, Tomas
2023-01-13  1:18 ` [Intel-gfx] [PATCH v5 4/6] drm/i915/pxp: Invalidate all PXP fw sessions during teardown Alan Previn
2023-01-13  1:18   ` Alan Previn
2023-01-19 19:28   ` [Intel-gfx] " Rodrigo Vivi
2023-01-19 22:00     ` Teres Alexis, Alan Previn
2023-01-13  1:18 ` [Intel-gfx] [PATCH v5 5/6] drm/i915/pxp: Trigger the global teardown for before suspending Alan Previn
2023-01-13  1:18   ` Alan Previn
2023-01-19 19:35   ` [Intel-gfx] " Rodrigo Vivi
2023-01-19 19:35     ` Rodrigo Vivi
2023-01-19 22:31     ` [Intel-gfx] " Teres Alexis, Alan Previn
2023-01-19 22:31       ` Teres Alexis, Alan Previn
2023-01-13  1:18 ` [Intel-gfx] [PATCH v5 6/6] drm/i915/pxp: Pxp hw init should be in resume_complete Alan Previn
2023-01-13  1:18   ` Alan Previn
2023-01-19 19:10   ` [Intel-gfx] " Ceraolo Spurio, Daniele
2023-01-19 19:10     ` Ceraolo Spurio, Daniele
2023-01-19 19:40     ` [Intel-gfx] " Rodrigo Vivi
2023-01-13  2:10 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/pxp: Add missing cleanup steps for PXP global-teardown Patchwork
2023-01-13  2:38 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " 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=Y8mZGMjjlTW3U0jA@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=Vivi@freedesktop.org \
    --cc=alan.previn.teres.alexis@intel.com \
    --cc=alexander.usyskin@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tomas.winkler@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.