nonlpae_tables.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. /*
  2. * Copyright (c) 2016-2017, Linaro Limited. All rights reserved.
  3. * Copyright (c) 2014-2020, Arm Limited. All rights reserved.
  4. * Copyright (c) 2014, STMicroelectronics International N.V.
  5. * All rights reserved.
  6. *
  7. * SPDX-License-Identifier: BSD-3-Clause
  8. */
  9. #include <assert.h>
  10. #include <stdio.h>
  11. #include <string.h>
  12. #include <platform_def.h>
  13. #include <arch.h>
  14. #include <arch_helpers.h>
  15. #include <common/debug.h>
  16. #include <lib/cassert.h>
  17. #include <lib/utils.h>
  18. #include <lib/xlat_tables/xlat_tables.h>
  19. #include "../xlat_tables_private.h"
  20. #ifdef ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING
  21. #error "ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING flag is set. \
  22. This module is to be used when LPAE is not supported"
  23. #endif
  24. CASSERT(PLAT_VIRT_ADDR_SPACE_SIZE == (1ULL << 32), invalid_vaddr_space_size);
  25. CASSERT(PLAT_PHY_ADDR_SPACE_SIZE == (1ULL << 32), invalid_paddr_space_size);
  26. #define MMU32B_UNSET_DESC ~0UL
  27. #define MMU32B_INVALID_DESC 0UL
  28. #define MT_UNKNOWN ~0U
  29. /*
  30. * MMU related values
  31. */
  32. /* Sharable */
  33. #define MMU32B_TTB_S (1U << 1)
  34. /* Not Outer Sharable */
  35. #define MMU32B_TTB_NOS (1U << 5)
  36. /* Normal memory, Inner Non-cacheable */
  37. #define MMU32B_TTB_IRGN_NC 0U
  38. /* Normal memory, Inner Write-Back Write-Allocate Cacheable */
  39. #define MMU32B_TTB_IRGN_WBWA (1U << 6)
  40. /* Normal memory, Inner Write-Through Cacheable */
  41. #define MMU32B_TTB_IRGN_WT 1U
  42. /* Normal memory, Inner Write-Back no Write-Allocate Cacheable */
  43. #define MMU32B_TTB_IRGN_WB (1U | (1U << 6))
  44. /* Normal memory, Outer Write-Back Write-Allocate Cacheable */
  45. #define MMU32B_TTB_RNG_WBWA (1U << 3)
  46. #define MMU32B_DEFAULT_ATTRS \
  47. (MMU32B_TTB_S | MMU32B_TTB_NOS | \
  48. MMU32B_TTB_IRGN_WBWA | MMU32B_TTB_RNG_WBWA)
  49. /* armv7 memory mapping attributes: section mapping */
  50. #define SECTION_SECURE (0U << 19)
  51. #define SECTION_NOTSECURE (1U << 19)
  52. #define SECTION_SHARED (1U << 16)
  53. #define SECTION_NOTGLOBAL (1U << 17)
  54. #define SECTION_ACCESS_FLAG (1U << 10)
  55. #define SECTION_UNPRIV (1U << 11)
  56. #define SECTION_RO (1U << 15)
  57. #define SECTION_TEX(tex) ((((tex) >> 2) << 12) | \
  58. ((((tex) >> 1) & 0x1) << 3) | \
  59. (((tex) & 0x1) << 2))
  60. #define SECTION_DEVICE SECTION_TEX(MMU32B_ATTR_DEVICE_INDEX)
  61. #define SECTION_NORMAL SECTION_TEX(MMU32B_ATTR_DEVICE_INDEX)
  62. #define SECTION_NORMAL_CACHED \
  63. SECTION_TEX(MMU32B_ATTR_IWBWA_OWBWA_INDEX)
  64. #define SECTION_XN (1U << 4)
  65. #define SECTION_PXN (1U << 0)
  66. #define SECTION_SECTION (2U << 0)
  67. #define SECTION_PT_NOTSECURE (1U << 3)
  68. #define SECTION_PT_PT (1U << 0)
  69. #define SMALL_PAGE_SMALL_PAGE (1U << 1)
  70. #define SMALL_PAGE_SHARED (1U << 10)
  71. #define SMALL_PAGE_NOTGLOBAL (1U << 11)
  72. #define SMALL_PAGE_TEX(tex) ((((tex) >> 2) << 6) | \
  73. ((((tex) >> 1) & 0x1) << 3) | \
  74. (((tex) & 0x1) << 2))
  75. #define SMALL_PAGE_DEVICE \
  76. SMALL_PAGE_TEX(MMU32B_ATTR_DEVICE_INDEX)
  77. #define SMALL_PAGE_NORMAL \
  78. SMALL_PAGE_TEX(MMU32B_ATTR_DEVICE_INDEX)
  79. #define SMALL_PAGE_NORMAL_CACHED \
  80. SMALL_PAGE_TEX(MMU32B_ATTR_IWBWA_OWBWA_INDEX)
  81. #define SMALL_PAGE_ACCESS_FLAG (1U << 4)
  82. #define SMALL_PAGE_UNPRIV (1U << 5)
  83. #define SMALL_PAGE_RO (1U << 9)
  84. #define SMALL_PAGE_XN (1U << 0)
  85. /* The TEX, C and B bits concatenated */
  86. #define MMU32B_ATTR_DEVICE_INDEX 0U
  87. #define MMU32B_ATTR_IWBWA_OWBWA_INDEX 1U
  88. #define MMU32B_PRRR_IDX(idx, tr, nos) (((tr) << (2 * (idx))) | \
  89. ((uint32_t)(nos) << ((idx) + 24)))
  90. #define MMU32B_NMRR_IDX(idx, ir, or) (((ir) << (2 * (idx))) | \
  91. ((uint32_t)(or) << (2 * (idx) + 16)))
  92. #define MMU32B_PRRR_DS0 (1U << 16)
  93. #define MMU32B_PRRR_DS1 (1U << 17)
  94. #define MMU32B_PRRR_NS0 (1U << 18)
  95. #define MMU32B_PRRR_NS1 (1U << 19)
  96. #define DACR_DOMAIN(num, perm) ((perm) << ((num) * 2))
  97. #define DACR_DOMAIN_PERM_NO_ACCESS 0U
  98. #define DACR_DOMAIN_PERM_CLIENT 1U
  99. #define DACR_DOMAIN_PERM_MANAGER 3U
  100. #define NUM_1MB_IN_4GB (1UL << 12)
  101. #define NUM_4K_IN_1MB (1UL << 8)
  102. #define ONE_MB_SHIFT 20
  103. /* mmu 32b integration */
  104. #define MMU32B_L1_TABLE_SIZE (NUM_1MB_IN_4GB * 4)
  105. #define MMU32B_L2_TABLE_SIZE (NUM_4K_IN_1MB * 4)
  106. #define MMU32B_L1_TABLE_ALIGN (1U << 14)
  107. #define MMU32B_L2_TABLE_ALIGN (1U << 10)
  108. static unsigned int next_xlat;
  109. static unsigned long long xlat_max_pa;
  110. static uintptr_t xlat_max_va;
  111. static uint32_t mmu_l1_base[NUM_1MB_IN_4GB]
  112. __aligned(MMU32B_L1_TABLE_ALIGN) __attribute__((section(".xlat_table")));
  113. static uint32_t mmu_l2_base[MAX_XLAT_TABLES][NUM_4K_IN_1MB]
  114. __aligned(MMU32B_L2_TABLE_ALIGN) __attribute__((section(".xlat_table")));
  115. /*
  116. * Array of all memory regions stored in order of ascending base address.
  117. * The list is terminated by the first entry with size == 0.
  118. */
  119. static mmap_region_t mmap[MAX_MMAP_REGIONS + 1];
  120. void print_mmap(void)
  121. {
  122. #if LOG_LEVEL >= LOG_LEVEL_VERBOSE
  123. mmap_region_t *mm = mmap;
  124. printf("init xlat - l1:%p l2:%p (%d)\n",
  125. (void *)mmu_l1_base, (void *)mmu_l2_base, MAX_XLAT_TABLES);
  126. printf("mmap:\n");
  127. while (mm->size) {
  128. printf(" VA:%p PA:0x%llx size:0x%zx attr:0x%x\n",
  129. (void *)mm->base_va, mm->base_pa,
  130. mm->size, mm->attr);
  131. ++mm;
  132. };
  133. printf("\n");
  134. #endif
  135. }
  136. void mmap_add(const mmap_region_t *mm)
  137. {
  138. const mmap_region_t *mm_cursor = mm;
  139. while ((mm_cursor->size != 0U) || (mm_cursor->attr != 0U)) {
  140. mmap_add_region(mm_cursor->base_pa, mm_cursor->base_va,
  141. mm_cursor->size, mm_cursor->attr);
  142. mm_cursor++;
  143. }
  144. }
  145. void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
  146. size_t size, unsigned int attr)
  147. {
  148. mmap_region_t *mm = mmap;
  149. const mmap_region_t *mm_last = mm + ARRAY_SIZE(mmap) - 1U;
  150. unsigned long long end_pa = base_pa + size - 1U;
  151. uintptr_t end_va = base_va + size - 1U;
  152. assert(IS_PAGE_ALIGNED(base_pa));
  153. assert(IS_PAGE_ALIGNED(base_va));
  154. assert(IS_PAGE_ALIGNED(size));
  155. if (size == 0U) {
  156. return;
  157. }
  158. assert(base_pa < end_pa); /* Check for overflows */
  159. assert(base_va < end_va);
  160. assert((base_va + (uintptr_t)size - (uintptr_t)1) <=
  161. (PLAT_VIRT_ADDR_SPACE_SIZE - 1U));
  162. assert((base_pa + (unsigned long long)size - 1ULL) <=
  163. (PLAT_PHY_ADDR_SPACE_SIZE - 1U));
  164. #if ENABLE_ASSERTIONS
  165. /* Check for PAs and VAs overlaps with all other regions */
  166. for (mm = mmap; mm->size; ++mm) {
  167. uintptr_t mm_end_va = mm->base_va + mm->size - 1U;
  168. /*
  169. * Check if one of the regions is completely inside the other
  170. * one.
  171. */
  172. bool fully_overlapped_va =
  173. ((base_va >= mm->base_va) && (end_va <= mm_end_va)) ||
  174. ((mm->base_va >= base_va) && (mm_end_va <= end_va));
  175. /*
  176. * Full VA overlaps are only allowed if both regions are
  177. * identity mapped (zero offset) or have the same VA to PA
  178. * offset. Also, make sure that it's not the exact same area.
  179. */
  180. if (fully_overlapped_va) {
  181. assert((mm->base_va - mm->base_pa) ==
  182. (base_va - base_pa));
  183. assert((base_va != mm->base_va) || (size != mm->size));
  184. } else {
  185. /*
  186. * If the regions do not have fully overlapping VAs,
  187. * then they must have fully separated VAs and PAs.
  188. * Partial overlaps are not allowed
  189. */
  190. unsigned long long mm_end_pa =
  191. mm->base_pa + mm->size - 1;
  192. bool separated_pa = (end_pa < mm->base_pa) ||
  193. (base_pa > mm_end_pa);
  194. bool separated_va = (end_va < mm->base_va) ||
  195. (base_va > mm_end_va);
  196. assert(separated_va && separated_pa);
  197. }
  198. }
  199. mm = mmap; /* Restore pointer to the start of the array */
  200. #endif /* ENABLE_ASSERTIONS */
  201. /* Find correct place in mmap to insert new region */
  202. while ((mm->base_va < base_va) && (mm->size != 0U)) {
  203. ++mm;
  204. }
  205. /*
  206. * If a section is contained inside another one with the same base
  207. * address, it must be placed after the one it is contained in:
  208. *
  209. * 1st |-----------------------|
  210. * 2nd |------------|
  211. * 3rd |------|
  212. *
  213. * This is required for mmap_region_attr() to get the attributes of the
  214. * small region correctly.
  215. */
  216. while ((mm->base_va == base_va) && (mm->size > size)) {
  217. ++mm;
  218. }
  219. /* Make room for new region by moving other regions up by one place */
  220. (void)memmove(mm + 1, mm, (uintptr_t)mm_last - (uintptr_t)mm);
  221. /* Check we haven't lost the empty sentinal from the end of the array */
  222. assert(mm_last->size == 0U);
  223. mm->base_pa = base_pa;
  224. mm->base_va = base_va;
  225. mm->size = size;
  226. mm->attr = attr;
  227. if (end_pa > xlat_max_pa) {
  228. xlat_max_pa = end_pa;
  229. }
  230. if (end_va > xlat_max_va) {
  231. xlat_max_va = end_va;
  232. }
  233. }
  234. /* map all memory as shared/global/domain0/no-usr access */
  235. static uint32_t mmap_desc(unsigned attr, unsigned int addr_pa,
  236. unsigned int level)
  237. {
  238. uint32_t desc;
  239. switch (level) {
  240. case 1U:
  241. assert((addr_pa & (MMU32B_L1_TABLE_ALIGN - 1)) == 0U);
  242. desc = SECTION_SECTION | SECTION_SHARED;
  243. desc |= (attr & MT_NS) != 0U ? SECTION_NOTSECURE : 0U;
  244. desc |= SECTION_ACCESS_FLAG;
  245. desc |= (attr & MT_RW) != 0U ? 0U : SECTION_RO;
  246. desc |= (attr & MT_MEMORY) != 0U ?
  247. SECTION_NORMAL_CACHED : SECTION_DEVICE;
  248. if (((attr & MT_RW) != 0U) || ((attr & MT_MEMORY) == 0U)) {
  249. desc |= SECTION_XN;
  250. }
  251. break;
  252. case 2U:
  253. assert((addr_pa & (MMU32B_L2_TABLE_ALIGN - 1)) == 0U);
  254. desc = SMALL_PAGE_SMALL_PAGE | SMALL_PAGE_SHARED;
  255. desc |= SMALL_PAGE_ACCESS_FLAG;
  256. desc |= (attr & MT_RW) != 0U ? 0U : SMALL_PAGE_RO;
  257. desc |= (attr & MT_MEMORY) != 0U ?
  258. SMALL_PAGE_NORMAL_CACHED : SMALL_PAGE_DEVICE;
  259. if (((attr & MT_RW) != 0U) || ((attr & MT_MEMORY) == 0U)) {
  260. desc |= SMALL_PAGE_XN;
  261. }
  262. break;
  263. default:
  264. panic();
  265. }
  266. #if LOG_LEVEL >= LOG_LEVEL_VERBOSE
  267. /* dump only the non-lpae level 2 tables */
  268. if (level == 2U) {
  269. printf(attr & MT_MEMORY ? "MEM" : "dev");
  270. printf(attr & MT_RW ? "-rw" : "-RO");
  271. printf(attr & MT_NS ? "-NS" : "-S");
  272. }
  273. #endif
  274. return desc | addr_pa;
  275. }
  276. static unsigned int mmap_region_attr(const mmap_region_t *mm, uintptr_t base_va,
  277. size_t size, unsigned int *attr)
  278. {
  279. /* Don't assume that the area is contained in the first region */
  280. unsigned int ret = MT_UNKNOWN;
  281. /*
  282. * Get attributes from last (innermost) region that contains the
  283. * requested area. Don't stop as soon as one region doesn't contain it
  284. * because there may be other internal regions that contain this area:
  285. *
  286. * |-----------------------------1-----------------------------|
  287. * |----2----| |-------3-------| |----5----|
  288. * |--4--|
  289. *
  290. * |---| <- Area we want the attributes of.
  291. *
  292. * In this example, the area is contained in regions 1, 3 and 4 but not
  293. * in region 2. The loop shouldn't stop at region 2 as inner regions
  294. * have priority over outer regions, it should stop at region 5.
  295. */
  296. for ( ; ; ++mm) {
  297. if (mm->size == 0U) {
  298. return ret; /* Reached end of list */
  299. }
  300. if (mm->base_va > (base_va + size - 1U)) {
  301. return ret; /* Next region is after area so end */
  302. }
  303. if ((mm->base_va + mm->size - 1U) < base_va) {
  304. continue; /* Next region has already been overtaken */
  305. }
  306. if ((ret == 0U) && (mm->attr == *attr)) {
  307. continue; /* Region doesn't override attribs so skip */
  308. }
  309. if ((mm->base_va > base_va) ||
  310. ((mm->base_va + mm->size - 1U) <
  311. (base_va + size - 1U))) {
  312. return MT_UNKNOWN; /* Region doesn't fully cover area */
  313. }
  314. *attr = mm->attr;
  315. ret = 0U;
  316. }
  317. }
  318. static mmap_region_t *init_xlation_table_inner(mmap_region_t *mm,
  319. unsigned int base_va,
  320. uint32_t *table,
  321. unsigned int level)
  322. {
  323. unsigned int level_size_shift = (level == 1U) ?
  324. ONE_MB_SHIFT : FOUR_KB_SHIFT;
  325. unsigned int level_size = 1U << level_size_shift;
  326. unsigned int level_index_mask = (level == 1U) ?
  327. (NUM_1MB_IN_4GB - 1) << ONE_MB_SHIFT :
  328. (NUM_4K_IN_1MB - 1) << FOUR_KB_SHIFT;
  329. assert((level == 1U) || (level == 2U));
  330. VERBOSE("init xlat table at %p (level%1u)\n", (void *)table, level);
  331. do {
  332. uint32_t desc = MMU32B_UNSET_DESC;
  333. if (mm->base_va + mm->size <= base_va) {
  334. /* Area now after the region so skip it */
  335. ++mm;
  336. continue;
  337. }
  338. #if LOG_LEVEL >= LOG_LEVEL_VERBOSE
  339. /* dump only non-lpae level 2 tables content */
  340. if (level == 2U) {
  341. printf(" 0x%lx %x " + 6 - 2 * level,
  342. base_va, level_size);
  343. }
  344. #endif
  345. if (mm->base_va >= base_va + level_size) {
  346. /* Next region is after area so nothing to map yet */
  347. desc = MMU32B_INVALID_DESC;
  348. } else if ((mm->base_va <= base_va) &&
  349. (mm->base_va + mm->size) >=
  350. (base_va + level_size)) {
  351. /* Next region covers all of area */
  352. unsigned int attr = mm->attr;
  353. unsigned int r = mmap_region_attr(mm, base_va,
  354. level_size, &attr);
  355. if (r == 0U) {
  356. desc = mmap_desc(attr,
  357. base_va - mm->base_va + mm->base_pa,
  358. level);
  359. }
  360. }
  361. if (desc == MMU32B_UNSET_DESC) {
  362. uintptr_t xlat_table;
  363. /*
  364. * Area not covered by a region so need finer table
  365. * Reuse next level table if any (assert attrib matching).
  366. * Otherwise allocate a xlat table.
  367. */
  368. if (*table) {
  369. assert((*table & 3) == SECTION_PT_PT);
  370. assert(((*table & SECTION_PT_NOTSECURE) == 0U)
  371. == ((mm->attr & MT_NS) == 0U));
  372. xlat_table = (*table) &
  373. ~(MMU32B_L1_TABLE_ALIGN - 1);
  374. desc = *table;
  375. } else {
  376. xlat_table = (uintptr_t)mmu_l2_base +
  377. next_xlat * MMU32B_L2_TABLE_SIZE;
  378. next_xlat++;
  379. assert(next_xlat <= MAX_XLAT_TABLES);
  380. (void)memset((char *)xlat_table, 0,
  381. MMU32B_L2_TABLE_SIZE);
  382. desc = xlat_table | SECTION_PT_PT;
  383. desc |= (mm->attr & MT_NS) != 0U ?
  384. SECTION_PT_NOTSECURE : 0;
  385. }
  386. /* Recurse to fill in new table */
  387. mm = init_xlation_table_inner(mm, base_va,
  388. (uint32_t *)xlat_table,
  389. level + 1);
  390. }
  391. #if LOG_LEVEL >= LOG_LEVEL_VERBOSE
  392. /* dump only non-lpae level 2 tables content */
  393. if (level == 2U) {
  394. printf("\n");
  395. }
  396. #endif
  397. *table++ = desc;
  398. base_va += level_size;
  399. } while ((mm->size != 0U) && ((base_va & level_index_mask) != 0U));
  400. return mm;
  401. }
  402. void init_xlat_tables(void)
  403. {
  404. print_mmap();
  405. assert(((unsigned int)mmu_l1_base & (MMU32B_L1_TABLE_ALIGN - 1)) == 0U);
  406. assert(((unsigned int)mmu_l2_base & (MMU32B_L2_TABLE_ALIGN - 1)) == 0U);
  407. (void)memset(mmu_l1_base, 0, MMU32B_L1_TABLE_SIZE);
  408. init_xlation_table_inner(mmap, 0, (uint32_t *)mmu_l1_base, 1);
  409. VERBOSE("init xlat - max_va=%p, max_pa=%llx\n",
  410. (void *)xlat_max_va, xlat_max_pa);
  411. assert(xlat_max_pa <= (PLAT_VIRT_ADDR_SPACE_SIZE - 1));
  412. }
  413. /*******************************************************************************
  414. * Function for enabling the MMU in Secure PL1, assuming that the
  415. * page-tables have already been created.
  416. ******************************************************************************/
  417. void enable_mmu_svc_mon(unsigned int flags)
  418. {
  419. unsigned int prrr;
  420. unsigned int nmrr;
  421. unsigned int sctlr;
  422. assert(IS_IN_SECURE());
  423. assert((read_sctlr() & SCTLR_M_BIT) == 0U);
  424. /* Enable Access flag (simplified access permissions) and TEX remap */
  425. write_sctlr(read_sctlr() | SCTLR_AFE_BIT | SCTLR_TRE_BIT);
  426. prrr = MMU32B_PRRR_IDX(MMU32B_ATTR_DEVICE_INDEX, 1, 0) \
  427. | MMU32B_PRRR_IDX(MMU32B_ATTR_IWBWA_OWBWA_INDEX, 2, 1);
  428. nmrr = MMU32B_NMRR_IDX(MMU32B_ATTR_DEVICE_INDEX, 0, 0) \
  429. | MMU32B_NMRR_IDX(MMU32B_ATTR_IWBWA_OWBWA_INDEX, 1, 1);
  430. prrr |= MMU32B_PRRR_NS1 | MMU32B_PRRR_DS1;
  431. write_prrr(prrr);
  432. write_nmrr(nmrr);
  433. /* Program Domain access control register: domain 0 only */
  434. write_dacr(DACR_DOMAIN(0, DACR_DOMAIN_PERM_CLIENT));
  435. /* Invalidate TLBs at the current exception level */
  436. tlbiall();
  437. /* set MMU base xlat table entry (use only TTBR0) */
  438. write_ttbr0((uint32_t)mmu_l1_base | MMU32B_DEFAULT_ATTRS);
  439. write_ttbr1(0U);
  440. /*
  441. * Ensure all translation table writes have drained
  442. * into memory, the TLB invalidation is complete,
  443. * and translation register writes are committed
  444. * before enabling the MMU
  445. */
  446. dsb();
  447. isb();
  448. sctlr = read_sctlr();
  449. sctlr |= SCTLR_M_BIT;
  450. #ifdef ARMV7_SUPPORTS_VIRTUALIZATION
  451. sctlr |= SCTLR_WXN_BIT;
  452. #endif
  453. if ((flags & DISABLE_DCACHE) != 0U) {
  454. sctlr &= ~SCTLR_C_BIT;
  455. } else {
  456. sctlr |= SCTLR_C_BIT;
  457. }
  458. write_sctlr(sctlr);
  459. /* Ensure the MMU enable takes effect immediately */
  460. isb();
  461. }