mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Stefan Agner <stefan@agner.ch>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] regmap: clairify max_register meaning
Date: Tue, 19 Jan 2016 17:41:20 +0000	[thread overview]
Message-ID: <20160119174120.GR6588@sirena.org.uk> (raw)
In-Reply-To: <c491d47f13873f6c7fc344a34d6fd141@agner.ch>

[-- Attachment #1: Type: text/plain, Size: 2665 bytes --]

On Mon, Jan 18, 2016 at 09:19:52AM -0800, Stefan Agner wrote:
> On 2016-01-18 08:05, Mark Brown wrote:

> >> Maybe I see something completely wrong here, but to me it seems
> >> that the regcache-flat.c is the only code interpreting max_register
> >> as register indexes rather then the maximum relative address...

> > I don't think I understand what the above means, sorry.  What is a
> > "relative address" in the context of a register map?

> My interpretation:

> relative address = index * stride
> absolute address = base address + relative address

Oh, OK.  I would have got that for absolute address for MMIO but
definitely not relative address.  For relative addresses I'd interpret
index and address as synonyms.

> > Your changelog doesn't actually say this but I think what this is trying
> > to do is make the cache more memory efficient by not allocating space
> > for the registers that don't exist due to striding (ie, if we have a 4
> > byte stride then currently we'll allocate space for 4 times as many
> > registers as actually exist).  That's a reasonable goal but I don't
> > immediately have a good idea for doing it bearing in mind that we are
> > very performance sensitive here.

> Yeah I saw a bug in that, but I see that this is actually just a not
> very space efficient implementation detail.

Indeed.  It is true that having that 300% overhead in a common case is a
bit annoying so if you do have any ideas for fixing that without taking
a performance hit that'd be really good.

> >> - * @max_register: Optional, specifies the maximum valid register index.
> >> + * @max_register: Optional, specifies the maximum valid register address.

> > This is reasonable (index and address are synonyms here).
> 
> Ok, in that case I clearly interpreted index wrong.

> Btw, range_min and range_max in struct regmap_range_cfg are defined as
> memory addresses:
> ...
>  * @range_min: Address of the lowest register address in virtual range. 
>         
>  * @range_max: Address of the highest register in virtual range.
> ...

Not memory addresses, register addresses.  Remember that most regmap
register maps are not memory mapped at all but rather are completely
separate ranges on some external device (especially things using ranges,
you're normally not short enough on addresses on a memory mapped device
to bother with a window) so when looking at memory mapped devices it's
best to think only of the area that's actually mapped into the regmap.

> Will send out a patch for the documentation change only, if you think
> that this is a reasonable change too?

Yes, please do.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      reply	other threads:[~2016-01-19 17:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18  6:52 Stefan Agner
2016-01-18 16:05 ` Mark Brown
2016-01-18 17:19   ` Stefan Agner
2016-01-19 17:41     ` Mark Brown [this message]

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=20160119174120.GR6588@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefan@agner.ch \
    /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

all inboxes | Powered by JetHome®