All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@avionic-design.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] mmc: tegra: invalidate complete cachelines
Date: Thu, 26 Apr 2012 12:34:43 +0200	[thread overview]
Message-ID: <20120426103443.GA11972@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <CAPnjgZ2seqgynpruHZkHjuGHJKORx488Y4d51ZyXUyPbmZGf3Q@mail.gmail.com>

* Simon Glass wrote:
> Hi Thierry,
> 
> On Thu, Apr 26, 2012 at 6:18 PM, Thierry Reding <
> thierry.reding at avionic-design.de> wrote:
> 
> > * Mike Frysinger wrote:
> > > On Tuesday 24 April 2012 03:53:44 Thierry Reding wrote:
> > > > The MMC core sometimes reads buffers that are smaller than a complete
> > > > cacheline, for example when reading the SCR. In order to avoid a
> > warning
> > > > from the ARM v7 cache handling code, this patch makes sure that
> > complete
> > > > cachelines are flushed.
> > >
> > > this is still wrong.  all you've done is bypass the error message without
> > > addressing the underlying problem -- you're invalidating too much.
> >
> > Reading 8 bytes is always less than a cacheline, so we don't have much
> > choice, do we? We could of course always read a whole cacheline even if
> > only
> > 8 bytes are requested, but does that have any advantage over reading 8
> > bytes
> > and then invalidating the cacheline?
> >
> > Or maybe I'm missing the point.
> >
> 
> Well the point is that you can read 8 bytes but you still must use a buffer
> that is large enough for DMA activity. So the caller must allocate a buffer
> larger than 8 bytes.

The buffer used in this case is allocated with the ALLOC_CACHE_ALIGN_BUFFER()
macro, so the buffer size is not an issue. However, the mmc_data structure's
blocksize field is set to 8, which is the value that will eventually end up
in invalidate_dcache_range().

For reference, see sd_change_freq() in drivers/mmc/mmc.c.

> I worry that what you have done will just introduce obscure bugs, since we
> will potentially invalidate stack variants (for example) and lose their
> values.
> 
> With the case problems, we are trying to fix them at source (i.e. at the
> higher level).

I understand. The question then becomes how to best fix the passed in size.
Always passing the size of a complete cacheline in the SEND_SCR command
doesn't seem like a better option because it may have other implications on
other hardware.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120426/778720f5/attachment.pgp>

  reply	other threads:[~2012-04-26 10:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24  7:53 [U-Boot] [PATCH 1/2] part_dos: allocate cacheline aligned buffers Thierry Reding
2012-04-24  7:53 ` [U-Boot] [PATCH 2/2] mmc: tegra: invalidate complete cachelines Thierry Reding
2012-04-25 22:54   ` Mike Frysinger
2012-04-26  6:18     ` Thierry Reding
2012-04-26 10:16       ` Simon Glass
2012-04-26 10:34         ` Thierry Reding [this message]
2012-04-27  5:29           ` Mike Frysinger
2012-04-27  5:50             ` Simon Glass
2012-11-02 20:22             ` Stephen Warren
2012-11-02 20:25               ` Simon Glass
2012-11-02 20:38                 ` Marek Vasut
2012-11-02 20:58                   ` Stephen Warren
2012-11-02 21:28                     ` Marek Vasut
2012-11-02 21:31                       ` Stephen Warren
2012-11-02 22:10                         ` Marek Vasut
2012-11-05 19:50                           ` Stephen Warren
2012-11-05 22:59                             ` Marek Vasut
2012-11-05 23:07                             ` Simon Glass
2012-11-02 20:55                 ` Stephen Warren
2012-04-24 18:31 ` [U-Boot] [PATCH 1/2] part_dos: allocate cacheline aligned buffers Simon Glass
2012-04-24 18:45   ` Thierry Reding

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=20120426103443.GA11972@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding@avionic-design.de \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.