devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Donald Robson <Donald.Robson@imgtec.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Sarah Walker <Sarah.Walker@imgtec.com>
Cc: "corbet@lwn.net" <corbet@lwn.net>,
	"luben.tuikov@amd.com" <luben.tuikov@amd.com>,
	"christian.koenig@amd.com" <christian.koenig@amd.com>,
	"krzysztof.kozlowski+dt@linaro.org" 
	<krzysztof.kozlowski+dt@linaro.org>,
	"tzimmermann@suse.de" <tzimmermann@suse.de>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"matthew.brost@intel.com" <matthew.brost@intel.com>,
	"afd@ti.com" <afd@ti.com>,
	"hns@goldelico.com" <hns@goldelico.com>,
	Matt Coster <Matt.Coster@imgtec.com>,
	"boris.brezillon@collabora.com" <boris.brezillon@collabora.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"dakr@redhat.com" <dakr@redhat.com>,
	"faith.ekstrand@collabora.com" <faith.ekstrand@collabora.com>
Subject: Re: [PATCH v6 02/20] drm/gpuva_mgr: Helper to get range of unmap from a remap op.
Date: Thu, 07 Sep 2023 16:15:57 +0300	[thread overview]
Message-ID: <877cp2gm42.fsf@intel.com> (raw)
In-Reply-To: <5b7f431f26eea296193d9e49ea85e0377e6ebcf0.camel@imgtec.com>

