summaryrefslogtreecommitdiff
path: root/lib/xlat_tables
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-04-26 12:59:08 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-04-26 12:59:08 +0100
commit01c0a38ef0ce4674d0edb0d6fbbe9700d5617a84 (patch)
tree7e99256b4d384b3064c7b9e2c9d770cf3e49a1ec /lib/xlat_tables
parent7f6d8f49aa916a526c2ce227606cc51eebd0c950 (diff)
xlat: Set AP[1] to 1 when it is RES1
According to the ARMv8 ARM issue C.a: AP[1] is valid only for stage 1 of a translation regime that can support two VA ranges. It is RES 1 when stage 1 translations can support only one VA range. This means that, even though this bit is ignored, it should be set to 1 in the EL3 and EL2 translation regimes. For translation regimes consisting on EL0 and a higher regime this bit selects between control at EL0 or at the higher Exception level. The regimes that support two VA ranges are EL1&0 and EL2&0 (the later one is only available since ARMv8.1). This fix has to be applied to both versions of the translation tables library. Change-Id: If19aaf588551bac7aeb6e9a686cf0c2068e7c181 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'lib/xlat_tables')
-rw-r--r--lib/xlat_tables/xlat_tables_common.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/xlat_tables/xlat_tables_common.c b/lib/xlat_tables/xlat_tables_common.c
index 13099362..21bf4897 100644
--- a/lib/xlat_tables/xlat_tables_common.c
+++ b/lib/xlat_tables/xlat_tables_common.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -41,6 +41,7 @@ static unsigned long long xlat_max_pa;
static uintptr_t xlat_max_va;
static uint64_t execute_never_mask;
+static uint64_t ap1_mask;
/*
* Array of all memory regions stored in order of ascending base address.
@@ -195,6 +196,7 @@ static uint64_t mmap_desc(mmap_attr_t attr, unsigned long long addr_pa,
desc |= (attr & MT_NS) ? LOWER_ATTRS(NS) : 0;
desc |= (attr & MT_RW) ? LOWER_ATTRS(AP_RW) : LOWER_ATTRS(AP_RO);
desc |= LOWER_ATTRS(ACCESS_FLAG);
+ desc |= ap1_mask;
/*
* Deduce shareability domain and executability of the memory region
@@ -381,7 +383,17 @@ void init_xlation_table(uintptr_t base_va, uint64_t *table,
unsigned int level, uintptr_t *max_va,
unsigned long long *max_pa)
{
- execute_never_mask = xlat_arch_get_xn_desc(xlat_arch_current_el());
+ int el = xlat_arch_current_el();
+
+ execute_never_mask = xlat_arch_get_xn_desc(el);
+
+ if (el == 3) {
+ ap1_mask = LOWER_ATTRS(AP_ONE_VA_RANGE_RES1);
+ } else {
+ assert(el == 1);
+ ap1_mask = 0;
+ }
+
init_xlation_table_inner(mmap, base_va, table, level);
*max_va = xlat_max_va;
*max_pa = xlat_max_pa;