All of lore.kernel.org
 help / color / mirror / Atom feed
From: R, Sricharan <r.sricharan@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] cache_v7: Check for dcache enablement in dcache flush functions
Date: Thu, 28 Jun 2012 11:19:18 +0530	[thread overview]
Message-ID: <CAJ7qFScKcXKw2pgNHEK-vD6xp2gGQOqNAhdp9TVFdsZr-3yPiA@mail.gmail.com> (raw)
In-Reply-To: <4FEB99E6.4070204@ti.com>

Aneesh,
[snip..]
>>>>>>>> If we are built with D-CACHE enabled but have run 'dcache off' and
>>>>
>>>> then
>>>>>>>>
>>>>>>>> attempt to flush unaligned regions we spam the console with
>>>>
>>>> problems
>>>>>>>>
>>>>>>>> that aren't true (as the cache was off).
>>>>>>>>
>>>>>>> ? ?Today we do cache maintenance operations after the dcache is
>>>>
>>>> turned off.
>>>>>>>
>>>>>>> ? ?One example is before jumping to kernel, we try to invalidate
>>>>
>>>> the caches,
>>>>>>>
>>>>>>> ? ?in cache turned off state. So with this patch those maintenance
>>>>
>>>> calls will
>>>>>>>
>>>>>>> ? ?do nothing, which is not correct.
>>>>>>
>>>>>>
>>>>>> Ah yes, ?But, shouldn't we be doing these same operations as part of
>>>>>> turning the cache off?
>>>>>>
>>>>> ? ?The problem is that while turning of dcaches, we flush it, and
>>>>
>>>> turn
>>>>>
>>>>> ? cache and MMU off. ?But these operations are not happening
>>>>> ? automatically in a single call. So there is a chance of ?valid
>>>>> ? entries present in cache even after it is OFF.
>>>>
>>>>
>>>> I think this is what we need to fix. Otherwise, Tom's change looks good
>>>> to me. How about an invalidate in dcache_disable() or something like
>>>> that?
>>>>
>>> ?Correct. So if the cleaning up sequence is fine, then ok.
>>> ?So there should be no need to check if caches are OFF inside
>>> ?the maintenance functions. Kernel does not looks like doing such checks.
>>> ?The real issue looks like we should have had assembly level functions
>>> ?to do the cleanup routines for flush-invalidate-turn OFF caches/MM
>>> atomically.
>>
>> ? Actually, with something like speculation in the behind, only way of
>> ensuring that
>> ? ?we do not have any valid entries is to do a invalidate all, after
>> turn of caches/mmu.
>> ? ?So this means that we will have a maintenance after turning off.
>
>
> Good point. But we need that invalidate just one last time after the
> disable, right? How about making the cache_status a variable rather
> than reading the C bit. And then disable_cache() shall be like this:
>
> 1. Flush all
> 2. Disable C bit
> 3. Invalidate all
> 4. cache_status = disabled
>
> Maybe, not the best solution. But I can't think of anything better.
> Please note that after this point there won't be any valid entries in
> the cache per ARMv7 Architecture reference manual(section B2.2.2):
>
> "If the cache is disabled, it is guaranteed that no new allocation of memory
> locations into the cache will occur."

  I agree on this sequence. But the only thing is, is it good to turn off
  the caches runtime, because one driver cant do aligned access ?
 Will this then not become a custom, say any other driver which
 sees problem with cache, will then simply go ahead disable and proceed.
  Is that right ?.
 yes, having enabled caches we are missing things like UNCACHED allocations,
 IO etc, but that is going to make boot loaders more heavy, may be.

  In the end, I am not sure which is the right decision to take here :)