On Thu, 07 Sep 2023, Donald Robson <Donald.Robson@imgtec.com> wrote:
> On Thu, 2023-09-07 at 15:14 +0300, Jani Nikula wrote:
>> On Wed, 06 Sep 2023, Sarah Walker <sarah.walker@imgtec.com> wrote:
>> > From: Donald Robson <donald.robson@imgtec.com>
>> > 
>> > Signed-off-by: Donald Robson <donald.robson@imgtec.com>
>> > ---
>> >  include/drm/drm_gpuva_mgr.h | 27 +++++++++++++++++++++++++++
>> >  1 file changed, 27 insertions(+)
>> > 
>> > diff --git a/include/drm/drm_gpuva_mgr.h b/include/drm/drm_gpuva_mgr.h
>> > index ed8d50200cc3..be7b3a6d7e67 100644
>> > --- a/include/drm/drm_gpuva_mgr.h
>> > +++ b/include/drm/drm_gpuva_mgr.h
>> > @@ -703,4 +703,31 @@ void drm_gpuva_remap(struct drm_gpuva *prev,
>> >  
>> >  void drm_gpuva_unmap(struct drm_gpuva_op_unmap *op);
>> >  
>> > +/**
>> > + * drm_gpuva_op_remap_get_unmap_range() - Helper to get the start and range of
>> > + * the unmap stage of a remap op.
>> > + * @op: Remap op.
>> > + * @start_addr: Output pointer for the start of the required unmap.
>> > + * @range: Output pointer for the length of the required unmap.
>> > + *
>> > + * These parameters can then be used by the caller to unmap memory pages that
>> > + * are no longer required.
>> > + */
>> > +static __always_inline void
>> 
>> IMO __always_inline *always* requires a justification in the commit
>> message.
>> 
>> BR,
>> Jani.
>
> Hi Jani,
> I went with __always_inline because I can't see this being used more than once per driver.
> I can add that to the commit message, but is that suitable justification? I could move
> it to the source file or make it a macro if you prefer.

My personal opinion is that static inlines in general should always have
a performance justification. If there isn't one, it should be a regular
function. Static inlines leak the abstractions and often make the header
dependencies worse.

Not everyone agrees, of course.

More than anything I was looking for justification on __always_inline
rather than just inline, though.


BR,
Jani.



> Thanks,
> Donald
>> 
>> 
>> > +drm_gpuva_op_remap_get_unmap_range(const struct drm_gpuva_op_remap *op,
>> > +				   u64 *start_addr, u64 *range)
>> > +{
>> > +	const u64 va_start = op->prev ?
>> > +			     op->prev->va.addr + op->prev->va.range :
>> > +			     op->unmap->va->va.addr;
>> > +	const u64 va_end = op->next ?
>> > +			   op->next->va.addr :
>> > +			   op->unmap->va->va.addr + op->unmap->va->va.range;
>> > +
>> > +	if (start_addr)
>> > +		*start_addr = va_start;
>> > +	if (range)
>> > +		*range = va_end - va_start;
>> > +}
>> > +
>> >  #endif /* __DRM_GPUVA_MGR_H__ */

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2023-09-07 16:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06  9:55 [PATCH v6 00/20] Imagination Technologies PowerVR DRM driver Sarah Walker
2023-09-06  9:55 ` [PATCH v6 01/20] sizes.h: Add entries between 32G and 64T Sarah Walker
2023-09-06  9:55 ` [PATCH v6 02/20] drm/gpuva_mgr: Helper to get range of unmap from a remap op Sarah Walker
2023-09-06 11:35   ` Maxime Ripard
2023-09-06 11:46     ` Sarah Walker
2023-09-07 12:14   ` Jani Nikula
2023-09-07 13:00     ` Donald Robson
2023-09-07 13:15       ` Jani Nikula [this message]
2023-09-06  9:55 ` [PATCH v6 03/20] dt-bindings: gpu: Add Imagination Technologies PowerVR/IMG GPU Sarah Walker
2023-09-06 11:36   ` Maxime Ripard
2023-09-06 11:36   ` Maxime Ripard
2023-09-06 19:03   ` Linus Walleij
2023-09-07 10:20   ` Conor Dooley
2023-09-06  9:55 ` [PATCH v6 04/20] drm/imagination/uapi: Add PowerVR driver UAPI Sarah Walker
     [not found]   ` <CAD_bs+qdnVPYbmtzqcpCC8xdLVNvDb8uNccsd=P6YX+sgMG6Xg@mail.gmail.com>
2023-09-22 18:46     ` Andrew Davis
2023-09-25  0:41   ` Dave Airlie
2023-09-06  9:55 ` [PATCH v6 05/20] drm/imagination: Add skeleton PowerVR driver Sarah Walker
2023-09-06  9:55 ` [PATCH v6 06/20] drm/imagination: Get GPU resources Sarah Walker
2023-09-06  9:55 ` [PATCH v6 07/20] drm/imagination: Add GPU register headers Sarah Walker
2023-09-06 11:53   ` Maxime Ripard
2023-09-06  9:55 ` [PATCH v6 08/20] drm/imagination: Add firmware and MMU related headers Sarah Walker
2023-09-06 11:55   ` Maxime Ripard
2023-09-06  9:55 ` [PATCH v6 09/20] drm/imagination: Add FWIF headers Sarah Walker
2023-09-06 11:44   ` Maxime Ripard
2023-09-06  9:55 ` [PATCH v6 10/20] drm/imagination: Add GPU ID parsing and firmware loading Sarah Walker
2023-09-06  9:55 ` [PATCH v6 11/20] drm/imagination: Add GEM and VM related code Sarah Walker
2023-09-06  9:55 ` [PATCH v6 12/20] drm/imagination: Implement power management Sarah Walker
2023-09-06  9:55 ` [PATCH v6 13/20] drm/imagination: Implement firmware infrastructure and META FW support Sarah Walker
2023-09-06  9:55 ` [PATCH v6 14/20] drm/imagination: Implement MIPS firmware processor and MMU support Sarah Walker
2023-09-06  9:55 ` [PATCH v6 15/20] drm/imagination: Implement free list and HWRT create and destroy ioctls Sarah Walker
2023-09-06  9:55 ` [PATCH v6 16/20] drm/imagination: Implement context creation/destruction ioctls Sarah Walker
2023-09-06  9:55 ` [PATCH v6 17/20] drm/imagination: Implement job submission and scheduling Sarah Walker
2023-09-06  9:55 ` [PATCH v6 18/20] drm/imagination: Add firmware trace header Sarah Walker
2023-09-06  9:55 ` [PATCH v6 19/20] drm/imagination: Add firmware trace to debugfs Sarah Walker
2023-09-06  9:55 ` [PATCH v6 20/20] drm/imagination: Add driver documentation Sarah Walker

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=877cp2gm42.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=Donald.Robson@imgtec.com \
    --cc=Matt.Coster@imgtec.com \
    --cc=Sarah.Walker@imgtec.com \
    --cc=afd@ti.com \
    --cc=boris.brezillon@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dakr@redhat.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=faith.ekstrand@collabora.com \
    --cc=hns@goldelico.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luben.tuikov@amd.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tzimmermann@suse.de \
    /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).