Changeset a8865f8 in rtems


Ignore:
Timestamp:
Jan 25, 2016, 9:20:28 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
885c342e
Parents:
cd9ef185
git-author:
Sebastian Huber <sebastian.huber@…> (01/25/16 09:20:28)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/26/16 08:07:30)
Message:

score: Introduce CPU_CACHE_LINE_BYTES

Add CPU_CACHE_LINE_BYTES for the maximum cache line size in bytes. The
actual processor may use no cache or a smaller cache line size.

Files:
18 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/shared/src/cache_manager.c

    rcd9ef185 ra8865f8  
    4343#include "cache_.h"
    4444
     45#if CPU_DATA_CACHE_ALIGNMENT > CPU_CACHE_LINE_BYTES
     46#error "CPU_DATA_CACHE_ALIGNMENT is greater than CPU_CACHE_LINE_BYTES"
     47#endif
     48
     49#if CPU_INSTRUCTION_CACHE_ALIGNMENT > CPU_CACHE_LINE_BYTES
     50#error "CPU_INSTRUCTION_CACHE_ALIGNMENT is greater than CPU_CACHE_LINE_BYTES"
     51#endif
     52
    4553#if defined(RTEMS_SMP)
    4654
  • cpukit/score/cpu/arm/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    145145#define CPU_STACK_GROWS_UP FALSE
    146146
    147 /* XXX Why 32? */
    148 #define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (32)))
     147/* FIXME: Is this the right value? */
     148#define CPU_CACHE_LINE_BYTES 32
     149
     150#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    149151
    150152/*
  • cpukit/score/cpu/bfin/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    296296#define CPU_STACK_GROWS_UP               FALSE
    297297
    298 /**
    299  * The following is the variable attribute used to force alignment
    300  * of critical RTEMS structures.  On some processors it may make
    301  * sense to have these aligned on tighter boundaries than
    302  * the minimum requirements of the compiler in order to have as
    303  * much of the critical data area as possible in a cache line.
    304  *
    305  * The placement of this macro in the declaration of the variables
    306  * is based on the syntactically requirements of the GNU C
    307  * "__attribute__" extension.  For example with GNU C, use
    308  * the following to force a structures to a 32 byte boundary.
    309  *
    310  *     __attribute__ ((aligned (32)))
    311  *
    312  * @note Currently only the Priority Bit Map table uses this feature.
    313  *       To benefit from using this, the data must be heavily
    314  *       used so it will stay in the cache and used frequently enough
    315  *       in the executive to justify turning this on.
    316  *
    317  * Port Specific Information:
    318  *
    319  * XXX document implementation including references if appropriate
    320  */
     298/* FIXME: Is this the right value? */
     299#define CPU_CACHE_LINE_BYTES 32
     300
    321301#define CPU_STRUCTURE_ALIGNMENT
    322302
  • cpukit/score/cpu/epiphany/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    261261#define CPU_STACK_GROWS_UP               FALSE
    262262
    263 /*
    264  *  The following is the variable attribute used to force alignment
    265  *  of critical RTEMS structures.  On some processors it may make
    266  *  sense to have these aligned on tighter boundaries than
    267  *  the minimum requirements of the compiler in order to have as
    268  *  much of the critical data area as possible in a cache line.
    269  *
    270  *  The placement of this macro in the declaration of the variables
    271  *  is based on the syntactically requirements of the GNU C
    272  *  "__attribute__" extension.  For example with GNU C, use
    273  *  the following to force a structures to a 32 byte boundary.
    274  *
    275  *      __attribute__ ((aligned (32)))
    276  *
    277  *  NOTE:  Currently only the Priority Bit Map table uses this feature.
    278  *         To benefit from using this, the data must be heavily
    279  *         used so it will stay in the cache and used frequently enough
    280  *         in the executive to justify turning this on.
    281  *
    282  */
    283 
    284 #define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (64)))
     263/* FIXME: Is this the right value? */
     264#define CPU_CACHE_LINE_BYTES 64
     265
     266#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    285267
    286268/*
  • cpukit/score/cpu/i386/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    101101
    102102#define CPU_STACK_GROWS_UP               FALSE
     103
     104/* FIXME: The Pentium 4 used 128 bytes, it this processor still relevant? */
     105#define CPU_CACHE_LINE_BYTES 64
     106
    103107#define CPU_STRUCTURE_ALIGNMENT
    104108
  • cpukit/score/cpu/lm32/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    290290#define CPU_STACK_GROWS_UP               FALSE
    291291
    292 /**
    293  * The following is the variable attribute used to force alignment
    294  * of critical RTEMS structures.  On some processors it may make
    295  * sense to have these aligned on tighter boundaries than
    296  * the minimum requirements of the compiler in order to have as
    297  * much of the critical data area as possible in a cache line.
    298  *
    299  * The placement of this macro in the declaration of the variables
    300  * is based on the syntactically requirements of the GNU C
    301  * "__attribute__" extension.  For example with GNU C, use
    302  * the following to force a structures to a 32 byte boundary.
    303  *
    304  *     __attribute__ ((aligned (32)))
    305  *
    306  * NOTE: Currently only the Priority Bit Map table uses this feature.
    307  *       To benefit from using this, the data must be heavily
    308  *       used so it will stay in the cache and used frequently enough
    309  *       in the executive to justify turning this on.
    310  *
    311  * Port Specific Information:
    312  *
    313  * L2 cache lines are 32 bytes in Milkymist SoC
    314  */
    315 #define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (32)))
     292/* L2 cache lines are 32 bytes in Milkymist SoC */
     293#define CPU_CACHE_LINE_BYTES 32
     294
     295#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    316296
    317297/**
  • cpukit/score/cpu/m32c/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    312312#define CPU_STACK_GROWS_UP               TRUE
    313313
    314 /**
    315  * The following is the variable attribute used to force alignment
    316  * of critical RTEMS structures.  On some processors it may make
    317  * sense to have these aligned on tighter boundaries than
    318  * the minimum requirements of the compiler in order to have as
    319  * much of the critical data area as possible in a cache line.
    320  *
    321  * The placement of this macro in the declaration of the variables
    322  * is based on the syntactically requirements of the GNU C
    323  * "__attribute__" extension.  For example with GNU C, use
    324  * the following to force a structures to a 32 byte boundary.
    325  *
    326  *     __attribute__ ((aligned (32)))
    327  *
    328  * NOTE: Currently only the Priority Bit Map table uses this feature.
    329  *       To benefit from using this, the data must be heavily
    330  *       used so it will stay in the cache and used frequently enough
    331  *       in the executive to justify turning this on.
    332  *
    333  * Port Specific Information:
    334  *
    335  * XXX document implementation including references if appropriate
    336  */
    337 #define CPU_STRUCTURE_ALIGNMENT          __attribute__ ((aligned (2)))
     314/* FIXME: Is this the right value? */
     315#define CPU_CACHE_LINE_BYTES 2
     316
     317#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    338318
    339319/**
  • cpukit/score/cpu/m68k/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    100100#define CPU_PROVIDES_IDLE_THREAD_BODY    TRUE
    101101#define CPU_STACK_GROWS_UP               FALSE
    102 #define CPU_STRUCTURE_ALIGNMENT          __attribute__ ((aligned (4)))
     102
     103/* FIXME: Is this the right value? */
     104#define CPU_CACHE_LINE_BYTES 16
     105
     106#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    103107
    104108/*
  • cpukit/score/cpu/mips/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    281281#define CPU_STACK_GROWS_UP               FALSE
    282282
    283 /*
    284  *  The following is the variable attribute used to force alignment
    285  *  of critical RTEMS structures.  On some processors it may make
    286  *  sense to have these aligned on tighter boundaries than
    287  *  the minimum requirements of the compiler in order to have as
    288  *  much of the critical data area as possible in a cache line.
    289  *
    290  *  The placement of this macro in the declaration of the variables
    291  *  is based on the syntactically requirements of the GNU C
    292  *  "__attribute__" extension.  For example with GNU C, use
    293  *  the following to force a structures to a 32 byte boundary.
    294  *
    295  *      __attribute__ ((aligned (32)))
    296  *
    297  *  NOTE:  Currently only the Priority Bit Map table uses this feature.
    298  *         To benefit from using this, the data must be heavily
    299  *         used so it will stay in the cache and used frequently enough
    300  *         in the executive to justify turning this on.
    301  */
    302 
    303 /* our cache line size is 16 bytes */
    304 #if __GNUC__
    305 #define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (16)))
    306 #else
    307 #define CPU_STRUCTURE_ALIGNMENT
    308 #endif
     283/* FIXME: Is this the right value? */
     284#define CPU_CACHE_LINE_BYTES 16
     285
     286#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    309287
    310288/*
  • cpukit/score/cpu/moxie/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    261261#define CPU_STACK_GROWS_UP               FALSE
    262262
    263 /*
    264  *  The following is the variable attribute used to force alignment
    265  *  of critical RTEMS structures.  On some processors it may make
    266  *  sense to have these aligned on tighter boundaries than
    267  *  the minimum requirements of the compiler in order to have as
    268  *  much of the critical data area as possible in a cache line.
    269  *
    270  *  The placement of this macro in the declaration of the variables
    271  *  is based on the syntactically requirements of the GNU C
    272  *  "__attribute__" extension.  For example with GNU C, use
    273  *  the following to force a structures to a 32 byte boundary.
    274  *
    275  *      __attribute__ ((aligned (32)))
    276  *
    277  *  NOTE:  Currently only the Priority Bit Map table uses this feature.
    278  *         To benefit from using this, the data must be heavily
    279  *         used so it will stay in the cache and used frequently enough
    280  *         in the executive to justify turning this on.
    281  *
    282  *  MOXIE Specific Information:
    283  *
    284  *  XXX
    285  */
     263/* FIXME: Is this the right value? */
     264#define CPU_CACHE_LINE_BYTES 32
     265
    286266#define CPU_STRUCTURE_ALIGNMENT
    287267
  • cpukit/score/cpu/nios2/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    6565#define CPU_STACK_GROWS_UP FALSE
    6666
    67 #define CPU_STRUCTURE_ALIGNMENT __attribute__((section(".sdata"), aligned(32)))
     67/* FIXME: Is this the right value? */
     68#define CPU_CACHE_LINE_BYTES 32
     69
     70#define CPU_STRUCTURE_ALIGNMENT \
     71  RTEMS_SECTION( ".sdata" ) RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    6872
    6973#define CPU_BIG_ENDIAN FALSE
  • cpukit/score/cpu/no_cpu/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    312312
    313313/**
     314 * The maximum cache line size in bytes.
     315 *
     316 * The actual processor may use no cache or a smaller cache line size.
     317 */
     318#define CPU_CACHE_LINE_BYTES 32
     319
     320/**
    314321 * The following is the variable attribute used to force alignment
    315322 * of critical RTEMS structures.  On some processors it may make
     
    318325 * much of the critical data area as possible in a cache line.
    319326 *
    320  * The placement of this macro in the declaration of the variables
    321  * is based on the syntactically requirements of the GNU C
    322  * "__attribute__" extension.  For example with GNU C, use
    323  * the following to force a structures to a 32 byte boundary.
    324  *
    325  *     __attribute__ ((aligned (32)))
    326  *
    327  * NOTE: Currently only the Priority Bit Map table uses this feature.
    328  *       To benefit from using this, the data must be heavily
    329  *       used so it will stay in the cache and used frequently enough
    330  *       in the executive to justify turning this on.
    331  *
    332  * Port Specific Information:
    333  *
    334  * XXX document implementation including references if appropriate
    335  */
    336 #define CPU_STRUCTURE_ALIGNMENT
     327 * Port Specific Information:
     328 *
     329 * XXX document implementation including references if appropriate
     330 */
     331#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    337332
    338333/**
  • cpukit/score/cpu/or1k/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    253253#define CPU_STACK_GROWS_UP               FALSE
    254254
    255 /*
    256  *  The following is the variable attribute used to force alignment
    257  *  of critical RTEMS structures.  On some processors it may make
    258  *  sense to have these aligned on tighter boundaries than
    259  *  the minimum requirements of the compiler in order to have as
    260  *  much of the critical data area as possible in a cache line.
    261  *
    262  *  The placement of this macro in the declaration of the variables
    263  *  is based on the syntactically requirements of the GNU C
    264  *  "__attribute__" extension.  For example with GNU C, use
    265  *  the following to force a structures to a 32 byte boundary.
    266  *
    267  *      __attribute__ ((aligned (32)))
    268  *
    269  *  NOTE:  Currently only the Priority Bit Map table uses this feature.
    270  *         To benefit from using this, the data must be heavily
    271  *         used so it will stay in the cache and used frequently enough
    272  *         in the executive to justify turning this on.
    273  *
    274  */
    275 
    276 #define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (32)))
     255/* FIXME: Is this the right value? */
     256#define CPU_CACHE_LINE_BYTES 32
     257
     258#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    277259
    278260/*
  • cpukit/score/cpu/powerpc/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    102102#define CPU_STACK_GROWS_UP               FALSE
    103103
    104 /*
    105  *  The following is the variable attribute used to force alignment
    106  *  of critical RTEMS structures.  On some processors it may make
    107  *  sense to have these aligned on tighter boundaries than
    108  *  the minimum requirements of the compiler in order to have as
    109  *  much of the critical data area as possible in a cache line.
    110  *
    111  *  The placement of this macro in the declaration of the variables
    112  *  is based on the syntactically requirements of the GNU C
    113  *  "__attribute__" extension.  For example with GNU C, use
    114  *  the following to force a structures to a 32 byte boundary.
    115  *
    116  *      __attribute__ ((aligned (32)))
    117  *
    118  *  NOTE:  Currently only the Priority Bit Map table uses this feature.
    119  *         To benefit from using this, the data must be heavily
    120  *         used so it will stay in the cache and used frequently enough
    121  *         in the executive to justify turning this on.
    122  */
    123 
    124 #define CPU_STRUCTURE_ALIGNMENT \
    125   __attribute__ ((aligned (PPC_STRUCTURE_ALIGNMENT)))
     104#define CPU_CACHE_LINE_BYTES PPC_STRUCTURE_ALIGNMENT
     105
     106#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    126107
    127108/*
  • cpukit/score/cpu/sh/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    230230#define CPU_STACK_GROWS_UP               FALSE
    231231
    232 /*
    233  *  The following is the variable attribute used to force alignment
    234  *  of critical RTEMS structures.  On some processors it may make
    235  *  sense to have these aligned on tighter boundaries than
    236  *  the minimum requirements of the compiler in order to have as
    237  *  much of the critical data area as possible in a cache line.
    238  *
    239  *  The placement of this macro in the declaration of the variables
    240  *  is based on the syntactically requirements of the GNU C
    241  *  "__attribute__" extension.  For example with GNU C, use
    242  *  the following to force a structures to a 32 byte boundary.
    243  *
    244  *      __attribute__ ((aligned (32)))
    245  *
    246  *  NOTE:  Currently only the Priority Bit Map table uses this feature.
    247  *         To benefit from using this, the data must be heavily
    248  *         used so it will stay in the cache and used frequently enough
    249  *         in the executive to justify turning this on.
    250  */
    251 
    252 #define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned(16)))
     232/* FIXME: Is this the right value? */
     233#define CPU_CACHE_LINE_BYTES 16
     234
     235#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    253236
    254237/*
  • cpukit/score/cpu/sparc/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    211211#define CPU_STACK_GROWS_UP               FALSE
    212212
    213 /**
    214  * The following is the variable attribute used to force alignment
    215  * of critical data structures.  On some processors it may make
    216  * sense to have these aligned on tighter boundaries than
    217  * the minimum requirements of the compiler in order to have as
    218  * much of the critical data area as possible in a cache line.
    219  *
    220  * The SPARC does not appear to have particularly strict alignment
    221  * requirements.  This value was chosen to take advantages of caches.
    222  */
    223 #define CPU_STRUCTURE_ALIGNMENT          __attribute__ ((aligned (32)))
     213/* FIXME: Is this the right value? */
     214#define CPU_CACHE_LINE_BYTES 32
     215
     216#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
    224217
    225218/**
  • cpukit/score/cpu/sparc64/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    171171#define CPU_STACK_GROWS_UP               FALSE
    172172
     173/* FIXME: Is this the right value? */
     174#define CPU_CACHE_LINE_BYTES 32
     175
    173176/*
    174177 *  The following is the variable attribute used to force alignment
     
    185188 */
    186189
    187 #define CPU_STRUCTURE_ALIGNMENT          __attribute__ ((aligned (16)))
     190#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( 16 )
    188191
    189192/*
  • cpukit/score/cpu/v850/rtems/score/cpu.h

    rcd9ef185 ra8865f8  
    290290#define CPU_STACK_GROWS_UP               FALSE
    291291
    292 /**
    293  * The following is the variable attribute used to force alignment
    294  * of critical RTEMS structures.  On some processors it may make
    295  * sense to have these aligned on tighter boundaries than
    296  * the minimum requirements of the compiler in order to have as
    297  * much of the critical data area as possible in a cache line.
    298  *
    299  * The placement of this macro in the declaration of the variables
    300  * is based on the syntactically requirements of the GNU C
    301  * "__attribute__" extension.  For example with GNU C, use
    302  * the following to force a structures to a 32 byte boundary.
    303  *
    304  *     __attribute__ ((aligned (32)))
    305  *
    306  * @note Currently only the Priority Bit Map table uses this feature.
    307  *       To benefit from using this, the data must be heavily
    308  *       used so it will stay in the cache and used frequently enough
    309  *       in the executive to justify turning this on.
    310  *
    311  * Port Specific Information:
    312  *
    313  * Until proven otherwise, use the compiler default.
    314  */
     292/* FIXME: Is this the right value? */
     293#define CPU_CACHE_LINE_BYTES 32
     294
    315295#define CPU_STRUCTURE_ALIGNMENT
    316296
Note: See TracChangeset for help on using the changeset viewer.