public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] ARM ISA/cpu/SoC code organization for cache and other functions
Date: Thu, 15 Sep 2011 23:42:12 +0200	[thread overview]
Message-ID: <4E727134.6090408@aribaud.net> (raw)

(re-posting cleaned up and outside any other discussion)

This RFC is for discussing how cache operation functions should be 
managed in the ARM tree.

ARM boards are frequently based on a SoC, itseff based on a processor 
(or cpu), itself based on an (instruction set) architecture, 'isa' for 
short. For instance, board edminiv2 is based on SoC orion5x which has an 
ARM926EJ-S processor/cpu, based on an ARMv5 isa.

Cache operations are normally defined at the isa level and all 
processors, SoCs and boards based on an architecture should use this 
architecture's cache operations.

However, some processors or SoCs may provide specialized instructions or 
instruction sequences for some cache operations, or may have a broken 
implementation for some other cache op.

There is thus a need to be able to redefine some isa-defined cache ops 
with processor-specific ops, and also to redefine some isa- or 
processor-defined ops with SoC-specific ops.

For instance, say some armv5 based cpu badly implements full flush but 
correctly implements cache line flush. The cpu code should then provide 
its own version of the full cache flush op, based on looping through the 
cache lines instead of the armv5 single coprocessor instruction.

If, OTOH, a SoC has broken cache ops to the point that cache is 
unuseable, then it should have its cache disabled, which can be done 
through configuration options or by providing SoC-specific cache ops 
implementations that will emit appropriate messages instead of trying to 
exercize the faulty cache functionality.

The source code implementation for ARM cache ops would be:

- a header file declaring the ops as weak C functions for at least full 
cache flush, full cache invalidate, cache line flush and cache line 
invalidate;

- SoC-specific, cpu-specific, and isa-specific definitions for these 
functions, in the form of C files.

- a default implementation in a lib/ file.

The object files shall be linked in decreasing precedence order, i.e. 
SoC file first, then cpu file, then isa file, then lib last, so that for 
each cache op, the weak symbol mechanism uses the most specific one.

One possible organisation for files would be (switch to fixed size font)

         (isa)   (cpu)     SoC)
arch/arm
         /armv5t/
                 cache-ops.c
                 arm926ejs/
                           cache-ops.c
                           orion5x/
                                   cache-ops.c

Plus of course arch/arm/lib/cache-ops.c.

There was a proposal to put SoC families right below arch/arm, because 
members of such SoC families may have many common devices but different 
cpus. We already deal with the common devices by putting them in their 
correct location in U-Boot, e.g. the Ethernet controller of orion5x is 
in drivers/net/, but we don't deal with SoCs which exist in various CPU 
flavors.

Comments more than welcome.

Amicalement,
-- 
Albert.

             reply	other threads:[~2011-09-15 21:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-15 21:42 Albert ARIBAUD [this message]
2011-09-15 23:10 ` [U-Boot] [RFC] ARM ISA/cpu/SoC code organization for cache and other functions Jason
2011-09-15 23:18   ` Jason
2011-09-16 17:24     ` Albert ARIBAUD
2011-10-14  4:43 ` Mike Frysinger
2011-10-18 18:50   ` Albert ARIBAUD

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=4E727134.6090408@aribaud.net \
    --to=albert.u.boot@aribaud.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox