diff options
author | davidcunado-arm <david.cunado@arm.com> | 2018-02-28 01:26:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-28 01:26:21 +0000 |
commit | c69145fc2a8f1660131f555f286c6989c8343c74 (patch) | |
tree | 57f5e8ea7244c33953999e97299b482fbe67a433 /include | |
parent | 99e198ecd869d33a5948445dd17c5e0920ef5477 (diff) | |
parent | 264410306381d4edceeb03b3a0e8db66605427be (diff) |
Merge pull request #1286 from antonio-nino-diaz-arm/an/mmu-mismatch
Clarify comments in xlat tables lib and fixes related to the TLB
Diffstat (limited to 'include')
-rw-r--r-- | include/lib/xlat_tables/xlat_mmu_helpers.h | 42 | ||||
-rw-r--r-- | include/lib/xlat_tables/xlat_tables_defs.h | 15 |
2 files changed, 42 insertions, 15 deletions
diff --git a/include/lib/xlat_tables/xlat_mmu_helpers.h b/include/lib/xlat_tables/xlat_mmu_helpers.h index fd3efc3f..d83d7640 100644 --- a/include/lib/xlat_tables/xlat_mmu_helpers.h +++ b/include/lib/xlat_tables/xlat_mmu_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -7,13 +7,51 @@ #ifndef __XLAT_MMU_HELPERS_H__ #define __XLAT_MMU_HELPERS_H__ +/* + * The following flags are passed to enable_mmu_xxx() to override the default + * values used to program system registers while enabling the MMU. + */ + +/* + * When this flag is used, all data access to Normal memory from this EL and all + * Normal memory accesses to the translation tables of this EL are non-cacheable + * for all levels of data and unified cache until the caches are enabled by + * setting the bit SCTLR_ELx.C. + */ +#define DISABLE_DCACHE (U(1) << 0) + +/* + * Mark the translation tables as non-cacheable for the MMU table walker, which + * is a different observer from the PE/CPU. If the flag is not specified, the + * tables are cacheable for the MMU table walker. + * + * Note that, as far as the PE/CPU observer is concerned, the attributes used + * are the ones specified in the translation tables themselves. The MAIR + * register specifies the cacheability through the field AttrIndx of the lower + * attributes of the translation tables. The shareability is specified in the SH + * field of the lower attributes. + * + * The MMU table walker uses the attributes specified in the fields ORGNn, IRGNn + * and SHn of the TCR register to access the translation tables. + * + * The attributes specified in the TCR register and the tables can be different + * as there are no checks to prevent that. Special care must be taken to ensure + * that there aren't mismatches. The behaviour in that case is described in the + * sections 'Mismatched memory attributes' in the ARMv8 ARM. + */ +#define XLAT_TABLE_NC (U(1) << 1) + +#ifndef __ASSEMBLY__ + #ifdef AARCH32 /* AArch32 specific translation table API */ -void enable_mmu_secure(uint32_t flags); +void enable_mmu_secure(unsigned int flags); #else /* AArch64 specific translation table APIs */ void enable_mmu_el1(unsigned int flags); void enable_mmu_el3(unsigned int flags); #endif /* AARCH32 */ +#endif /* __ASSEMBLY__ */ + #endif /* __XLAT_MMU_HELPERS_H__ */ diff --git a/include/lib/xlat_tables/xlat_tables_defs.h b/include/lib/xlat_tables/xlat_tables_defs.h index 3a7f2456..1c84fe07 100644 --- a/include/lib/xlat_tables/xlat_tables_defs.h +++ b/include/lib/xlat_tables/xlat_tables_defs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -9,6 +9,7 @@ #include <arch.h> #include <utils_def.h> +#include <xlat_mmu_helpers.h> /* Miscellaneous MMU related constants */ #define NUM_2MB_IN_GB (U(1) << 9) @@ -165,16 +166,4 @@ #define XN_SHIFT 54 #define UXN_SHIFT XN_SHIFT -/* - * Flags to override default values used to program system registers while - * enabling the MMU. - */ -#define DISABLE_DCACHE (U(1) << 0) - -/* - * This flag marks the translation tables are Non-cacheable for MMU accesses. - * If the flag is not specified, by default the tables are cacheable. - */ -#define XLAT_TABLE_NC (U(1) << 1) - #endif /* __XLAT_TABLES_DEFS_H__ */ |