dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Teres Alexis, Alan Previn" <alan.previn.teres.alexis@intel.com>
To: "Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
	"jani.nikula@linux.intel.com" <jani.nikula@linux.intel.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"airlied@redhat.com" <airlied@redhat.com>,
	"daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
	"Ceraolo Spurio, Daniele" <daniele.ceraolospurio@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH v9 04/17] drm/i915/pxp: allocate a vcs context for pxp usage
Date: Thu, 16 Sep 2021 15:23:31 +0000	[thread overview]
Message-ID: <f1b2658fd050c669f64382e8c73e058081b60dc6.camel@intel.com> (raw)
In-Reply-To: <YUNNsOmnhIHaPPxl@intel.com>


On Thu, 2021-09-16 at 09:59 -0400, Rodrigo Vivi wrote:
> On Thu, Sep 16, 2021 at 02:06:56PM +0300, Jani Nikula wrote:
> > On Wed, 15 Sep 2021, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> > > On Wed, Sep 15, 2021 at 04:53:35PM +0300, Jani Nikula wrote:
> > > > On Fri, 10 Sep 2021, Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> wrote:
> > > > > diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.h b/drivers/gpu/drm/i915/pxp/intel_pxp.h
> > > > > new file mode 100644
> > > > > index 000000000000..e87550fb9821
> > > > > --- /dev/null
> > > > > +++ b/drivers/gpu/drm/i915/pxp/intel_pxp.h
> > > > > @@ -0,0 +1,35 @@
> > > > > +/* SPDX-License-Identifier: MIT */
> > > > > +/*
> > > > > + * Copyright(c) 2020, Intel Corporation. All rights reserved.
> > > > > + */
> > > > > +
> > > > > +#ifndef __INTEL_PXP_H__
> > > > > +#define __INTEL_PXP_H__
> > > > > +
> > > > > +#include "gt/intel_gt_types.h"
> > > > 
> > > > I've been trying to promote the idea that we don't include headers from
> > > > headers, unless really necessary. It helps with build times by reducing
> > > > rebuilds due to changes, but more importantly, it helps with coming up
> > > > with abstractions that don't need to look at the guts of other
> > > > components.
> > > > 
> > > > The above include line pulls in 67 other includes. And it has to look at
> > > > the same files a *lot* more times to know not to include them again.
> > > > 
> > > > Maybe we need to start being more aggressive about hiding the
> > > > abstractions behind the interfaces and headers. Static inlines are
> > > > nothing but micro-optimizations that leak abstractions. Do we need
> > > > these?
> > > 
> > > Yeap, we have a few cases where this is already happening...
> > > 
> > > Should we start using the container_of more directly and avoid the a_to_b()
> > > helpers?
> > > 
> > > Should we create the a_to_b() helpers only inside .c files like we have
> > > in a few other cases?
> > > 
> > > In this pxp case here it looks like using the container of directly is
> > > everywhere is better... is this your recommendation?
> > 
> > Either that, or make it a non-inline function that's actually
> > abstracted. Yes, it leads to a function call, but I'm really starting to
> > wonder about the costs of a function call vs. maintainability across the
> > board.
> 
> Alan, could you please address this? With that addressed and CI happy
> we will merge to the already created topic/pxp and do the proper
> pull requests.
> 
> if your change only touches this patch don't need to resend the whole
> series but just in-reply-to. But if changes everything to container-of
> please resend it entirely.
> 
> Thanks,
> Rodrigo.
> 

Yes - as you are aware, I have something ready to publish but it touches multiple patches (as function
get introduced and modified across multiple patches). The approach i am taking is to make them function
prototypes (except when CONFG_PXP is off as they are can be inline stubs). I just have more clean ups +
testing to do.

