From: "Kevin D. Kissell" <kevink@mips.com>
To: "Jun Sun" <jsun@mvista.com>
Cc: <linux@cthulhu.engr.sgi.com>, <linux-mips@fnet.fr>, <ralf@oss.sgi.com>
Subject: Re: PROPOSAL : multi-way cache support in Linux/MIPS
Date: Wed, 2 Aug 2000 20:15:24 +0200 [thread overview]
Message-ID: <01ac01bffcad$a767c240$0deca8c0@Ulysses> (raw)
-->A couple of questions :
>
>. What about the actual cache operation routines (flush_cache_page,
>...)? Are they divided into R4xxx, R3xx, etc? I guess I am curious how
>the code is organized.
We kept pretty much the existing 2.2 structure for these things.
We created the module "r4k.c" in arch/mips/mm which was
essentially parallel to the old r4xx0.c module, but which implemented
the various TLB and cache functions (a) using the information in
the mips_cpu structure wherever it made sense and (b) in ways
that are fully compatible with the "MIPS32" ISA+CP0 model
as well as with the original R4000 family and its descendants.
It's possible to write code that is compatible with an R4000 but
not MIPS32, and vice versa, but they are 99% identical.
>. Your structure gives the number of ways, but no info about how to
>select a way. How would do an index-based cache operation? It seems to
>me you probably need something like cache_way_selection_offset in the
>cpu table.
The MIPS32 spec for the CACHE instruction gives a trivial
mapping from sets/ways/linesize into CACHE instruction
operands. In fact, the same technique works for most pre
MIPS32 multi-way caches as well. The only exception that
comes to mind is the R10000. If one wanted to support the
R10K or other oddball CACHE-implementations in this
system, I would suggest adding a MIPS_CACHE_R10KWAYSEL
or some flag to the flags field of the cache descriptor,
and tweaking any routines that need to select indices
(such a routine to hunt down and kill all possible virtual
aliases of an address) to handle the special case.
The primitives in Linux 2.2 did not require much knowedge
of multi-way caches as such - they could all be implemented
either using hit-based CACHE operations, or by cycling
through all possible indices using knowledge of the total
size and the line size. But the newer synthesizable MIPS
cores allow cache configurations to be "dialed in" in ways
that the old code could not handle. The CPUs themselves
can be interrogated to determine the line size/nways/nsets
geometry, so we mirror that in the Linux code and use those
parameters to compute total size, way size, etc. The
PrID-based lookup table and the dynamic probe routines
are there to allow older parts to use the same mechanisms.
Regards,
Kevin K.
WARNING: multiple messages have this Message-ID (diff)
From: "Kevin D. Kissell" <kevink@mips.com>
To: Jun Sun <jsun@mvista.com>
Cc: linux@cthulhu.engr.sgi.com, linux-mips@fnet.fr, ralf@oss.sgi.com
Subject: Re: PROPOSAL : multi-way cache support in Linux/MIPS
Date: Wed, 2 Aug 2000 20:15:24 +0200 [thread overview]
Message-ID: <01ac01bffcad$a767c240$0deca8c0@Ulysses> (raw)
Message-ID: <20000802181524.QYhrtsvW6aOU67ssZEy8kJr_N5FwRoP2TnahS0ZlRKw@z> (raw)
-->A couple of questions :
>
>. What about the actual cache operation routines (flush_cache_page,
>...)? Are they divided into R4xxx, R3xx, etc? I guess I am curious how
>the code is organized.
We kept pretty much the existing 2.2 structure for these things.
We created the module "r4k.c" in arch/mips/mm which was
essentially parallel to the old r4xx0.c module, but which implemented
the various TLB and cache functions (a) using the information in
the mips_cpu structure wherever it made sense and (b) in ways
that are fully compatible with the "MIPS32" ISA+CP0 model
as well as with the original R4000 family and its descendants.
It's possible to write code that is compatible with an R4000 but
not MIPS32, and vice versa, but they are 99% identical.
>. Your structure gives the number of ways, but no info about how to
>select a way. How would do an index-based cache operation? It seems to
>me you probably need something like cache_way_selection_offset in the
>cpu table.
The MIPS32 spec for the CACHE instruction gives a trivial
mapping from sets/ways/linesize into CACHE instruction
operands. In fact, the same technique works for most pre
MIPS32 multi-way caches as well. The only exception that
comes to mind is the R10000. If one wanted to support the
R10K or other oddball CACHE-implementations in this
system, I would suggest adding a MIPS_CACHE_R10KWAYSEL
or some flag to the flags field of the cache descriptor,
and tweaking any routines that need to select indices
(such a routine to hunt down and kill all possible virtual
aliases of an address) to handle the special case.
The primitives in Linux 2.2 did not require much knowedge
of multi-way caches as such - they could all be implemented
either using hit-based CACHE operations, or by cycling
through all possible indices using knowledge of the total
size and the line size. But the newer synthesizable MIPS
cores allow cache configurations to be "dialed in" in ways
that the old code could not handle. The CPUs themselves
can be interrogated to determine the line size/nways/nsets
geometry, so we mirror that in the Linux code and use those
parameters to compute total size, way size, etc. The
PrID-based lookup table and the dynamic probe routines
are there to allow older parts to use the same mechanisms.
Regards,
Kevin K.
next reply other threads:[~2000-08-02 18:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-08-02 18:15 Kevin D. Kissell [this message]
2000-08-02 18:15 ` PROPOSAL : multi-way cache support in Linux/MIPS Kevin D. Kissell
2000-08-02 21:50 ` Jun Sun
-- strict thread matches above, loose matches on Subject: below --
2000-08-02 22:44 Kevin D. Kissell
2000-08-02 22:44 ` Kevin D. Kissell
2000-08-02 23:10 ` Jun Sun
2000-08-02 23:31 ` Ralf Baechle
2000-08-02 18:36 Kevin D. Kissell
2000-08-02 18:36 ` Kevin D. Kissell
2000-08-02 8:26 Kevin D. Kissell
2000-08-02 8:26 ` Kevin D. Kissell
2000-08-02 17:05 ` Jun Sun
2000-08-01 23:52 Jun Sun
2000-08-02 18:12 ` Dominic Sweetman
2000-08-02 21:38 ` Jun Sun
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='01ac01bffcad$a767c240$0deca8c0@Ulysses' \
--to=kevink@mips.com \
--cc=jsun@mvista.com \
--cc=linux-mips@fnet.fr \
--cc=linux@cthulhu.engr.sgi.com \
--cc=ralf@oss.sgi.com \
/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