fix(lib/xlat): xlat_get_llt_from_va() returns the wrong base_va
xlat_get_llt_from_va() should populate xlat_llt_info struct with the
base VA mapped on the table being returned but instead, it populates
it with the context VA address.
This patch fixes that, as well as it renames some APIs and structures
in order to better reflect their purpose. In addition to that, it
also introduces some refactoring to improve performance related
to xlat_get_tte_ptr() API.
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: I1b16518d11b5427f3c5e02feb32e3ed9deb4e3e4
diff --git a/lib/realm/src/buffer.c b/lib/realm/src/buffer.c
index e4caa1a..592b7de 100644
--- a/lib/realm/src/buffer.c
+++ b/lib/realm/src/buffer.c
@@ -73,7 +73,7 @@
* are mapped to avoid needing to perform a table walk every time a buffer
* slot operation has to be done.
*/
-static struct xlat_tbl_info tbl_info_cache[MAX_CPUS];
+static struct xlat_llt_info llt_info_cache[MAX_CPUS];
uintptr_t slot_to_va(enum buffer_slot slot)
{
@@ -87,14 +87,14 @@
return &slot_buf_xlat_ctx[my_cpuid()];
}
-struct xlat_tbl_info *get_cached_tbl_info(void)
+struct xlat_llt_info *get_cached_llt_info(void)
{
- return &tbl_info_cache[my_cpuid()];
+ return &llt_info_cache[my_cpuid()];
}
__unused static uint64_t slot_to_descriptor(enum buffer_slot slot)
{
- uint64_t *entry = xlat_get_tte_ptr(get_cached_tbl_info(),
+ uint64_t *entry = xlat_get_tte_ptr(get_cached_llt_info(),
slot_to_va(slot));
return xlat_read_tte(entry);
@@ -164,10 +164,10 @@
* translation table that holds the MMU descriptors for the slot
* buffers, so we can access them faster when we need to map/unmap.
*/
- if ((get_cached_tbl_info())->table == NULL) {
- if (xlat_get_table_from_va(get_cached_tbl_info(),
- get_slot_buf_xlat_ctx(),
- slot_to_va(SLOT_NS)) != 0) {
+ if ((get_cached_llt_info())->table == NULL) {
+ if (xlat_get_llt_from_va(get_cached_llt_info(),
+ get_slot_buf_xlat_ctx(),
+ slot_to_va(SLOT_NS)) != 0) {
ERROR("%s (%u): Failed to initialize table entry cache for CPU %u\n",
__func__, __LINE__, my_cpuid());
panic();
@@ -323,7 +323,7 @@
{
uint64_t attr = SLOT_DESC_ATTR;
uintptr_t va = slot_to_va(slot);
- struct xlat_tbl_info *entry = get_cached_tbl_info();
+ struct xlat_llt_info *entry = get_cached_llt_info();
assert(GRANULE_ALIGNED(addr));
@@ -346,5 +346,5 @@
*/
COMPILER_BARRIER();
- xlat_unmap_memory_page(get_cached_tbl_info(), (uintptr_t)buf);
+ xlat_unmap_memory_page(get_cached_llt_info(), (uintptr_t)buf);
}