Thanks,
 Sricharan

  reply	other threads:[~2012-06-28  5:49 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 19:01 [U-Boot] [PATCH 0/4] USB and cache related fixes Tom Rini
2012-06-14 19:01 ` [U-Boot] [PATCH 1/4] ehci-omap: Do not call dcache_off from omap_ehci_hcd_init Tom Rini
2012-06-14 21:57   ` Marek Vasut
2012-06-14 22:14     ` Tom Rini
2012-06-14 19:01 ` [U-Boot] [PATCH 2/4] cache_v7: Check for dcache enablement in dcache flush functions Tom Rini
2012-06-14 22:00   ` Marek Vasut
2012-06-14 22:11     ` Tom Rini
2012-06-14 23:17       ` Marek Vasut
2012-06-15  5:48   ` R, Sricharan
2012-06-15 14:07     ` Tom Rini
2012-06-15 14:25       ` Marek Vasut
2012-06-15 14:30         ` Tom Rini
2012-06-15 14:33           ` Marek Vasut
2012-06-15 14:48       ` R, Sricharan
2012-06-15 15:00         ` Tom Rini
2012-06-15 15:18           ` R, Sricharan
2012-06-15 15:20             ` Tom Rini
2012-06-18 14:13               ` R, Sricharan
2012-06-18 15:23                 ` Tom Rini
2012-06-20 16:46         ` Aneesh V
2012-06-21  9:25           ` Sricharan R
2012-06-21 15:23             ` R, Sricharan
2012-06-27 23:40               ` Aneesh V
2012-06-28  5:49                 ` R, Sricharan [this message]
2012-06-27 23:17             ` Aneesh V
2012-06-14 19:01 ` [U-Boot] [PATCH 3/4] ehci-hcd.c: Add a new USB_DMA_MINALIGN define for cache alignment Tom Rini
2012-06-14 19:29   ` Marek Vasut
2012-06-14 19:30     ` Tom Rini
2012-06-14 19:41       ` Marek Vasut
2012-06-14 19:54         ` Tom Rini
2012-06-14 20:02           ` Marek Vasut
2012-06-14 19:01 ` [U-Boot] [PATCH 4/4] musb_core.h: " Tom Rini
2012-06-14 21:45 ` [U-Boot] [PATCH v2 0/3] USB and cache related fixes Tom Rini
2012-06-14 21:45   ` [U-Boot] [PATCH v2 1/3] ehci-omap: Do not call dcache_off from omap_ehci_hcd_init Tom Rini
2012-06-14 21:45   ` [U-Boot] [PATCH v2 2/3] cache_v7: Check for dcache enablement in dcache flush functions Tom Rini
2012-06-14 21:45   ` [U-Boot] [PATCH v2 3/3] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment Tom Rini
2012-06-20 16:21   ` [U-Boot] [PATCH v3 0/6] USB and cache related fixes Tom Rini
2012-06-20 16:21     ` [U-Boot] [PATCH v3 1/6] ehci-omap: Do not call dcache_off from omap_ehci_hcd_init Tom Rini
2012-06-20 16:21     ` [U-Boot] [PATCH v3 2/6] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment Tom Rini
2012-06-20 19:00       ` Marek Vasut
2012-06-20 19:15         ` Tom Rini
2012-06-20 21:15           ` Marek Vasut
2012-06-20 22:07             ` Tom Rini
2012-06-21  0:09               ` Marek Vasut
2012-06-20 16:21     ` [U-Boot] [PATCH v3 3/6] mcx: Disable DCACHE since USB EHCI is enabled Tom Rini
2012-06-20 16:21     ` [U-Boot] [PATCH v3 4/6] omap3_beagle: " Tom Rini
2012-06-20 16:21     ` [U-Boot] [PATCH v3 5/6] omap4_panda: " Tom Rini
2012-06-20 16:21     ` [U-Boot] [PATCH v3 6/6] tam3517-common: " Tom Rini
2012-06-20 22:14     ` [U-Boot] [PATCH v4 0/6] USB and cache related fixes Tom Rini
2012-06-20 22:14       ` [U-Boot] [PATCH v4 1/6] ehci-omap: Do not call dcache_off from omap_ehci_hcd_init Tom Rini
2012-06-20 22:14       ` [U-Boot] [PATCH v4 2/6] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment Tom Rini
2012-06-20 22:14       ` [U-Boot] [PATCH v4 3/6] mcx: Disable DCACHE since USB EHCI is enabled Tom Rini
2012-06-27 22:28         ` Ilya Yanok
2012-06-27 22:48           ` Marek Vasut
2012-06-28 13:57             ` Ilya Yanok
2012-06-28 14:37               ` Marek Vasut
2012-06-28 14:57                 ` Ilya Yanok
2012-06-28 15:41                   ` Marek Vasut
2012-06-30 15:51                     ` Ilya Yanok
2012-06-30 19:27                       ` Marek Vasut
2012-07-03 20:10                         ` Ilya Yanok
2012-07-03 21:23                           ` Marek Vasut
2012-06-28 17:29                 ` Tom Rini
2012-06-28 22:01                   ` Marek Vasut
2012-06-28 22:34                     ` Tom Rini
2012-06-28 22:36                       ` Marek Vasut
2012-06-28 23:01                         ` Tom Rini
2012-06-29  0:54                           ` Marek Vasut
2012-06-29  2:14                             ` Tom Rini
2012-06-30 15:55                             ` Ilya Yanok
2012-06-30 19:28                               ` Marek Vasut
2012-07-03 20:13                                 ` Ilya Yanok
2012-07-03 20:43                                   ` Tom Rini
2012-07-03 21:12                                     ` Ilya Yanok
2012-07-04  0:14                                       ` Marek Vasut
2012-07-04 13:08                                         ` Ilya Yanok
2012-07-03 21:24                                     ` Marek Vasut
2012-06-20 22:14       ` [U-Boot] [PATCH v4 4/6] omap3_beagle: " Tom Rini
2012-06-20 22:14       ` [U-Boot] [PATCH v4 5/6] omap4_panda: " Tom Rini
2012-06-21 11:19         ` Sricharan R
2012-06-21 16:40           ` R, Sricharan
2012-06-20 22:14       ` [U-Boot] [PATCH v4 6/6] tam3517-common: " Tom Rini
2012-06-14 22:02 ` [U-Boot] [PATCH 0/4] USB and cache related fixes Marek Vasut
2012-06-14 22:13   ` Tom Rini
2012-06-14 23:17     ` Marek Vasut

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=CAJ7qFScKcXKw2pgNHEK-vD6xp2gGQOqNAhdp9TVFdsZr-3yPiA@mail.gmail.com \
    --to=r.sricharan@ti.com \
    --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.