aboutsummaryrefslogtreecommitdiff
path: root/target/xtensa/cpu.h
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2019-03-13 12:40:38 -0700
committerMax Filippov <jcmvbkbc@gmail.com>2019-05-10 16:59:27 -0700
commit4d04ea35b30f9ba4097b746622eea07be3f2c363 (patch)
tree97ad9c55ea960abc5025039fb891d47d261017af /target/xtensa/cpu.h
parent631a77a03bc8905790af6fe3fd44c6c7ff285c73 (diff)
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/cpu.h')
-rw-r--r--target/xtensa/cpu.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h
index 74ee7d1253..d6e6bf6ca1 100644
--- a/target/xtensa/cpu.h
+++ b/target/xtensa/cpu.h
@@ -99,6 +99,7 @@ enum {
/* Memory protection and translation */
XTENSA_OPTION_REGION_PROTECTION,
XTENSA_OPTION_REGION_TRANSLATION,
+ XTENSA_OPTION_MPU,
XTENSA_OPTION_MMU,
XTENSA_OPTION_CACHEATTR,
@@ -137,11 +138,15 @@ enum {
PTEVADDR = 83,
MMID = 89,
RASID = 90,
+ MPUENB = 90,
ITLBCFG = 91,
DTLBCFG = 92,
+ MPUCFG = 92,
+ ERACCESS = 95,
IBREAKENABLE = 96,
MEMCTL = 97,
CACHEATTR = 98,
+ CACHEADRDIS = 98,
ATOMCTL = 99,
DDR = 104,
MEPC = 106,
@@ -234,6 +239,7 @@ enum {
#define MAX_TLB_WAY_SIZE 8
#define MAX_NDBREAK 2
#define MAX_NMEMORY 4
+#define MAX_MPU_FOREGROUND_SEGMENTS 32
#define REGION_PAGE_MASK 0xe0000000
@@ -327,6 +333,11 @@ typedef struct xtensa_tlb {
unsigned nrefillentries;
} xtensa_tlb;
+typedef struct xtensa_mpu_entry {
+ uint32_t vaddr;
+ uint32_t attr;
+} xtensa_mpu_entry;
+
typedef struct XtensaGdbReg {
int targno;
unsigned flags;
@@ -477,6 +488,11 @@ struct XtensaConfig {
xtensa_tlb itlb;
xtensa_tlb dtlb;
+
+ uint32_t mpu_align;
+ unsigned n_mpu_fg_segments;
+ unsigned n_mpu_bg_segments;
+ const xtensa_mpu_entry *mpu_bg;
};
typedef struct XtensaConfigList {
@@ -513,6 +529,7 @@ typedef struct CPUXtensaState {
#ifndef CONFIG_USER_ONLY
xtensa_tlb_entry itlb[7][MAX_TLB_WAY_SIZE];
xtensa_tlb_entry dtlb[10][MAX_TLB_WAY_SIZE];
+ xtensa_mpu_entry mpu_fg[MAX_MPU_FOREGROUND_SEGMENTS];
unsigned autorefill_idx;
bool runstall;
AddressSpace *address_space_er;