target/xtensa: use MPU background map from core configuration

Configuration overlay may define MPU background map. Import
core-matmap.h from the overlay and use XCHAL_MPU_BACKGROUND_MAP macro
if it's defined.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
Max Filippov 2019-12-07 22:27:23 -08:00
parent ca3c979d6b
commit a153a3f73d
2 changed files with 17 additions and 2 deletions

View File

@ -20,7 +20,8 @@ exit
[ $# -ge 3 ] && FREQ="$3"
mkdir -p "$TARGET"
tar -xf "$OVERLAY" -C "$TARGET" --strip-components=2 \
xtensa/config/core-isa.h
xtensa/config/core-isa.h \
xtensa/config/core-matmap.h
tar -xf "$OVERLAY" -O gdb/xtensa-config.c | \
sed -n '1,/*\//p;/XTREG/,/XTREG_END/p' > "$TARGET"/gdb-config.inc.c
#
@ -44,6 +45,7 @@ cat <<EOF > "${TARGET}.c"
#include "qemu/host-utils.h"
#include "core-$NAME/core-isa.h"
#include "core-$NAME/core-matmap.h"
#include "overlay_tool.h"
#define xtensa_modules xtensa_modules_$NAME

View File

@ -373,15 +373,28 @@
#elif XCHAL_HAVE_MPU
#ifndef XTENSA_MPU_BG_MAP
#ifdef XCHAL_MPU_BACKGROUND_MAP
#define XCHAL_MPU_BGMAP(s, vaddr_start, vaddr_last, rights, memtype, x...) \
{ .vaddr = (vaddr_start), .attr = ((rights) << 8) | ((memtype) << 12), },
#define XTENSA_MPU_BG_MAP (xtensa_mpu_entry []){\
XCHAL_MPU_BACKGROUND_MAP(0) \
}
#define XTENSA_MPU_BG_MAP_ENTRIES XCHAL_MPU_BACKGROUND_ENTRIES
#else
#define XTENSA_MPU_BG_MAP (xtensa_mpu_entry []){\
{ .vaddr = 0, .attr = 0x00006700, }, \
}
#define XTENSA_MPU_BG_MAP_ENTRIES 1
#endif
#endif
#define TLB_SECTION \
.mpu_align = XCHAL_MPU_ALIGN, \
.n_mpu_fg_segments = XCHAL_MPU_ENTRIES, \
.n_mpu_bg_segments = 1, \
.n_mpu_bg_segments = XTENSA_MPU_BG_MAP_ENTRIES, \
.mpu_bg = XTENSA_MPU_BG_MAP
#ifndef XCHAL_SYSROM0_PADDR