lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b7f431f26eea296193d9e49ea85e0377e6ebcf0.camel@imgtec.com>
Date:   Thu, 7 Sep 2023 13:00:28 +0000
From:   Donald Robson <Donald.Robson@...tec.com>
To:     "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "jani.nikula@...ux.intel.com" <jani.nikula@...ux.intel.com>,
        Sarah Walker <Sarah.Walker@...tec.com>
CC:     "corbet@....net" <corbet@....net>,
        "luben.tuikov@....com" <luben.tuikov@....com>,
        "christian.koenig@....com" <christian.koenig@....com>,
        "krzysztof.kozlowski+dt@...aro.org" 
        <krzysztof.kozlowski+dt@...aro.org>,
        "tzimmermann@...e.de" <tzimmermann@...e.de>,
        "mripard@...nel.org" <mripard@...nel.org>,
        "matthew.brost@...el.com" <matthew.brost@...el.com>,
        "afd@...com" <afd@...com>, "hns@...delico.com" <hns@...delico.com>,
        Matt Coster <Matt.Coster@...tec.com>,
        "boris.brezillon@...labora.com" <boris.brezillon@...labora.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "conor+dt@...nel.org" <conor+dt@...nel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "dakr@...hat.com" <dakr@...hat.com>,
        "faith.ekstrand@...labora.com" <faith.ekstrand@...labora.com>
Subject: Re: [PATCH v6 02/20] drm/gpuva_mgr: Helper to get range of unmap from
 a remap op.

On Thu, 2023-09-07 at 15:14 +0300, Jani Nikula wrote:
> On Wed, 06 Sep 2023, Sarah Walker <sarah.walker@...tec.com> wrote:
> > From: Donald Robson <donald.robson@...tec.com>
> > 
> > Signed-off-by: Donald Robson <donald.robson@...tec.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.
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__ */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