> > Static inlines considered harmful.
> > 
> > 
> > BR,
> > Jani.
> > 
> > 
> > > > > +#include "intel_pxp_types.h"
> > > > > +
> > > > > +static inline struct intel_gt *pxp_to_gt(const struct intel_pxp *pxp)
> > > > > +{
> > > > > +	return container_of(pxp, struct intel_gt, pxp);
> > > > > +}
> > > > 
> > > > I think it's questionable to claim the parameter is const, when you can
> > > > do:
> > > > 
> > > > 	const struct intel_pxp *const_pxp = something;
> > > > 	struct intel_pxp *pxp = &pxp_to_gt(const_pxp)->pxp;
> > > > 
> > > > BR,
> > > > Jani.
> > > > 
> > > > > +
> > > > > +static inline bool intel_pxp_is_enabled(const struct intel_pxp *pxp)
> > > > > +{
> > > > > +	return pxp->ce;
> > > > > +}
> > > > > +
> > > > > +#ifdef CONFIG_DRM_I915_PXP
> > > > > +void intel_pxp_init(struct intel_pxp *pxp);
> > > > > +void intel_pxp_fini(struct intel_pxp *pxp);
> > > > > +#else
> > > > > +static inline void intel_pxp_init(struct intel_pxp *pxp)
> > > > > +{
> > > > > +}
> > > > > +
> > > > > +static inline void intel_pxp_fini(struct intel_pxp *pxp)
> > > > > +{
> > > > > +}
> > > > > +#endif
> > > > > +
> > > > > +#endif /* __INTEL_PXP_H__ */
> > > > > diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_types.h b/drivers/gpu/drm/i915/pxp/intel_pxp_types.h
> > > > > new file mode 100644
> > > > > index 000000000000..bd12c520e60a
> > > > > --- /dev/null
> > > > > +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_types.h
> > > > > @@ -0,0 +1,15 @@
> > > > > +/* SPDX-License-Identifier: MIT */
> > > > > +/*
> > > > > + * Copyright(c) 2020, Intel Corporation. All rights reserved.
> > > > > + */
> > > > > +
> > > > > +#ifndef __INTEL_PXP_TYPES_H__
> > > > > +#define __INTEL_PXP_TYPES_H__
> > > > > +
> > > > > +struct intel_context;
> > > > > +
> > > > > +struct intel_pxp {
> > > > > +	struct intel_context *ce;
> > > > > +};
> > > > > +
> > > > > +#endif /* __INTEL_PXP_TYPES_H__ */
> > > > 
> > > > -- 
> > > > Jani Nikula, Intel Open Source Graphics Center
> > 
> > -- 
> > Jani Nikula, Intel Open Source Graphics Center


  reply	other threads:[~2021-09-16 15:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 15:36 [PATCH v9 00/17] drm/i915: Introduce Intel PXP Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 01/17] drm/i915/pxp: Define PXP component interface Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 02/17] mei: pxp: export pavp client to me client bus Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 03/17] drm/i915/pxp: define PXP device flag and kconfig Daniele Ceraolo Spurio
2021-09-15 13:29   ` Jani Nikula
2021-09-15 15:24     ` Rodrigo Vivi
2021-09-10 15:36 ` [PATCH v9 04/17] drm/i915/pxp: allocate a vcs context for pxp usage Daniele Ceraolo Spurio
2021-09-15 13:53   ` [Intel-gfx] " Jani Nikula
2021-09-15 21:00     ` Rodrigo Vivi
2021-09-16 11:06       ` Jani Nikula
2021-09-16 13:59         ` Rodrigo Vivi
2021-09-16 15:23           ` Teres Alexis, Alan Previn [this message]
2021-09-10 15:36 ` [PATCH v9 05/17] drm/i915/pxp: Implement funcs to create the TEE channel Daniele Ceraolo Spurio
2021-09-10 18:47   ` [Intel-gfx] " Rodrigo Vivi
2021-09-10 15:36 ` [PATCH v9 06/17] drm/i915/pxp: set KCR reg init Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 07/17] drm/i915/pxp: Create the arbitrary session after boot Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 08/17] drm/i915/pxp: Implement arb session teardown Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 09/17] drm/i915/pxp: Implement PXP irq handler Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 10/17] drm/i915/pxp: interfaces for using protected objects Daniele Ceraolo Spurio
2021-09-10 18:45   ` Rodrigo Vivi
2021-09-10 15:36 ` [PATCH v9 11/17] drm/i915/pxp: start the arb session on demand Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 12/17] drm/i915/pxp: Enable PXP power management Daniele Ceraolo Spurio
2021-09-14 19:13   ` Rodrigo Vivi
2021-09-15 15:11     ` Daniele Ceraolo Spurio
2021-09-15 15:23       ` Rodrigo Vivi
2021-09-16 13:55         ` [Intel-gfx] " Rodrigo Vivi
2021-09-10 15:36 ` [PATCH v9 13/17] drm/i915/pxp: Add plane decryption support Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 14/17] drm/i915/pxp: black pixels on pxp disabled Daniele Ceraolo Spurio
2021-09-10 15:36 ` [PATCH v9 15/17] drm/i915/pxp: add pxp debugfs Daniele Ceraolo Spurio
2021-09-10 22:27   ` [Intel-gfx] " Teres Alexis, Alan Previn
2021-09-10 15:36 ` [PATCH v9 16/17] drm/i915/pxp: add PXP documentation Daniele Ceraolo Spurio
2021-09-10 18:41   ` [Intel-gfx] " Rodrigo Vivi
2021-09-10 15:36 ` [PATCH v9 17/17] drm/i915/pxp: enable PXP for integrated Gen12 Daniele Ceraolo Spurio

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=f1b2658fd050c669f64382e8c73e058081b60dc6.camel@intel.com \
    --to=alan.previn.teres.alexis@intel.com \
    --cc=airlied@redhat.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=rodrigo.vivi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).