Commit 6a086061 authored by Antonio Nino Diaz's avatar Antonio Nino Diaz
Browse files

xlat v2: Make get/set attrs functions less verbose



It is useful to have LOG_LEVEL_VERBOSE because it prints the memory map
of each image, but that also means that the change_mem_attributes and
get_mem_attributes functions have verbose prints, and generate a too
long text output that hides other useful information.

As they were mostly there for debug purposes, this patch removes them.

Change-Id: I2986537377d1f78be2b79cc8a6cf230c380bdb55
Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
parent f9d58d17
...@@ -260,10 +260,7 @@ static uint64_t *find_xlat_table_entry(uintptr_t virtual_addr, ...@@ -260,10 +260,7 @@ static uint64_t *find_xlat_table_entry(uintptr_t virtual_addr,
uint64_t *table; uint64_t *table;
int entries; int entries;
VERBOSE("%s(%p)\n", __func__, (void *)virtual_addr);
start_level = GET_XLAT_TABLE_LEVEL_BASE(virt_addr_space_size); start_level = GET_XLAT_TABLE_LEVEL_BASE(virt_addr_space_size);
VERBOSE("Starting translation table walk from level %i\n", start_level);
table = xlat_table_base; table = xlat_table_base;
entries = xlat_table_base_entries; entries = xlat_table_base_entries;
...@@ -275,19 +272,15 @@ static uint64_t *find_xlat_table_entry(uintptr_t virtual_addr, ...@@ -275,19 +272,15 @@ static uint64_t *find_xlat_table_entry(uintptr_t virtual_addr,
uint64_t desc; uint64_t desc;
uint64_t desc_type; uint64_t desc_type;
VERBOSE("Table address: %p\n", (void *)table);
idx = XLAT_TABLE_IDX(virtual_addr, level); idx = XLAT_TABLE_IDX(virtual_addr, level);
VERBOSE("Index into level %i table: %i\n", level, idx);
if (idx >= entries) { if (idx >= entries) {
VERBOSE("Invalid address\n"); WARN("Missing xlat table entry at address 0x%lx\n",
virtual_addr);
return NULL; return NULL;
} }
desc = table[idx]; desc = table[idx];
desc_type = desc & DESC_MASK; desc_type = desc & DESC_MASK;
VERBOSE("Descriptor at level %i: 0x%llx\n", level,
(unsigned long long)desc);
if (desc_type == INVALID_DESC) { if (desc_type == INVALID_DESC) {
VERBOSE("Invalid entry (memory not mapped)\n"); VERBOSE("Invalid entry (memory not mapped)\n");
...@@ -296,25 +289,20 @@ static uint64_t *find_xlat_table_entry(uintptr_t virtual_addr, ...@@ -296,25 +289,20 @@ static uint64_t *find_xlat_table_entry(uintptr_t virtual_addr,
if (level == XLAT_TABLE_LEVEL_MAX) { if (level == XLAT_TABLE_LEVEL_MAX) {
/* /*
* There can't be table entries at the final lookup * Only page descriptors allowed at the final lookup
* level. * level.
*/ */
assert(desc_type == PAGE_DESC); assert(desc_type == PAGE_DESC);
VERBOSE("Descriptor mapping a memory page (size: 0x%llx)\n",
(unsigned long long)XLAT_BLOCK_SIZE(XLAT_TABLE_LEVEL_MAX));
*out_level = level; *out_level = level;
return &table[idx]; return &table[idx];
} }
if (desc_type == BLOCK_DESC) { if (desc_type == BLOCK_DESC) {
VERBOSE("Descriptor mapping a memory block (size: 0x%llx)\n",
(unsigned long long)XLAT_BLOCK_SIZE(level));
*out_level = level; *out_level = level;
return &table[idx]; return &table[idx];
} }
assert(desc_type == TABLE_DESC); assert(desc_type == TABLE_DESC);
VERBOSE("Table descriptor, continuing xlat table walk...\n");
table = (uint64_t *)(uintptr_t)(desc & TABLE_ADDR_MASK); table = (uint64_t *)(uintptr_t)(desc & TABLE_ADDR_MASK);
entries = XLAT_TABLE_ENTRIES; entries = XLAT_TABLE_ENTRIES;
} }
...@@ -460,7 +448,7 @@ int change_mem_attributes(xlat_ctx_t *ctx, ...@@ -460,7 +448,7 @@ int change_mem_attributes(xlat_ctx_t *ctx,
} }
if (((attr & MT_EXECUTE_NEVER) == 0) && ((attr & MT_RW) != 0)) { if (((attr & MT_EXECUTE_NEVER) == 0) && ((attr & MT_RW) != 0)) {
WARN("%s() doesn't allow to remap memory as read-write and executable.\n", WARN("%s: Mapping memory as read-write and executable not allowed.\n",
__func__); __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -523,9 +511,6 @@ int change_mem_attributes(xlat_ctx_t *ctx, ...@@ -523,9 +511,6 @@ int change_mem_attributes(xlat_ctx_t *ctx,
/* Restore original value. */ /* Restore original value. */
base_va = base_va_original; base_va = base_va_original;
VERBOSE("%s: All pages are mapped, now changing their attributes...\n",
__func__);
for (int i = 0; i < pages_count; ++i) { for (int i = 0; i < pages_count; ++i) {
uint32_t old_attr, new_attr; uint32_t old_attr, new_attr;
...@@ -536,8 +521,6 @@ int change_mem_attributes(xlat_ctx_t *ctx, ...@@ -536,8 +521,6 @@ int change_mem_attributes(xlat_ctx_t *ctx,
get_mem_attributes_internal(ctx, base_va, &old_attr, get_mem_attributes_internal(ctx, base_va, &old_attr,
&entry, &addr_pa, &level); &entry, &addr_pa, &level);
VERBOSE("Old attributes: 0x%x\n", old_attr);
/* /*
* From attr, only MT_RO/MT_RW, MT_EXECUTE/MT_EXECUTE_NEVER and * From attr, only MT_RO/MT_RW, MT_EXECUTE/MT_EXECUTE_NEVER and
* MT_USER/MT_PRIVILEGED are taken into account. Any other * MT_USER/MT_PRIVILEGED are taken into account. Any other
...@@ -545,15 +528,13 @@ int change_mem_attributes(xlat_ctx_t *ctx, ...@@ -545,15 +528,13 @@ int change_mem_attributes(xlat_ctx_t *ctx,
*/ */
/* Clean the old attributes so that they can be rebuilt. */ /* Clean the old attributes so that they can be rebuilt. */
new_attr = old_attr & ~(MT_RW|MT_EXECUTE_NEVER|MT_USER); new_attr = old_attr & ~(MT_RW | MT_EXECUTE_NEVER | MT_USER);
/* /*
* Update attributes, but filter out the ones this function * Update attributes, but filter out the ones this function
* isn't allowed to change. * isn't allowed to change.
*/ */
new_attr |= attr & (MT_RW|MT_EXECUTE_NEVER|MT_USER); new_attr |= attr & (MT_RW | MT_EXECUTE_NEVER | MT_USER);
VERBOSE("New attributes: 0x%x\n", new_attr);
/* /*
* The break-before-make sequence requires writing an invalid * The break-before-make sequence requires writing an invalid
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment