Changeset 7328ff4 in mainline for kernel/arch/sparc64/src/smc.c


Ignore:
Timestamp:
2018-09-06T18:18:52Z (6 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ffa73c6
Parents:
d51cca8
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-13 01:29:17)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-09-06 18:18:52)
Message:

Use builtin memory fences for kernel barriers, and convert smp_coherence() into a regular function

File:
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/smc.c

    rd51cca8 r7328ff4  
    2727 */
    2828
    29 /** @addtogroup mips32
    30  * @{
    31  */
    32 /** @file
    33  */
     29#include <barrier.h>
     30#include <arch/barrier.h>
    3431
    35 #ifndef KERN_mips32_BARRIER_H_
    36 #define KERN_mips32_BARRIER_H_
     32#if defined(US)
    3733
    38 /*
    39  * TODO: implement true MIPS memory barriers for macros below.
    40  */
    41 #define CS_ENTER_BARRIER()  asm volatile ("" ::: "memory")
    42 #define CS_LEAVE_BARRIER()  asm volatile ("" ::: "memory")
     34#define FLUSH_INVAL_MIN  4
    4335
    44 #define memory_barrier() asm volatile ("" ::: "memory")
    45 #define read_barrier()   asm volatile ("" ::: "memory")
    46 #define write_barrier()  asm volatile ("" ::: "memory")
     36void smc_coherence(void *a, size_t l)
     37{
     38        asm volatile ("membar #StoreStore\n" ::: "memory");
    4739
    48 #ifdef KERNEL
     40        for (size_t i = 0; i < l; i += FLUSH_INVAL_MIN) {
     41                asm volatile (
     42                    "flush %[reg]\n"
     43                    :: [reg] "r" (a + i)
     44                    : "memory"
     45                );
     46        }
     47}
    4948
    50 #define smc_coherence(a, l)
     49#elif defined (US3)
    5150
    52 #endif  /* KERNEL */
    5351
    54 #endif
     52void smc_coherence(void *a, size_t l)
     53{
     54        asm volatile ("membar #StoreStore\n" ::: "memory");
    5555
    56 /** @}
    57  */
     56        flush_pipeline();
     57}
     58
     59#endif  /* defined(US3) */
     60
Note: See TracChangeset for help on using the changeset viewer.