From: "Andrew F. Davis" <afd@ti.com>
To: Mark Brown <broonie@kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] regcache: flat: Add valid bit to this cache type
Date: Mon, 8 Jan 2018 10:46:58 -0600 [thread overview]
Message-ID: <03e5f22a-b08b-9923-61fe-be93588c4967@ti.com> (raw)
In-Reply-To: <20180108163606.GH11698@sirena.org.uk>
On 01/08/2018 10:36 AM, Mark Brown wrote:
> On Mon, Jan 08, 2018 at 10:25:28AM -0600, Andrew F. Davis wrote:
>
>> I can understand the need for a fast cache type, but without this change
>> the implementation is simply wrong IMHO. Reading from a register that
>> has not been read/written to should not just assume the default value is
>> 0, it should first read and load the real initial value into the cache,
>> just like other cache types do.
>
> Users are supposed to ensure that the cache is fully initialized either
> by supplying defaults or writing to all the registers. Adding reads is
> problematic since we'd suddenly start reading from hardware which might
> not like it.
>
This does not appear documented anywhere, and is counter to the basic
definition of how a cache should work.
If the hardware does not like reads then the registers should be marked
as not readable in their regmap config, if they don't do this then they
need fixed, not the cache scheme.
For my device, I cannot know beforehand what is in some registers as
they change from device to device, and if I do a read to find out it
will *always* return 0 as this cache type is broken. Other types work as
expected, fetching the real initial value. My only alternative is to
turn off cache, read, turn on cache, write, then continue as before..
>> Also, it looks like this cache type is used mostly in I2C devices
>> (outside of sound/soc/, where in there, like you said MMIO devices are
>> more common).
>
> Sounds like a good thing to do an audit and contribute fixes for...
>
My guess is most assumed what I did and they only got lucky as all their
device registers were default 0 anyway. In which case the results before
and after this patch will be the same.
next prev parent reply other threads:[~2018-01-08 16:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-07 23:22 [PATCH 1/3] regcache: flat: Use cache element type in sizeof Andrew F. Davis
2018-01-07 23:22 ` [PATCH 2/3] regcache: flat: Un-inline index lookup from cache access Andrew F. Davis
2018-01-07 23:22 ` [PATCH 3/3] regcache: flat: Add valid bit to this cache type Andrew F. Davis
2018-01-08 12:08 ` Mark Brown
2018-01-08 16:25 ` Andrew F. Davis
2018-01-08 16:36 ` Mark Brown
2018-01-08 16:46 ` Andrew F. Davis [this message]
2018-01-09 16:24 ` Mark Brown
2018-01-09 17:47 ` Andrew F. Davis
2018-01-10 12:02 ` Mark Brown
2018-01-08 11:59 ` [PATCH 1/3] regcache: flat: Use cache element type in sizeof Mark Brown
2018-01-08 16:25 ` Andrew F. Davis
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=03e5f22a-b08b-9923-61fe-be93588c4967@ti.com \
--to=afd@ti.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®