From: Jonathan Austin <jonathan.austin@arm.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: v7_flush_kern_cache_louis flushes up to L2?
Date: Wed, 10 Apr 2013 13:35:05 +0000 [thread overview]
Message-ID: <51656A89.9090600@arm.com> (raw)
In-Reply-To: <CABYn4swK_FB+nPO4vKZM8khp+mjaPwkAv_GF+XDg5SYz0VLf0Q@mail.gmail.com>
Hi again Bastian,
On 10/04/13 13:16, Bastian Hecht wrote:
[...]
>>> This flushes the data out up to the L2, right? The ARM docs say that
>>> the Point of Unification would be my L2. I'm a bit confused by the
>>> term "Level of Unification Inner Shareable" (that states that in an
>>> SMP system L1 coherency is guaranteed and all is flushed to the L2?).
>>>
>>
>> As you say, for the A9 (from the TRM) the CLIDR reports LoUIS is the same as
>> LoUU and both specify L2.
>
> Ok, this is the golden info I was looking for. So after cpu_suspend()
> I am good with the following sequence?
> flush L2 (outer_flush_all)
> disable L2 (outer_disable)
> Clear the SCTLR.C bit and issue an "isb"
> flush L1 (v7_flush_dcache_all)
This looks good but I think there's a minor modification to be made to
the sequence here:
After you turn of the caches with the SCTLR.C bit, you can no longer hit
in the L1 cache:
SCTLR.C = 0:
"The Cortex-A9 L1 Data Cache is not enabled. All memory accesses to
Normal Memory Cacheable regions are treated as Normal Memory
Non-Cacheable, without lookup and without allocation in the L1 Data Cache."
If you had dirty data in the L1 cache you will lose it at that point.
So, you should flush L1 before turning off caches.
Note that on SMP, you would also need to clean/flush again after turning
off the caches, as read-speculation could have sucked dirty data from
another cache in to your cache, which would need to be written back
before sleeping.
> cpu_do_idle
>
> and for resume:
> invalidate L1
How do you plan to do this? I notice that there's an increasing tendency
to call v7_invalidate_l1 which isn't actually part of the cacheflush API
(see arch/arm/include/asm/cacheflush.h arch/arm/include/asm/glue-cache.h...)
Does your cache definitely come up in an undefined state? If not, could
you use v7_flush_dcache_all? (see the comment above v7_invalidate_l1 in
arch/arm/mm/cache-v7.S)
Hope that helps,
Jonny
WARNING: multiple messages have this Message-ID (diff)
From: jonathan.austin@arm.com (Jonathan Austin)
To: linux-arm-kernel@lists.infradead.org
Subject: v7_flush_kern_cache_louis flushes up to L2?
Date: Wed, 10 Apr 2013 14:35:05 +0100 [thread overview]
Message-ID: <51656A89.9090600@arm.com> (raw)
In-Reply-To: <CABYn4swK_FB+nPO4vKZM8khp+mjaPwkAv_GF+XDg5SYz0VLf0Q@mail.gmail.com>
Hi again Bastian,
On 10/04/13 13:16, Bastian Hecht wrote:
[...]
>>> This flushes the data out up to the L2, right? The ARM docs say that
>>> the Point of Unification would be my L2. I'm a bit confused by the
>>> term "Level of Unification Inner Shareable" (that states that in an
>>> SMP system L1 coherency is guaranteed and all is flushed to the L2?).
>>>
>>
>> As you say, for the A9 (from the TRM) the CLIDR reports LoUIS is the same as
>> LoUU and both specify L2.
>
> Ok, this is the golden info I was looking for. So after cpu_suspend()
> I am good with the following sequence?
> flush L2 (outer_flush_all)
> disable L2 (outer_disable)
> Clear the SCTLR.C bit and issue an "isb"
> flush L1 (v7_flush_dcache_all)
This looks good but I think there's a minor modification to be made to
the sequence here:
After you turn of the caches with the SCTLR.C bit, you can no longer hit
in the L1 cache:
SCTLR.C = 0:
"The Cortex-A9 L1 Data Cache is not enabled. All memory accesses to
Normal Memory Cacheable regions are treated as Normal Memory
Non-Cacheable, without lookup and without allocation in the L1 Data Cache."
If you had dirty data in the L1 cache you will lose it at that point.
So, you should flush L1 before turning off caches.
Note that on SMP, you would also need to clean/flush again after turning
off the caches, as read-speculation could have sucked dirty data from
another cache in to your cache, which would need to be written back
before sleeping.
> cpu_do_idle
>
> and for resume:
> invalidate L1
How do you plan to do this? I notice that there's an increasing tendency
to call v7_invalidate_l1 which isn't actually part of the cacheflush API
(see arch/arm/include/asm/cacheflush.h arch/arm/include/asm/glue-cache.h...)
Does your cache definitely come up in an undefined state? If not, could
you use v7_flush_dcache_all? (see the comment above v7_invalidate_l1 in
arch/arm/mm/cache-v7.S)
Hope that helps,
Jonny
next prev parent reply other threads:[~2013-04-10 13:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 10:43 v7_flush_kern_cache_louis flushes up to L2? Bastian Hecht
2013-04-10 10:43 ` Bastian Hecht
2013-04-10 11:51 ` Jonathan Austin
2013-04-10 11:51 ` Jonathan Austin
2013-04-10 12:16 ` Bastian Hecht
2013-04-10 12:16 ` Bastian Hecht
2013-04-10 13:35 ` Jonathan Austin [this message]
2013-04-10 13:35 ` Jonathan Austin
2013-04-10 14:49 ` Bastian Hecht
2013-04-10 14:49 ` Bastian Hecht
2013-04-19 10:21 ` Russell King - ARM Linux
2013-04-19 10:21 ` Russell King - ARM Linux
2013-04-19 10:48 ` Russell King - ARM Linux
2013-04-19 10:48 ` Russell King - ARM Linux
2013-04-10 13:51 ` Lorenzo Pieralisi
2013-04-10 13:51 ` Lorenzo Pieralisi
2013-04-10 15:08 ` Bastian Hecht
2013-04-10 15:08 ` Bastian Hecht
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=51656A89.9090600@arm.com \
--to=jonathan.austin@arm.com \
--cc=linux-arm-kernel@lists.infradead.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 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.