summaryrefslogtreecommitdiffstats
path: root/target/xtensa/overlay_tool.h
diff options
context:
space:
mode:
authorMax Filippov2019-03-13 20:40:38 +0100
committerMax Filippov2019-05-11 01:59:27 +0200
commit4d04ea35b30f9ba4097b746622eea07be3f2c363 (patch)
tree97ad9c55ea960abc5025039fb891d47d261017af /target/xtensa/overlay_tool.h
parenttarget/xtensa: add parity/ECC option SRs (diff)
downloadqemu-4d04ea35b30f9ba4097b746622eea07be3f2c363.tar.gz
qemu-4d04ea35b30f9ba4097b746622eea07be3f2c363.tar.xz
qemu-4d04ea35b30f9ba4097b746622eea07be3f2c363.zip
target/xtensa: implement MPU option
The Memory Protection Unit Option (MPU) is a combined instruction and data memory protection unit with more protection flexibility than the Region Protection Option or the Region Translation Option but without any translation capability. It does no demand paging and does not reference a memory-based page table. Add memory protection unit option, internal state, SRs and opcodes. Implement MPU entries dumping in dump_mmu. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'target/xtensa/overlay_tool.h')
-rw-r--r--target/xtensa/overlay_tool.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/target/xtensa/overlay_tool.h b/target/xtensa/overlay_tool.h
index ffaab4b094..b61c925398 100644
--- a/target/xtensa/overlay_tool.h
+++ b/target/xtensa/overlay_tool.h
@@ -72,6 +72,10 @@
#define XCHAL_HAVE_EXTERN_REGS 0
#endif
+#ifndef XCHAL_HAVE_MPU
+#define XCHAL_HAVE_MPU 0
+#endif
+
#define XCHAL_OPTION(xchal, qemu) ((xchal) ? XTENSA_OPTION_BIT(qemu) : 0)
#define XTENSA_OPTIONS ( \
@@ -119,6 +123,7 @@
XTENSA_OPTION_REGION_PROTECTION) | \
XCHAL_OPTION(XCHAL_HAVE_XLT_CACHEATTR, \
XTENSA_OPTION_REGION_TRANSLATION) | \
+ XCHAL_OPTION(XCHAL_HAVE_MPU, XTENSA_OPTION_MPU) | \
XCHAL_OPTION(XCHAL_HAVE_PTP_MMU, XTENSA_OPTION_MMU) | \
XCHAL_OPTION(XCHAL_HAVE_CACHEATTR, XTENSA_OPTION_CACHEATTR) | \
/* Other, TODO */ \
@@ -361,6 +366,30 @@
#define XCHAL_SYSRAM0_SIZE 0x04000000
#endif
+#elif XCHAL_HAVE_MPU
+
+#ifndef XTENSA_MPU_BG_MAP
+#define XTENSA_MPU_BG_MAP (xtensa_mpu_entry []){\
+ { .vaddr = 0, .attr = 0x00006700, }, \
+}
+#endif
+
+#define TLB_SECTION \
+ .mpu_align = XCHAL_MPU_ALIGN, \
+ .n_mpu_fg_segments = XCHAL_MPU_ENTRIES, \
+ .n_mpu_bg_segments = 1, \
+ .mpu_bg = XTENSA_MPU_BG_MAP
+
+#ifndef XCHAL_SYSROM0_PADDR
+#define XCHAL_SYSROM0_PADDR 0x50000000
+#define XCHAL_SYSROM0_SIZE 0x04000000
+#endif
+
+#ifndef XCHAL_SYSRAM0_PADDR
+#define XCHAL_SYSRAM0_PADDR 0x60000000
+#define XCHAL_SYSRAM0_SIZE 0x04000000
+#endif
+
#else
#ifndef XCHAL_SYSROM0_PADDR