All of lore.kernel.org
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: Cache line size definition in arch/arm/mm/Kconfig
Date: Fri, 27 Mar 2015 12:06:01 +0000	[thread overview]
Message-ID: <20150327120601.GB4019@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <5515423E.4020802@free.fr>

On Fri, Mar 27, 2015 at 12:42:54PM +0100, Mason wrote:
> On 25/03/2015 15:35, Mason wrote:
> 
> >AFAICT, L1 cache line size is specified in arch/arm/mm/Kconfig
> >
> >config ARM_L1_CACHE_SHIFT_6
> >     bool
> >     default y if CPU_V7
> >     help
> >       Setting ARM L1 cache line size to 64 Bytes.
> >
> >config ARM_L1_CACHE_SHIFT
> >     int
> >     default 6 if ARM_L1_CACHE_SHIFT_6
> >     default 5
> >
> >
> >I'm using a Cortex A9 MPCore. If I'm not mistaken, the cache line size
> >is 32 bytes, even though this CPU is ARMv7.
> >
> >http://infocenter.arm.com/help/topic/com.arm.doc.ddi0388g/Caccifbd.html
> >
> >>The Cortex-A9 processor has separate instruction and data caches.
> >>The caches have the following features:
> >>
> >>  Each cache can be disabled independently. See System Control Register.
> >>  Both caches are 4-way set-associative.
> >>  The cache line length is eight words.
> >>  On a cache miss, critical word first filling of the cache is performed.
> >>  You can configure the instruction and data caches independently during implementation to sizes of 16KB, 32KB, or 64KB.
> >>  To reduce power consumption, the number of full cache reads is reduced by taking advantage of the sequential nature of many cache operations. If a cache read is sequential to the previous cache read, and the read is within the same cache line, only the data RAM set that was previously read is accessed.
> >
> >How do I set ARM_L1_CACHE_SHIFT_6 to 'n' in my platform Kconfig?
> >
> >Or perhaps I should "override" ARM_L1_CACHE_SHIFT to 5 (again in
> >my platform Kconfig). I don't know the syntax to do that.
> >
> >Could someone point out the correct way?
> 
> Would someone care to comment? :-)

No :)

What you've found is the _static_ L1 cache line size setting, which is
used at _compile_ time to align structures while building.  To allow
maximum flexibility - and because there are 64-byte cache line ARMv7
implementations around - we have decided that the _compile time_
cache line size will be 64 bytes.

As far as cache operations are concerned, they will know the correct
cache line size for the CPU which they're running on, so the code
will adapt.

It has the side effect that some allocators also assume that the L1
cache line size is 64 bytes.

It's better to have a larger than necessary cache line size than a
smaller one, because a larger one is automatically aligned to the
smaller sizes.

In other words, this is totally intentional.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2015-03-27 12:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25 14:35 Cache line size definition in arch/arm/mm/Kconfig Mason
2015-03-27 11:42 ` Mason
2015-03-27 12:06   ` Russell King - ARM Linux [this message]
2015-03-27 13:45     ` Mason
2015-04-01 11:42       ` Mason
2015-04-01 11:50         ` Russell King - ARM Linux
2015-04-01 14:06           ` Mason

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=20150327120601.GB4019@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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.