Ignore:
Timestamp:
2015-10-28T18:17:27Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77a194c, ff381a7
Parents:
0328987 (diff), 5783d10 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge various ARM fixes from lp:~jakub/helenos/arm

Fix GTA02 uspace/kernel memory corruption caused by wrong TLB
invalidation. ARM920T does not have a unified TLB, so it is necessary
to purge the instruction and data TLBs separately.

Fix RaspberryPi support. Make RaspberryPi use non-shared memory
(eliminating thus a weird special case for ARMv6) and invalidate the
entire D-cache before it is re-enabled in the kernel.

Make the CP15 cache-related macros non-ARMv7-centric for ARMv6-. Define
only macros that are supported by the given CPU/architecture (partially).

Be more careful and do not assume ARMv7 features. This relates to
enabling branch predictors, prefetch buffer and various control bits
in some registers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/arch/barrier.h

    r0328987 r5265eea4  
    3838
    3939#ifdef KERNEL
     40#include <arch/cache.h>
    4041#include <arch/cp15.h>
     42#include <align.h>
    4143#else
    4244#include <libarch/cp15.h>
     
    7173 * CP15 implementation is mandatory only for armv6+.
    7274 */
     75#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
    7376#define memory_barrier()  CP15DMB_write(0)
    74 #define read_barrier()    CP15DSB_write(0)
     77#else
     78#define memory_barrier()  CP15DSB_write(0)
     79#endif
     80#define read_barrier()    CP15DSB_write(0)
    7581#define write_barrier()   read_barrier()
     82#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
    7683#define inst_barrier()    CP15ISB_write(0)
     84#else
     85#define inst_barrier()
     86#endif
    7787#else
    7888/* Older manuals mention syscalls as a way to implement cache coherency and
     
    103113
    104114#if defined PROCESSOR_ARCH_armv7_a | defined PROCESSOR_ARCH_armv6 | defined KERNEL
    105 /* Available on all supported arms,
    106  * invalidates entire ICache so the written value does not matter. */
    107115//TODO might be PL1 only on armv5-
    108116#define smc_coherence(a) \
    109117do { \
    110         DCCMVAU_write((uint32_t)(a));  /* Flush changed memory */\
     118        dcache_clean_mva_pou(ALIGN_DOWN((uintptr_t) a, CP15_C7_MVA_ALIGN)); \
    111119        write_barrier();               /* Wait for completion */\
    112         ICIALLU_write(0);              /* Flush ICache */\
     120        icache_invalidate();\
    113121        inst_barrier();                /* Wait for Inst refetch */\
    114122} while (0)
     
    117125#define smc_coherence_block(a, l) \
    118126do { \
    119         for (uintptr_t addr = (uintptr_t)a; addr < (uintptr_t)a + l; addr += 4)\
     127        for (uintptr_t addr = (uintptr_t) a; addr < (uintptr_t) a + l; \
     128            addr += CP15_C7_MVA_ALIGN) \
    120129                smc_coherence(addr); \
    121130} while (0)
Note: See TracChangeset for help on using the changeset viewer.