From: Jani Nikula <jani.nikula@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
Chris Wilson <chris@chris-wilson.co.uk>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Dave Airlie <airlied@redhat.com>
Subject: Re: [Intel-gfx] [PATCH v9 04/17] drm/i915/pxp: allocate a vcs context for pxp usage
Date: Thu, 16 Sep 2021 14:06:56 +0300 [thread overview]
Message-ID: <87bl4swzhr.fsf@intel.com> (raw)
In-Reply-To: <YUJe4Az/in46lPkg@intel.com>
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.
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
next prev parent reply other threads:[~2021-09-16 11:07 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-10 15:36 [Intel-gfx] [PATCH v9 00/17] drm/i915: Introduce Intel PXP Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 01/17] drm/i915/pxp: Define PXP component interface Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 02/17] mei: pxp: export pavp client to me client bus Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [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 ` [Intel-gfx] [PATCH v9 04/17] drm/i915/pxp: allocate a vcs context for pxp usage Daniele Ceraolo Spurio
2021-09-15 13:53 ` Jani Nikula
2021-09-15 21:00 ` Rodrigo Vivi
2021-09-16 11:06 ` Jani Nikula [this message]
2021-09-16 13:59 ` Rodrigo Vivi
2021-09-16 15:23 ` Teres Alexis, Alan Previn
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 05/17] drm/i915/pxp: Implement funcs to create the TEE channel Daniele Ceraolo Spurio
2021-09-10 18:47 ` Rodrigo Vivi
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 06/17] drm/i915/pxp: set KCR reg init Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 07/17] drm/i915/pxp: Create the arbitrary session after boot Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 08/17] drm/i915/pxp: Implement arb session teardown Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 09/17] drm/i915/pxp: Implement PXP irq handler Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [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 ` [Intel-gfx] [PATCH v9 11/17] drm/i915/pxp: start the arb session on demand Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [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 ` Rodrigo Vivi
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 13/17] drm/i915/pxp: Add plane decryption support Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 14/17] drm/i915/pxp: black pixels on pxp disabled Daniele Ceraolo Spurio
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 15/17] drm/i915/pxp: add pxp debugfs Daniele Ceraolo Spurio
2021-09-10 22:27 ` Teres Alexis, Alan Previn
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 16/17] drm/i915/pxp: add PXP documentation Daniele Ceraolo Spurio
2021-09-10 18:41 ` Rodrigo Vivi
2021-09-10 15:36 ` [Intel-gfx] [PATCH v9 17/17] drm/i915/pxp: enable PXP for integrated Gen12 Daniele Ceraolo Spurio
2021-09-10 16:12 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Introduce Intel PXP (rev7) Patchwork
2021-09-10 16:14 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-09-10 16:17 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2021-09-10 16:43 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-09-10 18:30 ` [Intel-gfx] ✗ Fi.CI.IGT: 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=87bl4swzhr.fsf@intel.com \
--to=jani.nikula@linux.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=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